Search in sources :

Example 1 with PostConceptDescriptionResponse

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;
}
Also used : PostConceptDescriptionResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostConceptDescriptionResponse) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription)

Example 2 with PostConceptDescriptionResponse

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);
}
Also used : PostConceptDescriptionResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostConceptDescriptionResponse) PostConceptDescriptionRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.PostConceptDescriptionRequest) Test(org.junit.Test)

Aggregations

PostConceptDescriptionResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostConceptDescriptionResponse)2 PostConceptDescriptionRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.PostConceptDescriptionRequest)1 ConceptDescription (io.adminshell.aas.v3.model.ConceptDescription)1 Test (org.junit.Test)1