Search in sources :

Example 1 with PostSubmodelElementRequest

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

the class RequestHandlerManagerTest method testPostSubmodelElementRequest.

@Test
public void testPostSubmodelElementRequest() throws ResourceNotFoundException {
    Reference reference = ReferenceHelper.toReference(environment.getSubmodels().get(0).getIdentification(), Submodel.class);
    when(persistence.put(reference, (Reference) null, environment.getSubmodels().get(0).getSubmodelElements().get(0))).thenReturn(environment.getSubmodels().get(0).getSubmodelElements().get(0));
    PostSubmodelElementRequest request = new PostSubmodelElementRequest.Builder().id(environment.getSubmodels().get(0).getIdentification()).submodelElement(environment.getSubmodels().get(0).getSubmodelElements().get(0)).build();
    PostSubmodelElementResponse response = manager.execute(request);
    PostSubmodelElementResponse expected = new PostSubmodelElementResponse.Builder().statusCode(StatusCode.SuccessCreated).payload(environment.getSubmodels().get(0).getSubmodelElements().get(0)).build();
    Assert.assertEquals(expected, response);
}
Also used : Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) AtomicReference(java.util.concurrent.atomic.AtomicReference) PostSubmodelElementRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.PostSubmodelElementRequest) PostSubmodelElementResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostSubmodelElementResponse) Test(org.junit.Test)

Aggregations

PostSubmodelElementResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostSubmodelElementResponse)1 PostSubmodelElementRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.PostSubmodelElementRequest)1 Reference (io.adminshell.aas.v3.model.Reference)1 DefaultReference (io.adminshell.aas.v3.model.impl.DefaultReference)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Test (org.junit.Test)1