Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.UpdatableChronicle


    ((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();
      clean = true;
    }
  }
View Full Code Here


  }
 
  public void test1() {
    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

    Util.deleteChronicles(db, FULLNAME);
  }

  public void test001() {
    try {
      UpdatableChronicle e = db.getTopChronicle().edit().createChronicle(SIMPLENAME, false, "junit test 001", null, null);
      assertEquals(FULLNAME, e.getName(true));
      e.applyUpdates();
      db.commit();
      assertEquals(FULLNAME, ((Chronicle) tester.getEvent().getSourceOrNull()).getName(true));
    } catch (T2DBException e) {
      fail(e.toString());
    }
  }
View Full Code Here

    }
  }
 
  public void test002() {
    try {
      UpdatableChronicle e = db.getChronicle(FULLNAME, true).edit();
      e.destroy();
      e.applyUpdates();
      db.commit();
      assertEquals(db.getNamingPolicy().joinValueAndDescription(FULLNAME, "junit test 001"), tester.getEvent().getComment());
    } catch (Exception e) {
      fail(e.toString());
    }
  }
View Full Code Here

  }
 
  public void test032_create_entity() {
    try {
      Schema schema = db.getSchemas("foo schema").iterator().next();
      UpdatableChronicle ent = db.getTopChronicle().edit().createChronicle("fooent", false, "foo entity", null, schema);
      ent.getAttribute("foo property", true);
      ent.applyUpdates();
      assertNotNull(ent.getAttribute("foo property", false));
      assertNull(ent.getAttribute("bar property", false));
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    }
  }

  public void test036_create_series_and_add_value() {
    try {
      UpdatableChronicle ent = db.getChronicle("bt.fooent", true).edit();
      UpdatableSeries<Double> s = ent.updateSeries("fooser");
      assertNull(s);
      s = db.getUpdatableSeries("bt.fooent.fooser", true);
      assertNotNull(s);
      s.setValue(Day.DOMAIN.time("2011-06-30"), 42.);
      s.applyUpdates();
View Full Code Here

    }
  }
 
  public void test040_create_series_and_delete_value() {
    try {
      UpdatableChronicle ent = db.getChronicle("bt.fooent", true).edit();
      UpdatableSeries<Double> s = ent.updateSeries("fooser");
      assertNotNull(s);
      s.setValue(Day.DOMAIN.time("2011-06-30"), Double.NaN);
      s.applyUpdates();
      // next should not throw an exception
      s.setValue(Day.DOMAIN.time("2011-06-30"), Double.NaN);
View Full Code Here

    }
  }
 
  public void test044_update_attribute() {
    try {
      UpdatableChronicle ent = db.getChronicle("bt.fooent", true).edit();
      Attribute<String> attr = ent.getAttribute("foo property", true).typeCheck(String.class);
      assertEquals("bar", attr.get());
      attr.set("baz");
      expectException();
    } catch (Exception e) {
      assertException(e, D.D20110, D.D10115);
View Full Code Here

    try {
      UpdatableProperty<String> prop = db.getProperty("foo property", true).typeCheck(String.class).edit();
      UpdatableValueType<String> vt = prop.getValueType().edit();
      vt.addValue("baz", "this is baz");
      vt.applyUpdates();
      UpdatableChronicle ent = db.getChronicle("bt.fooent", true).edit();
      Attribute<String> attr = ent.getAttribute("foo property", true).typeCheck(String.class);
      attr.set("baz");
      ent.setAttribute(attr);
      ent.applyUpdates();
      Attribute<String> a = ent.getAttribute("foo property", true).typeCheck(String.class);
      assertEquals("baz", a.get());
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    }
  }
 
  public void test049_update_attribute() {
    try {
      UpdatableChronicle ent = db.getChronicle("bt.fooent", true).edit();
      Attribute<String> attr = ent.getAttribute("foo property", true).typeCheck(String.class);
      assertEquals("baz", attr.get());
      attr.set("barf");
      ent.setAttribute(attr);
      ent.applyUpdates();
      attr.set("baz");
      ent.setAttribute(attr);
      ent.applyUpdates();
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

TOP

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

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.