Search in sources :

Example 1 with PostSubmodelReferenceRequest

use of de.fraunhofer.iosb.ilt.faaast.service.model.request.PostSubmodelReferenceRequest in project FAAAST-Service by FraunhoferIOSB.

the class RequestHandlerManagerTest method testPostSubmodelReferenceRequest.

@Test
public void testPostSubmodelReferenceRequest() throws ResourceNotFoundException {
    when(persistence.get(environment.getAssetAdministrationShells().get(0).getIdentification(), new QueryModifier())).thenReturn(environment.getAssetAdministrationShells().get(0));
    when(persistence.put(environment.getSubmodels().get(0))).thenReturn(environment.getSubmodels().get(0));
    PostSubmodelReferenceRequest request = new PostSubmodelReferenceRequest.Builder().id(environment.getAssetAdministrationShells().get(0).getIdentification()).submodelRef(SUBMODEL_ELEMENT_REF).build();
    PostSubmodelReferenceResponse response = manager.execute(request);
    PostSubmodelReferenceResponse expected = new PostSubmodelReferenceResponse.Builder().statusCode(StatusCode.SuccessCreated).payload(SUBMODEL_ELEMENT_REF).build();
    Assert.assertEquals(expected, response);
}
Also used : PostSubmodelReferenceRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.PostSubmodelReferenceRequest) PostSubmodelReferenceResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostSubmodelReferenceResponse) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) Test(org.junit.Test)

Aggregations

QueryModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier)1 PostSubmodelReferenceResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostSubmodelReferenceResponse)1 PostSubmodelReferenceRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.PostSubmodelReferenceRequest)1 Test (org.junit.Test)1