Search in sources :

Example 31 with DeserializationException

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));
}
Also used : DefaultSubmodel(io.adminshell.aas.v3.model.impl.DefaultSubmodel) Submodel(io.adminshell.aas.v3.model.Submodel) HttpHelper(de.fraunhofer.iosb.ilt.faaast.service.test.util.HttpHelper) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) ElementReadEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.access.ElementReadEventMessage) HttpHelper.toHttpStatusCode(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.util.HttpHelper.toHttpStatusCode) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) URISyntaxException(java.net.URISyntaxException) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) Service(de.fraunhofer.iosb.ilt.faaast.service.Service) SubmodelElementCollection(io.adminshell.aas.v3.model.SubmodelElementCollection) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) DefaultProperty(io.adminshell.aas.v3.model.impl.DefaultProperty) MessageBusInternalConfig(de.fraunhofer.iosb.ilt.faaast.service.messagebus.internal.MessageBusInternalConfig) ServerSocket(java.net.ServerSocket) StatusCode(de.fraunhofer.iosb.ilt.faaast.service.model.api.StatusCode) DeserializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.DeserializationException) DefaultIdentifierKeyValuePair(io.adminshell.aas.v3.model.impl.DefaultIdentifierKeyValuePair) Map(java.util.Map) After(org.junit.After) FaaastConstants(de.fraunhofer.iosb.ilt.faaast.service.util.FaaastConstants) DefaultConceptDescription(io.adminshell.aas.v3.model.impl.DefaultConceptDescription) DefaultKey(io.adminshell.aas.v3.model.impl.DefaultKey) Level(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level) HttpResponse(java.net.http.HttpResponse) IdentifierType(io.adminshell.aas.v3.model.IdentifierType) MessageBusHelper.assertEvent(de.fraunhofer.iosb.ilt.faaast.service.test.util.MessageBusHelper.assertEvent) EncodingHelper(de.fraunhofer.iosb.ilt.faaast.service.util.EncodingHelper) ApiPaths(de.fraunhofer.iosb.ilt.faaast.service.test.util.ApiPaths) Reference(io.adminshell.aas.v3.model.Reference) ElementCreateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementCreateEventMessage) SerializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.SerializationException) Collectors(java.util.stream.Collectors) IdentifierKeyValuePair(io.adminshell.aas.v3.model.IdentifierKeyValuePair) EventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.EventMessage) List(java.util.List) CoreConfig(de.fraunhofer.iosb.ilt.faaast.service.config.CoreConfig) Path(de.fraunhofer.iosb.ilt.faaast.service.serialization.json.util.Path) BeforeClass(org.junit.BeforeClass) AASFull(de.fraunhofer.iosb.ilt.faaast.service.model.AASFull) AssetAdministrationShellEnvironment(io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment) JSONAssert(org.skyscreamer.jsonassert.JSONAssert) ServiceConfig(de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig) AssetInformation(io.adminshell.aas.v3.model.AssetInformation) Identifier(io.adminshell.aas.v3.model.Identifier) ArrayList(java.util.ArrayList) DeepCopyHelper(de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper) KeyType(io.adminshell.aas.v3.model.KeyType) LangString(io.adminshell.aas.v3.model.LangString) DefaultAssetAdministrationShell(io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell) ElementDeleteEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementDeleteEventMessage) Before(org.junit.Before) MessageBus(de.fraunhofer.iosb.ilt.faaast.service.messagebus.MessageBus) HttpMethod(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.model.HttpMethod) MessageBusException(de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException) DefaultSubmodel(io.adminshell.aas.v3.model.impl.DefaultSubmodel) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) HttpEndpointConfig(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.HttpEndpointConfig) IOException(java.io.IOException) Test(org.junit.Test) JsonSerializer(de.fraunhofer.iosb.ilt.faaast.service.dataformat.json.JsonSerializer) PersistenceInMemoryConfig(de.fraunhofer.iosb.ilt.faaast.service.persistence.memory.PersistenceInMemoryConfig) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) LambdaExceptionHelper(de.fraunhofer.iosb.ilt.faaast.service.util.LambdaExceptionHelper) ElementUpdateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementUpdateEventMessage) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) Assert(org.junit.Assert) Content(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Content) Submodel(io.adminshell.aas.v3.model.Submodel) Test(org.junit.Test)

