use of eu.esdihumboldt.hale.io.appschema.writer.internal.AssignHandler in project hale by halestudio.
the class AppSchemaMappingTest method testEncodeIfEmptyTrue.
@Test
public void testEncodeIfEmptyTrue() {
final String XLINK_HREF_CONSTANT = "#lcu.123";
final String OCQL_LITERAL = "'" + XLINK_HREF_CONSTANT + "'";
DefaultCell assign = new DefaultCell();
assign.setTransformationIdentifier(AssignFunction.ID);
ListMultimap<String, ParameterValue> parameters = ArrayListMultimap.create();
parameters.put(AssignFunction.PARAMETER_VALUE, new ParameterValue(XLINK_HREF_CONSTANT));
assign.setTransformationParameters(parameters);
assign.setTarget(getNestedUnitHrefTargetProperty());
AssignHandler assignHandler = new AssignHandler();
AttributeMappingType attrMapping = assignHandler.handlePropertyTransformation(getDefaultTypeCell(datasetType, landCoverDatasetType), assign, new AppSchemaMappingContext(mappingWrapper));
assertNull(attrMapping.getSourceExpression());
assertEquals("lcv:member", attrMapping.getTargetAttribute());
assertNotNull(attrMapping.getClientProperty());
assertEquals(1, attrMapping.getClientProperty().size());
assertEquals("xlink:href", attrMapping.getClientProperty().get(0).getName());
assertEquals(OCQL_LITERAL, attrMapping.getClientProperty().get(0).getValue());
// expression is constant, so encodeIfEmpty=true
assertNotNull(attrMapping.isEncodeIfEmpty());
assertTrue(attrMapping.isEncodeIfEmpty());
}
Aggregations