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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | cds.zip\cds\product\production\cdsinvocation\cds-invocation\src\test\java\com\cognitive\cds\invocation\engineplugins | OpenCDSEngineInstanceStateTest.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\engineplugins | OpenCDSEngineInstanceStateTest.java | Wed Sep 27 16:01:27 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 200 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 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.eng ineplugins ; | |
| 26 | ||
| 27 | import com .cognitive .cds.invoc ation.Engi neInstance StateManag ementIFace ; | |
| 28 | import com .cognitive .cds.invoc ation.mode l.ResultBu ndle; | |
| 29 | import com .cognitive .cds.invoc ation.mode l.Rule; | |
| 30 | import jav a.io.Buffe redReader; | |
| 31 | import jav a.io.IOExc eption; | |
| 32 | import jav a.io.Input Stream; | |
| 33 | import jav a.io.Input StreamRead er; | |
| 34 | import jav a.util.Arr ayList; | |
| 35 | import jav a.util.Lis t; | |
| 36 | import jav a.util.Pro perties; | |
| 37 | import sta tic org.ju nit.Assert .assertTru e; | |
| 38 | import org .junit.Ign ore; | |
| 39 | import org .junit.Tes t; | |
| 40 | import org .junit.run ner.RunWit h; | |
| 41 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 42 | import org .springfra mework.con text.Appli cationCont ext; | |
| 43 | import org .springfra mework.tes t.annotati on.Dirties Context; | |
| 44 | import org .springfra mework.tes t.context. ContextCon figuration ; | |
| 45 | import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ; | |
| 46 | ||
| 47 | /** | |
| 48 | * | |
| 49 | * @author jeremy | |
| 50 | */ | |
| 51 | @RunWith(S pringJUnit 4ClassRunn er.class) | |
| 52 | @ContextCo nfiguratio n(location s = {"clas spath:Test -CDSMockEn gineTest.x ml"}) | |
| 53 | @DirtiesCo ntext(clas sMode = Di rtiesConte xt.ClassMo de.AFTER_E ACH_TEST_M ETHOD) | |
| 54 | public cla ss OpenCDS EngineInst anceStateT est { | |
| 55 | ||
| 56 | @A utowired | |
| 57 | Ap plicationC ontext app Context; | |
| 58 | ||
| 59 | @A utowired | |
| 60 | pr ivate Engi neInstance StateManag ementIFace eism; | |
| 61 | ||
| 62 | @I gnore("Thi s is reall y an integ ration tes t") | |
| 63 | @T est | |
| 64 | pu blic void testFhirPa yloadGende r() { | |
| 65 | ||
| 66 | // We create this in th e applicat ion contex t now so t hat the ot her proper ties | |
| 67 | //wi ll also be autowired , etc. | |
| 68 | Open CDS openCD S = new Op enCDS(); | |
| 69 | openCDS.se tEndPoint( "http:// IP /opencds") ; | |
| 70 | ||
| 71 | List <Rule> rul es = new A rrayList<> (); | |
| 72 | Rule rule = ne w Rule(); | |
| 73 | Prop erties pro ps = new P roperties( ); | |
| 74 | prop s.put("sco pingEntity Id", "com. cognitive" ); | |
| 75 | prop s.put("bus inessId", "genderAge "); | |
| 76 | prop s.put("ver sion", "1. 0.0"); | |
| 77 | rule .setProper ties(props ); | |
| 78 | rule s.add(rule ); | |
| 79 | Stri ng payload = getFhir String("pa tientObs.j son"); | |
| 80 | ||
| 81 | Resu ltBundle r esult = op enCDS.invo ke(rules, payload, " 11111", ei sm); | |
| 82 | Syst em.out.pri ntln(resul t.getResul ts().get(0 ).getBody( )); | |
| 83 | Stri ng body = (String) r esult.getR esults().g et(0).getB ody(); | |
| 84 | asse rtTrue(bod y.contains ("Communic ationReque st")); | |
| 85 | } | |
| 86 | ||
| 87 | pr ivate Stri ng getFhir String(Str ing file) { | |
| 88 | Stri ngBuilder tmp = new StringBuil der(); | |
| 89 | try { | |
| 90 | InputS tream is = appContex t.getResou rce("class path:" + f ile).getIn putStream( ); | |
| 91 | Buffer edReader b r = new Bu fferedRead er(new Inp utStreamRe ader(is)); | |
| 92 | String sCurrentL ine; | |
| 93 | while ((sCurrent Line = br. readLine() ) != null) { | |
| 94 | tmp.appe nd(sCurren tLine); | |
| 95 | } | |
| 96 | } ca tch (IOExc eption e) { | |
| 97 | e.prin tStackTrac e(); | |
| 98 | } | |
| 99 | retu rn tmp.toS tring(); | |
| 100 | } | |
| 101 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.