use of de.fraunhofer.iosb.ilt.faaast.service.model.value.primitive.StringValue in project FAAAST-Service by FraunhoferIOSB.
the class RequestHandlerManagerTest method testWriteValueToAssetConnection.
@Test
public void testWriteValueToAssetConnection() throws AssetConnectionException {
RequestHandler requestHandler = new DeleteSubmodelByIdRequestHandler(persistence, messageBus, assetConnectionManager);
PropertyValue expected = new PropertyValue.Builder().value(new StringValue("test")).build();
when(assetConnectionManager.hasValueProvider(any())).thenReturn(true);
requestHandler.writeValueToAssetConnection(new DefaultReference(), expected);
verify(assetValueProvider).setValue(expected);
}
use of de.fraunhofer.iosb.ilt.faaast.service.model.value.primitive.StringValue in project FAAAST-Service by FraunhoferIOSB.
the class RequestHandlerManagerTest method testGetSubmodelElementByPathRequest.
@Test
public void testGetSubmodelElementByPathRequest() throws ResourceNotFoundException, AssetConnectionException {
Submodel submodel = environment.getSubmodels().get(0);
SubmodelElement cur_submodelElement = new DefaultProperty.Builder().idShort("testIdShort").value("testValue").build();
PropertyValue propertyValue = new PropertyValue.Builder().value(new StringValue("test")).build();
when(persistence.get(argThat((Reference t) -> true), eq(new OutputModifier()))).thenReturn(cur_submodelElement);
when(assetConnectionManager.hasValueProvider(any())).thenReturn(true);
when(assetValueProvider.getValue()).thenReturn(propertyValue);
GetSubmodelElementByPathRequest request = new GetSubmodelElementByPathRequest.Builder().id(submodel.getIdentification()).outputModifier(new OutputModifier()).path(ReferenceHelper.toKeys(SUBMODEL_ELEMENT_REF)).build();
GetSubmodelElementByPathResponse response = manager.execute(request);
SubmodelElement expected_submodelElement = new DefaultProperty.Builder().idShort("testIdShort").value("test").valueType("string").build();
GetSubmodelElementByPathResponse expected = new GetSubmodelElementByPathResponse.Builder().payload(expected_submodelElement).statusCode(StatusCode.Success).build();
Assert.assertEquals(expected, response);
}
Aggregations