Search in sources :

Example 1 with GetAllAssetAdministrationShellsByAssetIdRequest

use of de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsByAssetIdRequest 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);
}
Also used : GetAllAssetAdministrationShellsByAssetIdRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsByAssetIdRequest) DefaultIdentifierKeyValuePair(io.adminshell.aas.v3.model.impl.DefaultIdentifierKeyValuePair) IdentifierKeyValuePair(io.adminshell.aas.v3.model.IdentifierKeyValuePair) SpecificAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification) DefaultIdentifierKeyValuePair(io.adminshell.aas.v3.model.impl.DefaultIdentifierKeyValuePair) GetAllAssetAdministrationShellsByAssetIdResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByAssetIdResponse) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) Test(org.junit.Test)

Aggregations

GetAllAssetAdministrationShellsByAssetIdResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByAssetIdResponse)1 GlobalAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification)1 SpecificAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification)1 GetAllAssetAdministrationShellsByAssetIdRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsByAssetIdRequest)1 IdentifierKeyValuePair (io.adminshell.aas.v3.model.IdentifierKeyValuePair)1 DefaultIdentifierKeyValuePair (io.adminshell.aas.v3.model.impl.DefaultIdentifierKeyValuePair)1 Test (org.junit.Test)1