use of io.adminshell.aas.v3.model.Submodel in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testSubmodelRepositoryUpdateSubmodel.
@Test
public void testSubmodelRepositoryUpdateSubmodel() throws InterruptedException, MessageBusException, IOException, URISyntaxException, SerializationException, DeserializationException {
Submodel expected = environment.getSubmodels().get(1);
expected.setIdShort("changed");
assertEvent(messageBus, ElementUpdateEventMessage.class, expected, LambdaExceptionHelper.wrap(x -> executeAndAssertSingleEntity(HttpMethod.PUT, API_PATHS.submodelRepository().submodel(expected), StatusCode.SUCCESS, expected, expected, Submodel.class)));
}
use of io.adminshell.aas.v3.model.Submodel in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testSubmodelRepositoryGetSubmodelsByIdShort.
@Test
public void testSubmodelRepositoryGetSubmodelsByIdShort() throws IOException, DeserializationException, InterruptedException, URISyntaxException, SerializationException {
Submodel expected = environment.getSubmodels().get(1);
executeAndAssertMultipleEntities(HttpMethod.GET, String.format("%s?idShort=%s", API_PATHS.submodelRepository().submodels(), expected.getIdShort()), StatusCode.SUCCESS, null, List.of(expected), Submodel.class);
}
use of io.adminshell.aas.v3.model.Submodel in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testSubmodelInterfaceGetSubmodelLevelDeep.
@Test
public void testSubmodelInterfaceGetSubmodelLevelDeep() throws IOException, DeserializationException, InterruptedException, URISyntaxException, SerializationException, MessageBusException {
Submodel expected = environment.getSubmodels().get(2);
assertEvent(messageBus, ElementReadEventMessage.class, expected, LambdaExceptionHelper.wrap(x -> executeAndAssertSingleEntity(HttpMethod.GET, API_PATHS.submodelRepository().submodelInterface(expected).submodel(Level.DEEP), StatusCode.SUCCESS, null, expected, Submodel.class)));
}
use of io.adminshell.aas.v3.model.Submodel in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testSubmodelInterfaceGetSubmodelContentPath.
@Test
public void testSubmodelInterfaceGetSubmodelContentPath() throws IOException, DeserializationException, InterruptedException, URISyntaxException, SerializationException, MessageBusException {
Submodel submodel = environment.getSubmodels().get(2);
Path expected = Path.builder().id("TestSubmodel3").child("ExampleRelationshipElement").child("ExampleAnnotatedRelationshipElement").child("ExampleOperation").child("ExampleCapability").child("ExampleBasicEvent").child(Path.builder().id("ExampleSubmodelCollectionOrdered").child("ExampleProperty").child("ExampleMultiLanguageProperty").child("ExampleRange").build()).child(Path.builder().id("ExampleSubmodelCollectionUnordered").child("ExampleBlob").child("ExampleFile").child("ExampleReferenceElement").build()).build();
assertEvent(messageBus, ElementReadEventMessage.class, submodel, LambdaExceptionHelper.wrap(x -> {
HttpResponse<String> response = HttpHelper.get(API_PATHS.submodelRepository().submodelInterface(submodel).submodel(Level.DEEP, Content.PATH));
Assert.assertEquals(toHttpStatusCode(StatusCode.SUCCESS), response.statusCode());
JSONAssert.assertEquals(mapper.writeValueAsString(expected.getPaths()), response.body(), false);
}));
}
use of io.adminshell.aas.v3.model.Submodel in project FAAAST-Service by FraunhoferIOSB.
the class HttpEndpointIT method testSubmodelInterfaceGetSubmodel_ContentValue.
@Test
public void testSubmodelInterfaceGetSubmodel_ContentValue() throws IOException, DeserializationException, InterruptedException, URISyntaxException, SerializationException, MessageBusException {
Submodel submodel = environment.getSubmodels().get(3);
String expected = new JsonSerializer().write(submodel, new OutputModifier.Builder().content(Content.VALUE).build());
assertEvent(messageBus, ElementReadEventMessage.class, submodel, LambdaExceptionHelper.wrap(x -> {
HttpResponse<String> response = HttpHelper.get(API_PATHS.submodelRepository().submodelInterface(submodel).submodel(Content.VALUE));
Assert.assertEquals(toHttpStatusCode(StatusCode.SUCCESS), response.statusCode());
JSONAssert.assertEquals(expected, response.body(), false);
}));
}
Aggregations