Examples of KijiTable


Examples of org.kiji.schema.KijiTable

                .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(), table.getURI().toString()));
    } finally {
      ResourceUtils.releaseOrLog(table);
    }
  }
View Full Code Here

Examples of org.kiji.schema.KijiTable

  @Test
  public void testKijiLsStartAndLimitRow() throws Exception {
    final Kiji kiji = getKiji();
    final KijiTableLayout layout = KijiTableLayouts.getTableLayout(KijiTableLayouts.FOO_TEST);
    kiji.createTable(layout.getDesc());
    final KijiTable table = kiji.openTable(layout.getName());
    try {
      assertEquals(BaseTool.SUCCESS, runTool(new LsTool(), table.getURI().toString()));
      // TODO: Validate output
    } finally {
      ResourceUtils.releaseOrLog(table);
    }
  }
View Full Code Here

Examples of org.kiji.schema.KijiTable

        .build();

    final KijiTableLayout layoutTwo = KijiTableLayouts.getTableLayout(KijiTableLayouts.FOO_TEST);
    kiji.createTable(layoutTwo.getDesc());

    final KijiTable table = kiji.openTable(layout.getName());
    try {
      final KijiTable tableTwo = kiji.openTable(layoutTwo.getName());
      try {
        assertEquals(BaseTool.SUCCESS, runTool(new LsTool(), table.getURI().toString(),
            tableTwo.getURI().toString()));
        assertEquals(9, mToolOutputLines.length);
        assertEquals(BaseTool.SUCCESS, runTool(new LsTool(), kiji.getURI().toString()));
        assertEquals(2, mToolOutputLines.length);
        assertEquals(BaseTool.SUCCESS, runTool(new LsTool(), kiji.getURI().toString(),
            table.getURI().toString()));
        assertEquals(3, mToolOutputLines.length);
      } finally {
        tableTwo.release();
      }
    } finally {
      table.release();
    }
  }
View Full Code Here

Examples of org.kiji.schema.KijiTable

  @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.KijiTable

        .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.KijiTable

                .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");
      String hbaseRowKey = Hex.encodeHexString(eid.getHBaseRowKey());
      assertEquals(BaseTool.SUCCESS, runTool(new GetTool(),
          table.getURI() + "info:name",
              "--entity-id=hbase=hex:" + hbaseRowKey
          ));
      assertEquals(3, mToolOutputLines.length);
      // TODO: Validate GetTool output
    } finally {
View Full Code Here

Examples of org.kiji.schema.KijiTable

            .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);
      assertEquals(BaseTool.SUCCESS, runTool(new GetTool(), table.getURI().toString(),
          "--entity-id=['NYC','Technology','thingie',2,null]"
          ));
      assertEquals(3, mToolOutputLines.length);
    } finally {
      ResourceUtils.releaseOrLog(table);
View Full Code Here

Examples of org.kiji.schema.KijiTable

    // 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 {
        KijiTableWriter mWriter = mTable.openTableWriter();
        try {
          EntityId mEntityId = mTable.getEntityId("eid-foo");

          mWriter.put(mEntityId, "family", "column", 0L, "Value at timestamp 0.");
          mWriter.put(mEntityId, "family", "column", 1L, "Value at timestamp 1.");

          final KijiDataRequest dataRequest = KijiDataRequest.builder()
              .addColumns(
                  KijiDataRequestBuilder.ColumnsDef.create()
                      .withMaxVersions(2)
                      .add("family", "column"))
              .build();

          // Try this as a get.
          KijiRowData rowData = mReader.get(mEntityId, dataRequest);
          String s = rowData.getValue("family", "column", 0L).toString();
          assertEquals(s, "Value at timestamp 0.");

          // Delete the cell and make sure that this value is missing.
          mWriter.deleteCell(mEntityId, "family", "column", 0L);

          rowData = mReader.get(mEntityId, dataRequest);
          assertFalse(rowData.containsCell("family", "column", 0L));
        } finally {
          mWriter.close();
        }
      } finally {
        mReader.close();
      }
    } finally {
      mTable.release();
    }
  }
View Full Code Here

Examples of org.kiji.schema.KijiTable

        KijiDataRequest.create(EMPTY.getFamily(), EMPTY.getQualifier());
    final KijiDataRequest overrideRequest = KijiDataRequest.builder()
        .addColumns(ColumnsDef.create()
        .add(EMPTY, ColumnReaderSpec.avroReaderSchemaSpecific(TestRecord1.class))).build();

    final KijiTable table = getKiji().openTable("table");
    try {
      final EntityId eid = table.getEntityId("row");
      final KijiTableReader reader = table.openTableReader();
      try {
        final KijiRowData normalData = reader.get(eid, normalRequest);
        final EmptyRecord emptyRecord = normalData.getMostRecentValue("family", "empty");

        final KijiRowData overrideData = reader.get(table.getEntityId("row"), overrideRequest);
        final TestRecord1 record1 = overrideData.getMostRecentValue("family", "empty");
        assertEquals(Integer.valueOf(-1), record1.getInteger());
      } finally {
        reader.close();
      }
    } finally {
      table.release();
    }
  }
View Full Code Here

Examples of org.kiji.schema.KijiTable

  public void testFailOnOverride() throws IOException {
    final KijiDataRequest request = KijiDataRequest.builder()
        .addColumns(ColumnsDef.create()
        .add(EMPTY, ColumnReaderSpec.avroReaderSchemaSpecific(TestRecord1.class))).build();

    final KijiTable table = getKiji().openTable("table");
    try {
      final EntityId eid = table.getEntityId("row");
      final KijiTableReader reader = table.getReaderFactory().readerBuilder()
          .withOnDecoderCacheMiss(OnDecoderCacheMiss.FAIL).buildAndOpen();
      try {
        try {
          final KijiRowData data = reader.get(table.getEntityId("row"), request);
          final TestRecord1 record1 = data.getMostRecentValue("family", "empty");
          fail("Should have thrown DecoderNotFoundException");
        } catch (DecoderNotFoundException dnfe) {
          assertTrue(dnfe.getMessage().startsWith(
              "Could not find cell decoder for BoundColumnReaderSpec: "));
        }
      } finally {
        reader.close();
      }
    } finally {
      table.release();
    }
  }
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.