Examples of Kiji


Examples of org.kiji.schema.Kiji

    assertEquals(kiji.getSystemTable().getDataVersion().toString(), "system-1.1");
  }

  @Test
  public void testUnknownKey() throws Exception {
    final Kiji kiji = getKiji();
    final SystemTableTool st = new SystemTableTool();
    assertEquals(
        BaseTool.FAILURE,
        runTool(st, "--kiji=" + kiji.getURI(), "--do=get", "invalidKey"));
    assertEquals(mToolOutputStr.trim(), "No system table property named 'invalidKey'.");
  }
View Full Code Here

Examples of org.kiji.schema.Kiji

    assertEquals(mToolOutputStr.trim(), "No system table property named 'invalidKey'.");
  }

    @Test
    public void testPutShouldNotPromptWhenOriginalValueIsNull() throws Exception {
        final Kiji kiji = getKiji();
        final SystemTableTool st = new SystemTableTool();

        assertEquals(BaseTool.SUCCESS, runToolWithInput(
                // in case we are prompted to overwrite the existing value for testPutKey we are
                // saying "no" which should cause the assertion below to fail
                st, "no", "--kiji=" + kiji.getURI(),
                "--do=put", "testPutKey", "testPutValue", "--interactive=true"));
        assertEquals(
                Bytes.toString(kiji.getSystemTable().getValue("testPutKey")), "testPutValue");
    }
View Full Code Here

Examples of org.kiji.schema.Kiji

  private static void uninstallSystem_1_0(
      final KijiURI uri,
      final Configuration conf,
      final HBaseAdminFactory adminFactory
  ) throws IOException {
    final Kiji kiji = new HBaseKijiFactory().open(uri, conf);
    try {
      // If security is enabled, make sure the user has GRANT access on the instance
      // before uninstalling.
      if (kiji.isSecurityEnabled()) {
        KijiSecurityManager securityManager = kiji.getSecurityManager();
        try {
          securityManager.checkCurrentGrantAccess();
        } finally {
          securityManager.close();
        }
      }

      for (String tableName : kiji.getTableNames()) {
        LOG.debug("Deleting kiji table " + tableName + "...");
        kiji.deleteTable(tableName);
      }

      // Delete the user tables:
      final HBaseAdmin hbaseAdmin = adminFactory.create(conf);
      try {
        // Delete the system tables:
        HBaseSystemTable.uninstall(hbaseAdmin, uri);
        HBaseMetaTable.uninstall(hbaseAdmin, uri);
        HBaseSchemaTable.uninstall(hbaseAdmin, uri);
      } finally {
        hbaseAdmin.close();
      }
    } finally {
      kiji.release();
    }
  }
View Full Code Here

Examples of org.kiji.schema.Kiji

   * Tests that AvroCellEncoder throws an appropriate KijiEncodingException if no Avro writer
   * schema can be inferred for the specified value to encode.
   */
  @Test
  public void testWriterSchemaNotInferrable() throws IOException {
    final Kiji kiji = getKiji();
    final CellSpec cellSpec = CellSpec.create()
        .setCellSchema(CellSchema.newBuilder()
            .setType(SchemaType.AVRO)
            .setAvroValidationPolicy(AvroValidationPolicy.DEVELOPER)
            .build())
        .setSchemaTable(kiji.getSchemaTable());
    final AvroCellEncoder encoder = new AvroCellEncoder(cellSpec);
    try {
      encoder.encode(new Object());
      Assert.fail("AvroCellEncoder.encode() should throw a KijiEncodingException.");
    } catch (KijiEncodingException kee) {
View Full Code Here

Examples of org.kiji.schema.Kiji

/** Tests the StripValueRowFilter. */
public class TestCellByteSizeAsValueFilter extends KijiClientTest {
  /** Tests that the CellByteSizeAsValueFilter replaces the value by its size, in bytes. */
  @Test
  public void testCellByteSizeAsValueFilter() throws Exception {
    final Kiji kiji = new InstanceBuilder(getKiji())
        .withTable(KijiTableLayouts.getLayout(KijiTableLayouts.SIMPLE))
            .withRow("row")
                .withFamily("family")
                    .withQualifier("column")
                        .withValue("0123456789")
        .build();

    final KijiTable table = kiji.openTable("table");
    try {
      final EntityId eid = table.getEntityId("row");

      final KijiTableLayout layout = table.getLayout();
      final KijiColumnName column = KijiColumnName.create("family", "column");
View Full Code Here

Examples of org.kiji.schema.Kiji

  private TableLayoutDesc mTableLayout;
  private KijiTable mTable;

  @Before
  public final void setupTestKijiPaginationFilter() throws Exception {
    final Kiji kiji = getKiji();
    mTableLayout = KijiTableLayouts.getLayout(KijiTableLayouts.PAGING_TEST);
    kiji.createTable(mTableLayout);

    mTable = kiji.openTable("user");
    mReader = mTable.openTableReader();
  }
View Full Code Here

Examples of org.kiji.schema.Kiji

   * Validate the behavior of the FirstKeyOnly column filter: in particular, applying
   * this filter to one column should not affect other columns.
   */
  @Test
  public void testFirstKeyOnlyColumnFilter() throws Exception {
    final Kiji kiji = new InstanceBuilder(getKiji())
        .withTable(KijiTableLayouts.getLayout(KijiTableLayouts.FULL_FEATURED))
            .withRow("row")
                .withFamily("info")
                    .withQualifier("name")
                        .withValue(1L, "name1")
                        .withValue(2L, "name2")
                    .withQualifier("email")
                        .withValue(1L, "email1")
                        .withValue(2L, "email2")
        .build();
    final KijiTable table = kiji.openTable("user");
    try {
      final KijiTableReader reader = table.openTableReader();
      try {
        final EntityId eid = table.getEntityId("row");

View Full Code Here

Examples of org.kiji.schema.Kiji

/** Tests the StripValueRowFilter. */
public class TestStripValueRowFilter extends KijiClientTest {
  /** Verifies that values has been stripped if the StripValueRowFilter has been applied. */
  @Test
  public void testStripValueRowFilter() throws Exception {
    final Kiji kiji = getKiji();
    kiji.createTable(KijiTableLayouts.getLayout(KijiTableLayouts.SIMPLE));

    final KijiTable table = kiji.openTable("table");
    try {
      final EntityId eid = table.getEntityId("eid");

      {
        final KijiTableWriter writer = table.openTableWriter();
View Full Code Here

Examples of org.kiji.schema.Kiji

   *
   * @param kijiURI The KijiURI to create the table in.
   * @throws Exception If there is an error.
   */
  public void createAndPopulateFooTable(KijiURI kijiURI) throws Exception {
    final Kiji kiji = Kiji.Factory.open(kijiURI, getConf());
    try {
      final KijiTableLayout layout = KijiTableLayouts.getTableLayout(KijiTableLayouts.FOO_TEST);
      final long timestamp = System.currentTimeMillis();

      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();

    } finally {
      kiji.release();
    }

    // Create the temp files needed to populate the foo table.
    final File dataFile = File.createTempFile("data", ".csv");
    dataFile.deleteOnExit();
View Full Code Here

Examples of org.kiji.schema.Kiji

   *
   * @param kijiURI The KijiURI to delete the table from.
   * @throws Exception If there is an error.
   */
  public void deleteFooTable(KijiURI kijiURI) throws Exception {
    final Kiji kiji = Kiji.Factory.open(kijiURI, getConf());
    try {
      kiji.deleteTable("foo");
    } finally {
      kiji.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.