Search in sources :

Example 6 with AssetIdentification

use of de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification in project FAAAST-Service by FraunhoferIOSB.

the class RequestHandlerManagerTest method testGetAllAssetAdministrationShellsByIdShortRequest.

@Test
public void testGetAllAssetAdministrationShellsByIdShortRequest() {
    when(persistence.get(eq("Test"), argThat((List<AssetIdentification> t) -> true), any())).thenReturn(environment.getAssetAdministrationShells());
    GetAllAssetAdministrationShellsByIdShortRequest request = new GetAllAssetAdministrationShellsByIdShortRequest.Builder().idShort("Test").build();
    GetAllAssetAdministrationShellsByIdShortResponse response = manager.execute(request);
    GetAllAssetAdministrationShellsByIdShortResponse expected = new GetAllAssetAdministrationShellsByIdShortResponse.Builder().payload(environment.getAssetAdministrationShells()).statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
}
Also used : SpecificAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) GetAllAssetAdministrationShellsByIdShortResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByIdShortResponse) GetAllAssetAdministrationShellsByIdShortRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsByIdShortRequest) Test(org.junit.Test)

Example 7 with AssetIdentification

use of de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification in project FAAAST-Service by FraunhoferIOSB.

the class PersistenceInMemoryTest method getShellsAllTest.

@Test
public void getShellsAllTest() {
    List<AssetAdministrationShell> actualAASList = persistence.get("", (List<AssetIdentification>) null, new QueryModifier());
    List<AssetAdministrationShell> expectedAASList = environment.getAssetAdministrationShells();
    Assert.assertEquals(expectedAASList, actualAASList);
}
Also used : AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) Test(org.junit.Test)

Example 8 with AssetIdentification

use of de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification in project FAAAST-Service by FraunhoferIOSB.

the class PersistenceInMemoryTest method getShellsWithIdShortTest.

@Test
public void getShellsWithIdShortTest() {
    String AAS_IDSHORT = "Test_AssetAdministrationShell_Mandatory";
    List<AssetAdministrationShell> actualAASList = persistence.get(AAS_IDSHORT, (List<AssetIdentification>) null, new QueryModifier());
    List<AssetAdministrationShell> expectedAASList = environment.getAssetAdministrationShells().stream().filter(x -> x.getIdShort().equalsIgnoreCase(AAS_IDSHORT)).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) AssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification) GlobalAssetIdentification(de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) Test(org.junit.Test)

Aggregations

AssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification)8 GlobalAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification)6 AssetAdministrationShell (io.adminshell.aas.v3.model.AssetAdministrationShell)5 Test (org.junit.Test)5 SpecificAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.SpecificAssetIdentification)4 GetAllAssetAdministrationShellsResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsResponse)3 QueryModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier)2 GetAllAssetAdministrationShellsByIdShortResponse (de.fraunhofer.iosb.ilt.faaast.service.model.api.response.GetAllAssetAdministrationShellsByIdShortResponse)2 GetAllAssetAdministrationShellsRequest (de.fraunhofer.iosb.ilt.faaast.service.model.request.GetAllAssetAdministrationShellsRequest)2 DefaultKey (io.adminshell.aas.v3.model.impl.DefaultKey)2 DefaultReference (io.adminshell.aas.v3.model.impl.DefaultReference)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