Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Schema


    }
  }
 
  public void test_330_delete_series_in_actual_use_fails() {
    try {
      Schema schema = db.getSchemas("schema1a").iterator().next();
      UpdatableChronicle chro = db.getTopChronicle().edit().createChronicle("schema1achro", false, "test chronicle", null, schema);
      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


    }
  }
 
  public void test_340_rename_series_in_actual_use_okay() {
    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")));
View Full Code Here

    }
  }
 
  public void test_350_modify_time_domain_of_series_fails() {
    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_360_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();
View Full Code Here

    }
  }
 
  public void test_370_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();
View Full Code Here

    }
  }

  public void test_380_delete_series_in_use_via_base_schema() {
    try {
      Schema schema = db.getSchemas("schema4").iterator().next();
      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
View Full Code Here

    }
  }
 
  public void test_410_delete_chronicle_attribute_via_base_with_actual_values() {
    try {
      Schema schema3 = db.getSchemas("schema3").iterator().next();
      UpdatableChronicle chro = db.getTopChronicle().edit().createChronicle("schema3chro", false, "test chronicle", null, schema3);
      chro.applyUpdates();
      // use the attribute
      Attribute<?> a = chro.getAttribute("prop1", true);
      a.scan("t1v3");
View Full Code Here

    }
  }

  public void test_450_set_chronicle_attribute_with_value_same_as_default() {
    try {
      Schema schema1 = db.getSchemas("schema1a").iterator().next();
      UpdatableChronicle chro = db.getTopChronicle().edit().createChronicle("schema1achro2", false, "test chronicle", null, schema1);
      chro.applyUpdates();
      // use the attribute
      Attribute<?> a = chro.getAttribute("prop1", true);
      assertEquals("t1v1", schema1.getAttributeDefinition("prop1", false).getValue().toString());
      a.scan("t1v1");
      chro.setAttribute(a);
      chro.applyUpdates();
      assertEquals("t1v1", chro.getAttribute("prop1", true).get().toString());
      // now change the default
      UpdatableSchema uschema1 = schema1.edit();
      uschema1.setAttributeDefault(1, "t1v2");
      uschema1.applyUpdates();
      // expect that the attribute value has changed because t1v1 above was not set, being the default
      Chronicle c = db.getChronicle("bt.schema1achro2", true);
      assertEquals("t1v1", c.getAttribute("prop1", true).get().toString());
View Full Code Here

     
    db.commit();
  }

  private void setup2() throws Exception {
    Schema stocks = db.getSchemas("Stocks").iterator().next();
    UpdatableChronicle sm = db.getTopChronicle().edit().createChronicle("sm", false, "Stock markets", null, stocks);
    sm.applyUpdates();

    UpdatableChronicle ch = sm.createChronicle("ch", false, "CH", null, null);
    ch.applyUpdates();
View Full Code Here

  }
 
  public void test_create_chronicle_with_empty_schema_okay() {
    try {
      // creating a chronicle with an empty schema should be possible
      Schema schema = db.getSchemas("schema5").iterator().next();
      UpdatableChronicle chro = db.getTopChronicle().edit().createChronicle("schema5chro", false, "test chronicle", null, schema);
      chro.applyUpdates();
    } catch (Exception e) {
      fail(e.getMessage());
    }
View Full Code Here

TOP

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

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.