Produced by Araxis Merge on 7/10/2017 1:01:44 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\ImagingCommon\main\test\java\gov\va\med\imaging | ByteStreamPumpTest.java | Thu Jun 29 17:22:57 2017 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\IV-ehmp_cif\ImagingCommon\main\test\java\gov\va\med\imaging | ByteStreamPumpTest.java | Thu Jul 6 15:02:38 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 602 |
| 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 | * | |
| 3 | */ | |
| 4 | package go v.va.med.i maging; | |
| 5 | ||
| 6 | import jav a.io.*; | |
| 7 | import jav a.util.con current.Ex ecutorServ ice; | |
| 8 | import jav a.util.con current.Ex ecutors; | |
| 9 | import jav a.util.con current.Ti meUnit; | |
| 10 | ||
| 11 | import gov .va.med.im aging.chan nels.ByteS treamPump; | |
| 12 | import jun it.framewo rk.TestCas e; | |
| 13 | ||
| 14 | /** | |
| 15 | * @author
|
|
| 16 | * | |
| 17 | */ | |
| 18 | public cla ss ByteStr eamPumpTes t | |
| 19 | extends Te stCase | |
| 20 | { | |
| 21 | /* (non-Java doc) | |
| 22 | * @see juni t.framewor k.TestCase #setUp() | |
| 23 | * / | |
| 24 | pr otected vo id setUp() throws Ex ception | |
| 25 | { | |
| 26 | supe r.setUp(); | |
| 27 | } | |
| 28 | ||
| 29 | /* (non-Java doc) | |
| 30 | * @see juni t.framewor k.TestCase #tearDown( ) | |
| 31 | * / | |
| 32 | pr otected vo id tearDow n() throws Exception | |
| 33 | { | |
| 34 | Syst em.out.pri ntln("Afte r-" + this .getName() ); | |
| 35 | Syst em.out.pri ntln(ByteS treamPump. getNameToB ufferSizeM apString() ); | |
| 36 | supe r.tearDown (); | |
| 37 | } | |
| 38 | ||
| 39 | pu blic void testByteBu fferToByte BufferTran sfer() | |
| 40 | th rows IOExc eption | |
| 41 | { | |
| 42 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 43 | } | |
| 44 | ||
| 45 | pu blic void testMultip leByteBuff erToByteBu fferTransf er() | |
| 46 | th rows IOExc eption | |
| 47 | { | |
| 48 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 49 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 50 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 51 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 52 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 53 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 54 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 55 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 56 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 57 | byte BufferToBy teBufferTr ansfer(8 * 1024); | |
| 58 | } | |
| 59 | ||
| 60 | pu blic void testFileTo ByteBuffer Transfer() | |
| 61 | th rows IOExc eption | |
| 62 | { | |
| 63 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 64 | } | |
| 65 | ||
| 66 | pu blic void testMultip leFileToBy teBufferTr ansfer() | |
| 67 | th rows IOExc eption | |
| 68 | { | |
| 69 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 70 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 71 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 72 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 73 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 74 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 75 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 76 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 77 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 78 | file ToByteBuff erTransfer (8 * 1024) ; | |
| 79 | } | |
| 80 | ||
| 81 | pu blic void testSlowIn putStreamT oByteBuffe rTransfer( ) | |
| 82 | th rows IOExc eption | |
| 83 | { | |
| 84 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 85 | } | |
| 86 | ||
| 87 | pu blic void testMultip leSlowInpu tStreamToB yteBufferT ransfer() | |
| 88 | th rows IOExc eption | |
| 89 | { | |
| 90 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 91 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 92 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 93 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 94 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 95 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 96 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 97 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 98 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 99 | slow InputStrea mToByteBuf ferTransfe r(8 * 1024 ); | |
| 100 | } | |
| 101 | ||
| 102 | pu blic void testSlowIn putStreamT oFileTrans fer() | |
| 103 | th rows IOExc eption | |
| 104 | { | |
| 105 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 106 | } | |
| 107 | ||
| 108 | pu blic void testMultip leSlowInpu tStreamToF ileTransfe r() | |
| 109 | th rows IOExc eption | |
| 110 | { | |
| 111 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 112 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 113 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 114 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 115 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 116 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 117 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 118 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 119 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 120 | slow InputStrea mToFileTra nsfer(8 * 1024); | |
| 121 | } | |
| 122 | ||
| 123 | pu blic void testMultit hreadSlowI nputStream ToFileTran sfer() | |
| 124 | th rows Inter ruptedExce ption, IOE xception | |
| 125 | { | |
| 126 | // u se an exec utor that will not q ueue tasks | |
| 127 | Exec utorServic e executor = Executo rs.newCach edThreadPo ol(); | |
| 128 | ||
| 129 | for( int taskIn dex=0; tas kIndex < 1 0; ++taskI ndex) | |
| 130 | { | |
| 131 | execut or.submit( new Runnab le() | |
| 132 | { | |
| 133 | public v oid run() | |
| 134 | { | |
| 135 | try | |
| 136 | { | |
| 137 | sl owInputStr eamToFileT ransfer(8 * 1024); | |
| 138 | } | |
| 139 | catch (IOE xception x ) | |
| 140 | { | |
| 141 | x. printStack Trace(); | |
| 142 | fa il(x.getMe ssage()); | |
| 143 | } | |
| 144 | } | |
| 145 | } | |
| 146 | ); | |
| 147 | } | |
| 148 | ||
| 149 | exec utor.shutd own(); | |
| 150 | exec utor.await Terminatio n(60L, Tim eUnit.SECO NDS); | |
| 151 | } | |
| 152 | ||
| 153 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== == | |
| 154 | pu blic void testByteBu fferMultip leByteBuff erTransfer () | |
| 155 | th rows IOExc eption | |
| 156 | { | |
| 157 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 158 | } | |
| 159 | ||
| 160 | pu blic void testMultip leByteBuff erMultiple ByteBuffer Transfer() | |
| 161 | th rows IOExc eption | |
| 162 | { | |
| 163 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 164 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 165 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 166 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 167 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 168 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 169 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 170 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 171 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 172 | byte BufferToMu ltipleByte BufferTran sfer(8 * 1 024); | |
| 173 | } | |
| 174 | ||
| 175 | pu blic void testMultit hreadByteB ufferMulti pleByteBuf ferTransfe r() | |
| 176 | th rows Inter ruptedExce ption, IOE xception | |
| 177 | { | |
| 178 | // u se an exec utor that will not q ueue tasks | |
| 179 | Exec utorServic e executor = Executo rs.newCach edThreadPo ol(); | |
| 180 | ||
| 181 | for( int taskIn dex=0; tas kIndex < 1 0; ++taskI ndex) | |
| 182 | { | |
| 183 | execut or.submit( new Runnab le() | |
| 184 | { | |
| 185 | public v oid run() | |
| 186 | { | |
| 187 | try | |
| 188 | { | |
| 189 | by teBufferTo MultipleBy teBufferTr ansfer(8 * 1024); | |
| 190 | } | |
| 191 | catch (IOE xception x ) | |
| 192 | { | |
| 193 | x. printStack Trace(); | |
| 194 | fa il(x.getMe ssage()); | |
| 195 | } | |
| 196 | } | |
| 197 | } | |
| 198 | ); | |
| 199 | } | |
| 200 | ||
| 201 | exec utor.shutd own(); | |
| 202 | exec utor.await Terminatio n(60L, Tim eUnit.SECO NDS); | |
| 203 | } | |
| 204 | ||
| 205 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ==== | |
| 206 | // Helper me thods so r unning mul tiple tran sfers is e asier | |
| 207 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ==== | |
| 208 | /* * | |
| 209 | * @param te stDataLeng th | |
| 210 | * @throws I OException | |
| 211 | * / | |
| 212 | pr ivate void byteBuffe rToByteBuf ferTransfe r(int test DataLength ) | |
| 213 | th rows IOExc eption | |
| 214 | { | |
| 215 | byte [] sourceD ata = Test DataGenera tor.create ByteArray( testDataLe ngth); | |
| 216 | ||
| 217 | Byte ArrayInput Stream inS tream = ne w ByteArra yInputStre am(sourceD ata); | |
| 218 | Byte ArrayOutpu tStream ou tStream = new ByteAr rayOutputS tream(sour ceData.len gth); | |
| 219 | ||
| 220 | Byte StreamPump bytePump = ByteStre amPump.get ByteStream Pump(ByteS treamPump. TRANSFER_T YPE.ByteAr rayToByteA rray); | |
| 221 | byte Pump.xfer( inStream, outStream) ; | |
| 222 | ||
| 223 | Test DataGenera tor.assert ValidTestD ata(outStr eam.toByte Array()); | |
| 224 | } | |
| 225 | ||
| 226 | /* * | |
| 227 | * @param te stDataLeng th | |
| 228 | * @throws I OException | |
| 229 | * @throws F ileNotFoun dException | |
| 230 | * / | |
| 231 | pr ivate void fileToByt eBufferTra nsfer(int testDataLe ngth) | |
| 232 | th rows IOExc eption, Fi leNotFound Exception | |
| 233 | { | |
| 234 | File testFile = TestData Generator. createFile (testDataL ength); | |
| 235 | ||
| 236 | File InputStrea m inStream = new Fil eInputStre am(testFil e); | |
| 237 | Byte ArrayOutpu tStream ou tStream = new ByteAr rayOutputS tream(test DataLength ); | |
| 238 | ||
| 239 | Byte StreamPump bytePump = ByteStre amPump.get ByteStream Pump(ByteS treamPump. TRANSFER_T YPE.FileTo ByteArray) ; | |
| 240 | byte Pump.xfer( inStream, outStream) ; | |
| 241 | ||
| 242 | Test DataGenera tor.assert ValidTestD ata(outStr eam.toByte Array()); | |
| 243 | ||
| 244 | test File.delet e(); | |
| 245 | } | |
| 246 | ||
| 247 | pr ivate void slowInput StreamToFi leTransfer (int testD ataLength) | |
| 248 | th rows IOExc eption | |
| 249 | { | |
| 250 | Inpu tStream in Stream = T estDataGen erator.cre ateSlowInp utStream(t estDataLen gth, 32); | |
| 251 | File destinati onFile = T estDataGen erator.cre ateBlankDe stinationF ile(); | |
| 252 | File OutputStre am outStre am = new F ileOutputS tream(dest inationFil e); | |
| 253 | ||
| 254 | Byte StreamPump bytePump = ByteStre amPump.get ByteStream Pump(ByteS treamPump. TRANSFER_T YPE.Networ kToFile); | |
| 255 | byte Pump.xfer( inStream, outStream) ; | |
| 256 | ||
| 257 | Test DataGenera tor.assert ValidTestD ata(destin ationFile) ; | |
| 258 | ||
| 259 | dest inationFil e.delete() ; | |
| 260 | } | |
| 261 | ||
| 262 | pu blic void slowInputS treamToByt eBufferTra nsfer(int testDataLe ngth) | |
| 263 | th rows IOExc eption | |
| 264 | { | |
| 265 | Inpu tStream in Stream = T estDataGen erator.cre ateSlowInp utStream(t estDataLen gth, 32); | |
| 266 | Byte ArrayOutpu tStream ou tStream = new ByteAr rayOutputS tream(test DataLength ); | |
| 267 | ||
| 268 | Byte StreamPump bytePump = ByteStre amPump.get ByteStream Pump(ByteS treamPump. TRANSFER_T YPE.Networ kToByteArr ay); | |
| 269 | byte Pump.xfer( inStream, outStream) ; | |
| 270 | ||
| 271 | Test DataGenera tor.assert ValidTestD ata(outStr eam.toByte Array()); | |
| 272 | } | |
| 273 | ||
| 274 | pr ivate void byteBuffe rToMultipl eByteBuffe rTransfer( int testDa taLength) | |
| 275 | th rows IOExc eption | |
| 276 | { | |
| 277 | byte [] sourceD ata = Test DataGenera tor.create ByteArray( testDataLe ngth); | |
| 278 | ||
| 279 | Byte ArrayInput Stream inS tream = ne w ByteArra yInputStre am(sourceD ata); | |
| 280 | Byte ArrayOutpu tStream[] outStreams = new Byt eArrayOutp utStream[] | |
| 281 | { | |
| 282 | new By teArrayOut putStream( sourceData .length), | |
| 283 | new By teArrayOut putStream( sourceData .length), | |
| 284 | new By teArrayOut putStream( sourceData .length), | |
| 285 | new By teArrayOut putStream( sourceData .length), | |
| 286 | new By teArrayOut putStream( sourceData .length), | |
| 287 | new By teArrayOut putStream( sourceData .length), | |
| 288 | new By teArrayOut putStream( sourceData .length), | |
| 289 | new By teArrayOut putStream( sourceData .length), | |
| 290 | new By teArrayOut putStream( sourceData .length), | |
| 291 | new By teArrayOut putStream( sourceData .length), | |
| 292 | new By teArrayOut putStream( sourceData .length) | |
| 293 | }; | |
| 294 | ||
| 295 | Byte StreamPump bytePump = ByteStre amPump.get ByteStream Pump(ByteS treamPump. TRANSFER_T YPE.ByteAr rayToByteA rray); | |
| 296 | byte Pump.xfer( inStream, outStreams ); | |
| 297 | ||
| 298 | for( ByteArrayO utputStrea m outStrea m : outStr eams) | |
| 299 | TestDa taGenerato r.assertVa lidTestDat a(outStrea m.toByteAr ray()); | |
| 300 | } | |
| 301 | ||
| 302 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.