Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.UpdatableSchema


    }
  }

  public void test_320_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_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();

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

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

    }
  }
 
  public void test_400_delete_chronicle_attribute_with_actual_values() {
    try {
      UpdatableSchema schema = db.getUpdatableSchemas("schema1a").iterator().next();

      // use the attribute
      UpdatableChronicle chro = db.getChronicle("bt.schema1achro", true).edit();
      assertEquals("t1v1", chro.getAttribute("prop1", true).get().toString());
      Attribute<?> a = chro.getAttribute("prop1", true);
      a.scan("t1v2");
      assertEquals("t1v2", a.get().toString());
      chro.setAttribute(a);
      chro.applyUpdates();
      assertEquals("t1v2", chro.getAttribute("prop1", true).get().toString());
      schema.deleteAttribute(1);
      schema.applyUpdates();
      expectException();
    } catch (Exception e) {
      assertException(e, null, D.D30146);
    }
  }
View Full Code Here

      assertEquals("t1v3", a.get().toString());
      chro.setAttribute(a);
      chro.applyUpdates();
      assertEquals("t1v3", chro.getAttribute("prop1", true).get().toString());
      // remove the attribute from the base schema of schema3 (should fail)
      UpdatableSchema schema1 = db.getUpdatableSchemas("schema1a").iterator().next();
      schema1.deleteAttribute(1);
      schema1.applyUpdates();
      expectException();
    } catch (Exception e) {
      assertException(e, null, D.D30146);
    }
  }
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.