use of eu.esdihumboldt.hale.io.appschema.writer.internal.MathematicalExpressionHandler in project hale by halestudio.
the class AppSchemaMappingTest method testMathematicalExpressionHandler.
@Test
public void testMathematicalExpressionHandler() {
final String EXPRESSION = "100 * unit_id / 2";
final String OCQL = EXPRESSION;
DefaultCell cell = new DefaultCell();
cell.setTransformationIdentifier(MathematicalExpressionFunction.ID);
ListMultimap<String, ParameterValue> parameters = ArrayListMultimap.create();
parameters.put(MathematicalExpressionFunction.PARAMETER_EXPRESSION, new ParameterValue(EXPRESSION));
ListMultimap<String, Property> source = ArrayListMultimap.create();
source.putAll(MathematicalExpressionFunction.ENTITY_VARIABLE, getUnitIdSourceProperty(unitDenormType).values());
cell.setSource(source);
cell.setTarget(getLocalIdTargetProperty());
cell.setTransformationParameters(parameters);
MathematicalExpressionHandler handler = new MathematicalExpressionHandler();
AttributeMappingType attrMapping = handler.handlePropertyTransformation(getDefaultTypeCell(unitDenormType, landCoverUnitType), cell, new AppSchemaMappingContext(mappingWrapper));
assertEquals(OCQL, attrMapping.getSourceExpression().getOCQL());
assertEquals(TARGET_LOCAL_ID, attrMapping.getTargetAttribute());
}
Aggregations