Search in sources :

Example 1 with MemoryTimeMerger

use of org.apache.rya.export.client.merge.MemoryTimeMerger in project incubator-rya by apache.

the class StoreToStoreIT method cloneTest.

@Test
public void cloneTest() throws AddStatementException, FetchStatementException, ParentMetadataDoesNotExistException {
    loadMockStatements(parentStore, 50, new Date(currentDate.getTime() + 10000L));
    final MemoryTimeMerger merger = new MemoryTimeMerger(parentStore, childStore, new VisibilityStatementMerger(), currentDate, RYA_INSTANCE, 0L);
    merger.runJob();
    assertEquals(50, count(childStore));
}
Also used : VisibilityStatementMerger(org.apache.rya.export.client.merge.VisibilityStatementMerger) MemoryTimeMerger(org.apache.rya.export.client.merge.MemoryTimeMerger) Date(java.util.Date) Test(org.junit.Test)

Example 2 with MemoryTimeMerger

use of org.apache.rya.export.client.merge.MemoryTimeMerger in project incubator-rya by apache.

the class StoreToStoreIT method no_statementsTest.

@Test
public void no_statementsTest() throws AddStatementException, FetchStatementException {
    loadMockStatements(parentStore, 50, new Date(0L));
    assertEquals(0, count(childStore));
    final MemoryTimeMerger merger = new MemoryTimeMerger(parentStore, childStore, new VisibilityStatementMerger(), currentDate, RYA_INSTANCE, 0L);
    merger.runJob();
    assertEquals(0, count(childStore));
}
Also used : VisibilityStatementMerger(org.apache.rya.export.client.merge.VisibilityStatementMerger) MemoryTimeMerger(org.apache.rya.export.client.merge.MemoryTimeMerger) Date(java.util.Date) Test(org.junit.Test)

Example 3 with MemoryTimeMerger

use of org.apache.rya.export.client.merge.MemoryTimeMerger in project incubator-rya by apache.

the class StoreToStoreIT method childToParent_BothAddTest.

@Test
public void childToParent_BothAddTest() throws Exception {
    loadMockStatements(parentStore, 50, new Date(currentDate.getTime() + 10000L));
    assertEquals(0, count(childStore));
    final MemoryTimeMerger merger = new MemoryTimeMerger(parentStore, childStore, new VisibilityStatementMerger(), currentDate, RYA_INSTANCE, 0L);
    merger.runJob();
    assertEquals(50, count(parentStore));
    assertEquals(50, count(childStore));
    // add a statement to each store
    final RyaStatement stmnt1 = makeRyaStatement("http://subject", "http://predicate", "http://add");
    final RyaStatement stmnt2 = makeRyaStatement("http://subject", "http://predicate", "http://add2");
    stmnt1.setTimestamp(new Date().getTime() + 10L);
    stmnt2.setTimestamp(currentDate.getTime() + 1000L);
    parentStore.addStatement(stmnt1);
    childStore.addStatement(stmnt2);
    final MemoryTimeMerger otherMerger = new MemoryTimeMerger(childStore, parentStore, new VisibilityStatementMerger(), currentDate, RYA_INSTANCE, 0L);
    otherMerger.runJob();
    // both should still be there
    assertEquals(52, count(parentStore));
}
Also used : VisibilityStatementMerger(org.apache.rya.export.client.merge.VisibilityStatementMerger) MemoryTimeMerger(org.apache.rya.export.client.merge.MemoryTimeMerger) RyaStatement(org.apache.rya.api.domain.RyaStatement) Date(java.util.Date) Test(org.junit.Test)

Example 4 with MemoryTimeMerger

use of org.apache.rya.export.client.merge.MemoryTimeMerger in project incubator-rya by apache.

the class StoreToStoreIT method childToParent_ChildAddTest.

