use of nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty in project timbuctoo by HuygensING.
the class TinkerPopPropertyConverterTest method fromThrowsAnIoExceptionIfThePropertyCannotBeConverted.
@Test(expected = IOException.class)
public void fromThrowsAnIoExceptionIfThePropertyCannotBeConverted() throws UnknownPropertyException, IOException {
Collection collection = mock(Collection.class);
ReadableProperty readableProperty = mock(ReadableProperty.class);
when(readableProperty.getUniqueTypeId()).thenReturn("string");
when(collection.getProperty(PROPERTY_NAME)).thenReturn(Optional.of(readableProperty));
TinkerPopPropertyConverter instance = new TinkerPopPropertyConverter(collection);
instance.from(PROPERTY_NAME, new Object());
}
use of nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty in project timbuctoo by HuygensING.
the class TinkerPopPropertyConverterTest method fromCreatesAStringPropertyWhenUsesTheUniqueTypeIdOfThePropertyToDetermineTheTimPropertyType.
@Test
public void fromCreatesAStringPropertyWhenUsesTheUniqueTypeIdOfThePropertyToDetermineTheTimPropertyType() throws UnknownPropertyException, IOException {
Collection collection = mock(Collection.class);
ReadableProperty readableProperty = mock(ReadableProperty.class);
when(readableProperty.getUniqueTypeId()).thenReturn("string");
when(collection.getProperty(PROPERTY_NAME)).thenReturn(Optional.of(readableProperty));
TinkerPopPropertyConverter instance = new TinkerPopPropertyConverter(collection);
TimProperty property = instance.from(PROPERTY_NAME, STRING_VALUE);
assertThat(property, is(instanceOf(StringProperty.class)));
}
use of nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty in project timbuctoo by HuygensING.
the class PrepareForBiaImportMigration method addConceptsCollectionToAdminVre.
private void addConceptsCollectionToAdminVre(Graph graph) {
final Vre adminVre = mappings.getVre("Admin");
final LinkedHashMap<String, ReadableProperty> conceptProperties = Maps.newLinkedHashMap();
conceptProperties.put("label", localProperty("label"));
final Collection conceptsCollection = new Collection("concept", "concept", localProperty("label"), conceptProperties, "concepts", mappings.getVre("Admin"), "concepts", false, false, null);
adminVre.addCollection(conceptsCollection);
adminVre.save(graph);
}
Aggregations