Package com.cloudera.cdk.data.hbase.impl

Examples of com.cloudera.cdk.data.hbase.impl.SchemaManager


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

    assertEquals(25L, (long) dao.get(key).getField1());
  }
 
  @Test
  public void testComposite() {
    SchemaManager manager = new DefaultSchemaManager(tablePool);
   
    // Construct Dao
    Dao<CompositeRecord> dao = SpecificAvroDao.buildCompositeDaoWithEntityManager(tablePool,
        compositeTableName, CompositeRecord.class, manager);
    Dao<SubRecord1> subRecord1Dao = new SpecificAvroDao<SubRecord1>(tablePool, compositeTableName, "SubRecord1", manager);
View Full Code Here

    badMigration(testRecordv2);
  }

  @Test(expected = IncompatibleSchemaException.class)
  public void testBadMigrationIntToLong() throws Exception {
    SchemaManager manager = new DefaultSchemaManager(tablePool);
    manager.migrateSchema(tableName, "TestRecord", goodMigrationRecordAddField);
    manager.migrateSchema(tableName, "TestRecord", badMigrationRecordIntToLong);
  }
View Full Code Here

    tool.createOrMigrateSchema(tableName, badCreateIncompatibleColumn3, false);
  }

  @Test
  public void testGoodMigrations() throws Exception {
    SchemaManager manager = new DefaultSchemaManager(tablePool);
    manager.migrateSchema(tableName, "TestRecord", goodMigrationRecordAddField);
    manager.migrateSchema(tableName, "TestRecord",
        goodMigrationRecordRemoveField);
    manager.migrateSchema(tableName, "TestRecord",
        goodMigrationRecordAddSubField);
  }
View Full Code Here

   * 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

TOP

Related Classes of com.cloudera.cdk.data.hbase.impl.SchemaManager

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.