Skip to content

Commit

Permalink
Merge pull request #650 from catenax-ng/feat/579-adjust-aspect-types-…
Browse files Browse the repository at this point in the history
…ess-request-body

feat(impl):[#579] adjust aspect types ess request body
  • Loading branch information
ds-jhartmann authored May 16, 2024
2 parents 2696589 + 790729b commit 126ca82
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
_**For better traceability add the corresponding GitHub issue number in each changelog entry, please.**_

## [Unreleased]


### Fixed

- Fixed ESS Investigation job processing not starting #579

### Changed

- Improved policy store API input validation. #528
Expand All @@ -16,7 +20,6 @@ _**For better traceability add the corresponding GitHub issue number in each cha
- remove edc namespace from EdcContractAgreementNegotiationResponse and
EdcContractAgreementsResponse eclipse-tractusx/traceability-foss#963


## Added

- Added endpoint for dedicated removal of policy from BPNL. #559
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.tractusx.irs.common.auth.SecurityHelperService;
import org.eclipse.tractusx.irs.component.JobHandle;
import org.eclipse.tractusx.irs.component.Jobs;
import org.eclipse.tractusx.irs.component.Notification;
import org.eclipse.tractusx.irs.component.PartChainIdentificationKey;
import org.eclipse.tractusx.irs.component.RegisterBpnInvestigationJob;
import org.eclipse.tractusx.irs.component.RegisterJob;
import org.eclipse.tractusx.irs.component.enums.AspectType;
import org.eclipse.tractusx.irs.component.enums.BomLifecycle;
import org.eclipse.tractusx.irs.component.enums.JobState;
import org.eclipse.tractusx.irs.connector.job.JobStore;
Expand All @@ -57,8 +55,10 @@
@Slf4j
public class EssService {

private static final String PART_AS_PLANNED = "urn:samm:io.catenax.part_as_planned:2.0.0#PartAsPlanned";
private static final String PART_SITE_INFORMATION_AS_PLANNED = "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned";

private final IrsItemGraphQueryService irsItemGraphQueryService;
private final SecurityHelperService securityHelperService;
private final BpnInvestigationJobCache bpnInvestigationJobCache;
private final JobStore jobStore;
private final EssRecursiveNotificationHandler recursiveNotificationHandler;
Expand Down Expand Up @@ -167,8 +167,7 @@ private RegisterJob bpnInvestigations(final PartChainIdentificationKey key, fina
.key(key)
.bomLifecycle(bomLifecycle != null ? bomLifecycle : BomLifecycle.AS_PLANNED)
.depth(1)
.aspects(List.of(AspectType.PART_SITE_INFORMATION_AS_PLANNED.toString(),
AspectType.PART_AS_PLANNED.toString()))
.aspects(List.of(PART_SITE_INFORMATION_AS_PLANNED, PART_AS_PLANNED))
.collectAspects(true)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.util.Optional;
import java.util.UUID;

import org.eclipse.tractusx.irs.common.auth.SecurityHelperService;
import org.eclipse.tractusx.irs.component.GlobalAssetIdentification;
import org.eclipse.tractusx.irs.component.Job;
import org.eclipse.tractusx.irs.component.JobHandle;
Expand All @@ -63,13 +62,11 @@ class EssServiceTest {

private final IrsItemGraphQueryService irsItemGraphQueryService = mock(IrsItemGraphQueryService.class);

private final SecurityHelperService securityHelperService = mock(SecurityHelperService.class);

private final BpnInvestigationJobCache bpnInvestigationJobCache = new InMemoryBpnInvestigationJobCache();
private final JobStore jobStore = mock(JobStore.class);
private final EssRecursiveNotificationHandler recursiveNotificationHandler = Mockito.mock(
EssRecursiveNotificationHandler.class);
private final EssService essService = new EssService(irsItemGraphQueryService, securityHelperService, bpnInvestigationJobCache,
private final EssService essService = new EssService(irsItemGraphQueryService, bpnInvestigationJobCache,
jobStore, recursiveNotificationHandler);

@Test
Expand Down Expand Up @@ -98,7 +95,6 @@ void shouldSuccessfullyStartJobAndReturnWithExtendedSubmodelList() {
when(irsItemGraphQueryService.registerItemJob(any(RegisterJob.class), any())).thenReturn(JobHandle.builder().id(createdJobId).build());
when(jobStore.find(createdJobId.toString())).thenReturn(Optional.of(MultiTransferJob.builder().job(expectedResponse.getJob()).build()));
when(irsItemGraphQueryService.getJobForJobId(any(MultiTransferJob.class), eq(true))).thenReturn(expectedResponse);
when(securityHelperService.isAdmin()).thenReturn(true);

final JobHandle jobHandle = essService.startIrsJob(request);
final Jobs jobs = essService.getIrsJob(jobHandle.getId().toString());
Expand Down Expand Up @@ -235,7 +231,6 @@ void shouldReturnCorrectFirstLevelImpactedSupplierBpnAndHopsNumberWhenImpactedSu
void shouldKeepJobInRunningIfNotificationIsOpen() {
final String notificationId = UUID.randomUUID().toString();
final UUID jobId = UUID.randomUUID();
when(securityHelperService.isAdmin()).thenReturn(true);

final BpnInvestigationJob bpnInvestigationJob = new BpnInvestigationJob(
Jobs.builder().job(Job.builder().id(jobId).build()).build(),
Expand All @@ -258,7 +253,6 @@ void shouldThrowResponseStatusExceptionWhenIdDoesntExists() {
void shouldCompleteJobIfAllNotificationsSentWereAnswered() {
// Arrange
final String notificationId = UUID.randomUUID().toString();
when(securityHelperService.isAdmin()).thenReturn(true);

final UUID jobId = UUID.randomUUID();
final Jobs jobSnapshot = job(jobId);
Expand Down Expand Up @@ -288,8 +282,6 @@ void shouldCompleteJobIfAllNotificationsSentWereAnswered() {
@Test
void shouldCompleteJobIfFinalNotificationWasReceived() {
// Arrange
when(securityHelperService.isAdmin()).thenReturn(true);

final UUID jobId = UUID.randomUUID();
final Jobs jobSnapshot = job(jobId);
final String notificationId = UUID.randomUUID().toString();
Expand Down

0 comments on commit 126ca82

Please sign in to comment.