Package com.hp.hpl.jena.gvs.impl.util

Examples of com.hp.hpl.jena.gvs.impl.util.ToyClock


    assertFalse(followingChanges.hasNext());
  }
 
  public void testFGNodeMerging() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Model model1 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");
    Model model2 = modelWithStatements("_a dc:subject 'hullo'; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");

    Date date1 = dateFormat.parse("20050607");
    Date date2 = dateFormat.parse("20060912");
    FCAGraph graph1 = new FCAGraphImpl(model1);
    FCAGraph graph2 = new FCAGraphImpl(model2);
    Source source = new SourceImpl("http://example.org/graph-source");
    clock.setTime(date1);
    store.updateGraph(source, graph1);
    store = reGetStoreImpl();
    source = new SourceImpl("http://example.org/graph-source");
    clock.setTime(date2);
    store.assertGraph(source, graph2);
    FCAGraph graphR  = store.getGraphOverTime(Collections.singleton(source)).getGraph(dateFormat.parse("20060913"));
    JenaUtil.getModelFromGraph(graphR).write(System.out);
  }
View Full Code Here


  }
 
  //FIX BaseStoreImp revokegraph
  public void notYetTestPartialFGNodeRevoke() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Model model1 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox \"foo\"; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");
    Model model2 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");

    Date date1 = dateFormat.parse("20050607");
    Date date2 = dateFormat.parse("20060912");
    FCAGraph graph1 = new FCAGraphImpl(model1);
    FCAGraph graph2 = new FCAGraphImpl(model2);
    Source source = new SourceImpl("http://example.org/graph-source");
    clock.setTime(date1);
    store.updateGraph(source, graph1);
    store = reGetStoreImpl();
    clock.setTime(date2);
    store.revokeGraph(source, graph2);
    FCAGraph graphR  = store.getGraphOverTime(Collections.singleton(source)).getGraph(dateFormat.parse("20060913"));
    JenaUtil.getModelFromGraph(graphR).write(System.out);
  }
View Full Code Here

    JenaUtil.getModelFromGraph(graphR).write(System.out);
  }
 
  public void testPartialFGNodeRevoke2() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Model model1 = modelWithStatements("_a dc:subject 'sub1'; _a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");
    Model model1b = modelWithStatements("_a http://xmlns.com/foaf/0.1/mbox \"foo\"; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");
    Model model2 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");

    Date date1 = dateFormat.parse("20050607");
    Date date1b = dateFormat.parse("20050608");
    Date date2 = dateFormat.parse("20060912");
    FCAGraph graph1 = new FCAGraphImpl(model1);
    FCAGraph graph1b = new FCAGraphImpl(model1b);
    FCAGraph graph2 = new FCAGraphImpl(model2);
    Source source = new SourceImpl("http://example.org/graph-source");
    clock.setTime(date1);
    store.updateGraph(source, graph1);
    clock.setTime(date1b);
    store.assertGraph(source, graph1b);
    store = reGetStoreImpl();
    clock.setTime(date2);
    store.revokeGraph(source, graph2);
    FCAGraph graphR  = store.getGraphOverTime(Collections.singleton(source)).getGraph(dateFormat.parse("20060913"));
    //no exception retrieving graph containing fg-node that doesn't exist the same way as wehn stuff was added
    assertTrue(true);
    JenaUtil.getModelFromGraph(graphR).write(System.out);
