Skip to content

Instantly share code, notes, and snippets.

@edgarchan
Last active December 19, 2015 04:29
Show Gist options
  • Save edgarchan/5897738 to your computer and use it in GitHub Desktop.
Save edgarchan/5897738 to your computer and use it in GitHub Desktop.
after scalariform
@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