Skip to content

Commit d5fa7fa

Browse files
authored
Merge branch 'eclipse-tractusx:main' into main
2 parents 535999e + e3b7814 commit d5fa7fa

File tree

10 files changed

+80
-28
lines changed

10 files changed

+80
-28
lines changed

.github/workflows/xray-cucumber-association.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
env:
4848
JIRA_USERNAME: ${{ secrets.ASSOCIATION_TX_JIRA_USERNAME }}
4949
JIRA_PASSWORD: ${{ secrets.ASSOCIATION_TX_JIRA_PASSWORD }}
50+
working-directory: tx-cucumber-tests
5051
# JIRA filter 11349: project = "[TR] FOSS - Open Source (Impl.)" AND issuetype = Test AND "Test Type" = Cucumber AND status = Ready AND labels = INTEGRATION_TEST AND (environment ~ DEV OR environment ~ "INT")
5152
# Downloads all feature files of cucumber tests inside TRI project
5253
run: |
@@ -66,19 +67,20 @@ jobs:
6667
# Required step due to fact that jira will name feature files differently with each feature added and that will cause duplicate test runs
6768
- name: Cleanup repository feature files
6869
if: ${{ steps.download.outputs.http_response == '200' }}
69-
#working-directory: tx-cucumber-tests
70+
working-directory: tx-cucumber-tests
7071
run: |
71-
rm -r tx-cucumber-tests/src/test/resources/features/*
72+
rm -r src/test/resources/features/*
7273
7374
- name: Build with Maven
7475
if: ${{ steps.download.outputs.http_response == '200' }}
7576
env:
76-
KEYCLOAK_HOST: ${{ secrets.ASSOCIATION_KEYCLOAK_HOST }}
77-
SUPERVISOR_CLIENT_ID: ${{ secrets.ASSOCIATION_SUPERVISOR_CLIENT_ID }}
78-
SUPERVISOR_PASSWORD: ${{ secrets.ASSOCIATION_SUPERVISOR_PASSWORD }}
79-
E2E_TXA_HOST: ${{ secrets.ASSOCIATION_E2E_TXA_HOST }}
80-
E2E_TXB_HOST: ${{ secrets.ASSOCIATION_E2E_TXB_HOST }}
81-
#working-directory: tx-cucumber-tests
77+
ASSOCIATION_KEYCLOAK_HOST: ${{ secrets.ASSOCIATION_KEYCLOAK_HOST }}
78+
ASSOCIATION_SUPERVISOR_TX_A_CLIENT_ID: ${{ secrets.ASSOCIATION_SUPERVISOR_TX_A_CLIENT_ID }}
79+
ASSOCIATION_SUPERVISOR_TX_A_PASSWORD: ${{ secrets.ASSOCIATION_SUPERVISOR_TX_A_PASSWORD }}
80+
ASSOCIATION_SUPERVISOR_TX_B_CLIENT_ID: ${{ secrets.ASSOCIATION_SUPERVISOR_TX_B_CLIENT_ID }}
81+
ASSOCIATION_SUPERVISOR_TX_B_PASSWORD: ${{ secrets.ASSOCIATION_SUPERVISOR_TX_B_PASSWORD }}
82+
ASSOCIATION_E2E_TXA_HOST: ${{ secrets.ASSOCIATION_E2E_TXA_HOST }}
83+
ASSOCIATION_E2E_TXB_HOST: ${{ secrets.ASSOCIATION_E2E_TXB_HOST }}
8284
run: |
8385
unzip -o tx-cucumber-tests/features.zip -d tx-cucumber-tests/src/test/resources/features
8486
mvn -pl tx-models,tx-cucumber-tests --batch-mode clean install -D"cucumber.filter.tags"="@trace-x-automated" -P association

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88
_**For better traceability add the corresponding GitHub issue number in each changelog entry, please.**_
99
## [UNRELEASED - DD.MM.YYYY]
1010

11+
### Changed
12+
- #1122 Fixed editing notification sendTo attribute
13+
- #1328 Fixed semanticDataModel translation and part name within notification detail / edit view.
14+
1115
## [13.0.1 - 26.07.2024]
1216

1317
### Added

frontend/src/app/modules/page/notifications/detail/notification-detail.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ export class NotificationDetailComponent implements AfterViewInit, OnDestroy {
195195
private setTableConfigs(data: Notification): void {
196196
this.isReceived = !data.isFromSender;
197197

198-
const displayedColumns = [ 'id', 'semanticDataModel', 'name', 'semanticModelId' ];
199-
const sortableColumns = { id: true, semanticDataModel: true, name: true, semanticModelId: true };
198+
const displayedColumns = [ 'id', 'semanticDataModel', 'nameAtManufacturer', 'semanticModelId' ];
199+
const sortableColumns = { id: true, semanticDataModel: true, nameAtManufacturer: true, semanticModelId: true };
200200

201201
const tableConfig = {
202202
displayedColumns,

frontend/src/app/modules/shared/components/parts-table/parts-table.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ <h3>{{ 'table.noResultFound' | i18n }}</h3>
325325

326326
<ng-template #semanticDataModelElement>
327327
<ng-container *ngIf="isSemanticDataModel(column); else autoFormatRef">
328-
{{'table.semanticDataModel.' + element[column] | i18n}}
328+
{{'table.semanticDataModel.' + element[column]?.toUpperCase() | i18n}}
329329
</ng-container>
330330
</ng-template>
331331

tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/application/notification/rest/NotificationController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,10 @@ public void closeNotificationById(
460460
notificationService.updateStatusTransition(notificationId, NotificationStatus.from(NotificationStatusRequest.CLOSED), cleanCloseNotificationRequest.getReason());
461461
}
462462

463-
@Operation(operationId = "updateNotification",
464-
summary = "Update notification by id",
463+
@Operation(operationId = "updateNotificationStatus",
464+
summary = "Update notification status by id",
465465
tags = {"Notifications"},
466-
description = "The endpoint updates notification by their id.",
466+
description = "The endpoint updates the notification status by their id.",
467467
security = @SecurityRequirement(name = "oAuth2", scopes = "profile email"))
468468
@ApiResponses(value = {
469469
@ApiResponse(

tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/AbstractNotificationService.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
import jakarta.transaction.Transactional;
2222
import lombok.RequiredArgsConstructor;
2323
import lombok.extern.slf4j.Slf4j;
24-
import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository;
25-
import org.eclipse.tractusx.traceability.bpn.infrastructure.repository.BpnRepository;
26-
import org.eclipse.tractusx.traceability.common.model.BPN;
2724
import org.eclipse.tractusx.traceability.common.model.PageResult;
2825
import org.eclipse.tractusx.traceability.common.model.SearchCriteria;
2926
import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties;
@@ -54,8 +51,6 @@ public abstract class AbstractNotificationService implements NotificationService
5451

5552
private final TraceabilityProperties traceabilityProperties;
5653
private final NotificationPublisherService notificationPublisherService;
57-
private final AssetAsBuiltRepository assetAsBuiltRepository;
58-
private final BpnRepository bpnRepository;
5954

6055
private static final List<String> SUPPORTED_ENUM_FIELDS = List.of("status", "side", "severity", "type");
6156

@@ -115,7 +110,6 @@ public void editNotification(EditNotification editNotification) {
115110
Notification notification = loadOrNotFoundException(new NotificationId(editNotification.getId()));
116111

117112
if (editNotification.getReceiverBpn() != null) {
118-
notification.setBpn(BPN.of(editNotification.getReceiverBpn()));
119113
notification.setInitialReceiverBpns(List.of(editNotification.getReceiverBpn()));
120114
notification.setSendTo(editNotification.getReceiverBpn());
121115
}

tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/notification/service/NotificationServiceImpl.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
package org.eclipse.tractusx.traceability.notification.domain.notification.service;
2121

22-
import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository;
23-
import org.eclipse.tractusx.traceability.bpn.infrastructure.repository.BpnRepository;
2422
import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties;
2523
import org.eclipse.tractusx.traceability.notification.domain.base.service.AbstractNotificationService;
2624
import org.eclipse.tractusx.traceability.notification.domain.base.service.NotificationPublisherService;
@@ -34,9 +32,8 @@ public class NotificationServiceImpl extends AbstractNotificationService {
3432

3533
public NotificationServiceImpl(TraceabilityProperties traceabilityProperties,
3634
NotificationRepository alertRepository,
37-
NotificationPublisherService notificationPublisherService,
38-
AssetAsBuiltRepository assetAsBuiltRepository, BpnRepository bpnRepository) {
39-
super(traceabilityProperties, notificationPublisherService, assetAsBuiltRepository, bpnRepository);
35+
NotificationPublisherService notificationPublisherService) {
36+
super(traceabilityProperties, notificationPublisherService);
4037
this.notificationRepository = alertRepository;
4138

4239
}

tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/infrastructure/notification/repository/NotificationRepositoryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public void updateNotificationAndMessage(Notification notification) {
123123
.orElseThrow(() -> new IllegalArgumentException(String.format("Investigation with id %s not found!", notification.getNotificationId().value())));
124124
notificationEntity.setTitle(notification.getTitle());
125125
notificationEntity.setDescription(notification.getDescription());
126-
notificationEntity.setBpn(notification.getBpn());
126+
notificationEntity.setInitialReceiverBpn(notification.getSendTo());
127127
notificationEntity.setAssets(getAssetEntitiesByAssetIds(notification.getAffectedPartIds()));
128128
notificationEntity.setStatus(NotificationStatusBaseEntity.fromStringValue(notification.getNotificationStatus().name()));
129129
notificationEntity.setUpdated(clock.instant());

tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/NotificationApiSupport.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public PageResult<NotificationResponse> getNotificationsRequest(Header authHeade
8383
.when()
8484
.post("/api/notifications/filter")
8585
.then()
86+
.log().all()
8687
.statusCode(200)
8788
.extract().response();
8889

tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/notification/EditNotificationIT.java

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.junit.jupiter.api.BeforeEach;
2323
import org.junit.jupiter.api.Test;
2424
import org.springframework.beans.factory.annotation.Autowired;
25-
import org.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException;
2625
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
2726

2827
import java.util.Collections;
@@ -145,7 +144,7 @@ void shouldThrowBadRequestWhenUpdateInvestigation_SenderAndReceiverBpnIsSame() t
145144
}
146145

147146
@Test
148-
void shouldUpdateInvestigationFields() throws JsonProcessingException, JoseException, com.fasterxml.jackson.core.JsonProcessingException {
147+
void shouldUpdateInvestigationFields() throws JoseException, com.fasterxml.jackson.core.JsonProcessingException {
149148
Header authHeader = oAuth2Support.jwtAuthorization(SUPERVISOR);
150149
// given
151150
List<String> partIds = List.of(
@@ -255,6 +254,61 @@ void shouldNotUpdateInvestigationFields_whenBpnWrongFormatted() throws JoseExcep
255254
NotificationResponse notificationResponse = notificationResponsePageResult.content().get(0);
256255
assertThat(notificationResponse.getSendTo()).isEqualTo("BPNL00000003CNKC");
257256

257+
}
258+
259+
@Test
260+
void shouldUpdateReceiverBpn() throws JoseException, com.fasterxml.jackson.core.JsonProcessingException {
261+
Header authHeader = oAuth2Support.jwtAuthorization(SUPERVISOR);
262+
263+
// given
264+
List<String> partIds = List.of(
265+
"urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978", // BPN: BPNL00000003AYRE
266+
"urn:uuid:d387fa8e-603c-42bd-98c3-4d87fef8d2bb", // BPN: BPNL00000003AYRE
267+
"urn:uuid:0ce83951-bc18-4e8f-892d-48bad4eb67ef" // BPN: BPNL00000003AXS3
268+
);
269+
String description = "at least 15 characters long investigation description";
270+
String title = "the initial title";
271+
val startNotificationRequest = StartNotificationRequest.builder()
272+
.affectedPartIds(partIds)
273+
.description(description)
274+
.title(title)
275+
.type(NotificationTypeRequest.ALERT)
276+
.severity(NotificationSeverityRequest.MINOR)
277+
.receiverBpn("BPNL00000003AYRE")
278+
.build();
279+
280+
int id = notificationAPISupport.createNotificationRequest_withDefaultAssetsStored(authHeader, startNotificationRequest, 201);
281+
282+
String editedDescription = "at least 15 characters long investigation description which was edited";
283+
284+
String editedTitle = "changed title";
285+
val editNotificationRequest = EditNotificationRequest.builder()
286+
.receiverBpn("BPNL00000003AABC")
287+
.affectedPartIds(partIds)
288+
.description(editedDescription)
289+
.title(editedTitle)
290+
.affectedPartIds(startNotificationRequest.getAffectedPartIds())
291+
.severity(NotificationSeverityRequest.CRITICAL)
292+
.build();
293+
294+
// when
295+
notificationAPISupport.editNotificationRequest(authHeader, editNotificationRequest, id, 204);
296+
297+
// then
298+
notificationMessageSupport.assertMessageSize(0);
299+
300+
PageableFilterRequest pageableFilterRequest =
301+
new PageableFilterRequest(
302+
new OwnPageable(0, 10, Collections.emptyList()),
303+
new SearchCriteriaRequestParam(List.of("channel,EQUAL,SENDER,AND")));
304+
305+
PageResult<NotificationResponse> notificationResponsePageResult
306+
= notificationAPISupport.getNotificationsRequest(authHeader, pageableFilterRequest);
307+
308+
NotificationResponse notificationResponse = notificationResponsePageResult.content().get(0);
309+
assertThat(notificationResponse.getId()).isEqualTo(id);
310+
assertThat(notificationResponse.getSendTo()).isEqualTo(editNotificationRequest.getReceiverBpn());
311+
assertThat(notificationResponse.getCreatedBy()).isEqualTo("BPNL00000003AXS3");
258312

259313
}
260314
}

0 commit comments

Comments
 (0)