Search in sources :

Example 1 with GetAllAssetAdministrationShellsRequest

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

the class RequestHandlerManagerTest method testGetAllAssetAdministrationShellRequest.

@Test
public void testGetAllAssetAdministrationShellRequest() {
    when(persistence.get(any(), argThat((List<AssetIdentification> t) -> true), any())).thenReturn(environment.getAssetAdministrationShells());
    GetAllAssetAdministrationShellsRequest request = new GetAllAssetAdministrationShellsRequest();
    GetAllAssetAdministrationShellsResponse response = manager.execute(request);
    GetAllAssetAdministrationShellsResponse expected = new GetAllAssetAdministrationShellsResponse.Builder().payload(environment.getAssetAdministrationShells()).statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
}
Also used : SpecificAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) GetAllAssetAdministrationShellsResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsResponse) GetAllAssetAdministrationShellsRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsRequest) Test(org.junit.Test)

Example 2 with GetAllAssetAdministrationShellsRequest

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

the class RequestHandlerManagerTest method testGetAllAssetAdministrationShellRequestAsync.

@Test
public void testGetAllAssetAdministrationShellRequestAsync() throws InterruptedException {
    when(persistence.get(any(), argThat((List<AssetIdentification> t) -> true), any())).thenReturn(environment.getAssetAdministrationShells());
    GetAllAssetAdministrationShellsRequest request = new GetAllAssetAdministrationShellsRequest();
    final AtomicReference<GetAllAssetAdministrationShellsResponse> response = new AtomicReference<>();
    CountDownLatch condition = new CountDownLatch(1);
    manager.executeAsync(request, x -> response.set(x));
    condition.await(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
    Assert.assertEquals(environment.getAssetAdministrationShells(), response.get().getPayload());
}
Also used : SpecificAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) GetAllAssetAdministrationShellsResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsResponse) AtomicReference(java.util.concurrent.atomic.AtomicReference) CountDownLatch(java.util.concurrent.CountDownLatch) GetAllAssetAdministrationShellsRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsRequest) Test(org.junit.Test)

Aggregations

GetAllAssetAdministrationShellsResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsResponse)2 AssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification)2 GlobalAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification)2 SpecificAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification)2 GetAllAssetAdministrationShellsRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsRequest)2 Test (org.junit.Test)2 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1