Last active
December 19, 2015 04:29
-
-
Save edgarchan/5897738 to your computer and use it in GitHub Desktop.
after scalariform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
def pumpFileTest() { | |
val fs = vertx.newFileSystem | |
val from = fileDir + "/foo.tmp" | |
val to = fileDir + "/bar.tmp" | |
val content = TestUtils.generateRandomBuffer(10000) | |
fs.writeFile(from, content, () => { | |
fs.open(from, ares1 => { | |
assertEquals(true, Option(ares1.cause).isEmpty) | |
fs.open(to, ares2 => { | |
assertEquals(true, Option(ares2.cause).isEmpty) | |
val rs = ares1.result | |
val ws = ares2.result | |
val pump = Pump.createPump(rs, ws) | |
pump.start | |
rs.endHandler(() => { | |
ares1.result.close { cr1 => | |
ares2.result.close { cr2 => | |
fs.readFile(to, ares3 => { | |
assertEquals(true, Option(ares3.cause).isEmpty) | |
TestUtils.bufferEquals(content, ares3.result) | |
testComplete() | |
}) | |
} | |
} | |
}) | |
}) | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment