use of org.eclipse.vorto.model.runtime.EntityPropertyValue in project vorto by eclipse.
the class DataMapperTest method testMappingWithEntityUnmapped.
@Test
public void testMappingWithEntityUnmapped() throws Exception {
IDataMapper mapper = IDataMapper.newBuilder().withSpecification(new SpecWithTwoFunctionblocksWithNestedEntity()).build();
final String sampleDeviceData = "{\"temperature\" : 20.3 }";
IPayloadDeserializer deserializer = new JSONDeserializer();
InfomodelValue mappedOutput = mapper.mapSource(deserializer.deserialize(sampleDeviceData));
EntityPropertyValue temperatureValue = (EntityPropertyValue) mappedOutput.get("outdoorTemperature").getStatusProperty("value").get();
assertEquals(20.3, temperatureValue.getValue().getPropertyValue("value").get().getValue());
assertNull(mappedOutput.get("humidity"));
}
use of org.eclipse.vorto.model.runtime.EntityPropertyValue in project vorto by eclipse.
the class DataMapperTest method testMappingWithEntity.
@Test
public void testMappingWithEntity() throws Exception {
IDataMapper mapper = IDataMapper.newBuilder().withSpecification(new SpecWithNestedEntity()).build();
final String sampleDeviceData = "{\"temperature\" : 20.3 }";
IPayloadDeserializer deserializer = new JSONDeserializer();
InfomodelValue mappedOutput = mapper.mapSource(deserializer.deserialize(sampleDeviceData));
EntityPropertyValue temperatureValue = (EntityPropertyValue) mappedOutput.get("outdoorTemperature").getStatusProperty("value").get();
assertEquals(20.3, temperatureValue.getValue().getPropertyValue("value").get().getValue());
}
use of org.eclipse.vorto.model.runtime.EntityPropertyValue in project vorto by eclipse.
the class JsonMappingLoadTest method withoutConverter1.
// // Test Case 1: No converter functions
@Test
@JUnitPerfTest(threads = THREAD_AMOUNT_1, durationMs = TEST_DURATION_1, rampUpPeriodMs = RAMP_PERIOD, warmUpMs = WARMUP_DURATION_1, maxExecutionsPerSecond = EXECUTIONS_PER_SECOND_1)
public void withoutConverter1() throws Exception {
int r = new Random().nextInt(2 + 1);
InfomodelValue mappedOutput = testCaseOneMapper.mapSource(deserializer.deserialize(testCaseOneJsonInput[r]));
EntityPropertyValue temperatureValue = (EntityPropertyValue) mappedOutput.get("outdoorTemperature").getStatusProperty("value").get();
assertEquals(testCaseOneOutput[r], temperatureValue.getValue().getPropertyValue("value").get().getValue());
}
Aggregations