use of org.molgenis.data.elasticsearch.generator.model.Mapping in project molgenis by molgenis.
the class MappingContentBuilderTest method testCreateMapping.
@Test(dataProvider = "createMappingProvider")
public void testCreateMapping(MappingType mappingType, String expectedJson) throws IOException {
Mapping mapping = createMapping(FieldMapping.builder().setName("field").setType(mappingType).build());
XContentBuilder xContentBuilder = mappingContentBuilder.createMapping(mapping);
assertEquals(xContentBuilder.string(), expectedJson);
}
use of org.molgenis.data.elasticsearch.generator.model.Mapping in project molgenis by molgenis.
the class MappingGeneratorTest method testCreateMappingProviderNested.
@Test(dataProvider = "createMappingProviderNested")
public void testCreateMappingProviderNested(AttributeType attributeType) {
String refAttrIdentifier = "refAttr";
EntityType refEntityType = createEntityType(refAttrIdentifier, AttributeType.LONG);
String attrIdentifier = "attr";
EntityType entityType = createEntityType(attrIdentifier, attributeType, refEntityType);
Mapping mapping = mappingGenerator.createMapping(entityType);
FieldMapping fieldMapping = FieldMapping.builder().setName(attrIdentifier).setType(MappingType.NESTED).setNestedFieldMappings(singletonList(FieldMapping.builder().setName(refAttrIdentifier).setType(MappingType.LONG).build())).build();
Mapping expectedMapping = createMapping(fieldMapping);
assertEquals(mapping, expectedMapping);
}
use of org.molgenis.data.elasticsearch.generator.model.Mapping in project molgenis by molgenis.
the class MappingGeneratorTest method testCreateMappingProviderDepth.
@Test(dataProvider = "createMappingProviderDepth")
public void testCreateMappingProviderDepth(EntityType entityType, FieldMapping fieldMapping) {
Mapping mapping = mappingGenerator.createMapping(entityType);
Mapping expectedMapping = createMapping(fieldMapping);
assertEquals(mapping, expectedMapping);
}
use of org.molgenis.data.elasticsearch.generator.model.Mapping in project molgenis by molgenis.
the class MappingContentBuilderTest method testCreateMappingNested.
@Test
public void testCreateMappingNested() throws IOException {
FieldMapping nestedFieldMapping = FieldMapping.builder().setName("nestedField").setType(MappingType.BOOLEAN).build();
Mapping mapping = createMapping(FieldMapping.builder().setName("field").setType(MappingType.NESTED).setNestedFieldMappings(singletonList(nestedFieldMapping)).build());
XContentBuilder xContentBuilder = mappingContentBuilder.createMapping(mapping);
assertEquals(xContentBuilder.string(), JSON_NESTED);
}
use of org.molgenis.data.elasticsearch.generator.model.Mapping in project molgenis by molgenis.
the class MappingGeneratorTest method testCreateMapping.
@Test(dataProvider = "createMappingProvider")
public void testCreateMapping(AttributeType attributeType, MappingType mappingType) {
String attrIdentifier = "attr";
EntityType entityType = createEntityType(attrIdentifier, attributeType);
Mapping mapping = mappingGenerator.createMapping(entityType);
FieldMapping fieldMapping = FieldMapping.builder().setName(attrIdentifier).setType(mappingType).build();
Mapping expectedMapping = createMapping(fieldMapping);
assertEquals(mapping, expectedMapping);
}
Aggregations