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

Chore/upstream contribution #1383

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ds-lcapellino
Copy link
Contributor

Description

This PR provides the feature https://cofinity-x.atlassian.net/browse/TRACEX-212 to upstream.
The upstream feature is eclipse-tractusx/sig-release#940.

Pre-review checks

Please ensure to do as many of the following checks as possible, before asking for committer review:

@ds-lcapellino ds-lcapellino force-pushed the chore/upstream-contribution branch from 9717e62 to 1f7dcd3 Compare January 9, 2025 13:04
@@ -89,7 +90,7 @@ SPDX-License-Identifier: Apache-2.0
<junit-bom.version>5.10.3</junit-bom.version>
<awaitility.version>4.2.1</awaitility.version>
<!-- TODO https://github.com/eclipse-tractusx/traceability-foss/issues/978 update to the cx release version of irs lib IMPORTANT NO SNAPSHOT-->
<irs-client-lib.version>2.1.9</irs-client-lib.version>
<irs-client-lib.version>2.1.16</irs-client-lib.version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please recheck if this exists open source

throw new CreateEdcContractDefinitionException(e);
}

String submodelAssetId;
String submodelAssetIdToCreate = "urn:uuid:" + UUID.randomUUID();
try {
submodelAssetId = edcAssetService.createSubmodelAsset(traceabilityProperties.getSubmodelBase(), submodelAssetIdToCreate);
log.info("Submodel Asset Id created :{}", submodelAssetId);
submodelAssetId = edcAssetService.createSubmodelAsset(submodelProperties.getBaseInternal(), submodelAssetIdToCreate);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you set the public url for the submodel, this is the case in the open source variant. Please check

} catch (Exception exception) {
log.warn("EDC Asset (Submodel) could not be created: {}", exception.getMessage());
throw new CreateEdcAssetException(exception);
}

try {
String submodelContractId = edcContractDefinitionService.createContractDefinition(submodelAssetId, createdPolicyId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if the submodel server is returning the id on open source variant.

@@ -50,9 +51,9 @@
@EnableJpaRepositories(basePackages = "org.eclipse.tractusx.traceability.*")
public class EdcConfiguration {

@Value("${registry.urlWithPath}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helm Environments updated?

final RestTemplateBuilder restTemplateBuilder,
@Autowired RegistryProperties registryProperties) {
return oAuthRestTemplate(restTemplateBuilder,
registryProperties.getOauthProviderRegistrationId())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The open source variant does not have authentication curently. How to deal with that.

public RestTemplate submodelRestTemplate(@Autowired SubmodelProperties submodelProperties, @Autowired FeignDefaultProperties feignDefaultProperties,
final RestTemplateBuilder restTemplateBuilder) {

return oAuthRestTemplate(restTemplateBuilder, submodelProperties.getOauthProviderRegistrationId())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submodel server does not have oauth in open source. How to deal with that.

@@ -20,7 +20,7 @@
package org.eclipse.tractusx.traceability.submodel.domain.repository;

public interface SubmodelServerRepository {
void saveSubmodel(String submodelId, String submodel);
String saveSubmodel(String submodel);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not compliant with open source variant.

await()
.atMost(Durations.FIVE_MINUTES)
.pollInterval(1, TimeUnit.SECONDS)
.until(() -> {
try {
submodelRestTemplate.exchange("/" + submodelId, HttpMethod.POST, new HttpEntity<>(payload), Void.class);
log.info("Submodel created successfully with id: {}", submodelId);
submodelRestTemplate.exchange("/", HttpMethod.POST, new HttpEntity<>(submodelRequest), Void.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not compliant.

public String saveSubmodel(String submodel) {
String submodelId;
try {
String submodelEnriched = SubmodelUtil.enrichWithSubmodelUuid(objectMapper, submodel);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not compliant.

@UtilityClass
public class SubmodelUtil {

public static String enrichWithSubmodelUuid(final ObjectMapper objectMapper, String jsonString) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not compliant.

@@ -1,4 +1,52 @@
-- ${flyway:timestamp}
-- TODO remove after demo / discovery is working
INSERT INTO assets_as_built (id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not compliant.

import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;

public class BmwBpnConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not compliant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants