Skip to content

Commit

Permalink
Merge branch 'main' into chore/#958-available-parts-bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-mwesener authored May 14, 2024
2 parents 7a5b677 + a0074e8 commit 95af054
Show file tree
Hide file tree
Showing 25 changed files with 84 additions and 1,072 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ _**For better traceability add the corresponding GitHub issue number in each cha
- #778 return empty PageResult when no contract agreement Ids are found instead of http 404 in /contacts API
- #XXX Fixed some sonar issues in frontend application
- #958 Fixed bug where available parts filter was reset when list of affected parts are zero in notification creation

### Removed

- XXX Removed EdcNotifiactionMockServiceImpl class and replaced with mocks
- #XXX Switched eclipse-temurin:21-jre-alpine@sha256:fb4150a30569aadae9d693d949684a00653411528e62498b9900940c9b5b8a66 to 23467b3e42617ca197f43f58bc5fb03ca4cb059d68acd49c67128bfded132d67


## [11.0.0 - 08.05.2024]
### Added
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ COPY tx-backend tx-backend
RUN --mount=type=cache,target=/root/.m2 mvn -B clean package -pl :$BUILD_TARGET -am -DskipTests

# Copy the jar and build image
FROM eclipse-temurin:21-jre-alpine@sha256:fb4150a30569aadae9d693d949684a00653411528e62498b9900940c9b5b8a66 AS traceability-app
FROM eclipse-temurin:21-jre-alpine@sha256:23467b3e42617ca197f43f58bc5fb03ca4cb059d68acd49c67128bfded132d67 AS traceability-app

