Package org.hivedb.configuration

Examples of org.hivedb.configuration.EntityHiveConfig


  @Test
  public void testShardResolution() throws Exception {
    Hive hive = getHive();
    ConfigurationReader reader = new ConfigurationReader(Continent.class, WeatherReport.class);
    EntityHiveConfig config = reader.getHiveConfiguration();

    WeatherReport report = WeatherReportImpl.generate();
    Continent asia = new AsiaticContinent();

    HiveIndexer indexer = new HiveIndexer(hive);
    HiveShardResolver resolver = new HiveShardResolver(config, hive);

    indexer.insert(config.getEntityConfig(Continent.class), asia);
    indexer.insert(config.getEntityConfig(WeatherReport.class), report);

    ShardResolutionStrategyData continentData = new ShardResolutionStrategyDataImpl(Continent.class, asia.getName());
    ShardResolutionStrategyData reportData = new ShardResolutionStrategyDataImpl(WeatherReport.class, report.getReportId());

    Collection<ShardId> asiaIds = resolver.selectShardIdsFromShardResolutionStrategyData(continentData);
View Full Code Here


@HiveTest.Config("hive_default")
public class HiveInterceptorDecoratorTest extends HiveTest {
 
  @Test
  public void testIsTransient() throws Exception{
    EntityHiveConfig config = getEntityHiveConfig();
    Hive hive = getHive();
    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);

    WeatherReport report = generateInstance();
    Continent asia = new AsiaticContinent();

    assertNotNull(config.getEntityConfig(asia.getClass()));

    assertTrue(interceptor.isTransient(report));
    assertTrue(interceptor.isTransient(asia));

    HiveIndexer indexer = new HiveIndexer(getHive());
    indexer.insert(config.getEntityConfig(WeatherReport.class), report);
    indexer.insert(config.getEntityConfig(Continent.class), asia);

    assertFalse(interceptor.isTransient(report));
    assertFalse(interceptor.isTransient(asia));
  }
View Full Code Here

    return new GenerateInstance<WeatherReport>(WeatherReport.class).generate();
  }

  @Test
  public void testOnSaveInsert() throws Exception {
    EntityHiveConfig config = getEntityHiveConfig();
    Hive hive = getHive();
    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);

    WeatherReport report = generateInstance();
    Continent asia = new AsiaticContinent();
View Full Code Here

  @Test
  public void testOnSaveInsertReadOnlyFailure() throws Exception {
    Hive hive = getHive();
    ConfigurationReader reader = new ConfigurationReader(Continent.class, WeatherReport.class);
    EntityHiveConfig config = reader.getHiveConfiguration();
    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);

    WeatherReport report = generateInstance();
    hive.directory().insertPrimaryIndexKey(report.getContinent());
    hive.updateHiveStatus(Lockable.Status.readOnly);
View Full Code Here

    }
  }

  @Test
  public void testOnDeleteReadOnlyFailure() throws Exception{
    EntityHiveConfig config = getEntityHiveConfig();
    Hive hive = getHive();

    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);

    WeatherReport report = generateInstance();
View Full Code Here

  @Test
  public void testOnDelete() throws Exception{
    Hive hive = getHive();
    ConfigurationReader reader = new ConfigurationReader(Continent.class, WeatherReport.class);
    EntityHiveConfig config = reader.getHiveConfiguration();
    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);

    WeatherReport report = generateInstance();
    Continent asia = new AsiaticContinent();
    hive.directory().insertPrimaryIndexKey(report.getContinent());
View Full Code Here

  }

  @Test
  public void testOnSaveUpdate() throws Exception {
    Hive hive = getHive();
    EntityHiveConfig config = getEntityHiveConfig();
    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);

    WeatherReport report = generateInstance();
    hive.directory().insertPrimaryIndexKey(report.getContinent());
    interceptor.postFlush(Arrays.asList(new WeatherReport[]{report}).iterator());
View Full Code Here

@Config("hive_default")
public class HiveInterceptorDecoratorTest extends HiveTest {

  @Test
  public void testInstantiate() throws Exception {
    EntityHiveConfig config = getEntityHiveConfig();
    Hive hive = getHive();
    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);
    Object o = interceptor.instantiate("org.hivedb.util.database.test.WeatherReport", EntityMode.POJO, 7);
    assertEquals(GeneratedClassFactory.getGeneratedClass(WeatherReport.class), o.getClass());
  }
View Full Code Here

    assertEquals(GeneratedClassFactory.getGeneratedClass(WeatherReport.class), o.getClass());
  }

  @Test
  public void testIsTransient() throws Exception {
    EntityHiveConfig config = getEntityHiveConfig();
    Hive hive = getHive();
    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);

    WeatherReport report = generateInstance();
    Continent asia = new AsiaticContinent();

    assertNotNull(config.getEntityConfig(asia.getClass()));

    assertTrue(interceptor.isTransient(report));
    assertTrue(interceptor.isTransient(asia));

    HiveIndexer indexer = new HiveIndexer(getHive());
    indexer.insert(config.getEntityConfig(WeatherReport.class), report);
    indexer.insert(config.getEntityConfig(Continent.class), asia);

    assertFalse(interceptor.isTransient(report));
    assertFalse(interceptor.isTransient(asia));
  }
View Full Code Here

    return new GenerateInstance<WeatherReport>(WeatherReport.class).generate();
  }

  @Test
  public void testOnSaveInsert() throws Exception {
    EntityHiveConfig config = getEntityHiveConfig();
    Hive hive = getHive();
    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);

    WeatherReport report = generateInstance();
    Continent asia = new AsiaticContinent();
View Full Code Here

TOP

Related Classes of org.hivedb.configuration.EntityHiveConfig

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.