Examples of Kiji


Examples of org.kiji.schema.Kiji

    }
  }

  @Test
  public void testTableNoFamilies() throws Exception {
    final Kiji kiji = new InstanceBuilder(getKiji())
        .withTable(KijiTableLayouts.getLayout(KijiTableLayouts.NOFAMILY))
        .build();
    final KijiTable table = kiji.openTable("nofamily");
    try {
      assertEquals(BaseTool.SUCCESS, runTool(new LsTool(), table.getURI().toString()));
    } finally {
      table.release();
    }
View Full Code Here

Examples of org.kiji.schema.Kiji

      return true;
    }
    if (!getClass().equals(obj.getClass())) {
      return false;
    }
    final Kiji other = (Kiji) obj;

    // Equal if the two instances have the same URI:
    return mURI.equals(other.getURI());
  }
View Full Code Here

Examples of org.kiji.schema.Kiji

public class TestVersionTool extends KijiToolTest {

  @Test
  public void testVersionTool() throws Exception {
    final ProtocolVersion clientDataVersion = VersionInfo.getClientDataVersion();
    final Kiji kiji = getKiji();

    final int exitCode =
        runTool(new VersionTool(), "--debug", String.format("--kiji=%s", kiji.getURI()));

    final ProtocolVersion clusterDataVersion = kiji.getSystemTable().getDataVersion();

    assertEquals(
        "kiji client software version: " + VersionInfo.getSoftwareVersion() + "\n"
        + "kiji client data version: " + clientDataVersion + "\n"
        + "kiji cluster data version: " + clusterDataVersion + "\n"
View Full Code Here

Examples of org.kiji.schema.Kiji

public class TestGetTool extends KijiToolTest {
  private static final Logger LOG = LoggerFactory.getLogger(TestGetTool.class);

  @Test
  public void testUnderspecified() throws Exception {
    final Kiji kiji = getKiji();
    final KijiURI hbaseURI = KijiURI.newBuilder(kiji.getURI()).withInstanceName(null).build();

    assertEquals(BaseTool.FAILURE, runTool(new GetTool(), hbaseURI.toString()));
    assertTrue(mToolOutputLines[0].startsWith("Specify a cluster"));
    assertEquals(BaseTool.FAILURE, runTool(new GetTool()));
    assertTrue(mToolOutputLines[0].startsWith("URI must be specified"));
View Full Code Here

Examples of org.kiji.schema.Kiji

    assertTrue(mToolOutputLines[0].startsWith("--max-versions must be positive"));
  }

  @Test
  public void testGetFromTable() throws Exception {
    final Kiji kiji = getKiji();
    final KijiTableLayout layout = KijiTableLayouts.getTableLayout(KijiTableLayouts.SIMPLE);
    kiji.createTable(layout.getName(), layout);

    new InstanceBuilder(kiji)
        .withTable(layout.getName(), layout)
            .withRow("hashed")
                .withFamily("family").withQualifier("column").withValue(314L, "value")
        .build();

    final KijiTable table = kiji.openTable(layout.getName());
    try {
      assertEquals(BaseTool.SUCCESS, runTool(new GetTool(), table.getURI().toString(),
          "--entity-id=hashed"));
    } finally {
      ResourceUtils.releaseOrLog(table);
View Full Code Here

Examples of org.kiji.schema.Kiji

    }
  }

  @Test
  public void testGetFromTableMore() throws Exception {
    final Kiji kiji = getKiji();
    final KijiTableLayout layout = KijiTableLayouts.getTableLayout(KijiTableLayouts.FOO_TEST);
    final long timestamp = 10L;
    new InstanceBuilder(kiji)
        .withTable(layout.getName(), layout)
            .withRow("gwu@usermail.example.com")
                .withFamily("info")
                    .withQualifier("email").withValue(timestamp, "gwu@usermail.example.com")
                    .withQualifier("name").withValue(timestamp, "Garrett Wu")
            .withRow("aaron@usermail.example.com")
                .withFamily("info")
                    .withQualifier("email").withValue(timestamp, "aaron@usermail.example.com")
                    .withQualifier("name").withValue(timestamp, "Aaron Kimball")
            .withRow("christophe@usermail.example.com")
                .withFamily("info")
                    .withQualifier("email")
                        .withValue(timestamp, "christophe@usermail.example.com")
                    .withQualifier("name").withValue(timestamp, "Christophe Bisciglia")
            .withRow("kiyan@usermail.example.com")
                .withFamily("info")
                    .withQualifier("email").withValue(timestamp, "kiyan@usermail.example.com")
                    .withQualifier("name").withValue(timestamp, "Kiyan Ahmadizadeh")
            .withRow("john.doe@gmail.com")
                .withFamily("info")
                    .withQualifier("email").withValue(timestamp, "john.doe@gmail.com")
                    .withQualifier("name").withValue(timestamp, "John Doe")
            .withRow("jane.doe@gmail.com")
                .withFamily("info")
                    .withQualifier("email").withValue(timestamp, "jane.doe@gmail.com")
                    .withQualifier("name").withValue(timestamp, "Jane Doe")
        .build();

    final KijiTable table = kiji.openTable(layout.getName());
    try {
      assertEquals(BaseTool.SUCCESS, runTool(new GetTool(), table.getURI().toString(),
          "--entity-id=[\"jane.doe@gmail.com\"]"));
      assertEquals(5, mToolOutputLines.length);
      EntityId eid = EntityIdFactory.getFactory(layout).getEntityId("gwu@usermail.example.com");
View Full Code Here

Examples of org.kiji.schema.Kiji

    }
  }

  @Test
  public void testGetFormattedRKF() throws Exception {
    final Kiji kiji = getKiji();
    final KijiTableLayout layout = KijiTableLayouts.getTableLayout(KijiTableLayouts.FORMATTED_RKF);
    new InstanceBuilder(kiji)
        .withTable(layout.getName(), layout)
            .withRow("NYC", "Technology", "widget", 1, 2)
                .withFamily("family").withQualifier("column")
                    .withValue("Candaules")
            .withRow("NYC", "Technology", "widget", 1, 20)
                .withFamily("family").withQualifier("column")
                    .withValue("Croesus")
            .withRow("NYC", "Technology", "thingie", 2)
                .withFamily("family").withQualifier("column")
                    .withValue("Gyges")
            .withRow("DC", "Technology", "stuff", 123)
                .withFamily("family").withQualifier("column")
                    .withValue("Glaucon")
            .withRow("DC", "Technology", "stuff", 124, 1)
                .withFamily("family").withQualifier("column")
                    .withValue("Lydia")
        .build();

    final KijiTable table = kiji.openTable(layout.getName());
    try {
      assertEquals(BaseTool.SUCCESS, runTool(new GetTool(), table.getURI().toString(),
          "--entity-id=['NYC','Technology','widget',1,2]"
          ));
      assertEquals(3, mToolOutputLines.length);
View Full Code Here

Examples of org.kiji.schema.Kiji

  @Test
  public void testInTempFolder() throws Exception {
    final File backupFile = new File(getLocalTempDir(), "tempMetadataBackup");

    final Kiji kijiBackup = createTestKiji();
    final Kiji kijiRestored = createTestKiji();
    assertFalse(kijiBackup.getURI().equals(kijiRestored.getURI()));

    // Make this a non-trivial instance by creating a couple of tables.
    kijiBackup.createTable(KijiTableLayouts.getLayout(KijiTableLayouts.FOO_TEST));
    kijiBackup.createTable(KijiTableLayouts.getLayout(KijiTableLayouts.FULL_FEATURED));

    // Backup metadata for kijiBackup.
    List<String> args = Lists.newArrayList("--kiji=" + kijiBackup.getURI().toOrderedString(),
        "--backup=" + backupFile.getPath());
    MetadataTool tool = new MetadataTool();
    tool.setConf(getConf());
    assertEquals(BaseTool.SUCCESS, tool.toolMain(args));

    // Check that kijiBackup and kijiRestored do not intersect.
    assertFalse(kijiRestored.getTableNames().containsAll(kijiBackup.getTableNames()));

    // Restore metadata from kijiBackup to kijiRestored.
    args = Lists.newArrayList("--kiji=" + kijiRestored.getURI().toOrderedString(),
        "--restore=" + backupFile.getPath(),
        "--interactive=false");
    tool = new MetadataTool();
    tool.setConf(getConf());
    assertEquals(BaseTool.SUCCESS, tool.toolMain(args));
    assertTrue(kijiRestored.getTableNames().containsAll(kijiBackup.getTableNames()));
  }
View Full Code Here

Examples of org.kiji.schema.Kiji

  @Test
  public void testBackupUpdatedLayout() throws Exception {
    final File backupFile = new File(getLocalTempDir(), "tempMetadataBackup");

    final Kiji kijiBackup = createTestKiji();
    final Kiji kijiRestored = createTestKiji();
    assertFalse(kijiBackup.getURI().equals(kijiRestored.getURI()));

    // Create a table and update it's layout
    kijiBackup.createTable(KijiTableLayouts.getLayout(LAYOUT_V1));
    kijiBackup.modifyTableLayout(KijiTableLayouts.getLayout(LAYOUT_V2));
    KijiMetaTable backupMetaTable = kijiBackup.getMetaTable();
    assertEquals(2,
        backupMetaTable.getTableLayoutVersions("table_name", HConstants.ALL_VERSIONS).size());

    // Check that kijiBackup and kijiRestored do not intersect.
    assertFalse(kijiRestored.getTableNames().containsAll(kijiBackup.getTableNames()));

    // Backup metadata for kijiBackup.
    List<String> args = Lists.newArrayList("--kiji=" + kijiBackup.getURI().toOrderedString(),
        "--backup=" + backupFile.getPath());
    MetadataTool tool = new MetadataTool();
    tool.setConf(getConf());
    assertEquals(BaseTool.SUCCESS, tool.toolMain(args));

    // Restore metadata from kijiBackup to kijiRestored.
    args = Lists.newArrayList("--kiji=" + kijiRestored.getURI().toOrderedString(),
        "--restore=" + backupFile.getPath(),
        "--interactive=false");
    tool = new MetadataTool();
    tool.setConf(getConf());
    assertEquals(BaseTool.SUCCESS, tool.toolMain(args));

    // Validate that all tables are present with the correct number of versions
    assertTrue(kijiRestored.getTableNames().containsAll(kijiBackup.getTableNames()));
    KijiMetaTable restoreMetaTable = kijiRestored.getMetaTable();
    assertTrue(
        restoreMetaTable.getTableLayoutVersions("table_name", HConstants.ALL_VERSIONS).size() > 1);
  }
View Full Code Here

Examples of org.kiji.schema.Kiji

    // Create the table.

    // Insert some data.

    // Read it back.
    Kiji kiji = getKiji();
    assertNotNull(kiji);
    kiji.createTable(KijiTableLayouts.getLayout(KijiTableLayouts.SIMPLE_FORMATTED_EID));
    KijiTable mTable = kiji.openTable("table");
    try {
      assertNotNull(mTable);
      // Fill local variables.
      KijiTableReader mReader = mTable.openTableReader();
      try {
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.