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 | ByteBufferPoolManagerTest.java | Thu Jun 29 17:22:14 2017 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\IV-ehmp_cif\CoreValueObjects\main\test\java\gov\va\med\imaging\exchange | ByteBufferPoolManagerTest.java | Thu Jul 6 15:00:20 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 300 |
| 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 21, 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.Size dInputStre am; | |
| 29 | import gov .va.med.im aging.exch ange.stora ge.DataSou rceByteBuf ferPoolMan ager; | |
| 30 | import gov .va.med.im aging.exch ange.stora ge.KnownSi zeByteBuff er; | |
| 31 | ||
| 32 | import jav a.io.File; | |
| 33 | import jav a.io.FileI nputStream ; | |
| 34 | import jav a.io.IOExc eption; | |
| 35 | import jav a.net.URL; | |
| 36 | ||
| 37 | import jun it.framewo rk.TestCas e; | |
| 38 | ||
| 39 | /** | |
| 40 | * @author
|
|
| 41 | * | |
| 42 | */ | |
| 43 | public cla ss ByteBuf ferPoolMan agerTest | |
| 44 | extends Te stCase | |
| 45 | { | |
| 46 | pu blic ByteB ufferPoolM anagerTest () | |
| 47 | { | |
| 48 | supe r(); | |
| 49 | } | |
| 50 | ||
| 51 | /* (non-Java doc) | |
| 52 | * @see juni t.framewor k.TestCase #setUp() | |
| 53 | * / | |
| 54 | @O verride | |
| 55 | pr otected vo id setUp() | |
| 56 | th rows Excep tion | |
| 57 | { | |
| 58 | supe r.setUp(); | |
| 59 | } | |
| 60 | ||
| 61 | pr ivate Stri ng getFile sDirectory () | |
| 62 | { | |
| 63 | URL path = get Class().ge tResource( "images"); | |
| 64 | File f = new F ile(path.g etFile()); | |
| 65 | Stri ng imageDi r = f.getA bsolutePat h(); | |
| 66 | imag eDir = ima geDir.repl aceAll("%2 0", " "); | |
| 67 | retu rn imageDi r; | |
| 68 | } | |
| 69 | ||
| 70 | pu blic void testBuffer PoolManage r() | |
| 71 | { | |
| 72 | Stri ng fileDir ectory = g etFilesDir ectory(); | |
| 73 | File directory = new Fil e(fileDire ctory); | |
| 74 | File [] files = directory .listFiles (); | |
| 75 | for( File file : files) | |
| 76 | { | |
| 77 | TestFi le(file); | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| 81 | pr ivate Data SourceByte BufferPool Manager ge tBufferPoo lManager() | |
| 82 | { | |
| 83 | retu rn DataSou rceByteBuf ferPoolMan ager.getBy teBufferPo olManager( ); | |
| 84 | } | |
| 85 | ||
| 86 | pr ivate void TestFile( File file) | |
| 87 | { | |
| 88 | Know nSizeByteB uffer buff er = null; | |
| 89 | Data SourceByte BufferPool Manager ma nager = ge tBufferPoo lManager() ; | |
| 90 | try | |
| 91 | { | |
| 92 | assert NotNull(fi le); | |
| 93 | FileIn putStream input = ne w FileInpu tStream(fi le); | |
| 94 | //Byte StreamPump pump = By teStreamPu mp.getByte StreamPump (); | |
| 95 | //pump .xfer(inpu t, outStre am); | |
| 96 | buffer = manager .readIntoB uffer(file .getName() , input); | |
| 97 | long f ileLength = file.len gth(); | |
| 98 | assert Equals("Fi le length does not m atch known buffer si ze", buffe r.getKnown Size(), fi leLength); | |
| 99 | TestBu fferReads( buffer, fi leLength); | |
| 100 | TestBu fferReads( buffer, fi leLength / 2); | |
| 101 | TestBu fferReads( buffer, fi leLength); | |
| 102 | } | |
| 103 | catc h(Exceptio n ex) | |
| 104 | { | |
| 105 | fail(e x.getMessa ge()); | |
| 106 | } | |
| 107 | fina lly | |
| 108 | { | |
| 109 | if(buf fer != nul l) | |
| 110 | manager. releaseBuf fer(buffer .getBuffer ()); | |
| 111 | } | |
| 112 | } | |
| 113 | ||
| 114 | pr ivate void TestBuffe rReads(Kno wnSizeByte Buffer buf fer, long bytesToRea d) | |
| 115 | { | |
| 116 | Size dInputStre am inputSt ream = get InputStrea m(buffer); | |
| 117 | asse rtNotNull( inputStrea m); | |
| 118 | asse rtNotNull( inputStrea m.getInStr eam()); | |
| 119 | asse rtNotSame( 0, inputSt ream.getBy teSize()); | |
| 120 | try | |
| 121 | { | |
| 122 | for(in t i = 0; i < (bytesT oRead); i+ +) | |
| 123 | { | |
| 124 | inputStr eam.getInS tream().re ad(); | |
| 125 | } | |
| 126 | } | |
| 127 | catc h(IOExcept ion ioX) | |
| 128 | { | |
| 129 | fail(i oX.getMess age()); | |
| 130 | } | |
| 131 | fina lly | |
| 132 | { | |
| 133 | try | |
| 134 | { | |
| 135 | inputStr eam.getInS tream().cl ose(); | |
| 136 | } | |
| 137 | catch( IOExceptio n ioX) | |
| 138 | { | |
| 139 | fail(ioX .getMessag e()); | |
| 140 | } | |
| 141 | } | |
| 142 | } | |
| 143 | ||
| 144 | pr ivate Size dInputStre am getInpu tStream(Kn ownSizeByt eBuffer bu ffer) | |
| 145 | { | |
| 146 | retu rn getBuff erPoolMana ger().open StreamToBu ffer(buffe r); | |
| 147 | } | |
| 148 | ||
| 149 | // private vo id Test | |
| 150 | ||
| 151 | ||
| 152 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.