Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Chronicle


    }
  }
 
  public void test13() {
    try {
      Chronicle e1 = db.getChronicle(ENTITY, true);
      Chronicle e2 = db.getChronicle(e1.getSurrogate());
      assertEquals(e1.getCollection(), e2.getCollection());
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here


  @Override
  protected void setUp() throws Exception {
    db = getContext().getDatabase();
    ((DatabaseBackend) db).setStrictNameSpaceMode(false);
    if (!clean) {
      Chronicle testData = db.getChronicle(SIMPLENAME, false);
      if (testData != null) {
        Util.deleteChronicleCollection(testData);
        UpdatableChronicle upd = testData.edit();
        upd.destroy();
        upd.applyUpdates();
      }
      UpdatableChronicle ex = db.getTopChronicle().edit().createChronicle(SIMPLENAME, false, "standalone test", null, null);
      ex.applyUpdates();
View Full Code Here

    assertFalse(((DatabaseBackend) db).isStrictNameSpaceMode());
    try {
      UpdatableChronicle e = db.getChronicle(SIMPLENAME, true).edit();
      UpdatableChronicle ex = e.createChronicle("x", false, "it's x", null, null);
      ex.applyUpdates();
      Chronicle ent = db.getChronicle(SIMPLENAME + ".x", true);
      assertEquals(SIMPLENAME + ".x", ent.getName(true));
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  }
 
  public void test2() {
    assertFalse(((DatabaseBackend) db).isStrictNameSpaceMode());
    try {
      Chronicle en = db.getChronicle(SIMPLENAME + ".x", true);
      assertEquals(SIMPLENAME + ".x", en.getName(true));
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

 
  public void test3() {
    assertFalse(((DatabaseBackend) db).isStrictNameSpaceMode());
    try {
      // full name tolerated in non-strict mode
      Chronicle en = db.getChronicle(FULLNAME + ".x", true);
      assertEquals(SIMPLENAME + ".x", en.getName(true));
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

    }
  }

  public void test052_get_attribute() {
    try {
      Chronicle ent = db.getChronicle("bt.fooent", true);
      Attribute<String> attr = ent.getAttribute("foo property", true).typeCheck(String.class);
      assertEquals("baz", attr.get());
      assertEquals("this is baz", attr.getDescription(true));
      assertEquals(null, attr.getDescription(false));
      assertEquals("this is baz", attr.getProperty().getValueType().getValueDescriptions().get("baz"));
      AttributeDefinition<String> def = ent.getSchema(true).getAttributeDefinition("foo property", true).typeCheck(String.class);
      assertEquals("bar", def.getAttribute().get());
      assertEquals("it's bar", def.getAttribute().getDescription(true));
      assertEquals(null, def.getAttribute().getDescription(false));
    } catch (Exception e) {
      fail(e.getMessage());
View Full Code Here

    }
  }
 
  public void test_14() {
    try {
      Chronicle chronicle = db.getChronicle(CHRONICLE, true);
      Series<String>[] s = chronicle.getSeries(new String[]{"test"}, String.class, true);
      assertEquals(Double.class, s[0].getValueType().getType());
      expectException();
    } catch (Exception e) {
      assertException(e, D.D50101);
    }
View Full Code Here

    }
  }
 
  public void test_15() {
    try {
      Chronicle chronicle = db.getChronicle(CHRONICLE, true);
      Series<Double>[] s = chronicle.getSeries(new String[]{"test"}, Double.class, true);
      assertEquals(Double.class, s[0].getValueType().getType());
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

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

      UpdatableSeries<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      s.scanValue(t, "42.01");
      s.applyUpdates();
      db.commit();
      Chronicle chronicle = db.getChronicle(CHRONICLE, true);
      Series<Double>[] ss = chronicle.getSeries(new String[]{"test", "test4"}, Double.class, true);
      assertEquals(2, ss.length);
      assertEquals(Double.class, ss[0].getValueType().getType());
      assertEquals(42.01, ss[0].getValue(t));
      assertNull(ss[1]);
    } catch (Exception e) {
View Full Code Here

TOP

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

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.