Search in sources :

Example 1 with PostSubmodelElementByPathRequest

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

the class RequestHandlerManagerTest method testPostSubmodelElementByPathRequest.

@Test
public void testPostSubmodelElementByPathRequest() throws ResourceNotFoundException {
    when(persistence.put(any(), argThat((Reference t) -> true), any())).thenReturn(environment.getSubmodels().get(0).getSubmodelElements().get(0));
    PostSubmodelElementByPathRequest request = new PostSubmodelElementByPathRequest.Builder().id(environment.getSubmodels().get(0).getIdentification()).path(ReferenceHelper.toKeys(SUBMODEL_ELEMENT_REF)).build();
    PostSubmodelElementByPathResponse response = manager.execute(request);
    PostSubmodelElementByPathResponse expected = new PostSubmodelElementByPathResponse.Builder().payload(environment.getSubmodels().get(0).getSubmodelElements().get(0)).statusCode(StatusCode.SuccessCreated).build();
    Assert.assertEquals(expected, response);
}
Also used : PostSubmodelElementByPathResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostSubmodelElementByPathResponse) Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) AtomicReference(java.util.concurrent.atomic.AtomicReference) PostSubmodelElementByPathRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.PostSubmodelElementByPathRequest) Test(org.junit.Test)

Aggregations

PostSubmodelElementByPathResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PostSubmodelElementByPathResponse)1 PostSubmodelElementByPathRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.PostSubmodelElementByPathRequest)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