diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/pom.xml b/basyx.aasenvironment/basyx.aasenvironment-client/pom.xml
new file mode 100644
index 000000000..926097d98
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/pom.xml
@@ -0,0 +1,79 @@
+
+ 4.0.0
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasenvironment
+ ${revision}
+
+
+ BaSyx AAS Environment Client
+ BaSyx AAS Environment Client
+
+ basyx.aasenvironment-client
+
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.client
+
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasenvironment-core
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasrepository-client
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasservice-client
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasrepository-feature-registry-integration
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasrepository-feature-registry-integration
+ tests
+ test
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.submodelrepository-client
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.submodelrepository-feature-registry-integration
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.submodelrepository-feature-registry-integration
+ tests
+ test
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasenvironment-core
+ tests
+ test
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasregistry-client-native
+
+
+ org.eclipse.digitaltwin.basyx
+ basyx.submodelregistry-client-native
+
+
+ org.mockito
+ mockito-core
+ test
+
+
+
\ No newline at end of file
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/ConnectedAasManager.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/ConnectedAasManager.java
new file mode 100644
index 000000000..d49424658
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/ConnectedAasManager.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client;
+
+import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.AasUtils;
+import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell;
+import org.eclipse.digitaltwin.aas4j.v3.model.Submodel;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.exceptions.NoValidEndpointFoundException;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.exceptions.RegistryHttpRequestException;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.AasDescriptorResolver;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.SubmodelDescriptorResolver;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.api.RegistryAndDiscoveryInterfaceApi;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetAdministrationShellDescriptor;
+import org.eclipse.digitaltwin.basyx.aasrepository.client.ConnectedAasRepository;
+import org.eclipse.digitaltwin.basyx.aasrepository.feature.registry.integration.AasDescriptorFactory;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.api.SubmodelRegistryApi;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.SubmodelDescriptor;
+import org.eclipse.digitaltwin.basyx.submodelrepository.client.ConnectedSubmodelRepository;
+import org.eclipse.digitaltwin.basyx.submodelrepository.feature.registry.integration.SubmodelDescriptorFactory;
+
+/**
+ * Client component for executing consolidated Repository and Registry requests
+ *
+ * @author mateusmolina
+ *
+ */
+public class ConnectedAasManager {
+
+ private final ConnectedAasRepository aasRepository;
+ private final ConnectedSubmodelRepository smRepository;
+
+ private final RegistryAndDiscoveryInterfaceApi aasRegistryApi;
+ private final SubmodelRegistryApi smRegistryApi;
+
+ private final AasDescriptorResolver aasDescriptorResolver;
+ private final AasDescriptorFactory aasDescriptorFactory;
+
+ private final SubmodelDescriptorResolver smDescriptorResolver;
+ private final SubmodelDescriptorFactory smDescriptorFactory;
+
+ /**
+ * Default constructor for a {@link ConnectedAasManager} instance
+ *
+ * @param aasRegistryBaseUrl
+ * @param aasRepositoryBaseUrl
+ * @param submodelRegistryBaseUrl
+ * @param submodelBaseRepositoryUrl
+ */
+ public ConnectedAasManager(String aasRegistryBaseUrl, String aasRepositoryBaseUrl, String submodelRegistryBaseUrl, String submodelBaseRepositoryUrl) {
+ this(new RegistryAndDiscoveryInterfaceApi(aasRegistryBaseUrl), new ConnectedAasRepository(aasRepositoryBaseUrl), aasRepositoryBaseUrl, new SubmodelRegistryApi(submodelRegistryBaseUrl),
+ new ConnectedSubmodelRepository(submodelBaseRepositoryUrl), submodelBaseRepositoryUrl);
+ }
+
+ ConnectedAasManager(RegistryAndDiscoveryInterfaceApi aasRegistryApi, ConnectedAasRepository aasRepository, String aasRepositoryBaseUrl, SubmodelRegistryApi smRegistryApi, ConnectedSubmodelRepository smRepository,
+ String submodelBaseRepositoryUrl) {
+ this.aasRepository = aasRepository;
+ this.aasRegistryApi = aasRegistryApi;
+ this.smRepository = smRepository;
+ this.smRegistryApi = smRegistryApi;
+ this.aasDescriptorResolver = ConnectedAasManagerHelper.buildAasDescriptorResolver();
+ this.aasDescriptorFactory = ConnectedAasManagerHelper.buildAasDescriptorFactory(aasRepositoryBaseUrl);
+ this.smDescriptorResolver = ConnectedAasManagerHelper.buildSubmodelDescriptorResolver();
+ this.smDescriptorFactory = ConnectedAasManagerHelper.buildSmDescriptorFactory(submodelBaseRepositoryUrl);
+ }
+
+ /**
+ * Retrieves an AAS in an AAS registry by its identifier.
+ *
+ * @param identifier
+ * The identifier of the AAS to retrieve.
+ * @return The retrieved AAS object.
+ */
+ public AssetAdministrationShell getAas(String identifier) throws NoValidEndpointFoundException {
+ AssetAdministrationShellDescriptor descriptor;
+
+ try {
+ descriptor = aasRegistryApi.getAssetAdministrationShellDescriptorById(identifier);
+ } catch (Exception e) {
+ throw new RegistryHttpRequestException(identifier, e);
+ }
+ return aasDescriptorResolver.resolveAasDescriptor(descriptor);
+ }
+
+ /**
+ * Retrieves a Submodel in a Submodel registry by its identifier.
+ *
+ * @param identifier
+ * The identifier of the submodel to retrieve.
+ * @return The retrieved Submodel object.
+ */
+ public Submodel getSubmodel(String identifier) {
+ SubmodelDescriptor descriptor;
+
+ try {
+ descriptor = smRegistryApi.getSubmodelDescriptorById(identifier);
+ } catch (Exception e) {
+ throw new RegistryHttpRequestException(identifier, e);
+ }
+
+ return smDescriptorResolver.resolveSubmodelDescriptor(descriptor);
+ }
+
+ /**
+ * Deletes an AAS by its identifier.
+ *
+ * @param identifier
+ * The identifier of the AAS to delete.
+ */
+ public void deleteAas(String identifier) {
+ try {
+ aasRegistryApi.deleteAssetAdministrationShellDescriptorById(identifier);
+ } catch (Exception e) {
+ throw new RegistryHttpRequestException(identifier, e);
+ }
+
+ aasRepository.deleteAas(identifier);
+ }
+
+ /**
+ * Deletes a submodel associated with a specified AAS.
+ *
+ * @param aasIdentifier
+ * The identifier of the AAS.
+ * @param smIdentifier
+ * The identifier of the submodel to delete.
+ */
+ public void deleteSubmodelOfAas(String aasIdentifier, String smIdentifier) {
+ try {
+ smRegistryApi.deleteSubmodelDescriptorById(smIdentifier);
+ } catch (Exception e) {
+ throw new RegistryHttpRequestException(aasIdentifier, e);
+ }
+
+ aasRepository.removeSubmodelReference(aasIdentifier, smIdentifier);
+ smRepository.deleteSubmodel(smIdentifier);
+ }
+
+ /**
+ * Creates a new AAS
+ *
+ * @param aas
+ * The AAS object to create.
+ */
+ public void createAas(AssetAdministrationShell aas) {
+ aasRepository.createAas(aas);
+ AssetAdministrationShellDescriptor descriptor = aasDescriptorFactory.create(aas);
+
+ try {
+ aasRegistryApi.postAssetAdministrationShellDescriptor(descriptor);
+ } catch (Exception e) {
+ throw new RegistryHttpRequestException(aas.getId(), e);
+ }
+ }
+
+ /**
+ * Creates a submodel under a specified AAS.
+ *
+ * @param aasIdentifier
+ * The identifier of the AAS.
+ * @param submodel
+ * The Submodel object to create under the specified AAS.
+ */
+ public void createSubmodelInAas(String aasIdentifier, Submodel submodel) {
+ smRepository.createSubmodel(submodel);
+ SubmodelDescriptor descriptor = smDescriptorFactory.create(submodel);
+
+ try {
+ smRegistryApi.postSubmodelDescriptor(descriptor);
+ } catch (Exception e) {
+ throw new RegistryHttpRequestException(aasIdentifier, e);
+ }
+
+ aasRepository.addSubmodelReference(aasIdentifier, AasUtils.toReference(submodel));
+ }
+
+}
+
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/ConnectedAasManagerHelper.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/ConnectedAasManagerHelper.java
new file mode 100644
index 000000000..6fee5a8b5
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/ConnectedAasManagerHelper.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client;
+
+
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.AasDescriptorResolver;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.EndpointResolver;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.SubmodelDescriptorResolver;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.parsers.AasRegistryEndpointURIParser;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.parsers.SubmodelRegistryEndpointURIParser;
+import org.eclipse.digitaltwin.basyx.aasrepository.feature.registry.integration.AasDescriptorFactory;
+import org.eclipse.digitaltwin.basyx.aasrepository.feature.registry.integration.mapper.AttributeMapper;
+import org.eclipse.digitaltwin.basyx.http.Aas4JHTTPSerializationExtension;
+import org.eclipse.digitaltwin.basyx.submodelrepository.feature.registry.integration.SubmodelDescriptorFactory;
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Provides builder methods for {@link ConnectedAasManager} dependencies
+ *
+ * @author mateusmolina
+ *
+ */
+class ConnectedAasManagerHelper {
+
+ public static final ObjectMapper objectMapper = buildObjectMapper();
+
+ private ConnectedAasManagerHelper() {
+ }
+
+ public static ObjectMapper buildObjectMapper() {
+ Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder().serializationInclusion(JsonInclude.Include.NON_NULL);
+ Aas4JHTTPSerializationExtension extension = new Aas4JHTTPSerializationExtension();
+ extension.extend(builder);
+ return builder.build();
+ }
+
+ public static AasDescriptorResolver buildAasDescriptorResolver() {
+ return new AasDescriptorResolver(new EndpointResolver<>(new AasRegistryEndpointURIParser()));
+ }
+
+ public static SubmodelDescriptorResolver buildSubmodelDescriptorResolver() {
+ return new SubmodelDescriptorResolver(new EndpointResolver<>(new SubmodelRegistryEndpointURIParser()));
+ }
+
+ public static AasDescriptorFactory buildAasDescriptorFactory(String aasRepositoryBaseUrl) {
+ AttributeMapper attributeMapper = new AttributeMapper(objectMapper);
+
+ return new AasDescriptorFactory(null, aasRepositoryBaseUrl, attributeMapper);
+ }
+
+ public static SubmodelDescriptorFactory buildSmDescriptorFactory(String aasRepositoryBaseUrl) {
+ org.eclipse.digitaltwin.basyx.submodelrepository.feature.registry.integration.mapper.AttributeMapper attributeMapperSm = new org.eclipse.digitaltwin.basyx.submodelrepository.feature.registry.integration.mapper.AttributeMapper(
+ objectMapper);
+ return new SubmodelDescriptorFactory(null, aasRepositoryBaseUrl, attributeMapperSm);
+ }
+
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/exceptions/NoValidEndpointFoundException.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/exceptions/NoValidEndpointFoundException.java
new file mode 100644
index 000000000..4b700e6c0
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/exceptions/NoValidEndpointFoundException.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client.exceptions;
+
+/**
+ * Indicates a failure in finding a valid endpoint from a list of endpoints
+ *
+ * @author mateusmolina
+ *
+ */
+@SuppressWarnings("serial")
+public class NoValidEndpointFoundException extends RuntimeException {
+ public NoValidEndpointFoundException(String endpoints) {
+ super(getMessage(endpoints));
+ }
+
+ public static String getMessage(String endpoints) {
+ return "No valid endpoint found in " + endpoints;
+ }
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/exceptions/RegistryHttpRequestException.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/exceptions/RegistryHttpRequestException.java
new file mode 100644
index 000000000..11662abec
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/exceptions/RegistryHttpRequestException.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client.exceptions;
+
+/**
+ * Indicates failure in performing a request to a registry server
+ *
+ * @author mateusmolina
+ *
+ */
+@SuppressWarnings("serial")
+public class RegistryHttpRequestException extends RuntimeException {
+
+ public RegistryHttpRequestException(String id, Throwable th) {
+ super(getMessage(id), th);
+ }
+
+ private static String getMessage(String id) {
+ return "Unable to execute registry request on element '" + id + "'";
+ }
+
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/AasDescriptorResolver.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/AasDescriptorResolver.java
new file mode 100644
index 000000000..7f813bc07
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/AasDescriptorResolver.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers;
+
+import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetAdministrationShellDescriptor;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.Endpoint;
+import org.eclipse.digitaltwin.basyx.aasservice.client.ConnectedAasService;
+
+/**
+ * Resolves an AasDescriptor into an AssetAdministrationShell
+ *
+ * @author mateusmolina
+ *
+ */
+public class AasDescriptorResolver {
+
+ private final EndpointResolver endpointResolver;
+
+ public AasDescriptorResolver(EndpointResolver endpointResolver) {
+ this.endpointResolver = endpointResolver;
+ }
+
+ public AssetAdministrationShell resolveAasDescriptor(AssetAdministrationShellDescriptor aasDescriptor) {
+ String endpoint = endpointResolver.resolveFirst(aasDescriptor.getEndpoints());
+
+ ConnectedAasService aasService = new ConnectedAasService(endpoint);
+
+ return aasService.getAAS();
+ }
+
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/EndpointResolver.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/EndpointResolver.java
new file mode 100644
index 000000000..6a551799b
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/EndpointResolver.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers;
+
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.util.List;
+import java.util.Optional;
+
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.exceptions.NoValidEndpointFoundException;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.parsers.URIParser;
+
+/**
+ * Resolves a list of endpoints based on find first working strategy
+ *
+ * @author mateusmolina
+ *
+ */
+public class EndpointResolver {
+
+ private final URIParser parser;
+
+ private int timeout = 3000;
+
+ public EndpointResolver(URIParser parser) {
+ this.parser = parser;
+ }
+
+ public EndpointResolver(URIParser parser, int timeout) {
+ this(parser);
+ this.timeout = timeout;
+ }
+
+ public String resolveFirst(List endpoints) {
+ List uris = endpoints.stream().map(parser::parse).flatMap(Optional::stream).toList();
+ return findFirstWorkingURI(uris).orElseThrow(() -> new NoValidEndpointFoundException(endpoints.toString())).toString();
+ }
+
+ public List resolveAll(List endpoints) {
+ return endpoints.stream().map(parser::parse).flatMap(Optional::stream).filter(this::isURIWorking).map(URI::toString).toList();
+ }
+
+ private Optional findFirstWorkingURI(List uris) {
+ return uris.stream().filter(this::isURIWorking).findFirst();
+ }
+
+ private boolean isURIWorking(URI uri) {
+ HttpURLConnection connection = null;
+ try {
+ connection = (HttpURLConnection) uri.toURL().openConnection();
+ connection.setRequestMethod("HEAD");
+ connection.setConnectTimeout(timeout);
+ connection.setReadTimeout(timeout);
+ int responseCode = connection.getResponseCode();
+ return (200 <= responseCode && responseCode <= 399);
+ } catch (Exception e) {
+ return false;
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/SubmodelDescriptorResolver.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/SubmodelDescriptorResolver.java
new file mode 100644
index 000000000..9d49e3edb
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/SubmodelDescriptorResolver.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers;
+
+import org.eclipse.digitaltwin.aas4j.v3.model.Key;
+import org.eclipse.digitaltwin.aas4j.v3.model.KeyTypes;
+import org.eclipse.digitaltwin.aas4j.v3.model.Reference;
+import org.eclipse.digitaltwin.aas4j.v3.model.ReferenceTypes;
+import org.eclipse.digitaltwin.aas4j.v3.model.Submodel;
+import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultKey;
+import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultReference;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.Endpoint;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.SubmodelDescriptor;
+import org.eclipse.digitaltwin.basyx.submodelservice.client.ConnectedSubmodelService;
+
+/**
+ * Resolves an SubmodelDescriptor into a Submodel
+ *
+ * @author mateusmolina
+ *
+ */
+public class SubmodelDescriptorResolver {
+
+ private final EndpointResolver endpointResolver;
+
+ public SubmodelDescriptorResolver(EndpointResolver endpointResolver) {
+ this.endpointResolver = endpointResolver;
+ }
+
+ public Submodel resolveSubmodelDescriptor(SubmodelDescriptor smDescriptor) {
+ String endpoint = endpointResolver.resolveFirst(smDescriptor.getEndpoints());
+
+ ConnectedSubmodelService smService = new ConnectedSubmodelService(endpoint);
+
+ return smService.getSubmodel();
+ }
+
+ public Reference deriveReferenceFromSubmodelDescriptor(SubmodelDescriptor smDescriptor) {
+ return new DefaultReference.Builder().type(ReferenceTypes.EXTERNAL_REFERENCE).keys(generateKeyFromId(smDescriptor.getId())).build();
+ }
+
+ private static Key generateKeyFromId(String smId) {
+ return new DefaultKey.Builder().type(KeyTypes.SUBMODEL).value(smId).build();
+ }
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/AasRegistryEndpointURIParser.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/AasRegistryEndpointURIParser.java
new file mode 100644
index 000000000..2cc37abaf
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/AasRegistryEndpointURIParser.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.parsers;
+
+import java.net.URI;
+import java.util.Optional;
+
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.Endpoint;
+
+/**
+ * Parser for AasRegistry Endpoint Model
+ *
+ * @author mateusmolina
+ *
+ */
+public class AasRegistryEndpointURIParser implements URIParser {
+
+ @Override
+ public Optional parse(Endpoint endpoint) {
+ return parseEndpoint(endpoint);
+ }
+
+ private static Optional parseEndpoint(Endpoint endpoint) {
+ try {
+ if (endpoint == null || endpoint.getProtocolInformation() == null || endpoint.getProtocolInformation().getHref() == null)
+ return Optional.empty();
+
+ String baseHref = endpoint.getProtocolInformation().getHref();
+ // TODO not working: String queryString = "?" + endpoint.toUrlQueryString();
+ String queryString = "";
+ URI uri = new URI(baseHref + queryString);
+ return Optional.of(uri);
+ } catch (Exception e) {
+ return Optional.empty();
+ }
+ }
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/SubmodelRegistryEndpointURIParser.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/SubmodelRegistryEndpointURIParser.java
new file mode 100644
index 000000000..e0590af11
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/SubmodelRegistryEndpointURIParser.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.parsers;
+
+import java.net.URI;
+import java.util.Optional;
+
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.Endpoint;
+
+/**
+ * Parser for SubmodelRegistry Endpoint Model
+ *
+ * @author mateusmolina
+ *
+ */
+public class SubmodelRegistryEndpointURIParser implements URIParser {
+
+ @Override
+ public Optional parse(Endpoint endpoint) {
+ return parseEndpoint(endpoint);
+ }
+
+ private static Optional parseEndpoint(Endpoint endpoint) {
+ try {
+ if (endpoint == null || endpoint.getProtocolInformation() == null || endpoint.getProtocolInformation().getHref() == null)
+ return Optional.empty();
+
+ String baseHref = endpoint.getProtocolInformation().getHref();
+ // TODO not working: String queryString = "?" + endpoint.toUrlQueryString();
+ String queryString = "";
+ URI uri = new URI(baseHref + queryString);
+ return Optional.of(uri);
+ } catch (Exception e) {
+ return Optional.empty();
+ }
+ }
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/URIParser.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/URIParser.java
new file mode 100644
index 000000000..9959a83e3
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/URIParser.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.parsers;
+
+import java.net.URI;
+import java.util.Optional;
+
+/**
+ * Parses an object into an URI
+ *
+ * @author mateusmolina
+ *
+ */
+public interface URIParser {
+ public Optional parse(T object);
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/DummyAasEnvironmentComponent.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/DummyAasEnvironmentComponent.java
new file mode 100644
index 000000000..665c54ccc
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/DummyAasEnvironmentComponent.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * DummyAasEnvironmentComponent
+ *
+ * @author mateusmolina
+ *
+ */
+@SpringBootApplication(scanBasePackages = "org.eclipse.digitaltwin.basyx")
+public class DummyAasEnvironmentComponent {
+ public static void main(String[] args) {
+ SpringApplication.run(DummyAasEnvironmentComponent.class, args);
+ }
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/DummyAasEnvironmentConfiguration.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/DummyAasEnvironmentConfiguration.java
new file mode 100644
index 000000000..b8bdf7e4a
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/DummyAasEnvironmentConfiguration.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client;
+
+import java.util.List;
+
+import org.eclipse.digitaltwin.basyx.aasenvironment.AasEnvironment;
+import org.eclipse.digitaltwin.basyx.aasenvironment.AasEnvironmentFactory;
+import org.eclipse.digitaltwin.basyx.aasenvironment.feature.AasEnvironmentFeature;
+import org.eclipse.digitaltwin.basyx.aasenvironment.feature.DecoratedAasEnvironmentFactory;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Dummy configuration for testing the {@link AasEnvironment} authorization
+ * feature
+ *
+ * @author mateusmolina
+ *
+ */
+@Configuration
+public class DummyAasEnvironmentConfiguration {
+
+ @Bean
+ @ConditionalOnMissingBean
+ public static AasEnvironment getAasEnvironment(AasEnvironmentFactory aasEnvironmentFactory, List features) {
+ return new DecoratedAasEnvironmentFactory(aasEnvironmentFactory, features).create();
+ }
+
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/TestConnectedAasManager.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/TestConnectedAasManager.java
new file mode 100644
index 000000000..447f32458
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/TestConnectedAasManager.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+
+import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell;
+import org.eclipse.digitaltwin.aas4j.v3.model.Submodel;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.exceptions.NoValidEndpointFoundException;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.ApiException;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.api.RegistryAndDiscoveryInterfaceApi;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetAdministrationShellDescriptor;
+import org.eclipse.digitaltwin.basyx.aasrepository.AasRepository;
+import org.eclipse.digitaltwin.basyx.aasrepository.client.ConnectedAasRepository;
+import org.eclipse.digitaltwin.basyx.core.exceptions.ElementDoesNotExistException;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.api.SubmodelRegistryApi;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.SubmodelDescriptor;
+import org.eclipse.digitaltwin.basyx.submodelrepository.SubmodelRepository;
+import org.eclipse.digitaltwin.basyx.submodelrepository.client.ConnectedSubmodelRepository;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.InOrder;
+import org.springframework.boot.SpringApplication;
+import org.springframework.context.ConfigurableApplicationContext;
+
+/**
+ * Test for {@link ConnectedAasManager}
+ *
+ * @author mateusmolina
+ *
+ */
+public class TestConnectedAasManager {
+ private final static String AAS_REPOSITORY_BASE_PATH = "http://localhost:8081";
+ private final static String SM_REPOSITORY_BASE_PATH = "http://localhost:8081";
+ private final static String AAS_REGISTRY_BASE_PATH = "http://localhost:8050";
+ private final static String SM_REGISTRY_BASE_PATH = "http://localhost:8060";
+
+ private static ConfigurableApplicationContext appContext;
+ private static AasRepository aasRepository;
+ private static SubmodelRepository smRepository;
+
+ private final static TestFixture FIXTURE = new TestFixture(AAS_REPOSITORY_BASE_PATH, SM_REPOSITORY_BASE_PATH);
+
+ private static ConnectedAasRepository connectedAasRepository;
+ private static ConnectedSubmodelRepository connectedSmRepository;
+ private static RegistryAndDiscoveryInterfaceApi aasRegistryApi;
+ private static SubmodelRegistryApi smRegistryApi;
+
+ private ConnectedAasManager aasManager;
+
+
+ @BeforeClass
+ public static void initApplication() {
+ appContext = new SpringApplication(DummyAasEnvironmentComponent.class).run(new String[] {});
+
+ aasRepository = appContext.getBean(AasRepository.class);
+ smRepository = appContext.getBean(SubmodelRepository.class);
+ }
+
+ @AfterClass
+ public static void cleanUpContext() {
+ appContext.close();
+ }
+
+ @Before
+ public void setupRepositories() {
+ connectedAasRepository = spy(new ConnectedAasRepository(AAS_REPOSITORY_BASE_PATH));
+ connectedSmRepository = spy(new ConnectedSubmodelRepository(SM_REPOSITORY_BASE_PATH));
+ aasRegistryApi = spy(new RegistryAndDiscoveryInterfaceApi(AAS_REGISTRY_BASE_PATH));
+ smRegistryApi = spy(new SubmodelRegistryApi(SM_REGISTRY_BASE_PATH));
+
+ aasManager = new ConnectedAasManager(aasRegistryApi, connectedAasRepository, AAS_REPOSITORY_BASE_PATH, smRegistryApi, connectedSmRepository, SM_REPOSITORY_BASE_PATH);
+
+ cleanUpRegistries();
+ populateRepositories();
+ populateRegistries();
+ }
+
+ @After
+ public void cleanUpComponents() {
+ cleanUpRegistries();
+ cleanUpRepositories();
+ }
+
+ @Test
+ public void createAas() throws ApiException {
+ AssetAdministrationShell expectedAas = FIXTURE.buildAasPos1();
+ AssetAdministrationShellDescriptor expectedDescriptor = FIXTURE.buildAasPos1Descriptor();
+
+ aasManager.createAas(expectedAas);
+
+ InOrder inOrder = inOrder(connectedAasRepository, aasRegistryApi);
+
+ inOrder.verify(connectedAasRepository, times(1)).createAas(expectedAas);
+ inOrder.verify(aasRegistryApi, times(1)).postAssetAdministrationShellDescriptor(expectedDescriptor);
+
+ assertEquals(expectedAas, aasRepository.getAas(TestFixture.AAS_POS1_ID));
+ assertEquals(expectedDescriptor, new RegistryAndDiscoveryInterfaceApi(AAS_REGISTRY_BASE_PATH).getAssetAdministrationShellDescriptorById(TestFixture.AAS_POS1_ID));
+ }
+
+ @Test
+ public void createSubmodelInAas() throws Exception {
+ Submodel expectedSm = FIXTURE.buildSmPos1();
+ SubmodelDescriptor expectedDescriptor = FIXTURE.buildSmPos1Descriptor();
+
+ aasManager.createSubmodelInAas(TestFixture.AAS_PRE1_ID, expectedSm);
+
+ InOrder inOrder = inOrder(connectedSmRepository, smRegistryApi, connectedAasRepository);
+
+ inOrder.verify(connectedSmRepository, times(1)).createSubmodel(expectedSm);
+ inOrder.verify(smRegistryApi, times(1)).postSubmodelDescriptor(expectedDescriptor);
+ inOrder.verify(connectedAasRepository, times(1)).addSubmodelReference(eq(TestFixture.AAS_PRE1_ID), any());
+
+ assertEquals(expectedSm, smRepository.getSubmodel(TestFixture.SM_POS1_ID));
+ assertEquals(expectedDescriptor, new SubmodelRegistryApi(SM_REGISTRY_BASE_PATH).getSubmodelDescriptorById(TestFixture.SM_POS1_ID));
+ }
+
+ @Test
+ public void deleteAas() throws ApiException {
+ aasManager.deleteAas(TestFixture.AAS_PRE1_ID);
+
+ InOrder inOrder = inOrder(aasRegistryApi, connectedAasRepository);
+
+ inOrder.verify(aasRegistryApi, times(1)).deleteAssetAdministrationShellDescriptorById(TestFixture.AAS_PRE1_ID);
+ inOrder.verify(connectedAasRepository, times(1)).deleteAas(TestFixture.AAS_PRE1_ID);
+
+ assertThrows(ElementDoesNotExistException.class, () -> aasRepository.getAas(TestFixture.AAS_PRE1_ID));
+ assertThrows(Exception.class, () -> new RegistryAndDiscoveryInterfaceApi(AAS_REGISTRY_BASE_PATH).getAssetAdministrationShellDescriptorById(TestFixture.AAS_PRE1_ID));
+ }
+
+ @Test
+ public void deleteSubmodelOfAas() throws Exception {
+ aasManager.deleteSubmodelOfAas(TestFixture.AAS_PRE1_ID, TestFixture.SM_PRE1_ID);
+
+ InOrder inOrder = inOrder(smRegistryApi, connectedAasRepository, connectedSmRepository);
+
+ inOrder.verify(smRegistryApi, times(1)).deleteSubmodelDescriptorById(TestFixture.SM_PRE1_ID);
+ inOrder.verify(connectedAasRepository, times(1)).removeSubmodelReference(TestFixture.AAS_PRE1_ID, TestFixture.SM_PRE1_ID);
+ inOrder.verify(connectedSmRepository, times(1)).deleteSubmodel(TestFixture.SM_PRE1_ID);
+
+ assertThrows(ElementDoesNotExistException.class, () -> smRepository.getSubmodel(TestFixture.SM_PRE1_ID));
+ assertThrows(Exception.class, () -> new SubmodelRegistryApi(SM_REGISTRY_BASE_PATH).getSubmodelDescriptorById(TestFixture.SM_PRE1_ID));
+ }
+
+ @Test
+ public void getAas() throws ApiException, NoValidEndpointFoundException {
+ AssetAdministrationShell expectedAas = FIXTURE.buildAasPre1();
+
+ AssetAdministrationShell actualAas = aasManager.getAas(TestFixture.AAS_PRE1_ID);
+
+ assertEquals(expectedAas, actualAas);
+ }
+
+ @Test
+ public void getSubmodel() throws Exception {
+ Submodel expectedSm = FIXTURE.buildSmPre1();
+
+ Submodel actualSm = aasManager.getSubmodel(TestFixture.SM_PRE1_ID);
+
+ assertEquals(expectedSm, actualSm);
+ }
+
+ private void populateRegistries() {
+ try {
+ new RegistryAndDiscoveryInterfaceApi(AAS_REGISTRY_BASE_PATH).postAssetAdministrationShellDescriptor(FIXTURE.buildAasPre1Descriptor());
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ try {
+ new SubmodelRegistryApi(SM_REGISTRY_BASE_PATH).postSubmodelDescriptor(FIXTURE.buildSmPre1Descriptor());
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ private void cleanUpRegistries() {
+ try {
+ new RegistryAndDiscoveryInterfaceApi(AAS_REGISTRY_BASE_PATH).deleteAllShellDescriptors();
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ try {
+ new SubmodelRegistryApi(SM_REGISTRY_BASE_PATH).deleteAllSubmodelDescriptors();
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ private void populateRepositories() {
+ try {
+ aasRepository.createAas(FIXTURE.buildAasPre1());
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ try {
+ smRepository.createSubmodel(FIXTURE.buildSmPre1());
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ private void cleanUpRepositories() {
+ try {
+ aasRepository.deleteAas(TestFixture.AAS_PRE1_ID);
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ try {
+ aasRepository.deleteAas(TestFixture.AAS_POS1_ID);
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ try {
+ smRepository.deleteSubmodel(TestFixture.SM_PRE1_ID);
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ try {
+ smRepository.deleteSubmodel(TestFixture.SM_POS1_ID);
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/TestFixture.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/TestFixture.java
new file mode 100644
index 000000000..8e6a2fe96
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/TestFixture.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client;
+
+import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell;
+import org.eclipse.digitaltwin.aas4j.v3.model.AssetInformation;
+import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind;
+import org.eclipse.digitaltwin.aas4j.v3.model.KeyTypes;
+import org.eclipse.digitaltwin.aas4j.v3.model.Reference;
+import org.eclipse.digitaltwin.aas4j.v3.model.Submodel;
+import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetAdministrationShell;
+import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetInformation;
+import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultKey;
+import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultReference;
+import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodel;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetAdministrationShellDescriptor;
+import org.eclipse.digitaltwin.basyx.aasrepository.feature.registry.integration.DummyAasDescriptorFactory;
+import org.eclipse.digitaltwin.basyx.http.Base64UrlEncoder;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.SubmodelDescriptor;
+import org.eclipse.digitaltwin.basyx.submodelrepository.feature.registry.integration.DummySubmodelDescriptorFactory;
+
+/**
+ * Test fixture for {@link ConnectedAasManager} and related Components
+ *
+ * @author mateusmolina
+ *
+ */
+public class TestFixture {
+ public static final String AAS_PRE1_ID = "aasPre1";
+ public static final String AAS_PRE1_ID_ENCODED = Base64UrlEncoder.encode(AAS_PRE1_ID);
+ public static final String AAS_PRE1_IDSHORT = "aasPre1IdShort";
+ public static final String AAS_PRE1_GLOBALASSETID = "globalAssetIdPre1";
+
+ public static final String SM_PRE1_ID = "smPre1";
+ public static final String SM_PRE1_IDSHORT = "smPre1IdShort";
+ public static final String SM_PRE1_ID_ENCODED = Base64UrlEncoder.encode(SM_PRE1_ID);
+
+
+ public static final String AAS_POS1_ID = "aasPos1";
+ public static final String AAS_POS1_ID_ENCODED = Base64UrlEncoder.encode(AAS_POS1_ID);
+ public static final String AAS_POS1_IDSHORT = "aasPos1IdShort";
+ public static final String AAS_POS1_GLOBALASSETID = "globalAssetIdPos1";
+
+ public static final String SM_POS1_ID = "smPos1";
+ public static final String SM_POS1_ID_ENCODED = Base64UrlEncoder.encode(SM_POS1_ID);
+ public static final String SM_POS1_IDSHORT = "smPos1IdShort";
+
+ private final String aasRepositoryBasePath;
+ private final String smRepositoryBasePath;
+
+ public TestFixture(String aasRepositoryBasePath, String smRepositoryBasePath) {
+ this.aasRepositoryBasePath = aasRepositoryBasePath;
+ this.smRepositoryBasePath = smRepositoryBasePath;
+ }
+
+ public AssetAdministrationShell buildAasPre1() {
+ return new DefaultAssetAdministrationShell.Builder().id(AAS_PRE1_ID).idShort(AAS_PRE1_IDSHORT).submodels(buildSmPre1Ref()).assetInformation(buildAasPre1AssetInformation()).build();
+ }
+
+ public AssetInformation buildAasPre1AssetInformation() {
+ return new DefaultAssetInformation.Builder().assetKind(AssetKind.INSTANCE).globalAssetId(AAS_PRE1_GLOBALASSETID).build();
+ }
+
+ public AssetAdministrationShellDescriptor buildAasPre1Descriptor() {
+ return DummyAasDescriptorFactory.createDummyDescriptor(AAS_PRE1_ID, AAS_PRE1_IDSHORT, AAS_PRE1_GLOBALASSETID, aasRepositoryBasePath);
+ }
+
+ public Reference buildSmPre1Ref() {
+ return new DefaultReference.Builder().keys(new DefaultKey.Builder().type(KeyTypes.SUBMODEL).value(SM_PRE1_ID).build()).build();
+ }
+
+ public Submodel buildSmPre1() {
+ return new DefaultSubmodel.Builder().id(SM_PRE1_ID).idShort(SM_PRE1_IDSHORT).build();
+ }
+
+ public SubmodelDescriptor buildSmPre1Descriptor() {
+ return DummySubmodelDescriptorFactory.createDummyDescriptor(SM_PRE1_ID, SM_PRE1_IDSHORT, smRepositoryBasePath, null);
+ }
+
+ public AssetAdministrationShell buildAasPos1() {
+ return new DefaultAssetAdministrationShell.Builder().id(AAS_POS1_ID).idShort(AAS_POS1_IDSHORT).assetInformation(buildAasPos1AssetInformation()).build();
+ }
+
+ public AssetInformation buildAasPos1AssetInformation() {
+ return new DefaultAssetInformation.Builder().assetKind(AssetKind.INSTANCE).globalAssetId(AAS_POS1_GLOBALASSETID).build();
+ }
+
+ public AssetAdministrationShellDescriptor buildAasPos1Descriptor() {
+ return DummyAasDescriptorFactory.createDummyDescriptor(AAS_POS1_ID, AAS_POS1_IDSHORT, AAS_POS1_GLOBALASSETID, aasRepositoryBasePath);
+ }
+
+ public SubmodelDescriptor buildSmPos1Descriptor() {
+ return DummySubmodelDescriptorFactory.createDummyDescriptor(SM_POS1_ID, SM_POS1_IDSHORT, smRepositoryBasePath, null);
+ }
+
+ public Submodel buildSmPos1() {
+ return new DefaultSubmodel.Builder().id(SM_POS1_ID).idShort(SM_POS1_IDSHORT).build();
+ }
+
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/RegistryDescriptorResolverTest.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/RegistryDescriptorResolverTest.java
new file mode 100644
index 000000000..728f55800
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/RegistryDescriptorResolverTest.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell;
+import org.eclipse.digitaltwin.aas4j.v3.model.Submodel;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.DummyAasEnvironmentComponent;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.TestFixture;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.parsers.AasRegistryEndpointURIParser;
+import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.parsers.SubmodelRegistryEndpointURIParser;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.ApiException;
+import org.eclipse.digitaltwin.basyx.aasrepository.AasRepository;
+import org.eclipse.digitaltwin.basyx.submodelrepository.SubmodelRepository;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.boot.SpringApplication;
+import org.springframework.context.ConfigurableApplicationContext;
+
+/**
+ * Tests for {@link AasDescriptorResolver}, {@link SubmodelDescriptorResolver}
+ *
+ * @author mateusmolina
+ *
+ */
+public class RegistryDescriptorResolverTest {
+
+ private static ConfigurableApplicationContext appContext;
+ private static AasRepository aasRepository;
+ private static SubmodelRepository smRepository;
+
+ private final static String AAS_REPOSITORY_BASE_PATH = "http://localhost:8081";
+ private final static String SM_REPOSITORY_BASE_PATH = "http://localhost:8081";
+
+ private final static TestFixture FIXTURE = new TestFixture(AAS_REPOSITORY_BASE_PATH, SM_REPOSITORY_BASE_PATH);
+
+ @BeforeClass
+ public static void initApplication() {
+ appContext = new SpringApplication(DummyAasEnvironmentComponent.class).run(new String[] {});
+
+ aasRepository = appContext.getBean(AasRepository.class);
+ smRepository = appContext.getBean(SubmodelRepository.class);
+ aasRepository.createAas(FIXTURE.buildAasPre1());
+ smRepository.createSubmodel(FIXTURE.buildSmPre1());
+ }
+
+ @AfterClass
+ public static void cleanUp() {
+ appContext.close();
+ }
+
+ @Test
+ public void resolveAasDescriptor() throws ApiException {
+ AasDescriptorResolver resolver = new AasDescriptorResolver(new EndpointResolver<>(new AasRegistryEndpointURIParser()));
+
+ AssetAdministrationShell expectedAas = FIXTURE.buildAasPre1();
+ AssetAdministrationShell actualAas = resolver.resolveAasDescriptor(FIXTURE.buildAasPre1Descriptor());
+
+ assertEquals(expectedAas, actualAas);
+ }
+
+ @Test
+ public void resolveSmDescriptor() throws ApiException {
+ SubmodelDescriptorResolver resolver = new SubmodelDescriptorResolver(new EndpointResolver<>(new SubmodelRegistryEndpointURIParser()));
+
+ Submodel expectedSm = FIXTURE.buildSmPre1();
+ Submodel actualSm = resolver.resolveSubmodelDescriptor(FIXTURE.buildSmPre1Descriptor());
+
+ assertEquals(expectedSm, actualSm);
+ }
+
+}
diff --git a/basyx.aasenvironment/basyx.aasenvironment-client/src/test/resources/application.properties b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/resources/application.properties
new file mode 100644
index 000000000..45e729855
--- /dev/null
+++ b/basyx.aasenvironment/basyx.aasenvironment-client/src/test/resources/application.properties
@@ -0,0 +1,38 @@
+server.port=8081
+spring.application.name=AAS Environment
+
+basyx.backend = InMemory
+
+#basyx.backend = MongoDB
+#spring.data.mongodb.host=mongo
+# or spring.data.mongodb.host=127.0.0.1
+#spring.data.mongodb.port=27017
+#spring.data.mongodb.database=aasenvironments
+#spring.data.mongodb.authentication-database=admin
+#spring.data.mongodb.username=mongoAdmin
+#spring.data.mongodb.password=mongoPassword
+
+# basyx.aasrepository.feature.mqtt.enabled = true
+# mqtt.clientId=TestClient
+# mqtt.hostname = localhost
+# mqtt.port = 1883
+
+# basyx.cors.allowed-origins=http://localhost:3000, http://localhost:4000
+# basyx.cors.allowed-methods=GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD
+
+####################################################################################
+# Preconfiguring the Environment;
+####################################################################################
+# Comma seperated list that contains Environment files to load on startup
+# To load from Classpath (src/main/resources) use classpath:path/to/file.end
+# To load from Filesystem ( On your local machine ) use the prefix file:
+#
+# basyx.environment = classpath:testEnvironment.json,classpath:testEnvironment.xml,file:C:\\Users\\Administrator\\Documents\\01_Festo.aasx,file:/var/www/html/01_Submodel.json
+#
+
+####################################################################################
+# Operation Delegation
+####################################################################################
+# This feature is enabled by default
+
+#basyx.submodelrepository.feature.operation.delegation.enabled = false
\ No newline at end of file
diff --git a/basyx.aasenvironment/pom.xml b/basyx.aasenvironment/pom.xml
index b10c26f8b..9c6d222c3 100644
--- a/basyx.aasenvironment/pom.xml
+++ b/basyx.aasenvironment/pom.xml
@@ -18,6 +18,7 @@
basyx.aasenvironment-core
basyx.aasenvironment-http
basyx.aasenvironment-feature-authorization
+ basyx.aasenvironment-client
\ No newline at end of file
diff --git a/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/AasDescriptorFactory.java b/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/AasDescriptorFactory.java
index 9e99cb1b2..fa26f48a2 100644
--- a/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/AasDescriptorFactory.java
+++ b/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/AasDescriptorFactory.java
@@ -95,6 +95,11 @@ public AssetAdministrationShellDescriptor create() {
return descriptor;
}
+ public AssetAdministrationShellDescriptor create(AssetAdministrationShell shell) {
+ this.shell = shell;
+ return create();
+ }
+
private void setDescription(List descriptions, AssetAdministrationShellDescriptor descriptor) {
if (descriptions == null || descriptions.isEmpty())
diff --git a/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/AasRepositoryRegistryTestLink.java b/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/AasRepositoryRegistryTestLink.java
index f9041f131..1762f7bc0 100644
--- a/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/AasRepositoryRegistryTestLink.java
+++ b/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/AasRepositoryRegistryTestLink.java
@@ -38,10 +38,7 @@
import org.eclipse.digitaltwin.basyx.aasregistry.client.ApiException;
import org.eclipse.digitaltwin.basyx.aasregistry.client.api.RegistryAndDiscoveryInterfaceApi;
import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetAdministrationShellDescriptor;
-import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetKind;
-import org.eclipse.digitaltwin.basyx.aasregistry.client.model.Endpoint;
import org.eclipse.digitaltwin.basyx.aasregistry.client.model.GetAssetAdministrationShellDescriptorsResult;
-import org.eclipse.digitaltwin.basyx.aasregistry.client.model.ProtocolInformation;
import org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifier;
import org.eclipse.digitaltwin.basyx.http.serialization.BaSyxHttpTestUtils;
import org.junit.Test;
@@ -62,7 +59,7 @@ public class AasRepositoryRegistryTestLink {
public static String aasRepoBaseUrl = "http://localhost:8081";
public static String aasRegistryUrl = "http://localhost:8050";
- private static final AssetAdministrationShellDescriptor DUMMY_DESCRIPTOR = createExpectedDescriptor();
+ private static final AssetAdministrationShellDescriptor DUMMY_DESCRIPTOR = DummyAasDescriptorFactory.createDummyDescriptor(DUMMY_AAS_ID, DUMMY_IDSHORT, DUMMY_GLOBAL_ASSETID, aasRepoBaseUrl);
@Test
public void createAas() throws FileNotFoundException, IOException, ApiException {
@@ -129,49 +126,6 @@ private String getSpecificAasAccessURL(String aasId) {
return createAasRepositoryUrl(aasRepoBaseUrl) + "/" + Base64UrlEncodedIdentifier.encodeIdentifier(aasId);
}
- private static AssetAdministrationShellDescriptor createExpectedDescriptor() {
-
- AssetAdministrationShellDescriptor descriptor = new AssetAdministrationShellDescriptor();
-
- descriptor.setId(DUMMY_AAS_ID);
- descriptor.setIdShort(DUMMY_IDSHORT);
- descriptor.setAssetKind(AssetKind.INSTANCE);
- descriptor.setGlobalAssetId(DUMMY_GLOBAL_ASSETID);
- descriptor.addEndpointsItem(createEndpointItem());
-
- return descriptor;
- }
-
- private static Endpoint createEndpointItem() {
- Endpoint endpoint = new Endpoint();
- endpoint.setInterface("AAS-3.0");
- endpoint.setProtocolInformation(createProtocolInformation());
-
- return endpoint;
- }
-
- private static ProtocolInformation createProtocolInformation() {
- String href = createHref();
-
- ProtocolInformation protocolInformation = new ProtocolInformation();
- protocolInformation.setHref(href);
- protocolInformation.endpointProtocol(getProtocol(href));
-
- return protocolInformation;
- }
-
- private static String createHref() {
- return String.format("%s/%s", createAasRepositoryUrl(aasRepoBaseUrl), Base64UrlEncodedIdentifier.encodeIdentifier(DUMMY_AAS_ID));
- }
-
- private static String getProtocol(String endpoint) {
- try {
- return new URL(endpoint).getProtocol();
- } catch (MalformedURLException e) {
- throw new RuntimeException();
- }
- }
-
private static String createAasRepositoryUrl(String aasRepositoryBaseURL) {
try {
diff --git a/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/DummyAasDescriptorFactory.java b/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/DummyAasDescriptorFactory.java
new file mode 100644
index 000000000..9a832d3c6
--- /dev/null
+++ b/basyx.aasrepository/basyx.aasrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/registry/integration/DummyAasDescriptorFactory.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.aasrepository.feature.registry.integration;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetAdministrationShellDescriptor;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetKind;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.Endpoint;
+import org.eclipse.digitaltwin.basyx.aasregistry.client.model.ProtocolInformation;
+import org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifier;
+
+/**
+ * Factory for dummy AasDescriptors
+ *
+ * @author danish, mateusmolina
+ *
+ */
+public class DummyAasDescriptorFactory {
+ private static final String AAS_REPOSITORY_PATH = "/shells";
+
+ public static AssetAdministrationShellDescriptor createDummyDescriptor(String aasId, String idShort, String globalAssetId, String aasRepoBaseUrl) {
+
+ AssetAdministrationShellDescriptor descriptor = new AssetAdministrationShellDescriptor();
+
+ descriptor.setId(aasId);
+ descriptor.setIdShort(idShort);
+ descriptor.setAssetKind(AssetKind.INSTANCE);
+ descriptor.setGlobalAssetId(globalAssetId);
+ descriptor.addEndpointsItem(createEndpointItem(aasId, aasRepoBaseUrl));
+
+ return descriptor;
+ }
+
+ private static Endpoint createEndpointItem(String aasId, String aasRepoBaseUrl) {
+ Endpoint endpoint = new Endpoint();
+ endpoint.setInterface("AAS-3.0");
+ endpoint.setProtocolInformation(createProtocolInformation(aasId, aasRepoBaseUrl));
+
+ return endpoint;
+ }
+
+ private static ProtocolInformation createProtocolInformation(String aasId, String aasRepoBaseUrl) {
+ String href = createHref(aasId, aasRepoBaseUrl);
+
+ ProtocolInformation protocolInformation = new ProtocolInformation();
+ protocolInformation.setHref(href);
+ protocolInformation.endpointProtocol(getProtocol(href));
+
+ return protocolInformation;
+ }
+
+ private static String createHref(String aasId, String aasRepoBaseUrl) {
+ return String.format("%s/%s", createAasRepositoryUrl(aasRepoBaseUrl), Base64UrlEncodedIdentifier.encodeIdentifier(aasId));
+ }
+
+ private static String getProtocol(String endpoint) {
+ try {
+ return new URL(endpoint).getProtocol();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException();
+ }
+ }
+
+ private static String createAasRepositoryUrl(String aasRepositoryBaseURL) {
+
+ try {
+ return new URL(new URL(aasRepositoryBaseURL), AAS_REPOSITORY_PATH).toString();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("The AAS Repository Base url is malformed. " + e.getMessage());
+ }
+ }
+
+}
diff --git a/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/SubmodelDescriptorFactory.java b/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/SubmodelDescriptorFactory.java
index a16584fe7..fc96f639e 100644
--- a/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/SubmodelDescriptorFactory.java
+++ b/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/SubmodelDescriptorFactory.java
@@ -93,6 +93,11 @@ public SubmodelDescriptor create() {
return descriptor;
}
+ public SubmodelDescriptor create(Submodel submodel) {
+ this.submodel = submodel;
+ return create();
+ }
+
private void setDescription(List descriptions, SubmodelDescriptor descriptor) {
if (descriptions == null || descriptions.isEmpty())
diff --git a/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/DummySubmodelDescriptorFactory.java b/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/DummySubmodelDescriptorFactory.java
new file mode 100644
index 000000000..4e821bc9b
--- /dev/null
+++ b/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/DummySubmodelDescriptorFactory.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (C) 2024 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+
+package org.eclipse.digitaltwin.basyx.submodelrepository.feature.registry.integration;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Arrays;
+
+import org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifier;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.Endpoint;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.Key;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.KeyTypes;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.ProtocolInformation;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.Reference;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.ReferenceTypes;
+import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.SubmodelDescriptor;
+
+/**
+ * Factory for dummy SubmodelDescriptorss
+ *
+ * @author mateusmolina
+ *
+ */
+public class DummySubmodelDescriptorFactory {
+ private static final String SUBMODEL_REPOSITORY_PATH = "/submodels";
+
+ public static SubmodelDescriptor createDummyDescriptor(String smId, String idShort, String smRepoBaseUrl, Reference semanticId) {
+
+ SubmodelDescriptor descriptor = new SubmodelDescriptor();
+
+ descriptor.setId(smId);
+ descriptor.setIdShort(idShort);
+ descriptor.setSemanticId(semanticId);
+ descriptor.addEndpointsItem(createEndpointItem(smId, smRepoBaseUrl));
+
+ return descriptor;
+ }
+
+ public static Reference createSemanticId() {
+ return new Reference().keys(Arrays.asList(new Key().type(KeyTypes.GLOBALREFERENCE).value("0173-1#01-AFZ615#016"))).type(ReferenceTypes.EXTERNALREFERENCE);
+ }
+
+ private static Endpoint createEndpointItem(String smId, String smRepoBaseUrl) {
+ Endpoint endpoint = new Endpoint();
+ endpoint.setInterface("SUBMODEL-3.0");
+ endpoint.setProtocolInformation(createProtocolInformation(smId, smRepoBaseUrl));
+
+ return endpoint;
+ }
+
+ private static ProtocolInformation createProtocolInformation(String smId, String smRepoBaseUrl) {
+ String href = createHref(smId, smRepoBaseUrl);
+
+ ProtocolInformation protocolInformation = new ProtocolInformation();
+ protocolInformation.setHref(href);
+ protocolInformation.endpointProtocol(getProtocol(href));
+
+ return protocolInformation;
+ }
+
+ private static String createHref(String smId, String smRepoBaseUrl) {
+ return String.format("%s/%s", createSubmodelRepositoryUrl(smRepoBaseUrl), Base64UrlEncodedIdentifier.encodeIdentifier(smId));
+ }
+
+ private static String getProtocol(String endpoint) {
+ try {
+ return new URL(endpoint).getProtocol();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException();
+ }
+ }
+
+ private static String createSubmodelRepositoryUrl(String smRepositoryBaseURL) {
+
+ try {
+ return new URL(new URL(smRepositoryBaseURL), SUBMODEL_REPOSITORY_PATH).toString();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("The Submodel Repository Base url is malformed.\n " + e.getMessage());
+ }
+ }
+}
diff --git a/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/SubmodelRepositoryRegistryTestLink.java b/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/SubmodelRepositoryRegistryTestLink.java
index a398dfcee..f26be8557 100644
--- a/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/SubmodelRepositoryRegistryTestLink.java
+++ b/basyx.submodelrepository/basyx.submodelrepository-feature-registry-integration/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/registry/integration/SubmodelRepositoryRegistryTestLink.java
@@ -32,7 +32,6 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Arrays;
import java.util.List;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
@@ -40,13 +39,7 @@
import org.eclipse.digitaltwin.basyx.http.serialization.BaSyxHttpTestUtils;
import org.eclipse.digitaltwin.basyx.submodelregistry.client.ApiException;
import org.eclipse.digitaltwin.basyx.submodelregistry.client.api.SubmodelRegistryApi;
-import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.Endpoint;
import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.GetSubmodelDescriptorsResult;
-import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.Key;
-import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.KeyTypes;
-import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.ProtocolInformation;
-import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.Reference;
-import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.ReferenceTypes;
import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.SubmodelDescriptor;
import org.junit.Test;
import org.springframework.http.HttpStatus;
@@ -66,7 +59,7 @@ public class SubmodelRepositoryRegistryTestLink {
public static String submodelRepoBaseUrl = "http://localhost:8081";
public static String submodelRegistryUrl = "http://localhost:8060";
- private static final SubmodelDescriptor DUMMY_DESCRIPTOR = createExpectedDescriptor();
+ private static final SubmodelDescriptor DUMMY_DESCRIPTOR = DummySubmodelDescriptorFactory.createDummyDescriptor(DUMMY_SUBMODEL_ID, SUMMY_SUBMODEL_IDSHORT, submodelRepoBaseUrl, DummySubmodelDescriptorFactory.createSemanticId());
@Test
public void createSubmodel() throws FileNotFoundException, IOException, ApiException {
@@ -132,52 +125,6 @@ private CloseableHttpResponse createSubmodelOnRepo(String aasJsonContent) throws
private String getSpecificSubmodelAccessURL(String aasId) {
return createSubmodelRepositoryUrl(submodelRepoBaseUrl) + "/" + Base64UrlEncodedIdentifier.encodeIdentifier(aasId);
}
-
- private static SubmodelDescriptor createExpectedDescriptor() {
-
- SubmodelDescriptor descriptor = new SubmodelDescriptor();
-
- descriptor.setId(DUMMY_SUBMODEL_ID);
- descriptor.setIdShort(SUMMY_SUBMODEL_IDSHORT);
- descriptor.setSemanticId(createSemanticId());
- descriptor.addEndpointsItem(createEndpointItem());
-
- return descriptor;
- }
-
- private static Reference createSemanticId() {
- return new Reference().keys(Arrays.asList(new Key().type(KeyTypes.GLOBALREFERENCE).value("0173-1#01-AFZ615#016"))).type(ReferenceTypes.EXTERNALREFERENCE);
- }
-
- private static Endpoint createEndpointItem() {
- Endpoint endpoint = new Endpoint();
- endpoint.setInterface("SUBMODEL-3.0");
- endpoint.setProtocolInformation(createProtocolInformation());
-
- return endpoint;
- }
-
- private static ProtocolInformation createProtocolInformation() {
- String href = createHref();
-
- ProtocolInformation protocolInformation = new ProtocolInformation();
- protocolInformation.setHref(href);
- protocolInformation.endpointProtocol(getProtocol(href));
-
- return protocolInformation;
- }
-
- private static String createHref() {
- return String.format("%s/%s", createSubmodelRepositoryUrl(submodelRepoBaseUrl), Base64UrlEncodedIdentifier.encodeIdentifier(DUMMY_SUBMODEL_ID));
- }
-
- private static String getProtocol(String endpoint) {
- try {
- return new URL(endpoint).getProtocol();
- } catch (MalformedURLException e) {
- throw new RuntimeException();
- }
- }
private static String createSubmodelRepositoryUrl(String smRepositoryBaseURL) {
diff --git a/pom.xml b/pom.xml
index 7ddce94d7..932bedd09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -544,6 +544,11 @@
basyx.submodelrepository-backend-mongodb
${revision}
+
+ org.eclipse.digitaltwin.basyx
+ basyx.submodelrepository-client
+ ${revision}
+
org.eclipse.digitaltwin.basyx
@@ -616,6 +621,11 @@
basyx.aasrepository.component
${revision}
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasrepository-client
+ ${revision}
+
org.eclipse.digitaltwin.basyx
@@ -637,6 +647,11 @@
basyx.aasenvironment-feature-authorization
${revision}
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasenvironment-client
+ ${revision}
+
org.eclipse.digitaltwin.basyx
@@ -861,6 +876,12 @@
${revision}
tests
+
+ org.eclipse.digitaltwin.basyx
+ basyx.submodelrepository-client
+ ${revision}
+ tests
+
org.eclipse.digitaltwin.basyx
@@ -953,6 +974,12 @@
${revision}
tests
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasrepository-client
+ ${revision}
+ tests
+
org.eclipse.digitaltwin.basyx
@@ -978,6 +1005,12 @@
${revision}
tests
+
+ org.eclipse.digitaltwin.basyx
+ basyx.aasenvironment-client
+ ${revision}
+ tests
+
org.eclipse.digitaltwin.basyx