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);
}
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());
}
Aggregations