use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitField in project timbuctoo by HuygensING.
the class MergeExplicitSchemasTest method mergeExplicitSchemaMergesFieldsForSameCollection.
@Test
public void mergeExplicitSchemaMergesFieldsForSameCollection() throws Exception {
Map<String, List<ExplicitField>> explicitSchema1 = new HashMap<>();
ExplicitField explicitField1 = new ExplicitField("test:test1", false, Sets.newHashSet("String"), null);
explicitSchema1.put("http://timbuctoo.huygens.knaw.nl/datasets/clusius/Places", Lists.newArrayList(explicitField1));
Map<String, List<ExplicitField>> explicitSchema2 = new HashMap<>();
ExplicitField explicitField2 = new ExplicitField("test:test2", false, null, Sets.newHashSet("String"));
explicitSchema2.put("http://timbuctoo.huygens.knaw.nl/datasets/clusius/Places", Lists.newArrayList(explicitField2));
MergeExplicitSchemas mergeExplicitSchemas = new MergeExplicitSchemas();
Map<String, List<ExplicitField>> mergedExplicitSchema = mergeExplicitSchemas.mergeExplicitSchemas(explicitSchema1, explicitSchema2);
assertThat(mergedExplicitSchema, hasKey("http://timbuctoo.huygens.knaw.nl/datasets/clusius/Places"));
assertThat(mergedExplicitSchema.get("http://timbuctoo.huygens.knaw.nl/datasets/clusius/Places"), containsInAnyOrder(explicitField1, explicitField2));
}
use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitField in project timbuctoo by HuygensING.
the class MergeExplicitSchemasTest method mergeExplicitSchemaMergesFieldWithSameUriForSameCollection.
@Test
public void mergeExplicitSchemaMergesFieldWithSameUriForSameCollection() throws Exception {
Map<String, List<ExplicitField>> explicitSchema1 = new HashMap<>();
ExplicitField explicitField1 = new ExplicitField("test:test1", false, Sets.newHashSet("String"), null);
explicitSchema1.put("http://timbuctoo.huygens.knaw.nl/datasets/clusius/Places", Lists.newArrayList(explicitField1));
Map<String, List<ExplicitField>> explicitSchema2 = new HashMap<>();
ExplicitField explicitField2 = new ExplicitField("test:test1", false, Sets.newHashSet("Integer"), null);
explicitSchema2.put("http://timbuctoo.huygens.knaw.nl/datasets/clusius/Places", Lists.newArrayList(explicitField2));
MergeExplicitSchemas mergeExplicitSchemas = new MergeExplicitSchemas();
Map<String, List<ExplicitField>> mergedExplicitSchema = mergeExplicitSchemas.mergeExplicitSchemas(explicitSchema1, explicitSchema2);
assertThat(mergedExplicitSchema, hasKey("http://timbuctoo.huygens.knaw.nl/datasets/clusius/Places"));
MatcherAssert.assertThat(mergedExplicitSchema.get("http://timbuctoo.huygens.knaw.nl/datasets/clusius/Places"), Matchers.contains(ExplicitFieldMatcher.explicitField().withValues(Sets.newHashSet("Integer", "String"))));
}
Aggregations