Search in sources :

Example 1 with QueryModifier

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

the class RequestHandlerManagerTest method testPutAssetInformationRequest.

@Test
public void testPutAssetInformationRequest() throws ResourceNotFoundException {
    when(persistence.get(environment.getAssetAdministrationShells().get(0).getIdentification(), new QueryModifier())).thenReturn(environment.getAssetAdministrationShells().get(0));
    when(persistence.put(environment.getAssetAdministrationShells().get(0))).thenReturn(environment.getAssetAdministrationShells().get(0));
    PutAssetInformationRequest request = new PutAssetInformationRequest.Builder().id(environment.getAssetAdministrationShells().get(0).getIdentification()).assetInformation(environment.getAssetAdministrationShells().get(0).getAssetInformation()).build();
    PutAssetInformationResponse response = manager.execute(request);
    PutAssetInformationResponse expected = new PutAssetInformationResponse.Builder().statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
}
Also used : QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) PutAssetInformationResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PutAssetInformationResponse) PutAssetInformationRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.PutAssetInformationRequest) Test(org.junit.Test)

Example 2 with QueryModifier

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

the class RequestHandlerManagerTest method testDeleteSubmodelElementByPathRequest.

@Test
public void testDeleteSubmodelElementByPathRequest() throws ResourceNotFoundException {
    Submodel submodel = environment.getSubmodels().get(0);
    Reference reference = ReferenceHelper.toReference(ReferenceHelper.toKeys(SUBMODEL_ELEMENT_REF), submodel.getIdentification(), Submodel.class);
    when(persistence.get(reference, new QueryModifier())).thenReturn(environment.getSubmodels().get(0).getSubmodelElements().get(0));
    DeleteSubmodelElementByPathRequest request = new DeleteSubmodelElementByPathRequest.Builder().id(submodel.getIdentification()).path(ReferenceHelper.toKeys(SUBMODEL_ELEMENT_REF)).build();
    DeleteSubmodelElementByPathResponse response = manager.execute(request);
    DeleteSubmodelElementByPathResponse expected = new DeleteSubmodelElementByPathResponse.Builder().statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
    verify(persistence).remove(reference);
}
Also used : Submodel(io.adminshell.aas.v3.model.Submodel) Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) AtomicReference(java.util.concurrent.atomic.AtomicReference) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) DeleteSubmodelElementByPathResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.DeleteSubmodelElementByPathResponse) DeleteSubmodelElementByPathRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.DeleteSubmodelElementByPathRequest) Test(org.junit.Test)

Example 3 with QueryModifier

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

the class RequestHandlerManagerTest method testDeleteConceptDescriptionByIdRequest.

@Test
public void testDeleteConceptDescriptionByIdRequest() throws ResourceNotFoundException {
    when(persistence.get(environment.getConceptDescriptions().get(0).getIdentification(), new QueryModifier())).thenReturn(environment.getConceptDescriptions().get(0));
    DeleteConceptDescriptionByIdRequest request = new DeleteConceptDescriptionByIdRequest.Builder().id(environment.getConceptDescriptions().get(0).getIdentification()).build();
    DeleteConceptDescriptionByIdResponse response = manager.execute(request);
    DeleteConceptDescriptionByIdResponse expected = new DeleteConceptDescriptionByIdResponse.Builder().statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
    verify(persistence).remove(environment.getConceptDescriptions().get(0).getIdentification());
}
Also used : QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) DeleteConceptDescriptionByIdRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.DeleteConceptDescriptionByIdRequest) DeleteConceptDescriptionByIdResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.DeleteConceptDescriptionByIdResponse) Test(org.junit.Test)

Example 4 with QueryModifier

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

the class RequestHandlerManagerTest method testDeleteSubmodelByIdRequest.

@Test
public void testDeleteSubmodelByIdRequest() throws ResourceNotFoundException {
    when(persistence.get(environment.getSubmodels().get(0).getIdentification(), new QueryModifier())).thenReturn(environment.getSubmodels().get(0));
    DeleteSubmodelByIdRequest request = new DeleteSubmodelByIdRequest.Builder().id(environment.getSubmodels().get(0).getIdentification()).build();
    DeleteSubmodelByIdResponse response = manager.execute(request);
    DeleteSubmodelByIdResponse expected = new DeleteSubmodelByIdResponse.Builder().statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
    verify(persistence).remove(environment.getSubmodels().get(0).getIdentification());
}
Also used : DeleteSubmodelByIdResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.DeleteSubmodelByIdResponse) DeleteSubmodelByIdRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.DeleteSubmodelByIdRequest) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) Test(org.junit.Test)

Example 5 with QueryModifier

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

the class RequestHandlerManagerTest method testDeleteAssetAdministrationShellByIdRequest.

@Test
public void testDeleteAssetAdministrationShellByIdRequest() throws ResourceNotFoundException {
    when(persistence.get(environment.getAssetAdministrationShells().get(0).getIdentification(), new QueryModifier())).thenReturn(environment.getAssetAdministrationShells().get(0));
    DeleteAssetAdministrationShellByIdRequest request = new DeleteAssetAdministrationShellByIdRequest().builder().id(environment.getAssetAdministrationShells().get(0).getIdentification()).build();
    DeleteAssetAdministrationShellByIdResponse response = manager.execute(request);
    DeleteAssetAdministrationShellByIdResponse expected = new DeleteAssetAdministrationShellByIdResponse.Builder().statusCode(StatusCode.Success).build();
    Assert.assertEquals(expected, response);
    verify(persistence).remove(environment.getAssetAdministrationShells().get(0).getIdentification());
}
Also used : DeleteAssetAdministrationShellByIdResponse(de.fraunhofer.iosb.ilt.faaast.service.model.api.response.DeleteAssetAdministrationShellByIdResponse) QueryModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier) DeleteAssetAdministrationShellByIdRequest(de.fraunhofer.iosb.ilt.faaast.service.model.request.DeleteAssetAdministrationShellByIdRequest) Test(org.junit.Test)

Aggregations

QueryModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier)49 Test (org.junit.Test)41 AssetAdministrationShell (io.adminshell.aas.v3.model.AssetAdministrationShell)25 Reference (io.adminshell.aas.v3.model.Reference)24 DefaultReference (io.adminshell.aas.v3.model.impl.DefaultReference)24 ResourceNotFoundException (de.fraunhofer.iosb.ilt.faaast.service.exception.ResourceNotFoundException)22 SubmodelElement (io.adminshell.aas.v3.model.SubmodelElement)22 Identifier (io.adminshell.aas.v3.model.Identifier)21 DefaultIdentifier (io.adminshell.aas.v3.model.impl.DefaultIdentifier)21 ConceptDescription (io.adminshell.aas.v3.model.ConceptDescription)20 Submodel (io.adminshell.aas.v3.model.Submodel)20 OutputModifier (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier)18 GlobalAssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.GlobalAssetIdentification)18 AssetIdentification (de.fraunhofer.iosb.ilt.faaast.service.model.asset.AssetIdentification)17 Identifiable (io.adminshell.aas.v3.model.Identifiable)17 AASFull (de.fraunhofer.iosb.ilt.faaast.service.model.AASFull)16 Message (de.fraunhofer.iosb.ilt.faaast.service.model.api.Message)16 Result (de.fraunhofer.iosb.ilt.faaast.service.model.api.Result)16 Extend (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Extend)16 Level (de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level)16