use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAssetInformationResponse in project FAAAST-Service by FraunhoferIOSB.
the class GetAssetInformationRequestHandler method process.
@Override
public GetAssetInformationResponse process(GetAssetInformationRequest request) {
GetAssetInformationResponse response = new GetAssetInformationResponse();
try {
AssetAdministrationShell shell = (AssetAdministrationShell) persistence.get(request.getId(), new QueryModifier());
response.setPayload(shell.getAssetInformation());
response.setStatusCode(StatusCode.Success);
publishElementReadEventMessage(AasUtils.toReference(shell), shell);
} catch (Exception ex) {
response.setStatusCode(StatusCode.ServerInternalError);
}
return response;
}
use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAssetInformationResponse in project FAAAST-Service by FraunhoferIOSB.
the class RequestHandlerManagerTest method testGetAssetInformationRequest.
@Test
public void testGetAssetInformationRequest() throws ResourceNotFoundException {
when(persistence.get(environment.getAssetAdministrationShells().get(0).getIdentification(), new QueryModifier())).thenReturn(environment.getAssetAdministrationShells().get(0));
GetAssetInformationRequest request = new GetAssetInformationRequest.Builder().id(environment.getAssetAdministrationShells().get(0).getIdentification()).build();
GetAssetInformationResponse response = manager.execute(request);
GetAssetInformationResponse expected = new GetAssetInformationResponse.Builder().payload(environment.getAssetAdministrationShells().get(0).getAssetInformation()).statusCode(StatusCode.Success).build();
Assert.assertEquals(expected, response);
}
Aggregations