Example 32 with DeserializationException

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));
}
Also used : DefaultSubmodel(io.adminshell.aas.v3.model.impl.DefaultSubmodel) Submodel(io.adminshell.aas.v3.model.Submodel) HttpHelper(de.fraunhofer.iosb.ilt.faaast.service.test.util.HttpHelper) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) ElementReadEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.access.ElementReadEventMessage) HttpHelper.toHttpStatusCode(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.util.HttpHelper.toHttpStatusCode) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) URISyntaxException(java.net.URISyntaxException) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) Service(de.fraunhofer.iosb.ilt.faaast.service.Service) SubmodelElementCollection(io.adminshell.aas.v3.model.SubmodelElementCollection) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) DefaultProperty(io.adminshell.aas.v3.model.impl.DefaultProperty) MessageBusInternalConfig(de.fraunhofer.iosb.ilt.faaast.service.messagebus.internal.MessageBusInternalConfig) ServerSocket(java.net.ServerSocket) StatusCode(de.fraunhofer.iosb.ilt.faaast.service.model.api.StatusCode) DeserializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.DeserializationException) DefaultIdentifierKeyValuePair(io.adminshell.aas.v3.model.impl.DefaultIdentifierKeyValuePair) Map(java.util.Map) After(org.junit.After) FaaastConstants(de.fraunhofer.iosb.ilt.faaast.service.util.FaaastConstants) DefaultConceptDescription(io.adminshell.aas.v3.model.impl.DefaultConceptDescription) DefaultKey(io.adminshell.aas.v3.model.impl.DefaultKey) Level(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level) HttpResponse(java.net.http.HttpResponse) IdentifierType(io.adminshell.aas.v3.model.IdentifierType) MessageBusHelper.assertEvent(de.fraunhofer.iosb.ilt.faaast.service.test.util.MessageBusHelper.assertEvent) EncodingHelper(de.fraunhofer.iosb.ilt.faaast.service.util.EncodingHelper) ApiPaths(de.fraunhofer.iosb.ilt.faaast.service.test.util.ApiPaths) Reference(io.adminshell.aas.v3.model.Reference) ElementCreateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementCreateEventMessage) SerializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.SerializationException) Collectors(java.util.stream.Collectors) IdentifierKeyValuePair(io.adminshell.aas.v3.model.IdentifierKeyValuePair) EventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.EventMessage) List(java.util.List) CoreConfig(de.fraunhofer.iosb.ilt.faaast.service.config.CoreConfig) Path(de.fraunhofer.iosb.ilt.faaast.service.serialization.json.util.Path) BeforeClass(org.junit.BeforeClass) AASFull(de.fraunhofer.iosb.ilt.faaast.service.model.AASFull) AssetAdministrationShellEnvironment(io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment) JSONAssert(org.skyscreamer.jsonassert.JSONAssert) ServiceConfig(de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig) AssetInformation(io.adminshell.aas.v3.model.AssetInformation) Identifier(io.adminshell.aas.v3.model.Identifier) ArrayList(java.util.ArrayList) DeepCopyHelper(de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper) KeyType(io.adminshell.aas.v3.model.KeyType) LangString(io.adminshell.aas.v3.model.LangString) DefaultAssetAdministrationShell(io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell) ElementDeleteEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementDeleteEventMessage) Before(org.junit.Before) MessageBus(de.fraunhofer.iosb.ilt.faaast.service.messagebus.MessageBus) HttpMethod(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.model.HttpMethod) MessageBusException(de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException) DefaultSubmodel(io.adminshell.aas.v3.model.impl.DefaultSubmodel) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) HttpEndpointConfig(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.HttpEndpointConfig) IOException(java.io.IOException) Test(org.junit.Test) JsonSerializer(de.fraunhofer.iosb.ilt.faaast.service.dataformat.json.JsonSerializer) PersistenceInMemoryConfig(de.fraunhofer.iosb.ilt.faaast.service.persistence.memory.PersistenceInMemoryConfig) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) LambdaExceptionHelper(de.fraunhofer.iosb.ilt.faaast.service.util.LambdaExceptionHelper) ElementUpdateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementUpdateEventMessage) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) Assert(org.junit.Assert) Content(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Content) Submodel(io.adminshell.aas.v3.model.Submodel) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) Test(org.junit.Test)

