Produced by Araxis Merge on 7/10/2017 1:01:43 PM 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 | C:\AraxisMergeCompare\Pri_un\IV-ehmp_cif\CoreValueObjects\main\test\java\gov\va\med\imaging\exchange | TestFileTypeIdentifierStream.java | Thu Jun 29 17:22:15 2017 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\IV-ehmp_cif\CoreValueObjects\main\test\java\gov\va\med\imaging\exchange | TestFileTypeIdentifierStream.java | Thu Jul 6 15:00:21 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 444 |
| Changed | 2 | 4 |
| 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 | * | |
| 3 | Package: MAG - Vis tA Imaging | |
| 4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
| 5 | Date Cre ated: Oct 16, 2008 | |
| 6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
| 7 | Developer:
|
|
| 8 | Descript ion: | |
| 9 | ||
| 10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 11 | ;; Property of the US Government . | |
| 12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
| 13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
| 14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
| 15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
| 16 | ;; telephon e (301) 73 4-0100. | |
| 17 | ;; | |
| 18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
| 19 | ;; a Class I I medical device. A s such, it may not b e changed | |
| 20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
| 21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
| 22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
| 23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 24 | ||
| 25 | */ | |
| 26 | package go v.va.med.i maging.exc hange; | |
| 27 | ||
| 28 | import gov .va.med.im aging.exch ange.enums .ImageForm at; | |
| 29 | ||
| 30 | import jav a.io.File; | |
| 31 | import jav a.io.FileI nputStream ; | |
| 32 | import jav a.io.FileN otFoundExc eption; | |
| 33 | import jav a.io.IOExc eption; | |
| 34 | import jav a.net.URL; | |
| 35 | ||
| 36 | import jun it.framewo rk.TestCas e; | |
| 37 | ||
| 38 | /** | |
| 39 | * Unit te sting for the FileTy peIdentifi erStream. This test looks in t he image f older of t he test | |
| 40 | * resourc es and ide ntifies ea ch image i n the fold er. Then based on t he file ex tension gi ven to the | |
| 41 | * file de termines i f the file was ident ified corr ectly. Thi s means th at files i n this fol der need | |
| 42 | * non-sta ndard file extension s such as dcmj2k to indicate a DICOM wra pped JPEG 2000 image . While no t | |
| 43 | * optimal , this all ows the ul timate fle xibility. When new "problem" images app ear, they can simply | |
| 44 | * be drop ped into t his images folder an d immediat ely are ad ded to the test with out any co nfiguratio n | |
| 45 | * changes . | |
| 46 | * | |
| 47 | * @author
|
|
| 48 | * | |
| 49 | */ | |
| 50 | public cla ss TestFil eTypeIdent ifierStrea m | |
| 51 | extends Te stCase | |
| 52 | { | |
| 53 | // known fil e extensio ns and for mats, to a dd a new f ormat, add it here a nd the res ult | |
| 54 | // in the ge tExpectedI mageFormat function | |
| 55 | pr ivate fina l static S tring FILE _EXTENSION _DCM = "dc m"; | |
| 56 | pr ivate fina l static S tring FILE _EXTENSION _DCMJ2K = "dcmj2k"; | |
| 57 | pr ivate fina l static S tring FILE _EXTENSION _DCMJPG = "dcmjpg"; | |
| 58 | pr ivate fina l static S tring FILE _EXTENSION _DCMPDF = "dcmpdf"; | |
| 59 | pr ivate fina l static S tring FILE _EXTENSION _J2K = "j2 k"; | |
| 60 | pr ivate fina l static S tring FILE _EXTENSION _JPEG = "j pg"; | |
| 61 | pr ivate fina l static S tring FILE _EXTENSION _PDF = "pd f"; | |
| 62 | pr ivate fina l static S tring FILE _EXTENSION _TGA = "tg a"; | |
| 63 | pr ivate fina l static S tring FILE _EXTENSION _TIFF = "t iff"; | |
| 64 | pr ivate fina l static S tring FILE _EXTENSION _BMP = "bm p"; | |
| 65 | pr ivate fina l static S tring FILE _EXTENSION _AVI = "av i"; | |
| 66 | pr ivate fina l static S tring FILE _EXTENSION _WAV = "wa v"; | |
| 67 | pr ivate fina l static S tring FILE _EXTENSION _DOC = "do c"; | |
| 68 | pr ivate fina l static S tring FILE _EXTENSION _HTML = "h tml"; | |
| 69 | pr ivate fina l static S tring FILE _EXTENSION _RTF = "rt f"; | |
| 70 | pr ivate fina l static S tring FILE _EXTENSION _MP3 = "mp 3"; | |
| 71 | pr ivate fina l static S tring FILE _EXTENSION _MPG = "mp g"; | |
| 72 | pr ivate fina l static S tring FILE _EXTENSION _PNG = "pn g"; | |
| 73 | pr ivate fina l static S tring FILE _EXTENSION _GIF = "gi f"; | |
| 74 | pr ivate fina l static S tring FILE _EXTENSION _XLS = "xl s"; | |
| 75 | pr ivate fina l static S tring FILE _EXTENSION _DOCX = "d ocx"; | |
| 76 | pr ivate fina l static S tring FILE _EXTENSION _XML = "xm l"; | |
| 77 | pr ivate fina l static S tring SCCS ControlFil e = ".copy area.db"; | |
| 78 | ||
| 79 | pu blic TestF ileTypeIde ntifierStr eam() | |
| 80 | { | |
| 81 | supe r(); | |
| 82 | } | |
| 83 | ||
| 84 | pr ivate Stri ng getFile sDirectory () | |
| 85 | { | |
| 86 | URL path = get Class().ge tResource( "images"); | |
| 87 | File f = new F ile(path.g etFile()); | |
| 88 | Stri ng imageDi r = f.getA bsolutePat h(); | |
| 89 | imag eDir = ima geDir.repl aceAll("%2 0", " "); | |
| 90 | retu rn imageDi r; | |
| 91 | } | |
| 92 | ||
| 93 | pu blic void testImageI dentificat ion() | |
| 94 | { | |
| 95 | Stri ng imageDi rectory = getFilesDi rectory(); | |
| 96 | File directory = new Fil e(imageDir ectory); | |
| 97 | File [] files = directory .listFiles (); | |
| 98 | asse rtNotSame( "Did not f ind any im ages in im age direct ory", 0, f iles.lengt h); | |
| 99 | for( File file : files) | |
| 100 | { | |
| 101 | if(!fi le.getName ().equalsI gnoreCase( SCCSContro lFile)){ | |
| 102 | try | |
| 103 | { | |
| 104 | System.out .println(" Testing fo rmat for f ile [" + f ile.getAbs olutePath( ) + "]"); | |
| 105 | ImageForma t expected Format = g etExpected ImageForma t(file); | |
| 106 | assertNotN ull("Expec ted format for file [" + file. getAbsolut ePath() + "] is null ", expecte dFormat); | |
| 107 | FileTypeId entifierSt ream input Stream = | |
| 108 | ne w FileType Identifier Stream(new FileInput Stream(fil e)); | |
| 109 | ImageForma t imageFor mat = inpu tStream.ge tImageForm at(); | |
| 110 | inputStrea m.close(); | |
| 111 | assertEqua ls("Expect ed image f ormat [" + expectedF ormat + "] not equal to image format [" + imageFor mat + "] f or file [" + file.ge tAbsoluteP ath() + "] ", | |
| 112 | expe ctedFormat , imageFor mat); | |
| 113 | } | |
| 114 | catch(Fi leNotFound Exception fnfX) | |
| 115 | { | |
| 116 | fail("File NotFoundEx ception: " + fnfX.ge tMessage() ); | |
| 117 | } | |
| 118 | catch(IO Exception ioX) | |
| 119 | { | |
| 120 | fail("IO E xception: " + ioX.ge tMessage() ); | |
| 121 | } | |
| 122 | } | |
| 123 | } | |
| 124 | } | |
| 125 | ||
| 126 | /* * | |
| 127 | * Determine s the expe cted image format ba sed on the file exte nsion. | |
| 128 | * @param fi le | |
| 129 | * @return | |
| 130 | * / | |
| 131 | pr ivate Imag eFormat ge tExpectedI mageFormat (File file ) | |
| 132 | { | |
| 133 | Stri ng filenam e = file.g etName().t oLowerCase (); | |
| 134 | ||
| 135 | if(f ilename.en dsWith(FIL E_EXTENSIO N_DCM)) | |
| 136 | { | |
| 137 | return ImageForm at.DICOM; | |
| 138 | } | |
| 139 | else if(filena me.endsWit h(FILE_EXT ENSION_DCM J2K)) | |
| 140 | { | |
| 141 | return ImageForm at.DICOMJP EG2000; | |
| 142 | } | |
| 143 | else if(filena me.endsWit h(FILE_EXT ENSION_DCM JPG)) | |
| 144 | { | |
| 145 | return ImageForm at.DICOMJP EG; | |
| 146 | } | |
| 147 | else if(filena me.endsWit h(FILE_EXT ENSION_DCM PDF)) | |
| 148 | { | |
| 149 | return ImageForm at.DICOMPD F; | |
| 150 | } | |
| 151 | else if(filena me.endsWit h(FILE_EXT ENSION_J2K )) | |
| 152 | { | |
| 153 | return ImageForm at.J2K; | |
| 154 | } | |
| 155 | else if(filena me.endsWit h(FILE_EXT ENSION_PDF )) | |
| 156 | { | |
| 157 | return ImageForm at.PDF; | |
| 158 | } | |
| 159 | else if(filena me.endsWit h(FILE_EXT ENSION_TGA )) | |
| 160 | { | |
| 161 | return ImageForm at.TGA; | |
| 162 | } | |
| 163 | else if(filena me.endsWit h(FILE_EXT ENSION_TIF F)) | |
| 164 | { | |
| 165 | return ImageForm at.TIFF; | |
| 166 | } | |
| 167 | else if(filena me.endsWit h(FILE_EXT ENSION_JPE G)) | |
| 168 | { | |
| 169 | return ImageForm at.JPEG; | |
| 170 | } | |
| 171 | else if(filena me.endsWit h(FILE_EXT ENSION_BMP )) | |
| 172 | { | |
| 173 | return ImageForm at.BMP; | |
| 174 | } | |
| 175 | else if(filena me.endsWit h(FILE_EXT ENSION_AVI )) | |
| 176 | { | |
| 177 | return ImageForm at.AVI; | |
| 178 | } | |
| 179 | else if(filena me.endsWit h(FILE_EXT ENSION_WAV )) | |
| 180 | { | |
| 181 | return ImageForm at.WAV; | |
| 182 | } | |
| 183 | else if(filena me.endsWit h(FILE_EXT ENSION_DOC )) | |
| 184 | { | |
| 185 | return ImageForm at.DOC; | |
| 186 | } | |
| 187 | else if(filena me.endsWit h(FILE_EXT ENSION_MP3 )) | |
| 188 | { | |
| 189 | return ImageForm at.MP3; | |
| 190 | } | |
| 191 | else if(filena me.endsWit h(FILE_EXT ENSION_HTM L)) | |
| 192 | { | |
| 193 | return ImageForm at.HTML; | |
| 194 | } | |
| 195 | else if(filena me.endsWit h(FILE_EXT ENSION_RTF )) | |
| 196 | { | |
| 197 | return ImageForm at.RTF; | |
| 198 | } | |
| 199 | else if(filena me.endsWit h(FILE_EXT ENSION_MPG )) | |
| 200 | { | |
| 201 | return ImageForm at.MPG; | |
| 202 | } | |
| 203 | else if(filena me.endsWit h(FILE_EXT ENSION_PNG )) | |
| 204 | { | |
| 205 | return ImageForm at.PNG; | |
| 206 | } | |
| 207 | else if(filena me.endsWit h(FILE_EXT ENSION_GIF )) | |
| 208 | { | |
| 209 | return ImageForm at.GIF; | |
| 210 | } | |
| 211 | else if(filena me.endsWit h(FILE_EXT ENSION_XLS )) | |
| 212 | { | |
| 213 | return ImageForm at.XLS; | |
| 214 | } | |
| 215 | else if(filena me.endsWit h(FILE_EXT ENSION_DOC X)) | |
| 216 | { | |
| 217 | return ImageForm at.DOCX; | |
| 218 | } | |
| 219 | else if(filena me.endsWit h(FILE_EXT ENSION_XML )) | |
| 220 | return ImageForm at.XML; | |
| 221 | retu rn null; | |
| 222 | } | |
| 223 | ||
| 224 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.