use of de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification in project FAAAST-Service by FraunhoferIOSB.
the class RequestHandlerManagerTest method testGetAllAssetAdministrationShellsByAssetIdRequest.
@Test
public void testGetAllAssetAdministrationShellsByAssetIdRequest() {
GlobalAssetIdentification globalAssetIdentification = new GlobalAssetIdentification.Builder().reference(new DefaultReference.Builder().key(new DefaultKey.Builder().idType(KeyType.IRI).type(KeyElements.GLOBAL_REFERENCE).value("TestValue").build()).build()).build();
SpecificAssetIdentification specificAssetIdentification = new SpecificAssetIdentification.Builder().value("TestValue").key("TestKey").build();
when(persistence.get(eq(null), eq(List.of(globalAssetIdentification, specificAssetIdentification)), any())).thenReturn(List.of(environment.getAssetAdministrationShells().get(0), environment.getAssetAdministrationShells().get(1)));
List<IdentifierKeyValuePair> assetIds = List.of(new DefaultIdentifierKeyValuePair.Builder().key("globalAssetId").value("TestValue").externalSubjectId(new DefaultReference.Builder().build()).build(), new DefaultIdentifierKeyValuePair.Builder().key("TestKey").value("TestValue").build());
GetAllAssetAdministrationShellsByAssetIdRequest request = new GetAllAssetAdministrationShellsByAssetIdRequest.Builder().assetIds(assetIds).build();
GetAllAssetAdministrationShellsByAssetIdResponse response = manager.execute(request);
GetAllAssetAdministrationShellsByAssetIdResponse expected = new GetAllAssetAdministrationShellsByAssetIdResponse.Builder().payload(List.of(environment.getAssetAdministrationShells().get(0), environment.getAssetAdministrationShells().get(1))).statusCode(StatusCode.Success).build();
Assert.assertEquals(expected, response);
}
use of de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification in project FAAAST-Service by FraunhoferIOSB.
the class PersistenceInMemoryTest method getShellsWithGlobalAssetIdentificationTest.
@Test
public void getShellsWithGlobalAssetIdentificationTest() {
GlobalAssetIdentification globalAssetIdentification = new GlobalAssetIdentification();
globalAssetIdentification.setReference(new DefaultReference.Builder().key(new DefaultKey.Builder().type(KeyElements.ASSET).idType(KeyType.IRI).value("https://acplt.org/Test_Asset_Mandatory").build()).build());
List<AssetAdministrationShell> actualAASList = persistence.get(null, List.of(globalAssetIdentification), new QueryModifier());
List<AssetAdministrationShell> expectedAASList = environment.getAssetAdministrationShells().stream().filter(x -> x.getAssetInformation().getGlobalAssetId().equals(globalAssetIdentification.getReference())).collect(Collectors.toList());
Assert.assertEquals(expectedAASList, actualAASList);
}
use of de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification in project FAAAST-Service by FraunhoferIOSB.
the class PersistenceInMemoryTest method getShellsNullTest.
@Test
public void getShellsNullTest() {
String AAS_IDSHORT = "Test_AssetAdministrationShell_Mandatory";
List<AssetAdministrationShell> actualAASList = persistence.get(AAS_IDSHORT, List.of(new GlobalAssetIdentification()), new QueryModifier());
List<AssetAdministrationShell> expectedAASList = null;
Assert.assertEquals(expectedAASList, actualAASList);
}
Aggregations