private void writeNumMetablocks(Writer writer, String compression, int n) throws IOException { for (int i = 0; i < n; i++) { DataOutputStream dout = writer.prepareMetaBlock("TfileMeta" + i, compression); byte[] b = ("something to test" + i).getBytes(); dout.write(b); dout.close(); } }
public void testFailureWriteRecordAfterMetaBlock() throws IOException { if (skip) return; // write a key/value first writer.append("keyX".getBytes(), "valueX".getBytes()); // create a new metablock DataOutputStream outMeta = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); outMeta.write(123); outMeta.write("dummy".getBytes()); outMeta.close(); // add more key/value try { writer.append("keyY".getBytes(), "valueY".getBytes()); Assert.fail("Cannot add key/value after start adding meta blocks."); } catch (Exception e) { // noop, expecting exceptions } closeOutput(); }
public void testFailureGetNonExistentMetaBlock() throws IOException { if (skip) return; writer.append("keyX".getBytes(), "valueX".getBytes()); // create a new metablock DataOutputStream outMeta = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); outMeta.write(123); outMeta.write("foo".getBytes()); outMeta.close(); closeOutput(); Reader reader = new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf); DataInputStream mb = reader.getMetaBlock("testX"); Assert.assertNotNull(mb); mb.close(); try { DataInputStream mbBad = reader.getMetaBlock("testY"); Assert.assertNull(mbBad); Assert.fail("Error on handling non-existent metablocks."); } catch (Exception e) { // noop, expecting exceptions } reader.close(); }
@Test public void testFailureGetNonExistentMetaBlock() throws IOException { if (skip) return; writer.append("keyX".getBytes(), "valueX".getBytes()); // create a new metablock DataOutputStream outMeta = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); outMeta.write(123); outMeta.write("foo".getBytes()); outMeta.close(); closeOutput(); Reader reader = new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf); DataInputStream mb = reader.getMetaBlock("testX"); Assert.assertNotNull(mb); mb.close(); try { DataInputStream mbBad = reader.getMetaBlock("testY"); Assert.fail("Error on handling non-existent metablocks."); } catch (Exception e) { // noop, expecting exceptions } reader.close(); }
@Test public void testFailureGetNonExistentMetaBlock() throws IOException { if (skip) return; writer.append("keyX".getBytes(), "valueX".getBytes()); // create a new metablock DataOutputStream outMeta = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); outMeta.write(123); outMeta.write("foo".getBytes()); outMeta.close(); closeOutput(); Reader reader = new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf); DataInputStream mb = reader.getMetaBlock("testX"); Assert.assertNotNull(mb); mb.close(); try { DataInputStream mbBad = reader.getMetaBlock("testY"); Assert.fail("Error on handling non-existent metablocks."); } catch (Exception e) { // noop, expecting exceptions } reader.close(); }
@Test public void testFailureWriteRecordAfterMetaBlock() throws IOException { if (skip) return; // write a key/value first writer.append("keyX".getBytes(), "valueX".getBytes()); // create a new metablock DataOutputStream outMeta = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); outMeta.write(123); outMeta.write("dummy".getBytes()); outMeta.close(); // add more key/value try { writer.append("keyY".getBytes(), "valueY".getBytes()); Assert.fail("Cannot add key/value after start adding meta blocks."); } catch (Exception e) { // noop, expecting exceptions } closeOutput(); }
public void testFailureWriteMetaBlocksWithSameName() throws IOException { if (skip) return; writer.append("keyX".getBytes(), "valueX".getBytes()); // create a new metablock DataOutputStream outMeta = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); outMeta.write(123); outMeta.write("foo".getBytes()); outMeta.close(); // add the same metablock try { DataOutputStream outMeta2 = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); Assert.fail("Cannot create metablocks with the same name."); } catch (Exception e) { // noop, expecting exceptions } closeOutput(); }
@Test public void testFailureWriteRecordAfterMetaBlock() throws IOException { if (skip) return; // write a key/value first writer.append("keyX".getBytes(), "valueX".getBytes()); // create a new metablock DataOutputStream outMeta = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); outMeta.write(123); outMeta.write("dummy".getBytes()); outMeta.close(); // add more key/value try { writer.append("keyY".getBytes(), "valueY".getBytes()); Assert.fail("Cannot add key/value after start adding meta blocks."); } catch (Exception e) { // noop, expecting exceptions } closeOutput(); }
@Test public void testFailureWriteMetaBlocksWithSameName() throws IOException { if (skip) return; writer.append("keyX".getBytes(), "valueX".getBytes()); // create a new metablock DataOutputStream outMeta = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); outMeta.write(123); outMeta.write("foo".getBytes()); outMeta.close(); // add the same metablock try { writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); Assert.fail("Cannot create metablocks with the same name."); } catch (Exception e) { // noop, expecting exceptions } closeOutput(); }
@Test public void testFailureWriteMetaBlocksWithSameName() throws IOException { if (skip) return; writer.append("keyX".getBytes(), "valueX".getBytes()); // create a new metablock DataOutputStream outMeta = writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); outMeta.write(123); outMeta.write("foo".getBytes()); outMeta.close(); // add the same metablock try { writer.prepareMetaBlock("testX", Compression.Algorithm.GZ.getName()); Assert.fail("Cannot create metablocks with the same name."); } catch (Exception e) { // noop, expecting exceptions } closeOutput(); }
private void someTestingWithMetaBlock(Writer writer, String compression) throws IOException { DataOutputStream dout = null; writeNumMetablocks(writer, compression, 10); try { dout = writer.prepareMetaBlock("TfileMeta1", compression); assertTrue(false); } catch (MetaBlockAlreadyExists me) { // avoid this exception } dout = writer.prepareMetaBlock("TFileMeta100", compression); dout.close(); }
private void someTestingWithMetaBlock(Writer writer, String compression) throws IOException { DataOutputStream dout = null; writeNumMetablocks(writer, compression, 10); try { dout = writer.prepareMetaBlock("TfileMeta1", compression); assertTrue(false); } catch (MetaBlockAlreadyExists me) { // avoid this exception } dout = writer.prepareMetaBlock("TFileMeta100", compression); dout.close(); }
private void someTestingWithMetaBlock(Writer writer, String compression) throws IOException { DataOutputStream dout = null; writeNumMetablocks(writer, compression, 10); try { dout = writer.prepareMetaBlock("TfileMeta1", compression); assertTrue(false); } catch (MetaBlockAlreadyExists me) { // avoid this exception } dout = writer.prepareMetaBlock("TFileMeta100", compression); dout.close(); }
private void writeNumMetablocks(Writer writer, String compression, int n) throws IOException { for (int i = 0; i < n; i++) { DataOutputStream dout = writer.prepareMetaBlock("TfileMeta" + i, compression); byte[] b = ("something to test" + i).getBytes(); dout.write(b); dout.close(); } }
private void writeNumMetablocks(Writer writer, String compression, int n) throws IOException { for (int i = 0; i < n; i++) { DataOutputStream dout = writer.prepareMetaBlock("TfileMeta" + i, compression); byte[] b = ("something to test" + i).getBytes(); dout.write(b); dout.close(); } }