Search in sources :

Example 1 with CSVDeserializer

use of org.eclipse.vorto.mapping.engine.decoder.CSVDeserializer in project vorto by eclipse.

the class DataMapperTest method testStringArrayWithSimpleCondition.

@Test
public void testStringArrayWithSimpleCondition() throws Exception {
    IDataMapper mapper = IDataMapper.newBuilder().withSpecification(new SpecWithConditionFunction()).build();
    IPayloadDeserializer deserializer = new CSVDeserializer();
    InfomodelValue mappedOutput = mapper.mapSource(deserializer.deserialize(",2,3"));
    assertNull(mappedOutput.get("button"));
    mappedOutput = mapper.mapSource(deserializer.deserialize("1,2,3"));
    System.out.println(mappedOutput.get("button").getStatusProperty("sensor_value"));
    assertTrue(mappedOutput.get("button").getStatusProperty("sensor_value").isPresent());
}
Also used : SpecWithConditionFunction(org.eclipse.vorto.service.mapping.spec.SpecWithConditionFunction) CSVDeserializer(org.eclipse.vorto.mapping.engine.decoder.CSVDeserializer) IPayloadDeserializer(org.eclipse.vorto.mapping.engine.decoder.IPayloadDeserializer) IDataMapper(org.eclipse.vorto.mapping.engine.IDataMapper) InfomodelValue(org.eclipse.vorto.model.runtime.InfomodelValue) Test(org.junit.Test)

Aggregations

IDataMapper (org.eclipse.vorto.mapping.engine.IDataMapper)1 CSVDeserializer (org.eclipse.vorto.mapping.engine.decoder.CSVDeserializer)1 IPayloadDeserializer (org.eclipse.vorto.mapping.engine.decoder.IPayloadDeserializer)1 InfomodelValue (org.eclipse.vorto.model.runtime.InfomodelValue)1 SpecWithConditionFunction (org.eclipse.vorto.service.mapping.spec.SpecWithConditionFunction)1 Test (org.junit.Test)1