Example 33 with DeserializationException

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)));
}
Also used : DefaultSubmodel(io.adminshell.aas.v3.model.impl.DefaultSubmodel) Submodel(io.adminshell.aas.v3.model.Submodel) HttpHelper(de.fraunhofer.iosb.ilt.faaast.service.test.util.HttpHelper) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) ElementReadEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.access.ElementReadEventMessage) HttpHelper.toHttpStatusCode(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.util.HttpHelper.toHttpStatusCode) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) URISyntaxException(java.net.URISyntaxException) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) Service(de.fraunhofer.iosb.ilt.faaast.service.Service) SubmodelElementCollection(io.adminshell.aas.v3.model.SubmodelElementCollection) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) DefaultProperty(io.adminshell.aas.v3.model.impl.DefaultProperty) MessageBusInternalConfig(de.fraunhofer.iosb.ilt.faaast.service.messagebus.internal.MessageBusInternalConfig) ServerSocket(java.net.ServerSocket) StatusCode(de.fraunhofer.iosb.ilt.faaast.service.model.api.StatusCode) DeserializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.DeserializationException) DefaultIdentifierKeyValuePair(io.adminshell.aas.v3.model.impl.DefaultIdentifierKeyValuePair) Map(java.util.Map) After(org.junit.After) FaaastConstants(de.fraunhofer.iosb.ilt.faaast.service.util.FaaastConstants) DefaultConceptDescription(io.adminshell.aas.v3.model.impl.DefaultConceptDescription) DefaultKey(io.adminshell.aas.v3.model.impl.DefaultKey) Level(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level) HttpResponse(java.net.http.HttpResponse) IdentifierType(io.adminshell.aas.v3.model.IdentifierType) MessageBusHelper.assertEvent(de.fraunhofer.iosb.ilt.faaast.service.test.util.MessageBusHelper.assertEvent) EncodingHelper(de.fraunhofer.iosb.ilt.faaast.service.util.EncodingHelper) ApiPaths(de.fraunhofer.iosb.ilt.faaast.service.test.util.ApiPaths) Reference(io.adminshell.aas.v3.model.Reference) ElementCreateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementCreateEventMessage) SerializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.SerializationException) Collectors(java.util.stream.Collectors) IdentifierKeyValuePair(io.adminshell.aas.v3.model.IdentifierKeyValuePair) EventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.EventMessage) List(java.util.List) CoreConfig(de.fraunhofer.iosb.ilt.faaast.service.config.CoreConfig) Path(de.fraunhofer.iosb.ilt.faaast.service.serialization.json.util.Path) BeforeClass(org.junit.BeforeClass) AASFull(de.fraunhofer.iosb.ilt.faaast.service.model.AASFull) AssetAdministrationShellEnvironment(io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment) JSONAssert(org.skyscreamer.jsonassert.JSONAssert) ServiceConfig(de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig) AssetInformation(io.adminshell.aas.v3.model.AssetInformation) Identifier(io.adminshell.aas.v3.model.Identifier) ArrayList(java.util.ArrayList) DeepCopyHelper(de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper) KeyType(io.adminshell.aas.v3.model.KeyType) LangString(io.adminshell.aas.v3.model.LangString) DefaultAssetAdministrationShell(io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell) ElementDeleteEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementDeleteEventMessage) Before(org.junit.Before) MessageBus(de.fraunhofer.iosb.ilt.faaast.service.messagebus.MessageBus) HttpMethod(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.model.HttpMethod) MessageBusException(de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException) DefaultSubmodel(io.adminshell.aas.v3.model.impl.DefaultSubmodel) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) HttpEndpointConfig(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.HttpEndpointConfig) IOException(java.io.IOException) Test(org.junit.Test) JsonSerializer(de.fraunhofer.iosb.ilt.faaast.service.dataformat.json.JsonSerializer) PersistenceInMemoryConfig(de.fraunhofer.iosb.ilt.faaast.service.persistence.memory.PersistenceInMemoryConfig) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) LambdaExceptionHelper(de.fraunhofer.iosb.ilt.faaast.service.util.LambdaExceptionHelper) ElementUpdateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementUpdateEventMessage) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) Assert(org.junit.Assert) Content(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Content) Submodel(io.adminshell.aas.v3.model.Submodel) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) Test(org.junit.Test)

