use of org.eclipse.vorto.model.runtime.InfomodelValue in project vorto by eclipse.
the class TwinPayloadFactoryTest method testCreateRequestSingleFbProperty.
@Test
public void testCreateRequestSingleFbProperty() {
FunctionblockModel fbm = FunctionblockModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:Temperature:1.0.0")).statusProperty(ModelProperty.createPrimitiveProperty("value", true, PrimitiveType.FLOAT)).build();
Infomodel infomodel = Infomodel.Builder(ModelId.fromPrettyFormat("com.acme:TemperatureSensor:1.0.0")).withProperty(ModelProperty.Builder("temperature", fbm).build()).build();
FunctionblockValue fbValue = new FunctionblockValue(fbm);
fbValue.withStatusProperty("value", 20.2);
InfomodelValue infomodelValue = new InfomodelValue(infomodel);
infomodelValue.withFunctionblock("temperature", fbValue);
System.out.println(gson.toJson(TwinPayloadFactory.toShadowUpdateRequest(infomodelValue)));
}
use of org.eclipse.vorto.model.runtime.InfomodelValue in project vorto by eclipse.
the class JsonMappingLoadTest method withoutConverter3.
@Test
@JUnitPerfTest(threads = THREAD_AMOUNT_3, durationMs = TEST_DURATION_3, rampUpPeriodMs = RAMP_PERIOD, warmUpMs = WARMUP_DURATION_3, maxExecutionsPerSecond = EXECUTIONS_PER_SECOND_3)
public void withoutConverter3() 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());
}
use of org.eclipse.vorto.model.runtime.InfomodelValue in project vorto by eclipse.
the class JsonMappingLoadTest method builtInConverter3.
@Test
@JUnitPerfTest(threads = THREAD_AMOUNT_3, durationMs = TEST_DURATION_3, rampUpPeriodMs = RAMP_PERIOD, warmUpMs = WARMUP_DURATION_3, maxExecutionsPerSecond = EXECUTIONS_PER_SECOND_3)
public void builtInConverter3() throws Exception {
InfomodelValue mappedOutput = testCaseTwoMapper.mapSource(gson.fromJson(testCaseTwoJson, Object.class));
FunctionblockValue buttonFunctionblockData = mappedOutput.get("button");
assertEquals(JSON_DATE_FORMAT.format(timestamp), buttonFunctionblockData.getStatusProperty("sensor_value").get().getValue());
}
use of org.eclipse.vorto.model.runtime.InfomodelValue in project vorto by eclipse.
the class JsonMappingLoadTest method builtInConverter2.
@Test
@JUnitPerfTest(threads = THREAD_AMOUNT_2, durationMs = TEST_DURATION_2, rampUpPeriodMs = RAMP_PERIOD, warmUpMs = WARMUP_DURATION_2, maxExecutionsPerSecond = EXECUTIONS_PER_SECOND_2)
public void builtInConverter2() throws Exception {
InfomodelValue mappedOutput = testCaseTwoMapper.mapSource(gson.fromJson(testCaseTwoJson, Object.class));
FunctionblockValue buttonFunctionblockData = mappedOutput.get("button");
assertEquals(JSON_DATE_FORMAT.format(timestamp), buttonFunctionblockData.getStatusProperty("sensor_value").get().getValue());
}
use of org.eclipse.vorto.model.runtime.InfomodelValue in project vorto by eclipse.
the class JsonMappingLoadTest method withoutConverter4.
@Test
@JUnitPerfTest(threads = THREAD_AMOUNT_4, durationMs = TEST_DURATION_4, rampUpPeriodMs = RAMP_PERIOD, warmUpMs = WARMUP_DURATION_4, maxExecutionsPerSecond = EXECUTIONS_PER_SECOND_4)
public void withoutConverter4() 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