Skip to content

Commit

Permalink
Merge branch 'main' into TRI-822-add-known-knowns-to-changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-jkreutzfeld authored Nov 9, 2022
2 parents 13db07d + 2e19981 commit 36e672f
Show file tree
Hide file tree
Showing 29 changed files with 3,571 additions and 1,328 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/eclipse-dash-ip-create.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/publish-documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ jobs:
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

- name: Cache maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build API documentation with Maven
run: |
mvn clean package -pl irs-models,irs-testing,irs-api -DskipTests --batch-mode
cp irs-api/target/generated-sources/openapi/index.html docs/src/docs/api-specification/index.html
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
5 changes: 4 additions & 1 deletion .run/IrsApplication.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IrsApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="local" />
<envs>
<env name="SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK-SET-URI" value="http://localhost/pathToJwkSet" />
</envs>
<module name="irs-api" />
<option name="SPRING_BOOT_MAIN_CLASS" value="org.eclipse.tractusx.irs.IrsApplication" />
<option name="ACTIVE_PROFILES" value="local" />
<method v="2">
<option name="Make" enabled="true" />
</method>
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Added new parameters 'startedOn' and 'jobCompleted' to Job status response
-

### Changed
- Updated Spring Boot to 2.7.5 and Spring Security (Web and OAuth2 Client) dependencies to 5.7.5 due to CVEs
- Renamed parameter from 'status' to 'jobState' in Job status response
-
- Time to live for finished jobs is now configurable

### Known knowns
- PLACEHOLDER REMOVE IF EMPTY: risks that were introduced or discovered in the release and are known but not resolved

Expand Down
2 changes: 1 addition & 1 deletion api/irs-v1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1260,5 +1260,5 @@ components:
clientCredentials:
scopes:
profile email: ""
tokenUrl: https://centralidp.demo.catena-x.net/auth/realms/CX-Central/protocol/openid-connect/token
tokenUrl: http://localhost
type: oauth2
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import io.cucumber.java.After;
import io.cucumber.java.Before;
import io.cucumber.java.PendingException;
import io.cucumber.java.Scenario;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
Expand All @@ -52,6 +54,7 @@
import org.eclipse.tractusx.irs.component.enums.Direction;
import org.eclipse.tractusx.irs.component.enums.JobState;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

public class E2ETestStepDefinitions {
private RegisterJob.RegisterJobBuilder registerJobBuilder;
Expand Down Expand Up @@ -154,7 +157,7 @@ public void iCheckIfTheJobHasStatusWithinMinutes(String status, int maxWaitTime)
@And("I check, if number of {string} equals to {string}")
public void iCheckIfNumberOfEqualsTo(String valueType, String arg1) {
if ("tombstones".equals(valueType)) {
assertThat(completedJob.getTombstones().size()).isEqualTo(
assertThat(completedJob.getTombstones()).hasSize(
completedJob.getJob().getSummary().getAsyncFetchedItems().getFailed());
} else {
throw new PendingException();
Expand All @@ -172,29 +175,29 @@ public void iCheckIfAreAsExpected(String valueType, String fileName) throws IOEx
if ("relationships".equals(valueType)) {
final List<Relationship> actualRelationships = completedJob.getRelationships();
final List<Relationship> expectedRelationships = getExpectedRelationships(fileName);
assertThat(actualRelationships.size()).isEqualTo(expectedRelationships.size());
assertThat(actualRelationships).containsAll(expectedRelationships);
assertThat(actualRelationships).hasSameSizeAs(expectedRelationships)
.containsAll(expectedRelationships);
} else if ("submodels".equals(valueType)) {
final List<Submodel> actualSubmodels = completedJob.getSubmodels();
final List<Submodel> expectedSubmodels = getExpectedSubmodels(fileName);
assertThat(actualSubmodels.size()).isEqualTo(expectedSubmodels.size());
assertThat(actualSubmodels).usingRecursiveFieldByFieldElementComparatorIgnoringFields("identification")
assertThat(actualSubmodels).hasSameSizeAs(expectedSubmodels)
.usingRecursiveFieldByFieldElementComparatorIgnoringFields("identification")
.containsAll(expectedSubmodels);
}
}

private List<Submodel> getExpectedSubmodels(final String fileName) throws IOException {
ClassLoader classLoader = this.getClass().getClassLoader();
File file = new File(classLoader.getResource("expected-files/" + fileName).getFile());
assertThat(file.exists()).isTrue();
assertThat(file).exists();
final Jobs expectedJob = objectMapper.readValue(file, Jobs.class);
return expectedJob.getSubmodels();
}

private List<Relationship> getExpectedRelationships(final String fileName) throws IOException {
ClassLoader classLoader = this.getClass().getClassLoader();
File file = new File(classLoader.getResource("expected-files/" + fileName).getFile());
assertThat(file.exists()).isTrue();
assertThat(file).exists();
final Jobs expectedJob = objectMapper.readValue(file, Jobs.class);
return expectedJob.getRelationships();
}
Expand All @@ -214,4 +217,26 @@ public void iCheckIfSubmodelsContainsBPNLNumberAtLeastTimes(String bpnlNumber, i
.filter(submodel -> submodel.getPayload().toString().contains(bpnlNumber))
.count()).isGreaterThanOrEqualTo(numberOfOccurrence);
}

@And("{string} are empty")
public void areEmpty(String valueType) {
if ("tombstones".equals(valueType)) {
assertThat(completedJob.getTombstones()).isEmpty();
} else if ("submodels".equals(valueType)) {
assertThat(completedJob.getSubmodels()).isEmpty();
} else if ("relationships".equals(valueType)) {
assertThat(completedJob.getRelationships()).isEmpty();
} else if ("shells".equals(valueType)) {
assertThat(completedJob.getShells()).isEmpty();
} else if ("bpns".equals(valueType)) {
assertThat(completedJob.getBpns()).isEmpty();
} else {
throw new PendingException();
}
}

@After("@INTEGRATION_TEST")
public void addJobIdToResult(Scenario scenario) {
scenario.attach(jobId.toString(), MediaType.TEXT_PLAIN_VALUE, "jobId");
}
}
Loading

0 comments on commit 36e672f

Please sign in to comment.