use of org.eclipse.vorto.model.runtime.FunctionblockValue in project vorto by eclipse.
the class JsonMappingLoadTest method builtInConverterAndJs1.
// / With Converter
// // Test Case 3: Built-in Converter Function + 1 Javascript Function
@Test
@JUnitPerfTest(threads = THREAD_AMOUNT_1, durationMs = TEST_DURATION_1, rampUpPeriodMs = RAMP_PERIOD, warmUpMs = WARMUP_DURATION_1, maxExecutionsPerSecond = EXECUTIONS_PER_SECOND_1)
public void builtInConverterAndJs1() throws Exception {
int r = new Random().nextInt(2 + 1);
InfomodelValue mappedOutput = testCaseThreeMapper.mapSource(gson.fromJson(testCaseThreeJsonInput[r], Object.class));
FunctionblockValue buttonFunctionblockData = mappedOutput.get("button");
assertEquals(true, (Boolean) buttonFunctionblockData.getStatusProperty("digital_input_state").get().getValue());
assertEquals(testCaseThreeOutput[r], buttonFunctionblockData.getStatusProperty("digital_input_count").get().getValue());
FunctionblockValue voltageFunctionblockData = mappedOutput.get("voltage");
assertNull(voltageFunctionblockData);
}
use of org.eclipse.vorto.model.runtime.FunctionblockValue in project vorto by eclipse.
the class JsonMappingLoadTest method builtInConverterAndJs3.
@Test
@JUnitPerfTest(threads = THREAD_AMOUNT_3, durationMs = TEST_DURATION_3, rampUpPeriodMs = RAMP_PERIOD, warmUpMs = WARMUP_DURATION_3, maxExecutionsPerSecond = EXECUTIONS_PER_SECOND_3)
public void builtInConverterAndJs3() throws Exception {
int r = new Random().nextInt(2 + 1);
InfomodelValue mappedOutput = testCaseThreeMapper.mapSource(gson.fromJson(testCaseThreeJsonInput[r], Object.class));
FunctionblockValue buttonFunctionblockData = mappedOutput.get("button");
assertEquals(true, (Boolean) buttonFunctionblockData.getStatusProperty("digital_input_state").get().getValue());
assertEquals(testCaseThreeOutput[r], buttonFunctionblockData.getStatusProperty("digital_input_count").get().getValue());
FunctionblockValue voltageFunctionblockData = mappedOutput.get("voltage");
assertNull(voltageFunctionblockData);
}
use of org.eclipse.vorto.model.runtime.FunctionblockValue in project vorto by eclipse.
the class State method addReported.
public void addReported(InfomodelValue value) {
value.getProperties().keySet().stream().forEach(key -> {
FunctionblockValue fbValue = value.get(key);
reported.put(key, fbValue.serialize());
});
}
use of org.eclipse.vorto.model.runtime.FunctionblockValue in project vorto by eclipse.
the class BinaryMappingLoadTest method tripleNestedConverter1.
// // Test Case 3: Triple Nested Converter Functions (Built-in + Built-in + Javascript)
@Test
@JUnitPerfTest(threads = THREAD_AMOUNT_1, durationMs = TEST_DURATION_1, rampUpPeriodMs = RAMP_PERIOD, warmUpMs = WARMUP_DURATION_1, maxExecutionsPerSecond = EXECUTIONS_PER_SECOND_1)
public void tripleNestedConverter1() throws Exception {
InfomodelValue mappedDittoOutput = testCaseThreeMapper.mapSource(gson.fromJson(testCaseThreeJson, Object.class));
FunctionblockValue button = mappedDittoOutput.get("button");
assertEquals(2, button.getStatusProperty("sensor_value").get().getValue());
}
use of org.eclipse.vorto.model.runtime.FunctionblockValue in project vorto by eclipse.
the class BinaryMappingLoadTest method tripleNestedConverter2.
@Test
@JUnitPerfTest(threads = THREAD_AMOUNT_2, durationMs = TEST_DURATION_2, rampUpPeriodMs = RAMP_PERIOD, warmUpMs = WARMUP_DURATION_2, maxExecutionsPerSecond = EXECUTIONS_PER_SECOND_2)
public void tripleNestedConverter2() throws Exception {
InfomodelValue mappedDittoOutput = testCaseThreeMapper.mapSource(gson.fromJson(testCaseThreeJson, Object.class));
FunctionblockValue button = mappedDittoOutput.get("button");
assertEquals(2, button.getStatusProperty("sensor_value").get().getValue());
}
Aggregations