Search in sources :

Example 1 with CreateCollection

use of nl.knaw.huygens.timbuctoo.core.dto.CreateCollection in project timbuctoo by HuygensING.

the class TinkerPopOperationsTest method addCollectionToVreDoesNotAddTheCollectionWhenTheVreAlreadyHasACollectionWithTheSameName.

@Test
public void addCollectionToVreDoesNotAddTheCollectionWhenTheVreAlreadyHasACollectionWithTheSameName() {
    TinkerPopGraphManager graphManager = newGraph().wrap();
    TinkerPopOperations instance = forGraphWrapper(graphManager);
    Vre vre = instance.ensureVreExists("vre");
    CreateCollection collection = CreateCollection.forEntityTypeName("entityTypeName");
    instance.addCollectionToVre(vre, collection);
    instance.addCollectionToVre(vre, collection);
    assertThat(graphManager.getGraph().traversal().V().hasLabel(Collection.DATABASE_LABEL).has(ENTITY_TYPE_NAME_PROPERTY_NAME, collection.getEntityTypeName(vre)).count().next(), is(1L));
}
Also used : CreateCollection(nl.knaw.huygens.timbuctoo.core.dto.CreateCollection) TinkerPopGraphManager(nl.knaw.huygens.timbuctoo.server.TinkerPopGraphManager) Vre(nl.knaw.huygens.timbuctoo.model.vre.Vre) VreStubs.minimalCorrectVre(nl.knaw.huygens.timbuctoo.model.vre.VreStubs.minimalCorrectVre) Test(org.junit.Test)

Example 2 with CreateCollection

use of nl.knaw.huygens.timbuctoo.core.dto.CreateCollection in project timbuctoo by HuygensING.

the class TinkerPopOperationsTest method addCollectionToVreAddsACollectionToTheVre.

@Test
public void addCollectionToVreAddsACollectionToTheVre() {
    TinkerPopOperations instance = TinkerPopOperationsStubs.newInstance();
    Vre vre = instance.ensureVreExists("vre");
    CreateCollection collection = CreateCollection.forEntityTypeName("entityTypeName");
    instance.addCollectionToVre(vre, collection);
    Vres vres = instance.loadVres();
    Vre vre1 = vres.getVre("vre");
    assertThat(vre1.getCollectionForCollectionName(collection.getCollectionName(vre1)), is(present()));
}
Also used : Vres(nl.knaw.huygens.timbuctoo.model.vre.Vres) CreateCollection(nl.knaw.huygens.timbuctoo.core.dto.CreateCollection) Vre(nl.knaw.huygens.timbuctoo.model.vre.Vre) VreStubs.minimalCorrectVre(nl.knaw.huygens.timbuctoo.model.vre.VreStubs.minimalCorrectVre) Test(org.junit.Test)

Aggregations

CreateCollection (nl.knaw.huygens.timbuctoo.core.dto.CreateCollection)2 Vre (nl.knaw.huygens.timbuctoo.model.vre.Vre)2 VreStubs.minimalCorrectVre (nl.knaw.huygens.timbuctoo.model.vre.VreStubs.minimalCorrectVre)2 Test (org.junit.Test)2 Vres (nl.knaw.huygens.timbuctoo.model.vre.Vres)1 TinkerPopGraphManager (nl.knaw.huygens.timbuctoo.server.TinkerPopGraphManager)1