use of nl.knaw.huygens.timbuctoo.core.RdfImportSession in project timbuctoo by HuygensING.
the class PropertyTripleProcessorTest method processAddsThePropertyToTheEntity.
@Test
public void processAddsThePropertyToTheEntity() {
RdfImportSession rdfImportSession = mock(RdfImportSession.class);
PropertyTripleProcessor instance = new PropertyTripleProcessor(rdfImportSession);
instance.process("vreName", SUBJECT_URI, PREDICATE_URI, OBJECT_VALUE, OBJECT_TYPE, true);
verify(rdfImportSession).assertProperty(eq(SUBJECT_URI), argThat(allOf(hasProperty("predicateUri", equalTo(PREDICATE_URI)), hasProperty("value", equalTo(OBJECT_VALUE)), hasProperty("typeUri", equalTo(OBJECT_TYPE)))));
}
use of nl.knaw.huygens.timbuctoo.core.RdfImportSession in project timbuctoo by HuygensING.
the class CollectionMembershipTripleProcessorTest method processLogsAnExceptionWhenTheEntityAlreadyIsPartOfACollectionWhenAsserted.
@Test
public void processLogsAnExceptionWhenTheEntityAlreadyIsPartOfACollectionWhenAsserted() {
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(entity.isInKnownCollection()).thenReturn(true);
when(database.findOrCreateEntity("vreName", SUBJECT_URI)).thenReturn(entity);
RdfImportSession rdfImportSession = mock(RdfImportSession.class);
RdfImportErrorReporter errorReporter = mock(RdfImportErrorReporter.class);
when(rdfImportSession.getErrorReporter()).thenReturn(errorReporter);
CollectionMembershipTripleProcessor instance = new CollectionMembershipTripleProcessor(database, rdfImportSession);
instance.process("vreName", SUBJECT_URI, PREDICATE_URI, OBJECT_URI, true);
verify(errorReporter).multipleRdfTypes(SUBJECT_URI, OBJECT_URI);
}
use of nl.knaw.huygens.timbuctoo.core.RdfImportSession in project timbuctoo by HuygensING.
the class PersonNamesTripleProcessorTest method setUp.
@Before
public void setUp() throws Exception {
RdfImportSession rdfImportSession = mock(RdfImportSession.class);
database = mock(Database.class);
instance = new PersonNamesTripleProcessor(rdfImportSession, database);
entity = mock(Entity.class);
given(entity.getPropertyValue(PROPERTY_NAME)).willReturn(Optional.empty());
given(database.findOrCreateEntity(VRE_NAME, SUBJECT_URI)).willReturn(entity);
}
use of nl.knaw.huygens.timbuctoo.core.RdfImportSession in project timbuctoo by HuygensING.
the class PropertyTripleProcessorTest method processRemovesThePropertyFromTheEntityIfTheCallIsARetraction.
@Test
public void processRemovesThePropertyFromTheEntityIfTheCallIsARetraction() {
RdfImportSession rdfImportSession = mock(RdfImportSession.class);
PropertyTripleProcessor instance = new PropertyTripleProcessor(rdfImportSession);
instance.process("vreName", SUBJECT_URI, PREDICATE_URI, OBJECT_VALUE, OBJECT_TYPE, false);
verify(rdfImportSession).retractProperty(eq(SUBJECT_URI), argThat(allOf(hasProperty("predicateUri", equalTo(PREDICATE_URI)), hasProperty("typeUri", equalTo(OBJECT_TYPE)))));
}
Aggregations