Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Chronicle


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


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

  }
 
  public void test3() {
    assertTrue(((DatabaseBackend) db).isStrictNameSpaceMode());
    try {
      Chronicle en = db.getChronicle(FULLNAME + ".x", true);
      assertEquals(FULLNAME + ".x", en.getName(true));
    } catch (T2DBException e) {
      fail(e.toString());
    }
  }
View Full Code Here

    try {
      Schema schema = db.getSchemas("schema5").iterator().next();
      UpdatableChronicle chro = db.getChronicle("bt.schema5chro", true).edit();
      assertEquals(schema, chro.getSchema(false));
      chro.createChronicle("sub", false, "sub test", null, null).applyUpdates();
      Chronicle sub = db.getChronicle("bt.schema5chro.sub", true);
      assertEquals(schema, sub.getSchema(true));
      assertEquals(null, sub.getSchema(false));
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

  }
 
  public void test_erase_attribute_in_use() {
    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));
View Full Code Here

      // now change the default
      UpdatableSchema uschema1 = schema1.edit();
      uschema1.setAttributeDefault(1, "t1v2");
      uschema1.applyUpdates();
      // expect that the attribute value has changed because t1v1 above was not set, being the default
      Chronicle c = db.getChronicle("bt.schema1achro2", true);
      assertEquals("t1v1", c.getAttribute("prop1", true).get().toString());
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

  private static final String SIMPLENAME_UPDATED = "entitytest2";
 
  @Override
  protected void firstSetUp() throws Exception {
    db = getContext().getDatabase();
    Chronicle testData = db.getChronicle(FULLNAME, false);
    if (testData != null) {
      Util.deleteChronicleCollection(testData);
      UpdatableChronicle upd = testData.edit();
      upd.destroy();
      upd.applyUpdates();
      db.commit();
    }
  }
View Full Code Here

    }
  }

  public static void deleteChronicles(Database db, String... chrons) throws Exception {
    for (String chron : chrons) {
      Chronicle chronicle = db.getChronicle(chron, false);
      if (chronicle != null)
        deleteChronicle(db.getChronicle(chron, true), false);
    }
  }
View Full Code Here

  abstract protected DBObjectId id(int id);
   
  @Override
  protected void firstSetUp() throws Exception {
    db = getContext().getDatabase();
    Chronicle basic = db.getChronicle(BASE, false);
    if (basic == null) {
      String[] split = db.getNamingPolicy().split(BASE);
      Chronicle base = db.getChronicle(split[0], true);
      base.edit().createChronicle(split[1], false, "Unit tests", null, null).applyUpdates();
    } else
      Util.deleteChronicleCollection(basic);
  }
View Full Code Here

    Util.deleteChronicles(db, BASE);
  }

  public void test1() {
    try {
      Chronicle e = db.getChronicle(BASE, true);
      assertEquals(BASE, e.getName(true));
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
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.