11. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/2/2017 7:00:08 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

11.1 Files compared

# Location File Last Modified
1 cds.zip\cds\product\production\cdsinvocation\cds-invocation\src\test\java\com\cognitive\cds\invocation\mongo EngineInfoDaoTest.java Wed Jul 12 18:43:52 2017 UTC
2 cds.zip\cds\product\production\cdsinvocation\cds-invocation\src\test\java\com\cognitive\cds\invocation\mongo EngineInfoDaoTest.java Wed Sep 27 16:01:34 2017 UTC

11.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 6 368
Changed 5 10
Inserted 0 0
Removed 0 0

11.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

11.4 Active regular expressions

No regular expressions were active.

11.5 Comparison detail

  1   /*
  2    * COPYRIG HT STATUS:  © 2015, 2 016.  This  work, aut hored by C ognitive M edical Sys tems
  3    * employe es, was fu nded in wh ole or in  part by Th e Departme nt of Vete rans
  4    * Affairs  under U.S . Governme nt contrac t VA118-11 -D-1011 /  VA118-1011 -0013.
  5    * The cop yright hol der agrees  to post o r allow th e Governme nt to post  all or
  6    * part of  this work  in open-s ource repo sitories s ubject to  the Apache  License,
  7    * Version  2.0, date d January  2004. All  other righ ts are res erved by t he
  8    * copyrig ht owner.
  9    *
  10    * For use  outside t he Governm ent, the f ollowing n otice appl ies:
  11    *
  12    *     Cop yright 201 5 © Cognit ive Medica l Systems
  13    *
  14    *     Lic ensed unde r the Apac he License , Version  2.0 (the " License");  you may
  15    *     not  use this  file excep t in compl iance with  the Licen se. You ma y obtain
  16    *     a c opy of the  License a t http://w ww.apache. org/licens es/LICENSE -2.0
  17    *
  18    *     Unl ess requir ed by appl icable law  or agreed  to in wri ting, soft ware
  19    *     dis tributed u nder the L icense is  distribute d on an "A S IS" BASI S,
  20    *     WIT HOUT WARRA NTIES OR C ONDITIONS  OF ANY KIN D, either  express or  implied.
  21    *     See  the Licen se for the  specific  language g overning p ermissions  and
  22    *     lim itations u nder the L icense.
  23    *
  24    */
  25   package co m.cognitiv e.cds.invo cation.mon go;
  26  
  27   import jav a.sql.Time stamp;
  28   import jav a.util.Arr ayList;
  29   import jav a.util.Cal endar;
  30  
  31   import org .junit.Ass ert;
  32   import org .junit.Bef oreClass;
  33   import org .junit.Ign ore;
  34   import org .junit.Tes t;
  35   import org .slf4j.Log ger;
  36   import org .slf4j.Log gerFactory ;
  37   import org .springfra mework.con text.Appli cationCont ext;
  38   import org .springfra mework.con text.suppo rt.ClassPa thXmlAppli cationCont ext;
  39  
  40   import com .cognitive .cds.invoc ation.engi neplugins. MockEngine ;
  41   import com .cognitive .cds.invoc ation.mode l.EngineIn fo;
  42   import com .cognitive .cds.invoc ation.mode l.EngineIn stanceStat e;
  43  
  44   public cla ss EngineI nfoDaoTest  {
  45  
  46       privat e static M ongoDbDao  mongoDbDao ;
  47       privat e static E ngineInfoD ao engineI nfoDao;
  48       privat e static f inal Logge r LOGGER =  LoggerFac tory.getLo gger(Engin eInfoDaoTe st.class);
  49      
  50       String  engineNam e = "Engin eOne";
  51       String  engineTyp e = "MockE ngine";
  52       String  engineNam e2 = "Open CDSDb";
  53       String  engineTyp e2 = "Open CDS";
  54         String eng ineHost =  " IP        ";
  55       String  enginePor t = "8080" ;
  56       String  engineHos t2 = "99.9 9.99.99";
  57       String  enginePor t2 = "9999 ";
  58  
  59       @Befor eClass
  60       public  static vo id beforeC lass() {
  61           tr y {
  62                Applicat ionContext  context =  new Class PathXmlApp licationCo ntext(
  63                         "classpath :mongodb-d ao-context .xml");
  64                mongoDbD ao = (Mong oDbDao) co ntext.getB ean("mongo DbDao");
  65                engineIn foDao = ne w EngineIn foDao();
  66                engineIn foDao.setM ongoDbDao( mongoDbDao );
  67                engineIn foDao.setC acheEngine s(false);
  68           }  catch (Exc eption e)  {
  69                LOGGER.e rror("Erro r loading  connection  propertie s.  Cannot  connect t o MongoDB" );
  70           }
  71       }
  72  
  73       @Ignor e("a servi ce integra tion test" )
  74       @Test
  75       public  void test FetchEngin e() {
  76  
  77           En gineInfo e ngine = nu ll;
  78  
  79           en gine = eng ineInfoDao .lookupEng ine(engine Name);
  80           if  (engine = = null) {
  81                try {
  82                    Engi neInfo eng ineInfo =  createEngi neInfo(eng ineName, e ngineType) ;
  83                    engi neInfoDao. createEngi ne(engineI nfo);
  84                    engi ne = engin eInfoDao.l ookupEngin e(engineNa me);
  85                } catch  (Exception  e) {
  86                    // i gnore erro rs on crea te
  87                }
  88           }
  89           As sert.asser tTrue(engi ne != null );
  90       }
  91  
  92       @Ignor e("a servi ce integra tion test" )
  93       @Test
  94       public  void test FetchEngin e1() {
  95  
  96           En gineInfo e ngine = nu ll;
  97  
  98           en gine = eng ineInfoDao .lookupEng ine(engine Name2);
  99           if  (engine = = null) {
  100                try {
  101                    Engi neInfo eng ineInfo =  createEngi neInfo(eng ineName2,
  102                             engine Type2);
  103                    engi neInfoDao. createEngi ne(engineI nfo);
  104                    engi ne = engin eInfoDao.l ookupEngin e(engineNa me2);
  105                } catch  (Exception  e) {
  106                    // i gnore erro rs on crea te
  107                }
  108           }
  109           As sert.asser tTrue(engi ne != null );
  110       }
  111  
  112       privat e EngineIn fo createE ngineInfo( String nam e, String  type) {
  113           En gineInfo e ngineInfo  = new Engi neInfo();
  114           en gineInfo.s etName(nam e);
  115           en gineInfo.s etType(typ e);
  116           en gineInfo.s etEnvironm ent("Name:  " + name  + " type:  " + type);
  117           en gineInfo.s etEngine(n ew MockEng ine());
  118           re turn engin eInfo;
  119       }
  120  
  121       privat e EngineIn stanceStat e createEn gineInstan ceState(St ring name,  String ty pe, String  host, Str ing port)  {
  122           En gineInstan ceState en gineState  = new Engi neInstance State();
  123           en gineState. setName(na me);
  124           en gineState. setType(ty pe);
  125           en gineState. setTime(ne w Timestam p(Calendar .getInstan ce().getTi me().getTi me()));
  126           en gineState. setHost(ho st);
  127           en gineState. setPort(po rt);
  128           en gineState. setStatus( false);
  129           re turn engin eState;
  130       }
  131  
  132       @Ignor e("a servi ce integra tion test" )
  133       @Test
  134       public  void test UpdateEngi neInstance State() {
  135  
  136           //  Change da o to retur n the upda ted state?
  137           En gineInstan ceState en gineState  = createEn gineInstan ceState(en gineName,  engineType , engineHo st, engine Port);
  138           tr y {
  139  
  140                 // EngineO ne, MockEn gine,  IP        , 8080, fa lse
  141                engineIn foDao.upda teEngineIn stanceStat e(engineSt ate);
  142  
  143                 // EngineO ne, OpenCD S,  IP        , 8080, tr ue
  144                engineSt ate.setSta tus(true);
  145                engineSt ate.setTyp e(engineTy pe2);
  146                engineIn foDao.upda teEngineIn stanceStat e(engineSt ate);
  147  
  148                // Engin eOne, Open CDS, 99.99 .99.99, 80 80, true
  149                engineSt ate.setHos t(engineHo st2);
  150                engineIn foDao.upda teEngineIn stanceStat e(engineSt ate);
  151  
  152                 // EngineO ne, OpenCD S,  IP        , 9999, fa lse
  153                engineSt ate.setHos t(engineHo st);
  154                engineSt ate.setHos t(enginePo rt2);
  155                engineSt ate.setSta tus(false) ;
  156                engineIn foDao.upda teEngineIn stanceStat e(engineSt ate);
  157  
  158                 // OpenCDS Db, MockEn gine,  IP        , 9999, tr ue
  159                engineSt ate.setTyp e(engineTy pe);
  160                engineSt ate.setHos t(engineNa me2);
  161                engineSt ate.setHos t(engineHo st);
  162                engineSt ate.setHos t(enginePo rt2);
  163                engineSt ate.setSta tus(true);
  164                engineIn foDao.upda teEngineIn stanceStat e(engineSt ate);
  165  
  166                Assert.a ssertTrue( true);
  167           }  catch (Exc eption e)  {
  168                // ignor e errors o n create
  169                Assert.a ssertTrue( false);
  170           }
  171       }
  172  
  173       @Ignor e("a servi ce integra tion test" )
  174       @Test
  175       public  void test getActiveE ngines() {
  176  
  177           //  Change da o to retur n the upda ted state?
  178       ArrayL ist<Engine InstanceSt ate> engin es1 = null ;
  179       ArrayL ist<Engine InstanceSt ate> engin es2 = null ;
  180           tr y {
  181                engines1  = engineI nfoDao.get ActiveEngi nes(engine Type);
  182                engines2  = engineI nfoDao.get ActiveEngi nes(engine Type2);
  183           }  catch (Exc eption e)  {
  184                // ignor e errors o n create
  185                Assert.a ssertTrue( false);
  186           }
  187           As sert.asser tTrue(engi nes1.size( ) == 1 &&  engines2.s ize() == 2 );
  188       }
  189   }