Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Chronicle


    }
  }
 
  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

      UpdatableSeries<Double> s = db.getUpdatableSeries(SERIES, true).typeCheck(Double.class);
      TimeIndex t = s.getTimeDomain().time("2011-03-08");
      s.scanValue(t, "42");
      s.applyUpdates();
      db.commit();
      Chronicle chronicle = db.getChronicle(CHRONICLE, true);
      chronicle.getSeries(new String[]{"test", "test2", "test4"}, Double.class, true);
      expectException();
    } catch (Exception e) {
      assertException(e, D.D30121);
    }
  }
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");
      s.applyUpdates();
      db.commit();
      Chronicle chronicle = db.getChronicle(CHRONICLE, false);
      Series<Double>[] ss = chronicle.getSeries(new String[]{"test", "test2", "test4"}, Double.class, false);
      assertEquals(Double.class, ss[0].getValueType().getType());
      assertEquals(42.0, ss[0].getValue(t));
      assertNull(ss[1]);
      assertNull(ss[2]);
    } catch (Exception e) {
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_420_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

      throw new IllegalArgumentException(SCHEMA + ": " + schemas.size());
    }
  }
 
  private Chronicle createChronicle(Database db) throws Exception {
    Chronicle c = db.getChronicle(CHRONICLE, false);
    if (c == null) {
      String split[] = db.getNamingPolicy().split(CHRONICLE);
      UpdatableChronicle uc = db.getTopChronicle().edit().createChronicle(split[1], false, CHRONICLE + " (test)", null, createSchema(db));
      uc.applyUpdates();
      c = uc;
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.