Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements AAS and SM Repo integration with Registries feature #140

Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f453762
Adds skeleton for the AAS Repo Reg Int
mdanish98 Nov 10, 2023
969ce9e
Merge branch 'main' of https://github.com/eclipse-basyx/basyx-java-se…
mdanish98 Nov 10, 2023
f754d49
Implements RegistryLink basic working part in AAS Repository
mdanish98 Nov 13, 2023
de781c7
Adds AAS Desc Factory and Clone Factory
mdanish98 Nov 13, 2023
837a2c0
Fixes LinkedHashMap issue
mdanish98 Nov 13, 2023
2bd6276
Improves attribute mapper
mdanish98 Nov 14, 2023
c027ad9
Ignores Extensions and Admin info in Descriptor
mdanish98 Nov 14, 2023
d325b89
Removes unnecessary classes and codes
mdanish98 Nov 14, 2023
2f96e55
Aas Repository Feature Ready
mdanish98 Nov 14, 2023
e4e692d
Cherry-pick + submodel reg integ
mdanish98 Nov 14, 2023
8e4c6e2
Includes admins info and Extensions
mdanish98 Nov 14, 2023
7f2a0ff
Implements AAS and SM Repo integration with Registries feature
mdanish98 Nov 14, 2023
3023197
Merge remote-tracking branch 'upstream/main' into feature/registry-in…
mdanish98 Nov 16, 2023
c044262
Minor fixes related to docker for CI failure
mdanish98 Nov 16, 2023
279dc5c
Removes pull_policy from the docker-compose
mdanish98 Nov 16, 2023
c58f19e
Updates Readme.md
mdanish98 Nov 16, 2023
e97796c
Merge remote-tracking branch 'upstream/main' into feature/registry-in…
mdanish98 Nov 23, 2023
14192f0
Sync with the latest changes
mdanish98 Nov 23, 2023
9207c8f
Removed unnecessary file
mdanish98 Nov 23, 2023
7ebd7d3
Fixes minor typos during review
jannisjung Nov 23, 2023
e0dc9b2
Resolves review remarks
mdanish98 Nov 24, 2023
dbc5a89
Minor refactoring
mdanish98 Nov 24, 2023
12471ab
Resolved review remarks
mdanish98 Nov 24, 2023
3930feb
Minor refactoring
mdanish98 Nov 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Resolves review remarks
Signed-off-by: Mohammad Ghazanfar Ali Danish <ghazanfar.danish@iese.fraunhofer.de>
  • Loading branch information
mdanish98 committed Nov 24, 2023
commit e0dc9b2680c912d98df0385e1bcd954543d49422
Original file line number Diff line number Diff line change
@@ -111,8 +111,8 @@ public void removeSubmodelReference(String shellId, String submodelId) {
}

