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 index d49424658..57ae15b71 100644 --- 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 @@ -36,10 +36,12 @@ 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.aasservice.client.ConnectedAasService; 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; +import org.eclipse.digitaltwin.basyx.submodelservice.client.ConnectedSubmodelService; /** * Client component for executing consolidated Repository and Registry requests @@ -87,13 +89,13 @@ public ConnectedAasManager(String aasRegistryBaseUrl, String aasRepositoryBaseUr } /** - * Retrieves an AAS in an AAS registry by its identifier. + * Retrieves a ConnectedAasService in an AAS registry by its identifier. * * @param identifier * The identifier of the AAS to retrieve. - * @return The retrieved AAS object. + * @return The retrieved ConnectedAasService object. */ - public AssetAdministrationShell getAas(String identifier) throws NoValidEndpointFoundException { + public ConnectedAasService getAas(String identifier) throws NoValidEndpointFoundException { AssetAdministrationShellDescriptor descriptor; try { @@ -105,13 +107,14 @@ public AssetAdministrationShell getAas(String identifier) throws NoValidEndpoint } /** - * Retrieves a Submodel in a Submodel registry by its identifier. + * Retrieves a ConnectedSubmodelService in a Submodel registry by its + * identifier. * * @param identifier * The identifier of the submodel to retrieve. - * @return The retrieved Submodel object. + * @return The retrieved ConnectedSubmodelService object. */ - public Submodel getSubmodel(String identifier) { + public ConnectedSubmodelService getSubmodel(String identifier) { SubmodelDescriptor descriptor; try { 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 index 6fee5a8b5..6505c8f3e 100644 --- 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 @@ -29,8 +29,6 @@ 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; @@ -53,28 +51,28 @@ class ConnectedAasManagerHelper { private ConnectedAasManagerHelper() { } - public static ObjectMapper buildObjectMapper() { + 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())); + static AasDescriptorResolver buildAasDescriptorResolver() { + return new AasDescriptorResolver(new EndpointResolver()); } - public static SubmodelDescriptorResolver buildSubmodelDescriptorResolver() { - return new SubmodelDescriptorResolver(new EndpointResolver<>(new SubmodelRegistryEndpointURIParser())); + static SubmodelDescriptorResolver buildSubmodelDescriptorResolver() { + return new SubmodelDescriptorResolver(new EndpointResolver()); } - public static AasDescriptorFactory buildAasDescriptorFactory(String aasRepositoryBaseUrl) { + static AasDescriptorFactory buildAasDescriptorFactory(String aasRepositoryBaseUrl) { AttributeMapper attributeMapper = new AttributeMapper(objectMapper); return new AasDescriptorFactory(null, aasRepositoryBaseUrl, attributeMapper); } - public static SubmodelDescriptorFactory buildSmDescriptorFactory(String aasRepositoryBaseUrl) { + 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/resolvers/AasDescriptorResolver.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/AasDescriptorResolver.java index 7f813bc07..b6c8d955d 100644 --- 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 @@ -25,7 +25,9 @@ package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers; -import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell; +import java.net.URI; +import java.util.Optional; + 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; @@ -38,18 +40,30 @@ */ public class AasDescriptorResolver { - private final EndpointResolver endpointResolver; + private final EndpointResolver endpointResolver; - public AasDescriptorResolver(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); + public ConnectedAasService resolveAasDescriptor(AssetAdministrationShellDescriptor aasDescriptor) { + String endpoint = endpointResolver.resolveFirst(aasDescriptor.getEndpoints(), AasDescriptorResolver::parseEndpoint); - return aasService.getAAS(); + return new ConnectedAasService(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/EndpointResolver.java b/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/EndpointResolver.java index 6a551799b..0f560bcfd 100644 --- 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 @@ -31,7 +31,6 @@ 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 @@ -39,28 +38,24 @@ * @author mateusmolina * */ -public class EndpointResolver { +public class EndpointResolver { - private final URIParser parser; - private int timeout = 3000; - public EndpointResolver(URIParser parser) { - this.parser = parser; + public EndpointResolver() { } - public EndpointResolver(URIParser parser, int timeout) { - this(parser); + public EndpointResolver(int timeout) { this.timeout = timeout; } - public String resolveFirst(List endpoints) { - List uris = endpoints.stream().map(parser::parse).flatMap(Optional::stream).toList(); + public String resolveFirst(List endpoints, URIParser uriParser) { + List uris = endpoints.stream().map(uriParser::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(); + public List resolveAll(List endpoints, URIParser uriParser) { + return endpoints.stream().map(uriParser::parse).flatMap(Optional::stream).filter(this::isURIWorking).map(URI::toString).toList(); } private Optional findFirstWorkingURI(List uris) { 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 index 9d49e3edb..53dc6b552 100644 --- 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 @@ -25,13 +25,9 @@ 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 java.net.URI; +import java.util.Optional; + 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; @@ -44,25 +40,30 @@ */ public class SubmodelDescriptorResolver { - private final EndpointResolver endpointResolver; + private final EndpointResolver endpointResolver; - public SubmodelDescriptorResolver(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); + public ConnectedSubmodelService resolveSubmodelDescriptor(SubmodelDescriptor smDescriptor) { + String endpoint = endpointResolver.resolveFirst(smDescriptor.getEndpoints(), SubmodelDescriptorResolver::parseEndpoint); - return smService.getSubmodel(); + return new ConnectedSubmodelService(endpoint); } - public Reference deriveReferenceFromSubmodelDescriptor(SubmodelDescriptor smDescriptor) { - return new DefaultReference.Builder().type(ReferenceTypes.EXTERNAL_REFERENCE).keys(generateKeyFromId(smDescriptor.getId())).build(); - } + private static Optional parseEndpoint(Endpoint endpoint) { + try { + if (endpoint == null || endpoint.getProtocolInformation() == null || endpoint.getProtocolInformation().getHref() == null) + return Optional.empty(); - private static Key generateKeyFromId(String smId) { - return new DefaultKey.Builder().type(KeyTypes.SUBMODEL).value(smId).build(); + 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/URIParser.java similarity index 96% rename from basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/URIParser.java rename to basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/URIParser.java index 9959a83e3..c9f56434f 100644 --- 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/URIParser.java @@ -23,7 +23,7 @@ * SPDX-License-Identifier: MIT ******************************************************************************/ -package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.parsers; +package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers; import java.net.URI; import java.util.Optional; @@ -34,6 +34,7 @@ * @author mateusmolina * */ -public interface URIParser { +@FunctionalInterface +interface URIParser { public Optional parse(T object); } 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 deleted file mode 100644 index 2cc37abaf..000000000 --- a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/AasRegistryEndpointURIParser.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * 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 deleted file mode 100644 index e0590af11..000000000 --- a/basyx.aasenvironment/basyx.aasenvironment-client/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/parsers/SubmodelRegistryEndpointURIParser.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * 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/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 index 447f32458..d0b941fc7 100644 --- 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 @@ -178,7 +178,7 @@ public void deleteSubmodelOfAas() throws Exception { public void getAas() throws ApiException, NoValidEndpointFoundException { AssetAdministrationShell expectedAas = FIXTURE.buildAasPre1(); - AssetAdministrationShell actualAas = aasManager.getAas(TestFixture.AAS_PRE1_ID); + AssetAdministrationShell actualAas = aasManager.getAas(TestFixture.AAS_PRE1_ID).getAAS(); assertEquals(expectedAas, actualAas); } @@ -187,7 +187,7 @@ public void getAas() throws ApiException, NoValidEndpointFoundException { public void getSubmodel() throws Exception { Submodel expectedSm = FIXTURE.buildSmPre1(); - Submodel actualSm = aasManager.getSubmodel(TestFixture.SM_PRE1_ID); + Submodel actualSm = aasManager.getSubmodel(TestFixture.SM_PRE1_ID).getSubmodel(); assertEquals(expectedSm, actualSm); } 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 index 728f55800..533119693 100644 --- 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 @@ -31,8 +31,6 @@ 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; @@ -76,20 +74,20 @@ public static void cleanUp() { @Test public void resolveAasDescriptor() throws ApiException { - AasDescriptorResolver resolver = new AasDescriptorResolver(new EndpointResolver<>(new AasRegistryEndpointURIParser())); + AasDescriptorResolver resolver = new AasDescriptorResolver(new EndpointResolver()); AssetAdministrationShell expectedAas = FIXTURE.buildAasPre1(); - AssetAdministrationShell actualAas = resolver.resolveAasDescriptor(FIXTURE.buildAasPre1Descriptor()); + AssetAdministrationShell actualAas = resolver.resolveAasDescriptor(FIXTURE.buildAasPre1Descriptor()).getAAS(); assertEquals(expectedAas, actualAas); } @Test public void resolveSmDescriptor() throws ApiException { - SubmodelDescriptorResolver resolver = new SubmodelDescriptorResolver(new EndpointResolver<>(new SubmodelRegistryEndpointURIParser())); + SubmodelDescriptorResolver resolver = new SubmodelDescriptorResolver(new EndpointResolver()); Submodel expectedSm = FIXTURE.buildSmPre1(); - Submodel actualSm = resolver.resolveSubmodelDescriptor(FIXTURE.buildSmPre1Descriptor()); + Submodel actualSm = resolver.resolveSubmodelDescriptor(FIXTURE.buildSmPre1Descriptor()).getSubmodel(); assertEquals(expectedSm, actualSm); }