Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.UpdatableSchema


    }
  }
 
  public void test_add_series_to_schema4_but_dont_apply() {
    try {
      UpdatableSchema schema4 = db.getUpdatableSchemas("schema4").iterator().next();
      Schema s = schema4.resolve();
      assertEquals("fou", s.getSeriesDefinition(1, true).getName());
      schema4.addSeries(1);
      schema4.eraseSeries(1);
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here


  }
 
  public void test_set_schema2_as_base_of_schema3() {
    // related to test37
    try {
      UpdatableSchema schema2 = db.getUpdatableSchemas("schema2").iterator().next();
      UpdatableSchema schema3 = db.getUpdatableSchemas("schema3").iterator().next();
      schema3.setBase(schema2);
      schema3.applyUpdates();
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    }
  }

  public void test_delete_non_existing_series() {
    try {
      UpdatableSchema schema4 = db.getUpdatableSchemas("schema4").iterator().next();
      schema4.deleteSeries(1);
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30125);
    }
  }
View Full Code Here

      chro.applyUpdates();
      UpdatableSeries<Double> ser = db.getUpdatableSeries("bt.schema1achro.fou", true);
      ser.setValue(Workday.DOMAIN.time("2011-06-30"), 42.);
      ser.applyUpdates();
      // erase the series from the schema (should fail, of course)
      UpdatableSchema sch1 = schema.edit();
      sch1.deleteSeries(1);
      sch1.applyUpdates();
      expectException();
    } catch (Exception e) {
      assertException(e, null, "D30150");
    }
  }
View Full Code Here

    try {
      Schema schema = db.getSchemas("schema1a").iterator().next();
      Series<Double> ser = db.getSeries("bt.schema1achro.fou", true);
      assertEquals(42., ser.getValue(Workday.DOMAIN.time("2011-06-30")));
      // renaming the series should be okay
      UpdatableSchema sch1 = schema.edit();
      //sch1.setSeriesName(1, "fooo"); next line should be equivalent
      sch1.setAttributeDefault(1, 1, "fooo");
      sch1.applyUpdates();
      ser = db.getSeries("bt.schema1achro.fooo", true);
      assertEquals(42., ser.getValue(Workday.DOMAIN.time("2011-06-30")));
    } catch (Exception e) {
      fail(e.getMessage());
    }
View Full Code Here

    try {
      Schema schema = db.getSchemas("schema1a").iterator().next();
      Series<Double> ser = db.getSeries("bt.schema1achro.fooo", true);
      assertEquals(42., ser.getValue(Workday.DOMAIN.time("2011-06-30")));
      // changing the time domain should fail
      UpdatableSchema sch1 = schema.edit();
      sch1.setSeriesTimeDomain(1, DateTime.DOMAIN);
      sch1.applyUpdates();
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30105, D.D30149);
    }
  }
View Full Code Here

 
  public void test_update_attribute_value_okay() {
    try {
      Schema schema = db.getSchemas("schema1a").iterator().next();
      Series<Double> ser = db.getSeries("bt.schema1achro.fooo", true);
      UpdatableSchema sch1 = schema.edit();
      sch1.addAttribute(7);
      sch1.setAttributeDefault(7, "foo");
      sch1.setAttributeProperty(7, db.getProperty("prop3", true));
      sch1.applyUpdates();

      // important: get it again
      ser = db.getSeries("bt.schema1achro.fooo", true);
      Attribute<?> sa = ser.getAttribute("prop3", false);
      assertEquals("foo", sa.get().toString());
View Full Code Here

  }
 
  public void test_series_attribute_overrides_chronicle_attribute() {
    try {
      Schema schema = db.getSchemas("schema1a").iterator().next();
      UpdatableSchema sch1 = schema.edit();
      sch1.addAttribute(1, 5);
      sch1.setAttributeDefault(1, 5, "bar");
      sch1.setAttributeProperty(1, 5, db.getProperty("prop3", true));
      sch1.applyUpdates();

      Series<Double> ser = db.getSeries("bt.schema1achro.fooo", true);
      Attribute<?> sa = ser.getAttribute("prop3", false);
      assertEquals("bar", sa.get().toString());
      Attribute<?> ca = ser.getChronicle().getAttribute("prop3", false);
View Full Code Here

      UpdatableChronicle chro = db.getTopChronicle().edit().createChronicle("schema4chro", false, "test chronicle", null, schema);
      chro.applyUpdates();
      UpdatableSeries<Double> ser = db.getUpdatableSeries("bt.schema4chro.fooo", true);
      ser.applyUpdates();
      // note that the series is deleted in the base schema
      UpdatableSchema sch1 = db.getUpdatableSchemas("schema1a").iterator().next();
      sch1.deleteSeries(1);
      sch1.applyUpdates();
      expectException();
    } catch (Exception e) {
      assertException(e, null, D.D30150);
    }
  }
View Full Code Here

    }
  }
 
  public void test_delete_and_add_attribute() {
    try {
      UpdatableSchema schema = db.getUpdatableSchemas("schema1a").iterator().next();
      schema.deleteAttribute(1);
      schema.applyUpdates();
      assertEquals(1, schema.getAttributeDefinitions().size());
      // put it back we still need it
      schema.addAttribute(1);
      schema.setAttributeProperty(1, db.getProperty("prop1", true));
      schema.setAttributeDefault(1, "t1v1");
      schema.applyUpdates();
      assertEquals(2, schema.getAttributeDefinitions().size());
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of ch.agent.crnickl.api.UpdatableSchema

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.