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