Esempio n. 1
0
  @Test
  public void testScanTable() throws Exception {
    final Kiji kiji = getKiji();
    final KijiTableLayout layout = KijiTableLayouts.getTableLayout(KijiTableLayouts.SIMPLE);
    kiji.createTable(layout.getName(), layout);
    final KijiTable table = kiji.openTable(layout.getName());
    try {
      // Table is empty:
      assertEquals(BaseTool.SUCCESS, runTool(new LsTool(), "--kiji=" + table.getURI()));
      assertEquals(1, mToolOutputLines.length);
      assertTrue(mToolOutputLines[0].startsWith("Scanning kiji table: "));

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

      // Table has now one row:
      assertEquals(BaseTool.SUCCESS, runTool(new LsTool(), "--kiji=" + table.getURI()));
      assertEquals(3, mToolOutputLines.length);
      assertTrue(mToolOutputLines[0].startsWith("Scanning kiji table: "));
      assertTrue(mToolOutputLines[1].startsWith("entity-id=hbase='"));

    } finally {
      table.close();
    }
  }
Esempio n. 2
0
  @Test
  public void testFormattedRowKey() throws Exception {
    final Kiji kiji = getKiji();
    final KijiTableLayout layout = KijiTableLayouts.getTableLayout(KijiTableLayouts.FORMATTED_RKF);
    new InstanceBuilder(kiji)
        .withTable(layout.getName(), layout)
        .withRow("dummy", "str1", "str2", 1, 2L)
        .withFamily("family")
        .withQualifier("column")
        .withValue(1L, "string-value")
        .withValue(2L, "string-value2")
        .withRow("dummy", "str1", "str2", 1)
        .withFamily("family")
        .withQualifier("column")
        .withValue(1L, "string-value")
        .withRow("dummy", "str1", "str2")
        .withFamily("family")
        .withQualifier("column")
        .withValue(1L, "string-value")
        .withRow("dummy", "str1")
        .withFamily("family")
        .withQualifier("column")
        .withValue(1L, "string-value")
        .withRow("dummy")
        .withFamily("family")
        .withQualifier("column")
        .withValue(1L, "string-value")
        .build();

    final KijiTable table = kiji.openTable(layout.getName());
    try {
      assertEquals(BaseTool.SUCCESS, runTool(new LsTool(), "--kiji=" + table.getURI()));
      // TODO: Validate LsTool output
    } finally {
      table.close();
    }
  }
Esempio n. 3
0
  @Test
  public void testKijiLsStartAndLimitRow() 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("*****@*****.**")
        .withFamily("info")
        .withQualifier("email")
        .withValue(timestamp, "*****@*****.**")
        .withQualifier("name")
        .withValue(timestamp, "Garrett Wu")
        .withRow("*****@*****.**")
        .withFamily("info")
        .withQualifier("email")
        .withValue(timestamp, "*****@*****.**")
        .withQualifier("name")
        .withValue(timestamp, "Aaron Kimball")
        .withRow("*****@*****.**")
        .withFamily("info")
        .withQualifier("email")
        .withValue(timestamp, "*****@*****.**")
        .withQualifier("name")
        .withValue(timestamp, "Christophe Bisciglia")
        .withRow("*****@*****.**")
        .withFamily("info")
        .withQualifier("email")
        .withValue(timestamp, "*****@*****.**")
        .withQualifier("name")
        .withValue(timestamp, "Kiyan Ahmadizadeh")
        .withRow("*****@*****.**")
        .withFamily("info")
        .withQualifier("email")
        .withValue(timestamp, "*****@*****.**")
        .withQualifier("name")
        .withValue(timestamp, "John Doe")
        .withRow("*****@*****.**")
        .withFamily("info")
        .withQualifier("email")
        .withValue(timestamp, "*****@*****.**")
        .withQualifier("name")
        .withValue(timestamp, "Jane Doe")
        .build();

    final KijiTable table = kiji.openTable(layout.getName());
    try {
      assertEquals(
          BaseTool.SUCCESS,
          runTool(new LsTool(), "--kiji=" + table.getURI(), "--columns=info:name"));
      // TODO: Validate output

      assertEquals(
          BaseTool.SUCCESS,
          runTool(
              new LsTool(),
              "--kiji=" + table.getURI(),
              "--columns=info:name",
              "--start-row=hex:50000000000000000000000000000000", // after the second row.
              "--limit-row=hex:e0000000000000000000000000000000" // before the last row.
              ));
      // TODO: Validate output
    } finally {
      table.close();
    }
  }