use of nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerpopSaver in project timbuctoo by HuygensING.
the class TinkerpopSaverTest method addPropertyDescriptionsAddsThePropertyDescriptionsToTheCollection.
@Test
public void addPropertyDescriptionsAddsThePropertyDescriptionsToTheCollection() {
final TinkerpopSaver instance = new TinkerpopSaver(vres, graphWrapper, VRE_NAME, VRE_NAME, MAX_VERTICES_PER_TRANSACTION, VRE_NAME);
ImportPropertyDescriptions importPropertyDescriptions = new ImportPropertyDescriptions();
importPropertyDescriptions.getOrCreate(6).setPropertyName("first");
importPropertyDescriptions.getOrCreate(5).setPropertyName("second");
importPropertyDescriptions.getOrCreate(7).setPropertyName("third");
instance.addPropertyDescriptions(rawCollection, importPropertyDescriptions);
List<Vertex> properties = graphWrapper.getGraph().traversal().V(rawCollection.id()).out("hasProperty").toList();
assertThat(properties, hasSize(3));
assertThat(properties, containsInAnyOrder(likeVertex().withProperty("order", 0).withProperty("id", 6).withProperty("name", "first"), likeVertex().withProperty("order", 1).withProperty("id", 5).withProperty("name", "second"), likeVertex().withProperty("order", 2).withProperty("id", 7).withProperty("name", "third")));
}
use of nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerpopSaver in project timbuctoo by HuygensING.
the class TinkerpopSaverTest method addEntityAppendsTheNewVertexToThePrevious.
@Test
public void addEntityAppendsTheNewVertexToThePrevious() {
final TinkerpopSaver instance = new TinkerpopSaver(vres, graphWrapper, VRE_NAME, VRE_NAME, MAX_VERTICES_PER_TRANSACTION, VRE_NAME);
final Vertex first = instance.addEntity(rawCollection, Maps.newHashMap());
final Vertex second = instance.addEntity(rawCollection, Maps.newHashMap());
final Vertex third = instance.addEntity(rawCollection, Maps.newHashMap());
assertThat(first.vertices(Direction.OUT, NEXT_RAW_ITEM_EDGE_NAME).hasNext(), is(true));
assertThat(first.vertices(Direction.OUT, NEXT_RAW_ITEM_EDGE_NAME).next(), is(second));
assertThat(second.vertices(Direction.OUT, NEXT_RAW_ITEM_EDGE_NAME).hasNext(), is(true));
assertThat(second.vertices(Direction.OUT, NEXT_RAW_ITEM_EDGE_NAME).next(), is(third));
}
Aggregations