Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.UpdatableSchema


  public void test_20() {
    try {
      Chronicle chronicle = db.getChronicle(CHRONICLE, true);
      assertEquals(1, chronicle.getSchema(true).getSeriesDefinitions().size());
      Schema s0 = chronicle.getSchema(true);
      UpdatableSchema usch = s0.edit();
      usch.addSeries(4);
      usch.setSeriesName(4, "test4");
      usch.setSeriesType(4, "numeric");
      usch.setSeriesTimeDomain(4, Day.DOMAIN);
      assertEquals(2, usch.getSeriesDefinitions().size());
      usch.applyUpdates();
      assertEquals(2, usch.getSeriesDefinitions().size());
      db.commit();
      assertEquals(1, chronicle.getSchema(true).getSeriesDefinitions().size());
      chronicle = db.getChronicle(CHRONICLE, true);
      assertEquals(2, chronicle.getSchema(true).getSeriesDefinitions().size());
    } catch (Exception e) {
View Full Code Here


  }

  private void listSchemas(String pattern) throws Exception {
    Collection<UpdatableSchema> schemas = db.getUpdatableSchemas(pattern);
    for (UpdatableSchema schema : schemas) {
      UpdatableSchema base = schema.getBase();
      if (base == null)
        System.out.println(schema.getName());
      else
        System.out.println(schema.getName() + "--->" + schema.getBase().getName());
    }
View Full Code Here

    }
  }
 
  public void test_010_create_schema_failure_series_name_used_twice () {
    try {
      UpdatableSchema schema = db.createSchema("schema1", null);
      schema.addSeries(1);
      schema.setSeriesName(1, "x25");
      schema.addSeries(2);
      // name already used
      schema.setSeriesName(2, "x25");
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30153);
    }
  }
View Full Code Here

    }
  }
 
  public void test_020_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) {
      fail(e.getMessage());
    }
  }
View Full Code Here

      fail(e.getMessage());
    }
  }
  public void test_030_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();
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30133);
    }
  }
View Full Code Here

  }

  public void test_040_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_050_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_060_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) {
      fail(e.getMessage());
    }
  }
View Full Code Here

 
  public void test_070_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

  }

  public void test_080_create_schema_failure_incomplete_series() {
    try {
      // adding an incomplete, non-erasing series should fail
      UpdatableSchema schema = db.createSchema("schema1", null);
      schema.addSeries(1);
      schema.applyUpdates();
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30105, D.D30112);
    }
  }
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.