Search in sources :

Example 1 with GetAllConceptDescriptionsByIdShortResponse

use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsByIdShortResponse in project FAAAST-Service by FraunhoferIOSB.

the class RequestHandlerManagerTest method testGetAllConceptDescriptionsByIdShortRequest.

@Test
public void testGetAllConceptDescriptionsByIdShortRequest() throws ResourceNotFoundException {
    when(persistence.get(environment.getConceptDescriptions().get(0).getIdShort(), null, null, new OutputModifier())).thenReturn(environment.getConceptDescriptions());
    GetAllConceptDescriptionsByIdShortRequest request = new GetAllConceptDescriptionsByIdShortRequest.Builder().outputModifier(new OutputModifier()).idShort(environment.getConceptDescriptions().get(0).getIdShort()).build();
    GetAllConceptDescriptionsByIdShortResponse response = manager.execute(request);
    GetAllConceptDescriptionsByIdShortResponse expected = new GetAllConceptDescriptionsByIdShortResponse.Builder().payload(environment.getConceptDescriptions()).statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
}
Also used : GetAllConceptDescriptionsByIdShortRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllConceptDescriptionsByIdShortRequest) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) GetAllConceptDescriptionsByIdShortResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsByIdShortResponse) Test(org.junit.Test)

Example 2 with GetAllConceptDescriptionsByIdShortResponse

use of de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsByIdShortResponse in project FAAAST-Service by FraunhoferIOSB.

the class GetAllConceptDescriptionsByIdShortRequestHandler method process.

@Override
public GetAllConceptDescriptionsByIdShortResponse process(GetAllConceptDescriptionsByIdShortRequest request) {
    GetAllConceptDescriptionsByIdShortResponse response = new GetAllConceptDescriptionsByIdShortResponse();
    try {
        List<ConceptDescription> conceptDescriptions = persistence.get(request.getIdShort(), null, null, request.getOutputModifier());
        response.setPayload(conceptDescriptions);
        response.setStatusCode(StatusCode.Success);
        if (conceptDescriptions != null) {
            conceptDescriptions.forEach(x -> publishElementReadEventMessage(AasUtils.toReference(x), x));
        }
    } catch (Exception ex) {
        response.setStatusCode(StatusCode.ServerInternalError);
    }
    return response;
}
Also used : ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) GetAllConceptDescriptionsByIdShortResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsByIdShortResponse)

Aggregations

GetAllConceptDescriptionsByIdShortResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllConceptDescriptionsByIdShortResponse)2 OutputModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier)1 GetAllConceptDescriptionsByIdShortRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllConceptDescriptionsByIdShortRequest)1 ConceptDescription (io.adminshell.aas.v3.model.ConceptDescription)1 Test (org.junit.Test)1