Search in sources :

Example 1 with GlobalAssetIdentification

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

Example 2 with GlobalAssetIdentification

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);
}
Also used : KeyElements(io.adminshell.aas.v3.model.KeyElements) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) AASFull(de.fraunhofer.iosb.ilt.faaast.service.model.AASFull) AssetAdministrationShellEnvironment(io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment) SubmodelElementCollection(io.adminshell.aas.v3.model.SubmodelElementCollection) Extend(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Extend) Identifier(io.adminshell.aas.v3.model.Identifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) Identifiable(io.adminshell.aas.v3.model.Identifiable) Message(de.fraunhofer.iosb.ilt.faaast.service.model.api.Message) DeepCopyHelper(de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper) KeyType(io.adminshell.aas.v3.model.KeyType) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) DefaultKey(io.adminshell.aas.v3.model.impl.DefaultKey) Level(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level) Before(org.junit.Before) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) IdentifierType(io.adminshell.aas.v3.model.IdentifierType) Reference(io.adminshell.aas.v3.model.Reference) Test(org.junit.Test) Persistence(de.fraunhofer.iosb.ilt.faaast.service.persistence.Persistence) Collectors(java.util.stream.Collectors) Result(de.fraunhofer.iosb.ilt.faaast.service.model.api.Result) OperationHandle(de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationHandle) List(java.util.List) ExecutionState(de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.ExecutionState) ResourceNotFoundException(de.fraunhofer.iosb.ilt.faaast.service.exception.ResourceNotFoundException) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) OperationResult(de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationResult) Assert(org.junit.Assert) Submodel(io.adminshell.aas.v3.model.Submodel) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) DefaultKey(io.adminshell.aas.v3.model.impl.DefaultKey) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) Test(org.junit.Test)

Example 3 with GlobalAssetIdentification

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);
}
Also used : AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) Test(org.junit.Test)

Aggregations

GlobalAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification)3 Test (org.junit.Test)3 QueryModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier)2 AssetAdministrationShell (io.adminshell.aas.v3.model.AssetAdministrationShell)2 ResourceNotFoundException (de.fraunhofer.iosb.ilt.faaast.service.exception.ResourceNotFoundException)1 AASFull (de.fraunhofer.iosb.ilt.faaast.service.model.AASFull)1 Message (de.fraunhofer.iosb.ilt.faaast.service.model.api.Message)1 Result (de.fraunhofer.iosb.ilt.faaast.service.model.api.Result)1 Extend (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Extend)1 Level (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level)1 OutputModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier)1 ExecutionState (de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.ExecutionState)1 OperationHandle (de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationHandle)1 OperationResult (de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationResult)1 GetAllAssetAdministrationShellsByAssetIdResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByAssetIdResponse)1 AssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification)1 SpecificAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification)1 GetAllAssetAdministrationShellsByAssetIdRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsByAssetIdRequest)1 Persistence (de.fraunhofer.iosb.ilt.faaast.service.persistence.Persistence)1 DeepCopyHelper (de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper)1