use of nl.knaw.huygens.timbuctoo.rdf.Database in project timbuctoo by HuygensING.
the class CollectionMembershipTripleProcessorTest method processMovesTheEntityToTheKnownCollectionIfItIsAnAssertion.
@Test
public void processMovesTheEntityToTheKnownCollectionIfItIsAnAssertion() {
Database database = mock(Database.class);
Collection collectionFromTriple = mock(Collection.class);
Collection archetypeCollection = mock(Collection.class);
when(collectionFromTriple.getArchetype()).thenReturn(Optional.of(archetypeCollection));
when(database.findOrCreateCollection(anyString(), anyString(), anyString())).thenReturn(collectionFromTriple);
Collection defaultCollection = mock(Collection.class);
when(database.getDefaultCollection("vreName")).thenReturn(defaultCollection);
Entity entity = mock(Entity.class);
when(database.findOrCreateEntity("vreName", SUBJECT_URI)).thenReturn(entity);
CollectionMembershipTripleProcessor instance = new CollectionMembershipTripleProcessor(database, mock(RdfImportSession.class));
instance.process("vreName", SUBJECT_URI, PREDICATE_URI, OBJECT_URI, true);
verify(entity).moveToNewCollection(defaultCollection, collectionFromTriple);
}
use of nl.knaw.huygens.timbuctoo.rdf.Database in project timbuctoo by HuygensING.
the class RelationTripleProcessorTest method setup.
@Before
public void setup() {
final Database database = mock(Database.class);
subjectEntity = mock(Entity.class);
objectEntity = mock(Entity.class);
relation = mock(Relation.class);
relationType = mock(RelationType.class);
given(database.findOrCreateEntity(VRE_NAME, SUBJECT_URI)).willReturn(subjectEntity);
given(database.findOrCreateEntity(VRE_NAME, OBJECT_URI)).willReturn(objectEntity);
given(database.findOrCreateRelationType(PREDICATE_URI, PREDICATE_NAME)).willReturn(relationType);
given(subjectEntity.addRelation(any(), any())).willReturn(relation);
instance = new RelationTripleProcessor(database);
}
Aggregations