Search in sources :

Example 1 with Level

use of de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level in project FAAAST-Service by FraunhoferIOSB.

the class PersistenceInMemoryTest method testQueryModifierLevel.

@Test
public void testQueryModifierLevel() throws ResourceNotFoundException {
    String SUBMODEL_IDENTIFIER = "https://acplt.org/Test_Submodel_Mandatory";
    QueryModifier queryModifier = new QueryModifier.Builder().level(Level.Deep).build();
    Identifier submodelId = new DefaultIdentifier.Builder().idType(IdentifierType.IRI).identifier(SUBMODEL_IDENTIFIER).build();
    Submodel expected = this.environment.getSubmodels().stream().filter(x -> x.getIdentification().equals(submodelId)).findFirst().get();
    Submodel actual = (Submodel) this.persistence.get(submodelId, queryModifier);
    Assert.assertEquals(expected, actual);
    queryModifier = new QueryModifier.Builder().level(Level.Core).build();
    actual = (Submodel) this.persistence.get(submodelId, queryModifier);
    List<SubmodelElement> submodelElementCollections = actual.getSubmodelElements().stream().filter(x -> SubmodelElementCollection.class.isAssignableFrom(x.getClass())).collect(Collectors.toList());
    Assert.assertTrue(submodelElementCollections.stream().allMatch(x -> ((SubmodelElementCollection) x).getValues() == null));
}
Also used : Submodel(io.adminshell.aas.v3.model.Submodel) 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) Identifier(io.adminshell.aas.v3.model.Identifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) Test(org.junit.Test)

Aggregations

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 QueryModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier)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 AssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification)1 GlobalAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification)1 Persistence (de.fraunhofer.iosb.ilt.faaast.service.persistence.Persistence)1 DeepCopyHelper (de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper)1 AssetAdministrationShell (io.adminshell.aas.v3.model.AssetAdministrationShell)1 AssetAdministrationShellEnvironment (io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment)1 ConceptDescription (io.adminshell.aas.v3.model.ConceptDescription)1 Identifiable (io.adminshell.aas.v3.model.Identifiable)1 Identifier (io.adminshell.aas.v3.model.Identifier)1