use of eu.esdihumboldt.hale.io.appschema.writer.internal.DateExtractionHandler in project hale by halestudio.
the class AppSchemaMappingTest method testDateExtractionHandler.
@Test
public void testDateExtractionHandler() {
final String DATE_FORMAT = "yyyy-MM-dd hh:mm:ss";
final String OCQL = "dateParse(" + SOURCE_UUID_V1 + ", '" + DATE_FORMAT + "')";
DefaultCell cell = new DefaultCell();
cell.setTransformationIdentifier(DateExtractionFunction.ID);
ListMultimap<String, ParameterValue> parameters = ArrayListMultimap.create();
parameters.put(DateExtractionFunction.PARAMETER_DATE_FORMAT, new ParameterValue(DATE_FORMAT));
cell.setSource(getUuidSourceProperty(unitDenormType));
cell.setTarget(getFirstObservationDateTargetProperty());
cell.setTransformationParameters(parameters);
DateExtractionHandler handler = new DateExtractionHandler();
AttributeMappingType attrMapping = handler.handlePropertyTransformation(getDefaultTypeCell(unitDenormType, landCoverUnitType), cell, new AppSchemaMappingContext(mappingWrapper));
assertEquals(OCQL, attrMapping.getSourceExpression().getOCQL());
assertEquals(TARGET_FIRST_OBSERVATION_DATE, attrMapping.getTargetAttribute());
}
Aggregations