Example 34 with DeserializationException

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)));
}
Also used : HttpHelper(de.fraunhofer.iosb.ilt.faaast.service.test.util.HttpHelper) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) ElementReadEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.access.ElementReadEventMessage) HttpHelper.toHttpStatusCode(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.util.HttpHelper.toHttpStatusCode) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) URISyntaxException(java.net.URISyntaxException) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) Service(de.fraunhofer.iosb.ilt.faaast.service.Service) SubmodelElementCollection(io.adminshell.aas.v3.model.SubmodelElementCollection) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) DefaultProperty(io.adminshell.aas.v3.model.impl.DefaultProperty) MessageBusInternalConfig(de.fraunhofer.iosb.ilt.faaast.service.messagebus.internal.MessageBusInternalConfig) ServerSocket(java.net.ServerSocket) StatusCode(de.fraunhofer.iosb.ilt.faaast.service.model.api.StatusCode) DeserializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.DeserializationException) DefaultIdentifierKeyValuePair(io.adminshell.aas.v3.model.impl.DefaultIdentifierKeyValuePair) Map(java.util.Map) After(org.junit.After) FaaastConstants(de.fraunhofer.iosb.ilt.faaast.service.util.FaaastConstants) DefaultConceptDescription(io.adminshell.aas.v3.model.impl.DefaultConceptDescription) DefaultKey(io.adminshell.aas.v3.model.impl.DefaultKey) Level(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level) HttpResponse(java.net.http.HttpResponse) IdentifierType(io.adminshell.aas.v3.model.IdentifierType) MessageBusHelper.assertEvent(de.fraunhofer.iosb.ilt.faaast.service.test.util.MessageBusHelper.assertEvent) EncodingHelper(de.fraunhofer.iosb.ilt.faaast.service.util.EncodingHelper) ApiPaths(de.fraunhofer.iosb.ilt.faaast.service.test.util.ApiPaths) Reference(io.adminshell.aas.v3.model.Reference) ElementCreateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementCreateEventMessage) SerializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.SerializationException) Collectors(java.util.stream.Collectors) IdentifierKeyValuePair(io.adminshell.aas.v3.model.IdentifierKeyValuePair) EventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.EventMessage) List(java.util.List) CoreConfig(de.fraunhofer.iosb.ilt.faaast.service.config.CoreConfig) Path(de.fraunhofer.iosb.ilt.faaast.service.serialization.json.util.Path) BeforeClass(org.junit.BeforeClass) AASFull(de.fraunhofer.iosb.ilt.faaast.service.model.AASFull) AssetAdministrationShellEnvironment(io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment) JSONAssert(org.skyscreamer.jsonassert.JSONAssert) ServiceConfig(de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig) AssetInformation(io.adminshell.aas.v3.model.AssetInformation) Identifier(io.adminshell.aas.v3.model.Identifier) ArrayList(java.util.ArrayList) DeepCopyHelper(de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper) KeyType(io.adminshell.aas.v3.model.KeyType) LangString(io.adminshell.aas.v3.model.LangString) DefaultAssetAdministrationShell(io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell) ElementDeleteEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementDeleteEventMessage) Before(org.junit.Before) MessageBus(de.fraunhofer.iosb.ilt.faaast.service.messagebus.MessageBus) HttpMethod(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.model.HttpMethod) MessageBusException(de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException) DefaultSubmodel(io.adminshell.aas.v3.model.impl.DefaultSubmodel) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) HttpEndpointConfig(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.HttpEndpointConfig) IOException(java.io.IOException) Test(org.junit.Test) JsonSerializer(de.fraunhofer.iosb.ilt.faaast.service.dataformat.json.JsonSerializer) PersistenceInMemoryConfig(de.fraunhofer.iosb.ilt.faaast.service.persistence.memory.PersistenceInMemoryConfig) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) LambdaExceptionHelper(de.fraunhofer.iosb.ilt.faaast.service.util.LambdaExceptionHelper) ElementUpdateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementUpdateEventMessage) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) Assert(org.junit.Assert) Content(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Content) Submodel(io.adminshell.aas.v3.model.Submodel) DefaultAssetAdministrationShell(io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) Test(org.junit.Test)

