use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentReferenceAttribute.
@Test(dataProvider = "createDocumentReference")
public void createDocumentReferenceAttribute(AttributeType attributeType, Entity value, String expectedContent) {
String attrIdentifier = "attr";
Entity entity = createEntity(attrIdentifier, attributeType);
when(entity.getEntity(attrIdentifier)).thenReturn(value);
Document document = documentContentBuilder.createDocument(entity);
assertDocumentEquals(document, expectedContent);
}
use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentObject.
@Test
public void createDocumentObject() {
String entityId = "id";
Document document = documentContentBuilder.createDocument(entityId);
Document expectedDocument = Document.builder().setId(entityId).build();
assertEquals(document, expectedDocument);
}
use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentLong.
@Test(dataProvider = "createDocumentLong")
public void createDocumentLong(Long value, String expectedContent) {
String attrIdentifier = "attr";
Entity entity = createEntity(attrIdentifier, AttributeType.LONG);
when(entity.getLong(attrIdentifier)).thenReturn(value);
Document document = documentContentBuilder.createDocument(entity);
assertDocumentEquals(document, expectedContent);
}
use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentDepth.
@Test(dataProvider = "createDocumentDepth")
public void createDocumentDepth(int indexingDepth, String expectedContent) {
String refRefAttrIdentifier = "refRefAttr";
Entity refRefEntity = createEntity(refRefAttrIdentifier, AttributeType.DECIMAL);
when(refRefEntity.getDouble(refRefAttrIdentifier)).thenReturn(null);
String refAttrIdentifier = "refAttr";
Entity refEntity = createEntity(refAttrIdentifier, AttributeType.XREF);
when(refEntity.getEntity(refAttrIdentifier)).thenReturn(refRefEntity);
String attrIdentifier = "attr";
Entity entity = createEntity(attrIdentifier, AttributeType.XREF, indexingDepth);
when(entity.getEntity(attrIdentifier)).thenReturn(refEntity);
Document document = documentContentBuilder.createDocument(entity);
assertDocumentEquals(document, expectedContent);
}
use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentInt.
@Test(dataProvider = "createDocumentInt")
public void createDocumentInt(Integer value, String expectedContent) {
String attrIdentifier = "attr";
Entity entity = createEntity(attrIdentifier, AttributeType.INT);
when(entity.getInt(attrIdentifier)).thenReturn(value);
Document document = documentContentBuilder.createDocument(entity);
assertDocumentEquals(document, expectedContent);
}
Aggregations