Package org.kiji.schema.avro

Examples of org.kiji.schema.avro.TableLayoutDesc


    assertEquals(resolvedEid, restEid4.getEntityId());
  }

  @Test
  public void testShouldWorkWithRKFHashPrefixedLayout() throws Exception {
    final TableLayoutDesc desc =
        KijiTableLayouts.getLayout(KijiTableLayouts.HASH_PREFIXED_RKF);
    final KijiTableLayout layout = KijiTableLayout.newLayout(desc);
    final EntityIdFactory factory = EntityIdFactory.getFactory(layout);

    // Byte array representations of row keys should work.
View Full Code Here


    assertEquals(resolvedEid, restEid4.getEntityId());
  }

  @Test
  public void testShouldWorkWithRKF2RawLayout() throws Exception {
    final TableLayoutDesc desc =
        KijiTableLayouts.getLayout(KijiTableLayouts.PAGING_TEST);
    final KijiTableLayout layout = KijiTableLayout.newLayout(desc);
    final EntityIdFactory factory = EntityIdFactory.getFactory(layout);
    final byte[] rowKey = Bytes.toBytes(UNUSUAL_STRING_EID);
    final EntityId originalEid = factory.getEntityIdFromHBaseRowKey(rowKey);
View Full Code Here

    assertEquals(originalEid, restEid3.getEntityId());
  }

  @Test
  public void testShouldWorkWithRKF2SuppressedLayout() throws Exception {
    final TableLayoutDesc desc =
        KijiTableLayouts.getLayout(KijiTableLayouts.HASH_PREFIXED_FORMATTED_MULTI_COMPONENT);
    final KijiTableLayout layout = KijiTableLayout.newLayout(desc);

    // Construct complex entity id.
    final String eidString = String.format("[%s,%s,%s,%d,%d]",
View Full Code Here

    assertEquals(originalEid, restEid4.getEntityId());
  }

  @Test
  public void testShouldWorkWithRKF2FormattedLayout() throws Exception {
    final TableLayoutDesc desc =
        KijiTableLayouts.getLayout(KijiTableLayouts.HASH_PREFIXED_FORMATTED_MULTI_COMPONENT);
    final KijiTableLayout layout = KijiTableLayout.newLayout(desc);

    // Construct complex entity id.
    final String eidString = String.format("[%s,%s,%s,%d,%d]",
View Full Code Here

    assertEquals(toolUtilsEid, restEid4.getEntityId());
  }

  @Test
  public void testIntegerComponentsShouldBePromotableToLong() throws Exception {
    final TableLayoutDesc desc =
        KijiTableLayouts.getLayout(KijiTableLayouts.HASH_PREFIXED_FORMATTED_MULTI_COMPONENT);
    final KijiTableLayout layout = KijiTableLayout.newLayout(desc);

    // Construct complex entity id.
    final String eidString = String.format("[%s,%s,%s,%d,%d]",
View Full Code Here

    assertTrue(restEid.getComponents()[4] instanceof Long);
  }

  @Test
  public void testLongComponentsShouldNotComplain() throws Exception {
    final TableLayoutDesc desc =
        KijiTableLayouts.getLayout(KijiTableLayouts.HASH_PREFIXED_FORMATTED_MULTI_COMPONENT);
    final KijiTableLayout layout = KijiTableLayout.newLayout(desc);

    // Construct complex entity id.
    final String eidString = String.format("[%s,%s,%s,%d,%d]",
View Full Code Here

    }
  }

  @Test
  public void testCreateTableWithInvalidSchemaClassInLayout() throws Exception {
    final TableLayoutDesc layout = KijiTableLayouts.getLayout(KijiTableLayouts.INVALID_SCHEMA);
    final File layoutFile = getTempLayoutFile(layout);
    final KijiURI tableURI =
        KijiURI.newBuilder(getKiji().getURI()).withTableName(layout.getName()).build();

    try {
      runTool(new CreateTableTool(),
        "--table=" + tableURI,
        "--layout=" + layoutFile
View Full Code Here

  /** Tests for a empty layout with no reference layout. */
  @Test
  public void testEmptyLayoutWithNoReference() throws Exception {
    RowKeyFormat2 format = makeHashPrefixedRowKeyFormat();
    final TableLayoutDesc desc = TableLayoutDesc.newBuilder()
        .setName("table_name")
        .setKeysFormat(format)
        .setVersion(TABLE_LAYOUT_VERSION)
        .build();
    final KijiTableLayout layout = KijiTableLayout.newLayout(desc);
View Full Code Here

  }

  /** Tests layout IDs. */
  @Test
  public void testLayoutIDs() throws Exception {
    final TableLayoutDesc desc = TableLayoutDesc.newBuilder()
        .setName("table_name")
        .setKeysFormat(makeRawRKF1())
        .setVersion("layout-1.0")
        .build();
    final KijiTableLayout layout = KijiTableLayout.newLayout(desc);
    assertEquals("1", layout.getDesc().getLayoutId());

    final TableLayoutDesc descV2 = TableLayoutDesc.newBuilder(desc)
        .setReferenceLayout("1")
        .build();
    final KijiTableLayout layoutV2 = KijiTableLayout.createUpdatedLayout(descV2, layout);
    assertEquals("2", layoutV2.getDesc().getLayoutId());
  }
View Full Code Here

  }

  /** Test deprecated layout version. */
  @Test
  public void testDeprecatedVersion() throws Exception {
    final TableLayoutDesc validDesc = TableLayoutDesc.newBuilder()
        .setName("table_name")
        .setKeysFormat(makeRawRKF1())
        .setVersion("kiji-1.0")
        .build();
    try {
      KijiTableLayout validLayout = KijiTableLayout.newLayout(validDesc);
    } catch (InvalidLayoutException ile) {
      fail("Deprecated version 'kiji-1.0' should be valid.");
    }

    final TableLayoutDesc invalidDesc = TableLayoutDesc.newBuilder()
        .setName("table_name")
        .setKeysFormat(makeRawRKF1())
        .setVersion("kiji-1.1")
        .build();
    try {
View Full Code Here

TOP

Related Classes of org.kiji.schema.avro.TableLayoutDesc

Copyright © 2018 www.massapicom. 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.