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));
}
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));
}
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));
}
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));
}
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));
}
Aggregations