@Override
public void setAssetInformation(String shellId, AssetInformation sehllInfo) throws ElementDoesNotExistException {
decorated.setAssetInformation(shellId, sehllInfo);
public void setAssetInformation(String shellId, AssetInformation shellInfo) throws ElementDoesNotExistException {
decorated.setAssetInformation(shellId, shellInfo);
}

@Override
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
import org.eclipse.digitaltwin.basyx.aasrepository.AasRepositoryFactory;
import org.eclipse.digitaltwin.basyx.aasrepository.feature.AasRepositoryFeature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Component;

@@ -44,6 +45,12 @@ public class RegistryIntegrationAasRepositoryFeature implements AasRepositoryFea
public final static String FEATURENAME = "basyx.aasrepository.feature.registryintegration";

private AasRepositoryRegistryLink aasRepositoryRegistryLink;

@Value("${" + FEATURENAME + ":}")
private String registryBaseURL;

@Value("${basyx.externalurl:}")
private String submodelRepositoryExternalBaseURL;

@Autowired
public RegistryIntegrationAasRepositoryFeature(AasRepositoryRegistryLink aasRepositoryRegistryLink) {
@@ -71,6 +78,6 @@ public String getName() {

@Override
public boolean isEnabled() {
return true;
return !registryBaseURL.isBlank() && !submodelRepositoryExternalBaseURL.isBlank();
}
}
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
import org.eclipse.digitaltwin.basyx.submodelrepository.SubmodelRepositoryFactory;
import org.eclipse.digitaltwin.basyx.submodelrepository.feature.SubmodelRepositoryFeature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Component;

@@ -39,9 +40,15 @@
@Component
@ConditionalOnExpression("!T(org.springframework.util.StringUtils).isEmpty('${basyx.submodelrepository.feature.registryintegration:}') && !T(org.springframework.util.StringUtils).isEmpty('${basyx.externalurl:}')")
public class RegistryIntegrationSubmodelRepositoryFeature implements SubmodelRepositoryFeature {
public final static String FEATURENAME = "basyx.submodelrepository.feature.registryintegration";
public static final String FEATURENAME = "basyx.submodelrepository.feature.registryintegration";

private SubmodelRepositoryRegistryLink submodelRepositoryRegistryLink;

@Value("${" + FEATURENAME + ":}")
private String registryBaseURL;

@Value("${basyx.externalurl:}")
private String aasRepositoryExternalBaseURL;

@Autowired
public RegistryIntegrationSubmodelRepositoryFeature(SubmodelRepositoryRegistryLink submodelRepositoryRegistryLink) {
@@ -69,6 +76,6 @@ public String getName() {

@Override
public boolean isEnabled() {
return true;
return !registryBaseURL.isBlank() && !aasRepositoryExternalBaseURL.isBlank();
}
}
Original file line number Diff line number Diff line change
@@ -69,10 +69,10 @@ public class SubmodelRepositoryRegistryTestLink {
private static final SubmodelDescriptor DUMMY_DESCRIPTOR = createExpectedDescriptor();

@Test
public void createAas() throws FileNotFoundException, IOException, ApiException {
String aasJsonContent = getAas1JSONString();
public void createSubmodel() throws FileNotFoundException, IOException, ApiException {
String submodelJsonContent = getSubmodelJSONString();

CloseableHttpResponse creationResponse = createAasOnRepo(aasJsonContent);
CloseableHttpResponse creationResponse = createSubmodelOnRepo(submodelJsonContent);
assertEquals(HttpStatus.CREATED.value(), creationResponse.getCode());

SubmodelDescriptor actualDescriptor = retrieveDescriptorFromRegistry();
@@ -83,13 +83,13 @@ public void createAas() throws FileNotFoundException, IOException, ApiException
}

@Test
public void deleteAas() throws FileNotFoundException, IOException, ApiException {
String aasJsonContent = getAas1JSONString();
public void deleteSubmodel() throws FileNotFoundException, IOException, ApiException {
String submodelJsonContent = getSubmodelJSONString();

CloseableHttpResponse creationResponse = createAasOnRepo(aasJsonContent);
CloseableHttpResponse creationResponse = createSubmodelOnRepo(submodelJsonContent);
assertEquals(HttpStatus.CREATED.value(), creationResponse.getCode());

CloseableHttpResponse deleteResponse = deleteAasFromRepo(DUMMY_SUBMODEL_ID);
CloseableHttpResponse deleteResponse = deleteSubmodelFromRepo(DUMMY_SUBMODEL_ID);
assertEquals(HttpStatus.NO_CONTENT.value(), deleteResponse.getCode());

assertDescriptionDeletionAtRegistry();
@@ -102,13 +102,13 @@ private SubmodelDescriptor retrieveDescriptorFromRegistry() throws ApiException
}

private void resetRepository() throws IOException {
CloseableHttpResponse deleteResponse = deleteAasFromRepo(DUMMY_SUBMODEL_ID);
CloseableHttpResponse deleteResponse = deleteSubmodelFromRepo(DUMMY_SUBMODEL_ID);

assertEquals(HttpStatus.NO_CONTENT.value(), deleteResponse.getCode());
}

private CloseableHttpResponse deleteAasFromRepo(String shellId) throws IOException {
return BaSyxHttpTestUtils.executeDeleteOnURL(getSpecificAasAccessURL(shellId));
private CloseableHttpResponse deleteSubmodelFromRepo(String shellId) throws IOException {
return BaSyxHttpTestUtils.executeDeleteOnURL(getSpecificSubmodelAccessURL(shellId));
}

private void assertDescriptionDeletionAtRegistry() throws ApiException {
@@ -121,15 +121,15 @@ private void assertDescriptionDeletionAtRegistry() throws ApiException {
assertTrue(actualDescriptors.isEmpty());
}

private String getAas1JSONString() throws FileNotFoundException, IOException {
private String getSubmodelJSONString() throws FileNotFoundException, IOException {
return BaSyxHttpTestUtils.readJSONStringFromClasspath("SingleSubmodel.json");
}

private CloseableHttpResponse createAasOnRepo(String aasJsonContent) throws IOException {
private CloseableHttpResponse createSubmodelOnRepo(String aasJsonContent) throws IOException {
return BaSyxHttpTestUtils.executePostOnURL(createSubmodelRepositoryUrl(submodelRepoBaseUrl), aasJsonContent);
}

private String getSpecificAasAccessURL(String aasId) {
private String getSpecificSubmodelAccessURL(String aasId) {
return createSubmodelRepositoryUrl(submodelRepoBaseUrl) + "/" + Base64UrlEncodedIdentifier.encodeIdentifier(aasId);
}

@@ -184,7 +184,7 @@ 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 " + e.getMessage());
throw new RuntimeException("The Submodel Repository Base url is malformed.\n " + e.getMessage());
}
}