Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.UpdatableSchema


    }
  }

  public void test_220_create_schema1_and_schema2() {
    try {
      UpdatableSchema schema1 = db.createSchema("schema1", null);
      schema1.addAttribute(1);
      schema1.setAttributeProperty(1, db.getProperty("prop1", true));
      schema1.setAttributeDefault(1, "t1v1");
      schema1.applyUpdates();
      UpdatableSchema schema2 = db.createSchema("schema2", "schema1");
      schema2.addAttribute(1);
      schema2.setAttributeProperty(1, db.getProperty("prop1", true));
      schema2.setAttributeDefault(1, "t1v2");
      schema2.applyUpdates();
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here


    }
  }
 
  public void test_230_define_series_in_schema1() {
    try {
      UpdatableSchema schema1 = db.getSchemas("schema1").iterator().next().edit();
      Schema schema2 = db.getSchemas("schema2").iterator().next();
      schema1.addSeries(1);
      schema1.setSeriesName(1, "foo");
      schema1.setSeriesDescription(1, "foo series");
      schema1.setSeriesTimeDomain(1, Workday.DOMAIN);
      schema1.setSeriesType(1, db.getValueType("numeric"));
      schema1.addAttribute(1, 6);
      schema1.setAttributeProperty(1, 6, db.getProperty("prop2", true));
      schema1.setAttributeDefault(1, 6, "t2v2");
      schema1.applyUpdates();
      assertEquals("foo", schema1.getSeriesDefinition(1, true).getName());
      assertEquals("foo series", schema1.getSeriesDefinition(1, true).getDescription());
      assertEquals(null, schema2.getSeriesDefinition(1, false));
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    }
  }
 
  public void test_240_edit_and_add_series_in_schema1() {
    try {
      UpdatableSchema schema1 = db.getSchemas("schema1").iterator().next().edit();
      schema1.setSeriesName(1, "fou");
      schema1.setSeriesDescription(1, "fou series");
      schema1.applyUpdates();
      assertEquals("fou", schema1.getSeriesDefinition(1, true).getName());
      assertEquals("fou series", schema1.getSeriesDefinition(1, true).getDescription());
      schema1.addSeries(3);
      schema1.setSeriesName(3, "foo");
      schema1.setSeriesDescription(3, "fully foo");
      schema1.setSeriesTimeDomain(3, Workday.DOMAIN);
      schema1.setSeriesType(3, db.getValueType("numeric"));
      schema1.applyUpdates();
      assertEquals(Workday.DOMAIN, schema1.getSeriesDefinition(3, true).getTimeDomain());
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    }
  }

  public void test_250_rename_schema1_schema1a() {
    try {
      UpdatableSchema schema1 = db.getSchemas("schema1").iterator().next().edit();
      schema1.setName("schema1a");
      schema1.applyUpdates();
      assertEquals(1, db.getSchemas("schema1a").size());
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    }
  }
 
  public void test_260_create_schema3_for_base_of_schema1a() {
    try {
      UpdatableSchema schema3 = db.createSchema("schema3", null);
      schema3.applyUpdates();
      UpdatableSchema schema1 = db.getSchemas("schema1a").iterator().next().edit();
      schema1.setBase(schema3);
      schema1.applyUpdates();
      assertEquals(schema3, schema1.getBase());
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    }
  }
 
  public void test_270_reset_base_of_schema1a() {
    try {
      UpdatableSchema schema1 = db.getSchemas("schema1a").iterator().next().edit();
      schema1.setBase(null);
      schema1.applyUpdates();
      assertEquals(null, schema1.getBase());
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    }
  }
 
  public void test_280_cannot_set_base_to_schema_in_construction() {
    try {
      UpdatableSchema schema4 = db.createSchema("schema4", null);
      schema4.addAttribute(1);
      schema4.setAttributeProperty(1, db.getProperty("prop1", true));
      schema4.setAttributeDefault(1, "t1v1");
//      schema4.applyUpdates();
      UpdatableSchema schema1 = db.getSchemas("schema1a").iterator().next().edit();
      schema1.setBase(schema4);
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30128);
    }
  }
View Full Code Here

      assertException(e, D.D30128);
    }
  }

  public void test_290_create_schema4_based_on_schema1a_and_override_attribute() {
    UpdatableSchema schema1 = null;
    try {
      UpdatableSchema schema4 = db.createSchema("schema4", "schema1a");
      Schema s = schema4.resolve();
      assertEquals("prop1", s.getAttributeDefinition(1, true).getName());
      schema4.addAttribute(1);
      schema4.eraseAttribute(1);
      assertEquals(true, schema4.getAttributeDefinition(1, true).isErasing());
      assertEquals("fou", s.getSeriesDefinition(1, true).getName());
      schema4.setAttributeProperty(1, db.getProperty("prop1", true));
      schema4.setAttributeDefault(1, "t1v1");
      schema4.applyUpdates();
      schema1 = db.getSchemas("schema1a").iterator().next().edit();
      schema1.setBase(schema4);
      schema1.applyUpdates();
      expectException();
    } catch (Exception e) {
View Full Code Here

    }
  }
 
  public void test_300_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_310_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

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.