Search in sources :

Example 1 with GetAssetInformationResponse

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

the class GetAssetInformationRequestHandler method process.

@Override
public GetAssetInformationResponse process(GetAssetInformationRequest request) {
    GetAssetInformationResponse response = new GetAssetInformationResponse();
    try {
        AssetAdministrationShell shell = (AssetAdministrationShell) persistence.get(request.getId(), new QueryModifier());
        response.setPayload(shell.getAssetInformation());
        response.setStatusCode(StatusCode.Success);
        publishElementReadEventMessage(AasUtils.toReference(shell), shell);
    } catch (Exception ex) {
        response.setStatusCode(StatusCode.ServerInternalError);
    }
    return response;
}
Also used : AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) GetAssetInformationResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAssetInformationResponse) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier)

Example 2 with GetAssetInformationResponse

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

the class RequestHandlerManagerTest method testGetAssetInformationRequest.

@Test
public void testGetAssetInformationRequest() throws ResourceNotFoundException {
    when(persistence.get(environment.getAssetAdministrationShells().get(0).getIdentification(), new QueryModifier())).thenReturn(environment.getAssetAdministrationShells().get(0));
    GetAssetInformationRequest request = new GetAssetInformationRequest.Builder().id(environment.getAssetAdministrationShells().get(0).getIdentification()).build();
    GetAssetInformationResponse response = manager.execute(request);
    GetAssetInformationResponse expected = new GetAssetInformationResponse.Builder().payload(environment.getAssetAdministrationShells().get(0).getAssetInformation()).statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
}
Also used : GetAssetInformationResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAssetInformationResponse) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) GetAssetInformationRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAssetInformationRequest) Test(org.junit.Test)

Aggregations

QueryModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier)2 GetAssetInformationResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAssetInformationResponse)2 GetAssetInformationRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAssetInformationRequest)1 AssetAdministrationShell (io.adminshell.aas.v3.model.AssetAdministrationShell)1 Test (org.junit.Test)1