Package com.cloudera.cdk.data.hbase.manager

Examples of com.cloudera.cdk.data.hbase.manager.DefaultSchemaManager


   * table in HBase, and create the required tables to run.
   */
  public UserProfileExample() {
    Configuration conf = HBaseConfiguration.create();
    HTablePool pool = new HTablePool(conf, 10);
    SchemaManager schemaManager = new DefaultSchemaManager(pool);

    registerSchemas(conf, schemaManager);

    userProfileDao = new SpecificAvroDao<UserProfileModel>(pool,
        "cdk_example_user_profiles", "UserProfileModel", schemaManager);
View Full Code Here


    return new HTablePool(getConf(), 10);
  }

  public static SchemaManager initializeSchemaManager(
      HTablePool tablePool, String directory) throws Exception {
    SchemaManager entityManager = new DefaultSchemaManager(
        tablePool);
    SchemaTool schemaTool = new SchemaTool(new HBaseAdmin(getConf()),
        entityManager);
    schemaTool.createOrMigrateSchemaDirectory(directory, true);
    return entityManager;
View Full Code Here

  private SchemaManager schemaManager;
  private HBaseMetadataProvider metadataProvider;

  HBaseDatasetRepository(HBaseAdmin hBaseAdmin, HTablePool tablePool) {
    this.tablePool = tablePool;
    this.schemaManager = new DefaultSchemaManager(tablePool);
    this.metadataProvider = new HBaseMetadataProvider(hBaseAdmin, schemaManager);
  }
View Full Code Here

  @Before
  public void before() throws Exception {
    tablePool = new HTablePool(HBaseTestUtils.getConf(), 10);
    SchemaTool tool = new SchemaTool(new HBaseAdmin(HBaseTestUtils.getConf()),
        new DefaultSchemaManager(tablePool));
    tool.createOrMigrateSchema(tableName, testRecord, true);
    tool.createOrMigrateSchema(tableName, testRecordv2, true);
    tool.createOrMigrateSchema(compositeTableName, compositeSubrecord1, true);
    tool.createOrMigrateSchema(compositeTableName, compositeSubrecord2, true);
    tool.createOrMigrateSchema(incrementTableName, testIncrement, true);
View Full Code Here

        ((IndexedRecord) ((List<?>) record.get(7)).get(1)).get(2));
  }

  @Test
  public void testGeneric() throws Exception {
    SchemaManager manager = new DefaultSchemaManager(tablePool);
    Dao<GenericRecord> dao = new GenericAvroDao(tablePool, tableName,
        "TestRecord", manager, testRecord);

    // Create the new entities
    for (int i = 0; i < 10; ++i) {
View Full Code Here

    }
  }

  @Test
  public void testSpecific() throws Exception {
    SchemaManager manager = new DefaultSchemaManager(tablePool);
    Dao<TestRecord> dao = new SpecificAvroDao<TestRecord>(tablePool, tableName,
        "TestRecord", manager);

    // Create the new entities
    for (int i = 0; i < 10; ++i) {
View Full Code Here

    }
  }

  @Test
  public void testMigrateEntities() throws Exception {
    SchemaManager manager = new DefaultSchemaManager(tablePool);
    Dao<TestRecord> dao = new SpecificAvroDao<TestRecord>(tablePool, tableName,
        "TestRecord", manager);

    manager.migrateSchema(tableName, "TestRecord", goodMigrationRecordAddField);

    Dao<TestRecord> afterDao = new SpecificAvroDao<TestRecord>(tablePool,
        tableName, "TestRecord", manager);

    // Create the new entities
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  @Test
  public void testMigrateAndPut() throws Exception {
    SchemaManager manager = new DefaultSchemaManager(tablePool);
    Dao<GenericRecord> dao = new GenericAvroDao(tablePool, tableName,
        "TestRecord", manager, testRecord);

    manager.migrateSchema(tableName, "TestRecord", goodMigrationRecordAddField);

    SchemaManager afterManager = new DefaultSchemaManager(tablePool);
    Dao<GenericRecord> afterDao = new GenericAvroDao(tablePool, tableName,
        "TestRecord", afterManager, goodMigrationRecordAddField);

    // Create the new entities
    for (int i = 0; i < 10; ++i) {
View Full Code Here

   * use the newest available
   */
  @SuppressWarnings("unchecked")
  @Test
  public void testDynamicGenericDao() throws Exception {
    SchemaManager manager = new DefaultSchemaManager(tablePool);
    Dao<GenericRecord> dao = new GenericAvroDao(tablePool, tableName,
        "TestRecord", manager);

    manager.migrateSchema(tableName, "TestRecord", goodMigrationRecordAddField);

    SchemaManager afterManager = new DefaultSchemaManager(tablePool);
    Dao<GenericRecord> afterDao = new GenericAvroDao(tablePool, tableName,
        "TestRecord", afterManager);

    // Create an entity with each dao.
    PartitionKey key1 = createKey(dao.getPartitionStrategy(), 1);
View Full Code Here

    assertEquals(2, entity2After.get("fieldToAdd2"));
  }

  @Test
  public void testIncrement() {
    SchemaManager manager = new DefaultSchemaManager(tablePool);
    Dao<TestIncrement> dao = new SpecificAvroDao<TestIncrement>(tablePool,
        incrementTableName, "TestIncrement", manager);

    TestIncrement entity = TestIncrement.newBuilder().setKeyPart1("part1")
        .setKeyPart2("part2").setField1(10).build();
View Full Code Here

TOP

Related Classes of com.cloudera.cdk.data.hbase.manager.DefaultSchemaManager

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.