use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByIdShortResponse in project FAAAST-Service by FraunhoferIOSB.
the class GetAllAssetAdministrationShellsByIdShortRequestHandler method process.
@Override
public GetAllAssetAdministrationShellsByIdShortResponse process(GetAllAssetAdministrationShellsByIdShortRequest request) {
GetAllAssetAdministrationShellsByIdShortResponse response = new GetAllAssetAdministrationShellsByIdShortResponse();
try {
List<AssetAdministrationShell> shells = persistence.get(request.getIdShort(), (List<AssetIdentification>) null, request.getOutputModifier());
response.setPayload(shells);
response.setStatusCode(StatusCode.Success);
if (shells != null) {
shells.forEach(x -> publishElementReadEventMessage(AasUtils.toReference(x), x));
}
} catch (Exception ex) {
response.setStatusCode(StatusCode.ServerInternalError);
}
return response;
}
use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByIdShortResponse in project FAAAST-Service by FraunhoferIOSB.
the class RequestHandlerManagerTest method testGetAllAssetAdministrationShellsByIdShortRequest.
@Test
public void testGetAllAssetAdministrationShellsByIdShortRequest() {
when(persistence.get(eq("Test"), argThat((List<AssetIdentification> t) -> true), any())).thenReturn(environment.getAssetAdministrationShells());
GetAllAssetAdministrationShellsByIdShortRequest request = new GetAllAssetAdministrationShellsByIdShortRequest.Builder().idShort("Test").build();
GetAllAssetAdministrationShellsByIdShortResponse response = manager.execute(request);
GetAllAssetAdministrationShellsByIdShortResponse expected = new GetAllAssetAdministrationShellsByIdShortResponse.Builder().payload(environment.getAssetAdministrationShells()).statusCode(StatusCode.Success).build();
Assert.assertEquals(expected, response);
}
Aggregations