use of org.eclipse.vorto.service.mapping.spec.SpecWithPropertyConditionXpath in project vorto by eclipse.
the class DataMapperTest method testMapWithJxpathCondition.
@Test
public void testMapWithJxpathCondition() throws Exception {
IDataMapper mapper = IDataMapper.newBuilder().withSpecification(new SpecWithPropertyConditionXpath()).build();
String json = "{\"data\" : [{\"id\": 100,\"value\": \"x\"},{\"id\": 200,\"value\": \"y\"}]}";
IPayloadDeserializer deserializer = new JSONDeserializer();
InfomodelValue mappedOutput = mapper.mapSource(deserializer.deserialize(json));
assertEquals(100.0, mappedOutput.get("button").getStatusProperty("sensor_value").get().getValue());
}
Aggregations