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);
}
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;
}
Aggregations