ARG UID=10000
ARG GID=1000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public List<String> isValid(MultipartFile file) {
reader.close();

} catch (ProcessingException | IOException e) {
throw new JsonFileProcessingException(e);
return List.of("Json file is not processable." + e.getMessage());
}
errors.addAll(validateAspectPayload(file));
return errors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.eclipse.tractusx.irs.component.assetadministrationshell.SecurityAttribute;
import org.eclipse.tractusx.irs.component.assetadministrationshell.SemanticId;
import org.eclipse.tractusx.irs.component.assetadministrationshell.SubmodelDescriptor;
import org.eclipse.tractusx.irs.component.enums.BomLifecycle;
import org.eclipse.tractusx.irs.registryclient.decentral.DigitalTwinRegistryCreateShellService;
import org.eclipse.tractusx.irs.registryclient.decentral.exception.CreateDtrShellException;
import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase;
Expand Down Expand Up @@ -145,18 +144,7 @@ private AssetAdministrationShellDescriptor aasFrom(AssetBase assetBase, List<Sub

List<IdentifierKeyValuePair> aasIdentifiersFromAsset(AssetBase assetBase) {

final String digitalTwinType = assetBase.getBomLifecycle().equals(BomLifecycle.AS_BUILT) ? "PartInstance" : "PartType";

return List.of(
IdentifierKeyValuePair.builder()
.name("digitalTwinType")
.value(digitalTwinType)
.externalSubjectId(
Reference.builder()
.type(EXTERNAL_REFERENCE)
.keys(getExternalSubjectIds())
.build())
.build(),
List<IdentifierKeyValuePair> identifierKeyValuePairs = List.of(
IdentifierKeyValuePair.builder()
.name("manufacturerId")
.value(assetBase.getManufacturerId())
Expand All @@ -176,6 +164,8 @@ List<IdentifierKeyValuePair> aasIdentifiersFromAsset(AssetBase assetBase) {
.build())
.build()
);
log.info("IdentifierKeyValuePair {}", identifierKeyValuePairs);
return identifierKeyValuePairs;
}

private List<SemanticId> getExternalSubjectIds() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Profile;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
Expand All @@ -51,6 +52,8 @@
import java.util.List;
import java.util.UUID;

import static org.eclipse.tractusx.traceability.common.config.ApplicationProfiles.NOT_INTEGRATION_TESTS;

@Configuration
@ConfigurationPropertiesScan(basePackages = "org.eclipse.tractusx.traceability.*")
@EnableWebMvc
Expand All @@ -59,7 +62,7 @@
@Slf4j
@EnableJpaRepositories(basePackages = "org.eclipse.tractusx.traceability.*")
@RequiredArgsConstructor

@Profile(NOT_INTEGRATION_TESTS)
public class PolicyStartUpConfig {

private final AcceptedPoliciesProvider.DefaultAcceptedPoliciesProvider defaultAcceptedPoliciesProvider;
Expand Down Expand Up @@ -105,7 +108,8 @@ private List<AcceptedPolicy> createIrsAcceptedPolicies() {
private List<AcceptedPolicy> createOwnAcceptedPolicies(OffsetDateTime offsetDateTime) {
List<Constraint> andConstraintList = new ArrayList<>();
List<Constraint> orConstraintList = new ArrayList<>();
orConstraintList.add(new Constraint(traceabilityProperties.getLeftOperand(), new Operator(OperatorType.fromValue(traceabilityProperties.getOperatorType())), traceabilityProperties.getRightOperand()));
andConstraintList.add(new Constraint(traceabilityProperties.getLeftOperand(), new Operator(OperatorType.fromValue(traceabilityProperties.getOperatorType())), traceabilityProperties.getRightOperand()));
andConstraintList.add(new Constraint(traceabilityProperties.getLeftOperand(), new Operator(OperatorType.fromValue(traceabilityProperties.getOperatorType())), traceabilityProperties.getRightOperand()));

List<Permission> permissions = List.of(
new Permission(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class FeignDiscoveryRepositoryImpl implements DiscoveryRepository {

@Override
public Optional<Discovery> retrieveDiscoveryByFinderAndEdcDiscoveryService(String bpn) {
DiscoveryFinderRequest request = new DiscoveryFinderRequest(List.of(bpn));
DiscoveryFinderRequest request = new DiscoveryFinderRequest(List.of("bpn"));
DiscoveryResponse discoveryEndpoints = discoveryFinderClient.findDiscoveryEndpoints(request);
List<EdcDiscoveryResult> discoveryResults = new ArrayList<>();
discoveryEndpoints.endpoints().forEach(discoveryEndpoint -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/********************************************************************************
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

package org.eclipse.tractusx.traceability.notification.domain.base.service;


import lombok.extern.slf4j.Slf4j;
import org.eclipse.tractusx.traceability.notification.domain.base.model.NotificationMessage;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

import java.util.concurrent.CompletableFuture;

import static org.eclipse.tractusx.traceability.common.config.ApplicationProfiles.INTEGRATION_SPRING_BOOT;

@Slf4j
@Service
@Profile(INTEGRATION_SPRING_BOOT)
public class EdcNotificationMockServiceImpl implements EdcNotificationService {
@Override
public CompletableFuture<NotificationMessage> asyncNotificationMessageExecutor(NotificationMessage message) {
log.info("EdcNotificationMockServiceImpl: {}", message);
return CompletableFuture.completedFuture(message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@
import java.util.concurrent.CompletableFuture;

import static org.apache.commons.collections4.ListUtils.emptyIfNull;
import static org.eclipse.tractusx.traceability.common.config.ApplicationProfiles.NOT_INTEGRATION_TESTS;

@Slf4j
@RequiredArgsConstructor
@Service
@Transactional(dontRollbackOn = DiscoveryFinderException.class)
@Profile(NOT_INTEGRATION_TESTS)
public class EdcNotificationServiceImpl implements EdcNotificationService {

private final NotificationsEDCFacade edcFacade;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ traceability:
url: localhost:${server.port}/api
leftOperand: "PURPOSE"
operatorType: "eq"
rightOperand: "ID 3.0 Trace"
validUntil: "2050-07-04T16:01:05.309Z"
rightOperand: "ID Trace 3.1"
validUntil: "2023-07-04T16:01:05.309Z"
adminApiKey: testAdminKey
regularApiKey: testRegularKey
irsBase: "http://127.0.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public static class Initializer implements ApplicationContextInitializer<Configu
@Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
TestPropertyValues.of(
"spring.security.oauth2.client.provider.keycloak.token-uri=http://127.0.0.1:" + STUB_SERVER_PORT + OAUTH2_TOKEN_PATH,
"spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://127.0.0.1:" + STUB_SERVER_PORT + OAUTH2_JWK_PATH,
"spring.security.oauth2.client.provider.OKTA.token-uri=http://127.0.0.1:" + STUB_SERVER_PORT + OAUTH2_TOKEN_PATH,
"feign.bpnApi.url=http://127.0.0.1:" + STUB_SERVER_PORT,
Expand All @@ -63,8 +62,7 @@ public void initialize(ConfigurableApplicationContext configurableApplicationCon
"registry.urlWithPath=http://127.0.0.1:" + STUB_SERVER_PORT + "/semantics/registry/api/v3.0",
"edc.parts-provider-edc-controlplane-url=http://localhost:" + STUB_SERVER_PORT,
"edc.callbackUrls=http://localhost:" + STUB_SERVER_PORT + "/callback/redirect",
"bpdm.bpnEndpoint=http://localhost:" + STUB_SERVER_PORT + "/api/catena/legal-entities/{partnerId}?idType={idType}",
"digitalTwinRegistryClient.discoveryFinderUrl=http://localhost:" + STUB_SERVER_PORT + "/v1.0/administration/connectors/discovery/search"
"bpdm.bpnEndpoint=http://localhost:" + STUB_SERVER_PORT + "/api/catena/legal-entities/{partnerId}?idType={idType}"
).applyTo(configurableApplicationContext.getEnvironment());
}
}
Expand Down

This file was deleted.

Loading

0 comments on commit 95af054

Please sign in to comment.