use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostAssetAdministrationShellResponse in project FAAAST-Service by FraunhoferIOSB.
the class RequestHandlerManagerTest method testPostAssetAdministrationShellRequest.
@Test
public void testPostAssetAdministrationShellRequest() {
when(persistence.put(environment.getAssetAdministrationShells().get(0))).thenReturn(environment.getAssetAdministrationShells().get(0));
PostAssetAdministrationShellRequest request = new PostAssetAdministrationShellRequest.Builder().aas(environment.getAssetAdministrationShells().get(0)).build();
PostAssetAdministrationShellResponse response = manager.execute(request);
PostAssetAdministrationShellResponse expected = new PostAssetAdministrationShellResponse.Builder().payload(environment.getAssetAdministrationShells().get(0)).statusCode(StatusCode.SuccessCreated).build();
Assert.assertEquals(expected, response);
}
use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostAssetAdministrationShellResponse in project FAAAST-Service by FraunhoferIOSB.
the class PostAssetAdministrationShellRequestHandler method process.
@Override
public PostAssetAdministrationShellResponse process(PostAssetAdministrationShellRequest request) {
PostAssetAdministrationShellResponse response = new PostAssetAdministrationShellResponse();
try {
AssetAdministrationShell shell = (AssetAdministrationShell) persistence.put(request.getAas());
response.setPayload(shell);
response.setStatusCode(StatusCode.SuccessCreated);
publishElementCreateEventMessage(AasUtils.toReference(shell), shell);
} catch (Exception ex) {
response.setStatusCode(StatusCode.ServerInternalError);
}
return response;
}
Aggregations