@Test
public void childToParent_ChildAddTest() throws AddStatementException, FetchStatementException {
    loadMockStatements(parentStore, 50, new Date(currentDate.getTime() + 100L));
    // setup child
    final MemoryTimeMerger merger = new MemoryTimeMerger(parentStore, childStore, new VisibilityStatementMerger(), currentDate, RYA_INSTANCE, 0L);
    merger.runJob();
    // add a few statements to child
    final RyaStatement stmnt1 = makeRyaStatement("http://subject", "http://predicate", "http://51");
    final RyaStatement stmnt2 = makeRyaStatement("http://subject", "http://predicate", "http://52");
    childStore.addStatement(stmnt1);
    childStore.addStatement(stmnt2);
    final MemoryTimeMerger otherMerger = new MemoryTimeMerger(childStore, parentStore, new VisibilityStatementMerger(), currentDate, RYA_INSTANCE, 0L);
    otherMerger.runJob();
    assertEquals(52, count(parentStore));
}
Also used : VisibilityStatementMerger(org.apache.rya.export.client.merge.VisibilityStatementMerger) MemoryTimeMerger(org.apache.rya.export.client.merge.MemoryTimeMerger) RyaStatement(org.apache.rya.api.domain.RyaStatement) Date(java.util.Date) Test(org.junit.Test)

Example 5 with MemoryTimeMerger

use of org.apache.rya.export.client.merge.MemoryTimeMerger in project incubator-rya by apache.

the class StoreToStoreIT method childToParent_ChildReAddsDeletedStatementTest.

@Test
public void childToParent_ChildReAddsDeletedStatementTest() throws Exception {
    loadMockStatements(parentStore, 50, new Date(currentDate.getTime() + 10000L));
    // setup child
    final MemoryTimeMerger merger = new MemoryTimeMerger(parentStore, childStore, new VisibilityStatementMerger(), currentDate, RYA_INSTANCE, 0L);
    merger.runJob();
    // remove a statement from the parent
    final RyaStatement stmnt1 = makeRyaStatement("http://subject", "http://predicate", "http://1");
    parentStore.removeStatement(stmnt1);
    assertEquals(49, count(parentStore));
    assertFalse(parentStore.containsStatement(stmnt1));
    final MemoryTimeMerger otherMerger = new MemoryTimeMerger(childStore, parentStore, new VisibilityStatementMerger(), currentDate, RYA_INSTANCE, 0L);
    otherMerger.runJob();
    // merging will have added the statement back
    assertEquals(50, count(parentStore));
}
Also used : VisibilityStatementMerger(org.apache.rya.export.client.merge.VisibilityStatementMerger) MemoryTimeMerger(org.apache.rya.export.client.merge.MemoryTimeMerger) RyaStatement(org.apache.rya.api.domain.RyaStatement) Date(java.util.Date) Test(org.junit.Test)

Aggregations

MemoryTimeMerger (org.apache.rya.export.client.merge.MemoryTimeMerger)6 VisibilityStatementMerger (org.apache.rya.export.client.merge.VisibilityStatementMerger)6 Date (java.util.Date)5 Test (org.junit.Test)5 RyaStatement (org.apache.rya.api.domain.RyaStatement)3 File (java.io.File)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 AccumuloException (org.apache.accumulo.core.client.AccumuloException)1 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)1 ParseException (org.apache.commons.cli.ParseException)1 AccumuloRyaStatementStore (org.apache.rya.export.accumulo.AccumuloRyaStatementStore)1 MergerException (org.apache.rya.export.api.MergerException)1 MergeConfigurationException (org.apache.rya.export.api.conf.MergeConfigurationException)1 TimestampPolicyMergeConfiguration (org.apache.rya.export.api.conf.policy.TimestampPolicyMergeConfiguration)1 RyaStatementStore (org.apache.rya.export.api.store.RyaStatementStore)1 MergeConfigurationCLI (org.apache.rya.export.client.conf.MergeConfigurationCLI)1 StatementStoreFactory (org.apache.rya.export.client.merge.StatementStoreFactory)1 InferenceEngineException (org.apache.rya.rdftriplestore.inference.InferenceEngineException)1 MalformedQueryException (org.openrdf.query.MalformedQueryException)1