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