Ejemplo n.º 1
0
 @Parameters
 public static Collection<Object[]> data() throws IOException {
   Object[][] data =
       new Object[][] {
         {WritableTypeFamily.getInstance(), PTableKeyValueIT.class},
         {WritableTypeFamily.getInstance(), null},
         {AvroTypeFamily.getInstance(), PTableKeyValueIT.class},
         {AvroTypeFamily.getInstance(), null}
       };
   return Arrays.asList(data);
 }
Ejemplo n.º 2
0
  @Test
  public void unionWriteShouldNotThrowNPE() throws IOException {
    String outputPath1 = tmpDir.getFileName("output1");
    String outputPath2 = tmpDir.getFileName("output2");
    String outputPath3 = tmpDir.getFileName("output3");

    if (typeFamily == AvroTypeFamily.getInstance()) {
      union.write(To.avroFile(outputPath1));
      pipeline.write(union, To.avroFile(outputPath2));

      pipeline.run();

      checkFileContents(outputPath1);
      checkFileContents(outputPath2);

    } else {

      union.write(To.textFile(outputPath1));
      pipeline.write(union, To.textFile(outputPath2));
      pipeline.writeTextFile(union, outputPath3);

      pipeline.run();

      checkFileContents(outputPath1);
      checkFileContents(outputPath2);
      checkFileContents(outputPath3);
    }
  }
Ejemplo n.º 3
0
  private void checkFileContents(String filePath) throws IOException {

    List<String> fileContentValues =
        (typeFamily != AvroTypeFamily.getInstance())
            ? Lists.newArrayList(
                pipeline.read(At.textFile(filePath, typeFamily.strings())).materialize().iterator())
            : Lists.newArrayList(
                pipeline.read(At.avroFile(filePath, Avros.strings())).materialize().iterator());

    Collections.sort(fileContentValues);

    LOG.info("Saved Union: " + fileContentValues);
    assertEquals(EXPECTED, fileContentValues);
  }
Ejemplo n.º 4
0
 @Parameters
 public static Collection<Object[]> data() {
   Object[][] data =
       new Object[][] {{WritableTypeFamily.getInstance()}, {AvroTypeFamily.getInstance()}};
   return Arrays.asList(data);
 }
Ejemplo n.º 5
0
 public static <T extends Serializable> AvroType<T> avro(Class<T> clazz) {
   return (AvroType<T>) ptype(clazz, AvroTypeFamily.getInstance());
 }