Example 35 with DeserializationException

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));
}
Also used : DefaultSubmodel(io.adminshell.aas.v3.model.impl.DefaultSubmodel) Submodel(io.adminshell.aas.v3.model.Submodel) HttpHelper(de.fraunhofer.iosb.ilt.faaast.service.test.util.HttpHelper) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) ElementReadEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.access.ElementReadEventMessage) HttpHelper.toHttpStatusCode(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.util.HttpHelper.toHttpStatusCode) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) URISyntaxException(java.net.URISyntaxException) OutputModifier(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier) Service(de.fraunhofer.iosb.ilt.faaast.service.Service) SubmodelElementCollection(io.adminshell.aas.v3.model.SubmodelElementCollection) DefaultIdentifier(io.adminshell.aas.v3.model.impl.DefaultIdentifier) DefaultProperty(io.adminshell.aas.v3.model.impl.DefaultProperty) MessageBusInternalConfig(de.fraunhofer.iosb.ilt.faaast.service.messagebus.internal.MessageBusInternalConfig) ServerSocket(java.net.ServerSocket) StatusCode(de.fraunhofer.iosb.ilt.faaast.service.model.api.StatusCode) DeserializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.DeserializationException) DefaultIdentifierKeyValuePair(io.adminshell.aas.v3.model.impl.DefaultIdentifierKeyValuePair) Map(java.util.Map) After(org.junit.After) FaaastConstants(de.fraunhofer.iosb.ilt.faaast.service.util.FaaastConstants) DefaultConceptDescription(io.adminshell.aas.v3.model.impl.DefaultConceptDescription) DefaultKey(io.adminshell.aas.v3.model.impl.DefaultKey) Level(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level) HttpResponse(java.net.http.HttpResponse) IdentifierType(io.adminshell.aas.v3.model.IdentifierType) MessageBusHelper.assertEvent(de.fraunhofer.iosb.ilt.faaast.service.test.util.MessageBusHelper.assertEvent) EncodingHelper(de.fraunhofer.iosb.ilt.faaast.service.util.EncodingHelper) ApiPaths(de.fraunhofer.iosb.ilt.faaast.service.test.util.ApiPaths) Reference(io.adminshell.aas.v3.model.Reference) ElementCreateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementCreateEventMessage) SerializationException(de.fraunhofer.iosb.ilt.faaast.service.dataformat.SerializationException) Collectors(java.util.stream.Collectors) IdentifierKeyValuePair(io.adminshell.aas.v3.model.IdentifierKeyValuePair) EventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.EventMessage) List(java.util.List) CoreConfig(de.fraunhofer.iosb.ilt.faaast.service.config.CoreConfig) Path(de.fraunhofer.iosb.ilt.faaast.service.serialization.json.util.Path) BeforeClass(org.junit.BeforeClass) AASFull(de.fraunhofer.iosb.ilt.faaast.service.model.AASFull) AssetAdministrationShellEnvironment(io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment) JSONAssert(org.skyscreamer.jsonassert.JSONAssert) ServiceConfig(de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig) AssetInformation(io.adminshell.aas.v3.model.AssetInformation) Identifier(io.adminshell.aas.v3.model.Identifier) ArrayList(java.util.ArrayList) DeepCopyHelper(de.fraunhofer.iosb.ilt.faaast.service.util.DeepCopyHelper) KeyType(io.adminshell.aas.v3.model.KeyType) LangString(io.adminshell.aas.v3.model.LangString) DefaultAssetAdministrationShell(io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell) ElementDeleteEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementDeleteEventMessage) Before(org.junit.Before) MessageBus(de.fraunhofer.iosb.ilt.faaast.service.messagebus.MessageBus) HttpMethod(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.model.HttpMethod) MessageBusException(de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException) DefaultSubmodel(io.adminshell.aas.v3.model.impl.DefaultSubmodel) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) HttpEndpointConfig(de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.HttpEndpointConfig) IOException(java.io.IOException) Test(org.junit.Test) JsonSerializer(de.fraunhofer.iosb.ilt.faaast.service.dataformat.json.JsonSerializer) PersistenceInMemoryConfig(de.fraunhofer.iosb.ilt.faaast.service.persistence.memory.PersistenceInMemoryConfig) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) LambdaExceptionHelper(de.fraunhofer.iosb.ilt.faaast.service.util.LambdaExceptionHelper) ElementUpdateEventMessage(de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ElementUpdateEventMessage) AssetAdministrationShell(io.adminshell.aas.v3.model.AssetAdministrationShell) Assert(org.junit.Assert) Content(de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Content) Submodel(io.adminshell.aas.v3.model.Submodel) SubmodelElement(io.adminshell.aas.v3.model.SubmodelElement) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)63 AssetAdministrationShell (io.adminshell.aas.v3.model.AssetAdministrationShell)47 DefaultAssetAdministrationShell (io.adminshell.aas.v3.model.impl.DefaultAssetAdministrationShell)47 LangString (io.adminshell.aas.v3.model.LangString)42 Submodel (io.adminshell.aas.v3.model.Submodel)40 DefaultSubmodel (io.adminshell.aas.v3.model.impl.DefaultSubmodel)40 AssetAdministrationShellEnvironment (io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment)36 AssetInformation (io.adminshell.aas.v3.model.AssetInformation)35 SubmodelElement (io.adminshell.aas.v3.model.SubmodelElement)35 IOException (java.io.IOException)35 ArrayList (java.util.ArrayList)35 Reference (io.adminshell.aas.v3.model.Reference)34 DefaultReference (io.adminshell.aas.v3.model.impl.DefaultReference)34 List (java.util.List)34 Collectors (java.util.stream.Collectors)34 DeserializationException (de.fraunhofer.iosb.ilt.faaast.service.dataformat.DeserializationException)33 Service (de.fraunhofer.iosb.ilt.faaast.service.Service)32 ServiceConfig (de.fraunhofer.iosb.ilt.faaast.service.config.ServiceConfig)32 JsonSerializer (de.fraunhofer.iosb.ilt.faaast.service.dataformat.json.JsonSerializer)32 HttpEndpointConfig (de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.HttpEndpointConfig)32