View Full Code Here

    JenaUtil.getModelFromGraph(graphR).write(System.out);
  }
 
  public void testTransactions1() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Model model = modelWithStatements("_a dc:subject 'sub1'; _a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/knows http://example.org/");
    Source source = new SourceImpl("http://example.org/graph-source");
    Date date1 = dateFormat.parse("20050607");
    Date date2 = dateFormat.parse("20050608");
    Date date3 = dateFormat.parse("20060912");
    clock.setTime(date1);
    store.assertGraph(source, new FCAGraphImpl(model));
    clock.setTime(date2);
    store.perform(source, new StoreTransaction() {

      public void execute(SourceStoreView storeView) {
        storeView.revokeAll();
       
View Full Code Here

    assertEquals(0, retrieved.size());
  }
 
  public void testTransactions2() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Model model1 = modelWithStatements("_a dc:subject 'sub1'; _a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/knows http://example.org/");
    Model model2 = modelWithStatements("_b dc:subject 'sub2'; _b dc:subject 'hello'; _b http://xmlns.com/foaf/0.1/knows http://example.org/");
    final FCAGraph graph2 = new FCAGraphImpl(model2);
    Source source = new SourceImpl("http://example.org/graph-source");
    Date date1 = dateFormat.parse("20050607");
    Date date2 = dateFormat.parse("20050608");
    Date date3 = dateFormat.parse("20060912");
    clock.setTime(date1);
    store.assertGraph(source, new FCAGraphImpl(model1));
    store.assertGraph(source, graph2);
    clock.setTime(date2);
    store.perform(source, new StoreTransaction() {

      public void execute(SourceStoreView storeView) {
        storeView.revokeAll();
        storeView.assertGraph(graph2);
View Full Code Here

    assertEquals(graph2, retrieved);
  }
 
  public void testTransactions3() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Model model1 = modelWithStatements("_a dc:subject 'sub1'; _a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/knows http://example.org/; _c dc:subject 'foo'");
    final FCAGraph graph1 = new FCAGraphImpl(model1);
    Model model2 = modelWithStatements("_b dc:subject 'sub2'; _b dc:subject 'hello'; _b http://xmlns.com/foaf/0.1/knows http://example.org/");
    final FCAGraph graph2 = new FCAGraphImpl(model2);
    Source source = new SourceImpl("http://example.org/graph-source");
    Date date1 = dateFormat.parse("20050607");
    Date date2 = dateFormat.parse("20050608");
    Date date3 = dateFormat.parse("20060912");
    clock.setTime(date1);
    store.assertGraph(source, graph1);
    store.assertGraph(source, graph1);
    store.assertGraph(source, graph2);
    clock.setTime(date2);
    store.perform(source, new StoreTransaction() {

      public void execute(SourceStoreView storeView) {
        storeView.revokeGraph(graph1);
      }
View Full Code Here

   */
  public boolean performTest(FCAGraph[] graphs) {
    for (int k = 0; k < 2; k++) {
    JenaParameters.disableBNodeUIDGeneration = true;
    try {
      ToyClock clock = new ToyClock();
      Store store = getStoreImpl(clock);
      Source source = new SourceImpl("http://example.org/graph-source");
      for (int i = 0; i < graphs.length; i++) {
        //TODO leanify based on dec
        graphs[i] = new FCAGraphImpl(MoleculeBasedLeanifier.getLeanVersionOf(graphs[i]));
      }
      TimedGraphSequence tgs = TimedGraphSequence
          .getSequenceWithRandomDates(graphs);
      for (int i = 0; i < tgs.getSize(); i++) {
        clock.setTime(tgs.getDate(i));
        store.updateGraph(source, tgs.getGraph(i));
      }
      if (!StoreTest.compareAllVersions(store, source, tgs)) {
        return false;
      }
View Full Code Here

  /**
   * @param round
   */
  private static void singleRound(int round) {
    System.out.println("round nr: " + round);
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl();
    store.setClock(clock);
    Source source = new SourceImpl("http://example.org/graph-source");
    TimedGraphSequence testData = TimedGraphSequence.getRandomSequence(4,
        315);// + 300);//(round / 5));
    try {
      System.out.println("writing current-case.txt");
      FileOutputStream currentCaseOut = new FileOutputStream(
          "current-case.txt");
      testData.write(currentCaseOut);
      currentCaseOut.close();
      currentCaseOut = null;
      // graphs representing the state of a changing graph in
      // chronological
      // order
      for (int i = 0; i < testData.getSize(); i++) {
        clock.setTime(testData.getDate(i));
        store.updateGraph(source, testData.getGraph(i));
      }
      for (int i = 0; i < 1/* 0 */; i++) {

        if (!StoreTest.compareVersionAtRandomDate(store, source,
View Full Code Here

      throw new RuntimeException(e);
    }
  }

  protected void performTestsWithGraphs(FCAGraph[] graphs) {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source = new SourceImpl("http://example.org/graph-source");
    TimedGraphSequence tgs = TimedGraphSequence
        .getSequenceWithRandomDates(graphs);
    for (int i = 0; i < tgs.getSize(); i++) {
      clock.setTime(tgs.getDate(i));
      store.updateGraph(source, tgs.getGraph(i));
    }
    assertTrue(compareAllVersions(store, source, tgs));
    assertTrue(compareVersionAtRandomDate(store, source, tgs));
    // do the same again with new store instance
View Full Code Here

  @Override
  protected void execute(Store store, DownloadRemoteCommandArgumets arguments) {
    URL remoteService = arguments.getRemoteServiceURL();
    log.info("Remote Service: " + remoteService);
    Clock origClock = store.getClock();
    ToyClock toyClock = new ToyClock();
    store.setClock(toyClock);
    Set<String> sources = getSources(remoteService);
    for (String omitSource : arguments.getOmitSourceURLs()) {
      if (!sources.contains(omitSource)) {
        throw new RuntimeException("Cannot omit " + omitSource
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.gvs.impl.util.ToyClock

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.