Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.UpdatableSchema.addAttribute()


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


    try {
      // erase attribute
      Chronicle chro = db.getChronicle("bt.schema3chro", true);
      assertEquals("t1v3", chro.getAttribute("prop1", true).get().toString());
      UpdatableSchema schema3 = db.getUpdatableSchemas("schema3").iterator().next();
      schema3.addAttribute(1);
      schema3.eraseAttribute(1);
      schema3.applyUpdates();
      assertEquals(null, schema3.getAttributeDefinition("prop1", false));
      expectException();
    } catch (Exception e) {
View Full Code Here

      chro.setAttribute(a);
      chro.applyUpdates();
      assertEquals("t1v2", chro.getAttribute("prop1", true).get().toString());
     
      UpdatableSchema schema3 = db.getUpdatableSchemas("schema3").iterator().next();
      schema3.addAttribute(1);
      schema3.eraseAttribute(1);
      schema3.applyUpdates();
      assertEquals(null, schema3.getAttributeDefinition("prop1", false));
      // value still here because it's the default value, which is not in the chronicle
      assertEquals("t1v2", chro.getAttribute("prop1", true).get().toString());
View Full Code Here

    UpdatableProperty<String> p = db.createProperty("Ticker", vt, true);
    p.applyUpdates();
     
    // create "Stocks" schema, with a "Ticker" property and a "price" series
    UpdatableSchema schema = db.createSchema("Stocks", null);
    schema.addAttribute(2);
    schema.setAttributeProperty(2, p);
    schema.addSeries(1);
    schema.setSeriesName(1, "price");
    schema.setSeriesType(1, "numeric");
    schema.setSeriesTimeDomain(1, Day.DOMAIN);
View Full Code Here

  public void test_create_schema_ok_but_not_applied() {
    try {
      UpdatableSchema schema = db.createSchema("schema1", null);
      schema.addSeries(1);
      schema.setSeriesName(1, "x25");
      schema.addAttribute(1);
      schema.setAttributeProperty(1, db.getProperty("prop1", true));
      schema.setAttributeDefault(1, "t1v1");
      assertEquals("t1v1", schema.getAttributeDefinition(1, true).getValue().toString());
      assertEquals("t1v1", schema.getAttributeDefinition("prop1", true).getValue().toString());
    } catch (Exception e) {
View Full Code Here

    }
  }
  public void test_create_schema_failure_illegal_value_on_property_modification() {
    try {
      UpdatableSchema schema = db.createSchema("schema1", null);
      schema.addAttribute(1);
      schema.setAttributeProperty(1, db.getProperty("prop1", true));
      schema.setAttributeDefault(1, "t1v1");
      // next one makes default value illegal
      schema.setAttributeProperty(1, db.getProperty("prop2", true));
      schema.applyUpdates();
View Full Code Here

  public void test_create_schema_failure_incomplete_attribute() {
    try {
      // adding an incomplete, non-erasing attribute should fail
      UpdatableSchema schema = db.createSchema("schema1", null);
      schema.addAttribute(1);
      schema.applyUpdates();
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30105, D.D30111);
    }
View Full Code Here

 
  public void test_create_schema_failure_incomplete_attribute_no_value() {
    try {
      // attribute restricted, without "empty" value in the list
      UpdatableSchema schema = db.createSchema("schema1", null);
      schema.addAttribute(1);
      schema.setAttributeProperty(1, db.getProperty("prop1", true));
      schema.applyUpdates();
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30105, D.D30111);
View Full Code Here

 
  public void test_create_schema_with_empty_value() {
    try {
      // attribute restricted, with "empty" value in the list
      UpdatableSchema schema = db.createSchema("schema2a", null);
      schema.addAttribute(1);
      Property<?> prop = db.getProperty("prop2", true);
      schema.setAttributeProperty(1, prop);
      schema.setAttributeDefault(1, prop.scan(""));
      schema.applyUpdates();
    } catch (Exception e) {
View Full Code Here

  public void test_create_schema_with_null_value() {
    try {
      // attribute restricted, with "empty" value in the list
      // null string is not okay, use empty string
      UpdatableSchema schema = db.createSchema("schema2b", null);
      schema.addAttribute(1);
      schema.setAttributeProperty(1, db.getProperty("prop2", true));
      schema.applyUpdates();
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30105, D.D30111);
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.