Examples of RowKeyFormat2


Examples of org.kiji.schema.avro.RowKeyFormat2

    }
  }

  @Test
  public void testBadHbaseKey() {
    final RowKeyFormat2 format = makeIntRowKeyFormat();
    final byte[] hbkey = new byte[] { 0x01, 0x02, 0x042, 0x01, 0x02, 0x042, 0x01, 0x02, 0x042, };

    try {
      FormattedEntityId.fromHBaseRowKey(hbkey, format);
      fail("Should fail with EntityIdException");
View Full Code Here

Examples of org.kiji.schema.avro.RowKeyFormat2

    }
  }

  @Test
  public void testUnicodeZeroStringFormattedEntityId() {
    final RowKeyFormat2 format = makeRowKeyFormat();
    try {
      makeId(format, "one\u0000two");
      fail("Should fail with EntityIdException");
    } catch (EntityIdException eie) {
      assertEquals("String component cannot contain \u0000", eie.getMessage());
View Full Code Here

Examples of org.kiji.schema.avro.RowKeyFormat2

  }

  @Test
  public void testNullFormattedEntityId() {
    final RowKeyFormat2 format = makeRowKeyFormat();
    try {
      makeId(format, new Object[] { null });
      fail("Should fail with EntityIdException");
    } catch (EntityIdException eie) {
      LOG.info("Expected exception: {}", eie.getMessage());
View Full Code Here

Examples of org.kiji.schema.avro.RowKeyFormat2

    }
  }

  @Test
  public void testNullInputFormattedEntityId() {
    final RowKeyFormat2 format = makeRowKeyFormat();
    try {
      FormattedEntityId.getEntityId(null, format);
      fail("Should fail with NullPointerException");
    } catch (NullPointerException npe) {
      assertEquals(null, npe.getMessage());
View Full Code Here

Examples of org.kiji.schema.avro.RowKeyFormat2

    }
  }

  @Test
  public void testEmptyFormattedEntityId() {
    final RowKeyFormat2 format = makeRowKeyFormat();
    try {
      makeId(format); // no component specified at all
      fail("Should fail with EntityIdException");
    } catch (EntityIdException eie) {
      assertEquals("Too few components in kiji Row key", eie.getMessage());
View Full Code Here

Examples of org.kiji.schema.avro.RowKeyFormat2

    }
  }

  @Test
  public void testHashedEntityId() {
    final RowKeyFormat2 format = makeHashedRowKeyFormat();

    FormattedEntityId formattedEntityId = makeId(format, "one");
    byte[] hbaseRowKey = formattedEntityId.getHBaseRowKey();

    // since we have suppressed materialization, we dont have valid components anymore.
View Full Code Here

Examples of org.kiji.schema.avro.RowKeyFormat2

    }
  }

  @Test
  public void testHashedEntityIdToShellString() {
    final RowKeyFormat2 format = makeHashedRowKeyFormat();

    final FormattedEntityId formattedEntityId = makeId(format, "one");
    assertEquals("hbase=hex:f9", formattedEntityId.toShellString());
  }
View Full Code Here

Examples of org.kiji.schema.avro.RowKeyFormat2

  }

  @Test
  public void testDefaultSaltRowKeyFormat() {
    // SCHEMA-335: This should use a default HashSpec rather than triggering an NPE.
    final RowKeyFormat2 format = makeDefaultSaltRowKeyFormat();

    // Test that the salt field is populated with the default value we expect. It's an incompatible
    // change if this ever changes. In effect, the next few asserts test that the Avro IDL is not
    // incompatibly changed.
    HashSpec spec = format.getSalt();
    assertNotNull("Didn't get a default HashSpec, got null!", spec);
    assertEquals("Default hash spec doesn't have the well-defined default size",
        2, (int) spec.getHashSize());
    assertEquals("Default hash spec doesn't have the well-defined default algorithm",
        HashType.MD5, spec.getHashType());
View Full Code Here

Examples of org.kiji.schema.avro.RowKeyFormat2

    ArrayList<RowKeyComponent> components = new ArrayList<RowKeyComponent>();
    components.add(RowKeyComponent.newBuilder()
        .setName("NAME").setType(ComponentType.STRING).build());

    // build the row key format
    RowKeyFormat2 format = RowKeyFormat2.newBuilder().setEncoding(RowKeyEncoding.FORMATTED)
        .setSalt(HashSpec.newBuilder().build())
        .setComponents(components)
        .build();

    return format;
View Full Code Here

Examples of org.kiji.schema.avro.RowKeyFormat2

    return format;
  }

  /** Reference layout with a single column: "family_name:column_name". */
  private TableLayoutDesc getLayoutV1Desc() {
    RowKeyFormat2 format = makeHashPrefixedRowKeyFormat();
    return TableLayoutDesc.newBuilder()
      .setName("table_name")
      .setKeysFormat(format)
      .setVersion(TABLE_LAYOUT_VERSION)
      .setLocalityGroups(Lists.newArrayList(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.