use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostConceptDescriptionResponse in project FAAAST-Service by FraunhoferIOSB.
the class PostConceptDescriptionRequestHandler method process.
@Override
public PostConceptDescriptionResponse process(PostConceptDescriptionRequest request) {
PostConceptDescriptionResponse response = new PostConceptDescriptionResponse();
try {
ConceptDescription conceptDescription = (ConceptDescription) persistence.put(request.getConceptDescription());
response.setPayload(conceptDescription);
response.setStatusCode(StatusCode.SuccessCreated);
publishElementCreateEventMessage(AasUtils.toReference(conceptDescription), conceptDescription);
} catch (Exception ex) {
response.setStatusCode(StatusCode.ServerInternalError);
}
return response;
}
use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostConceptDescriptionResponse in project FAAAST-Service by FraunhoferIOSB.
the class RequestHandlerManagerTest method testPostConceptDescriptionRequest.
@Test
public void testPostConceptDescriptionRequest() throws ResourceNotFoundException {
when(persistence.put(environment.getConceptDescriptions().get(0))).thenReturn(environment.getConceptDescriptions().get(0));
PostConceptDescriptionRequest request = new PostConceptDescriptionRequest.Builder().conceptDescription(environment.getConceptDescriptions().get(0)).build();
PostConceptDescriptionResponse response = manager.execute(request);
PostConceptDescriptionResponse expected = new PostConceptDescriptionResponse.Builder().payload(environment.getConceptDescriptions().get(0)).statusCode(StatusCode.SuccessCreated).build();
Assert.assertEquals(expected, response);
}
Aggregations