public void testOverwrite() throws IOException {
Path path = new Path("/test/hadoop/file");
s3FileSystem.mkdirs(path.getParent());
FSOutputStream out = s3FileSystem.createRaw(path, false, (short) 1, BLOCK_SIZE);
out.write(data, 0, BLOCK_SIZE);
out.close();
assertTrue("Exists", s3FileSystem.exists(path));
assertEquals("Length", BLOCK_SIZE, s3FileSystem.getLength(path));
try {
s3FileSystem.createRaw(path, false, (short) 1, 128);
fail("Should throw IOException.");
} catch (IOException e) {
// Expected
}
out = s3FileSystem.createRaw(path, true, (short) 1, BLOCK_SIZE);
out.write(data, 0, BLOCK_SIZE / 2);
out.close();
assertTrue("Exists", s3FileSystem.exists(path));
assertEquals("Length", BLOCK_SIZE / 2, s3FileSystem.getLength(path));
}