use of nl.knaw.huygens.timbuctoo.core.EntityFinisherHelper in project timbuctoo by HuygensING.
the class TripleImporterIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
// FIXME create stub
// Timbuctoo needs at least an Admin VRE.
Vres vres = getVres();
graphWrapper = newGraph().wrap();
TinkerPopOperations tinkerPopOperations = new TinkerPopOperations(graphWrapper);
tinkerPopOperations.saveVre(vres.getVre("Admin"));
timbuctooActions = TimbuctooActionsStubs.withDataStore(tinkerPopOperations);
rdfImportSession = RdfImportSession.cleanImportSession(VRE_NAME, tinkerPopOperations, new EntityFinisherHelper());
instance = new TripleImporter(graphWrapper, VRE_NAME, rdfImportSession);
}
use of nl.knaw.huygens.timbuctoo.core.EntityFinisherHelper in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method finishEntitiesSetsTheAdministrativeProperties.
@Test
public void finishEntitiesSetsTheAdministrativeProperties() {
TinkerPopGraphManager graphManager = newGraph().wrap();
TinkerPopOperations instance = forGraphWrapper(graphManager);
Vre vre = instance.ensureVreExists("vre");
instance.addCollectionToVre(vre, CreateCollection.defaultCollection("vre"));
vre = instance.loadVres().getVre("vre");
Vertex e1 = instance.assertEntity(vre, "http://example.org/entity1");
Vertex e2 = instance.assertEntity(vre, "http://example.org/entity2");
instance.finishEntities(vre, new EntityFinisherHelper());
assertThat(graphManager.getGraph().traversal().V(e1.id()).has("tim_id").has("rev").has("modified").has("created").has("types").hasNext(), is(true));
assertThat(graphManager.getGraph().traversal().V(e2.id()).has("tim_id").has("rev").has("modified").has("created").has("types").hasNext(), is(true));
}
use of nl.knaw.huygens.timbuctoo.core.EntityFinisherHelper in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method finishEntitiesDuplicatesTheVertices.
@Test
public void finishEntitiesDuplicatesTheVertices() {
TinkerPopGraphManager graphManager = newGraph().wrap();
TinkerPopOperations instance = forGraphWrapper(graphManager);
Vre vre = instance.ensureVreExists("vre");
instance.addCollectionToVre(vre, CreateCollection.defaultCollection("vre"));
vre = instance.loadVres().getVre("vre");
Vertex orig = instance.assertEntity(vre, "http://example.org/entity1");
instance.finishEntities(vre, new EntityFinisherHelper());
assertThat(orig.edges(Direction.OUT, VERSION_OF).hasNext(), is(true));
}
use of nl.knaw.huygens.timbuctoo.core.EntityFinisherHelper in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method finishEntitiesCallsTheChangeListener.
@Test
public void finishEntitiesCallsTheChangeListener() {
ChangeListener changeListener = mock(ChangeListener.class);
TinkerPopOperations instance = TinkerPopOperationsStubs.forChangeListenerMock(changeListener);
Vre vre = instance.ensureVreExists("vre");
instance.addCollectionToVre(vre, CreateCollection.defaultCollection("vre"));
vre = instance.loadVres().getVre("vre");
Collection defaultCollection = vre.getCollectionForTypeName(defaultEntityTypeName(vre));
Vertex orig = instance.assertEntity(vre, "http://example.org/entity1");
instance.finishEntities(vre, new EntityFinisherHelper());
Vertex duplicate = orig.vertices(Direction.OUT, VERSION_OF).next();
verify(changeListener).onCreate(eq(defaultCollection), eq(duplicate));
verify(changeListener).onAddToCollection(eq(defaultCollection), eq(Optional.empty()), eq(duplicate));
}
Aggregations