Examples of WeatherReport


Examples of org.hivedb.util.database.test.WeatherReport

  // Test for HiveIndexer.delete(EntityIndexConfiguration config, Object entity)
  @Test
  public void deleteTest() throws Exception {
    Hive hive = getHive();
    HiveIndexer indexer = new HiveIndexer(hive);
    WeatherReport report = generateInstance();
    indexer.insert(getWeatherReportConfig(report), report);
    assertTrue(hive.directory().doesResourceIdExist("WeatherReport", report.getReportId()));
    assertTrue(hive.directory().doesResourceIdExist("Temperature", report.getTemperature()));
    indexer.delete(getWeatherReportConfig(report), report);
    assertFalse(hive.directory().doesResourceIdExist("WeatherReport", report.getReportId()));
    // Temperature is an entity so it does not get deleted
    assertTrue(hive.directory().doesResourceIdExist("Temperature", report.getTemperature()));
    indexer.delete(getWeatherReportConfig(report), report);
  }
View Full Code Here

Examples of org.hivedb.util.database.test.WeatherReport

  // Test for HiveIndexer.exists(EntityIndexConfiguration config, Object entity)
  @Test
  public void existsTest() throws Exception {
    Hive hive = getHive();
    HiveIndexer indexer = new HiveIndexer(hive);
    WeatherReport report = generateInstance();
    assertFalse(indexer.exists(getWeatherReportConfig(report), report));
    indexer.insert(getWeatherReportConfig(report), report);
    assertTrue(indexer.exists(getWeatherReportConfig(report), report));
  }
View Full Code Here

Examples of org.hivedb.util.database.test.WeatherReport

public class GeneratedClassTest {
 
  @Test
  public void testGetClass() throws Exception {
    WeatherReport instance = new GenerateInstance<WeatherReport>(WeatherReport.class).generate();
    instance.getClass().newInstance();
  }
View Full Code Here

Examples of org.hivedb.util.database.test.WeatherReport

  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));
View Full Code Here

Examples of org.hivedb.util.database.test.WeatherReport

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

    WeatherReport report = generateInstance();
    Continent asia = new AsiaticContinent();
    hive.directory().insertPrimaryIndexKey(asia.getName());
    hive.directory().insertPrimaryIndexKey(report.getContinent());
    interceptor.postFlush(Arrays.asList(new Object[]{report, asia}).iterator());

    assertTrue(hive.directory().doesResourceIdExist("WeatherReport", report.getReportId()));
    assertTrue(hive.directory().doesResourceIdExist("Temperature", report.getTemperature()));

    assertTrue(hive.directory().doesPrimaryIndexKeyExist(asia.getName()));
    assertTrue(hive.directory().doesSecondaryIndexKeyExist("Continent", "population", asia.getPopulation(), asia.getName()));
  }
View Full Code Here

Examples of org.hivedb.util.database.test.WeatherReport

    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(Status.readOnly);
    try {
      interceptor.postFlush(Arrays.asList(new Object[]{report}).iterator());
      fail("No exception thrown");
    } catch (CallbackException e) {
View Full Code Here

Examples of org.hivedb.util.database.test.WeatherReport

    EntityHiveConfig config = getEntityHiveConfig();
    Hive hive = getHive();

    HiveInterceptorDecorator interceptor = new HiveInterceptorDecorator(config, hive);

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

    assertTrue(hive.directory().doesPrimaryIndexKeyExist(report.getContinent()));
    assertTrue(hive.directory().doesResourceIdExist("WeatherReport", report.getReportId()));
    assertTrue(hive.directory().doesResourceIdExist("Temperature", report.getTemperature()));

    hive.updateHiveStatus(Status.readOnly);
    try {
      interceptor.onDelete(report, null, null, null, null);
      fail("No exception thrown");
View Full Code Here

Examples of org.hivedb.util.database.test.WeatherReport

    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());
    hive.directory().insertPrimaryIndexKey(asia.getName());
    interceptor.postFlush(Arrays.asList(new Object[]{report, asia}).iterator());

    assertTrue(hive.directory().doesPrimaryIndexKeyExist(report.getContinent()));
    assertTrue(hive.directory().doesResourceIdExist("WeatherReport", report.getReportId()));
    assertTrue(hive.directory().doesResourceIdExist("Temperature", report.getTemperature()));

    assertTrue(hive.directory().doesPrimaryIndexKeyExist(asia.getName()));
    assertTrue(hive.directory().doesSecondaryIndexKeyExist("Continent", "population", asia.getPopulation(), asia.getName()));

    interceptor.onDelete(report, null, null, null, null);
    interceptor.onDelete(asia, null, null, null, null);

    assertFalse(hive.directory().doesResourceIdExist("WeatherReport", report.getReportId()));
    // Referenced entity does not get deleted
    assertTrue(hive.directory().doesResourceIdExist("Temperature", report.getTemperature()));

    assertFalse(hive.directory().doesPrimaryIndexKeyExist(asia.getName()));
    assertFalse(hive.directory().doesSecondaryIndexKeyExist("Continent", "population", asia.getPopulation(), asia.getName()));

  }
View Full Code Here

Examples of org.hivedb.util.database.test.WeatherReport

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

    assertTrue(hive.directory().doesPrimaryIndexKeyExist(report.getContinent()));
    assertTrue(hive.directory().doesResourceIdExist("WeatherReport", report.getReportId()));
    assertTrue(hive.directory().doesResourceIdExist("Temperature", report.getTemperature()));

    int oldTemperature = report.getTemperature();
    GeneratedInstanceInterceptor.setProperty(report, "temperature", 72);
    assertFalse(oldTemperature == 72);
    interceptor.postFlush(Arrays.asList(new WeatherReport[]{report}).iterator());
    assertTrue(hive.directory().doesResourceIdExist("Temperature", 72));
  }
View Full Code Here

Examples of org.hivedb.util.database.test.WeatherReport

  @Test
  public void testSelectNode() throws Exception {
    ConfigurationReader reader = new ConfigurationReader(Continent.class, WeatherReport.class);
    Hive hive = getHive();
    HiveShardSelector selector = new HiveShardSelector(reader.getHiveConfiguration(), hive);
    WeatherReport report = WeatherReportImpl.generate();

    ShardId id = selector.selectShardIdForNewObject(report);
    Assert.assertNotNull(id);

    Collection<Integer> nodeIds = Transform.map(new Unary<Node, Integer>() {
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.