use of io.adminshell.aas.v3.dataformat.DeserializationException in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testSubmodelRepositoryDeleteSubmodel.
@Test
public void testSubmodelRepositoryDeleteSubmodel() throws IOException, DeserializationException, InterruptedException, URISyntaxException, SerializationException, MessageBusException {
Submodel expected = environment.getSubmodels().get(1);
List<Submodel> before = HttpHelper.getWithMultipleResult(API_PATHS.submodelRepository().submodels(), Submodel.class);
Assert.assertTrue(before.contains(expected));
assertEvent(messageBus, ElementDeleteEventMessage.class, expected, LambdaExceptionHelper.wrap(x -> executeAndAssert(HttpMethod.DELETE, API_PATHS.submodelRepository().submodel(expected), StatusCode.SUCCESS)));
List<Submodel> after = HttpHelper.getWithMultipleResult(API_PATHS.submodelRepository().submodels(), Submodel.class);
Assert.assertFalse(after.contains(expected));
}
use of io.adminshell.aas.v3.dataformat.DeserializationException in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testSubmodelRepositoryCreateSubmodel.
@Test
public void testSubmodelRepositoryCreateSubmodel() throws IOException, DeserializationException, InterruptedException, URISyntaxException, SerializationException, MessageBusException {
Submodel expected = new DefaultSubmodel.Builder().identification(new DefaultIdentifier.Builder().idType(IdentifierType.IRI).identifier("newSubmodel").build()).build();
assertEvent(messageBus, ElementCreateEventMessage.class, expected, LambdaExceptionHelper.wrap(x -> executeAndAssertSingleEntity(HttpMethod.POST, API_PATHS.submodelRepository().submodels(), StatusCode.SUCCESS_CREATED, expected, expected, Submodel.class)));
Assert.assertTrue(HttpHelper.getWithMultipleResult(API_PATHS.submodelRepository().submodels(), Submodel.class).contains(expected));
}
use of io.adminshell.aas.v3.dataformat.DeserializationException in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testSubmodelInterfaceGetSubmodelElement.
@Test
public void testSubmodelInterfaceGetSubmodelElement() throws IOException, DeserializationException, InterruptedException, URISyntaxException, SerializationException, MessageBusException {
Submodel submodel = environment.getSubmodels().get(0);
SubmodelElement expected = submodel.getSubmodelElements().get(0);
assertEvent(messageBus, ElementReadEventMessage.class, expected, LambdaExceptionHelper.wrap(x -> executeAndAssertSingleEntity(HttpMethod.GET, API_PATHS.submodelRepository().submodelInterface(submodel).submodelElement(expected), StatusCode.SUCCESS, null, expected, SubmodelElement.class)));
}
use of io.adminshell.aas.v3.dataformat.DeserializationException in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testAssetAdministrationShellInterfaceUpdateAssetAdministrationShell.
@Test
public void testAssetAdministrationShellInterfaceUpdateAssetAdministrationShell() throws InterruptedException, MessageBusException, IOException, URISyntaxException, SerializationException, DeserializationException {
AssetAdministrationShell expected = environment.getAssetAdministrationShells().get(1);
expected.setIdShort("changed");
assertEvent(messageBus, ElementUpdateEventMessage.class, expected, LambdaExceptionHelper.wrap(x -> executeAndAssertSingleEntity(HttpMethod.PUT, API_PATHS.aasRepository().assetAdministrationShell(expected), StatusCode.SUCCESS, expected, expected, AssetAdministrationShell.class)));
}
use of io.adminshell.aas.v3.dataformat.DeserializationException in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testSubmodelInterfaceCreateSubmodelElement.
@Test
public void testSubmodelInterfaceCreateSubmodelElement() throws InterruptedException, MessageBusException, IOException, URISyntaxException, SerializationException, DeserializationException {
Submodel submodel = environment.getSubmodels().get(0);
SubmodelElement expected = new DefaultProperty.Builder().idShort("newProperty").build();
assertEvent(messageBus, ElementCreateEventMessage.class, expected, LambdaExceptionHelper.wrap(x -> executeAndAssertSingleEntity(HttpMethod.POST, API_PATHS.submodelRepository().submodelInterface(submodel).submodelElements(), StatusCode.SUCCESS_CREATED, expected, expected, SubmodelElement.class)));
List<SubmodelElement> after = HttpHelper.getWithMultipleResult(API_PATHS.submodelRepository().submodelInterface(submodel).submodelElements(), SubmodelElement.class);
Assert.assertTrue(after.contains(expected));
}
Aggregations