Skip to content

Commit

Permalink
Merge branch 'main' into chore/xxx-delete-submodel-interface
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
ashanmugavel committed Jun 18, 2024
2 parents d502e87 + 39e3f18 commit 6eedeab
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 197 deletions.
91 changes: 0 additions & 91 deletions .github/workflows/jira-publish-release.yaml

This file was deleted.

42 changes: 33 additions & 9 deletions .github/workflows/pull-request_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ env:
GHCR_REGISTRY: ghcr.io
JAVA_VERSION: 17
DOCKER_HUB_REGISTRY_NAMESPACE: tractusx
BACKEND_IMAGE_DOCKER_HUB: traceability-foss

jobs:
Check-Changelog-update:
Expand Down Expand Up @@ -114,16 +115,16 @@ jobs:
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Verify Sonar Scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }}
SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }}
SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY_BACKEND }}
run: mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --batch-mode sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/tx-traceability-foss/tx-traceability-foss/tx-coverage/target/site/jacoco-aggregate/jacoco.xml -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY_BACKEND }} -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }}
# - name: Verify Sonar Scan
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }}
# SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }}
# SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY_BACKEND }}
# run: mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --batch-mode sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/traceability-foss/tx-traceability-foss/tx-coverage/target/site/jacoco-aggregate/jacoco.xml -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY_BACKEND }} -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }}

Publish-docker-image:
needs: [ "Test-and-Sonar" ]
# needs: [ "Test-and-Sonar" ]
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -142,18 +143,41 @@ jobs:
distribution: 'temurin'
cache: 'maven'


- name: Login to GHCR Registry
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
if: env.DOCKER_HUB_USER == ''
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build & Push docker image for GHCR ${{ env.GHCR_REGISTRY }}/${{ github.repository }}:${{ github.event.pull_request.head.sha }}
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
if: env.DOCKER_HUB_USER == ''
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.GHCR_REGISTRY }}/${{ github.repository }}:${{ github.event.pull_request.head.sha }}

- name: Login to Docker Hub
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
if: env.DOCKER_HUB_USER != ''
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Build & push docker image for Docker Hub ${{ env.DOCKER_HUB_REGISTRY_NAMESPACE }}/${{ env.BACKEND_IMAGE_DOCKER_HUB }}:${{ github.event.pull_request.head.sha }}
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
if: env.DOCKER_HUB_USER != ''
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.DOCKER_HUB_REGISTRY_NAMESPACE }}/${{ env.BACKEND_IMAGE_DOCKER_HUB }}:${{ github.event.pull_request.head.sha }}
8 changes: 0 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ jobs:
with:
body: ${{ env.CHANGELOG }}

trigger-jira:
needs:
- release
uses: ./.github/workflows/jira-publish-release.yaml
with:
version: ${{ github.ref_name }}
secrets: inherit

publish-to-swaggerhub:
name: "Publish OpenAPI spec to Swaggerhub"
permissions:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ _**For better traceability add the corresponding GitHub issue number in each cha
### Removed

- XXX Removed EdcNotifiactionMockServiceImpl class and replaced with mocks
- #1033 removed action jira-publish-release workflow
- XXX Removed submodel interfaces

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public class PolicyStartUpConfig {
@ConditionalOnProperty(name = "applicationConfig.registerDecentralRegistryPermissions.enabled", havingValue = "true")
public void registerDecentralRegistryPermissions() throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.registerModule(new JavaTimeModule());
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
List<AcceptedPolicy> acceptedPolicy = buildAcceptedPolicies();
defaultAcceptedPoliciesProvider.addAcceptedPolicies(acceptedPolicy);
log.info("Successfully added permission to irs client lib provider: {}", mapper.writeValueAsString(acceptedPolicy));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public RestTemplate edcRestTemplate(@Autowired EdcProperties edcProperties) {
.rootUri(edcProperties.getProviderEdcUrl())
.defaultHeader(EDC_API_KEY_HEADER_NAME, edcProperties.getApiAuthKey())
.setConnectTimeout(Duration.ofSeconds(10L))
.additionalInterceptors(new RequestResponseLoggingInterceptor())
.setReadTimeout(Duration.ofSeconds(25L))
.build();
}
Expand All @@ -116,7 +115,6 @@ public RestTemplate edcDtrAssetRestTemplate(@Autowired EdcProperties edcProperti
.defaultHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
.defaultHeader(EDC_API_KEY_HEADER_NAME, edcProperties.getApiAuthKey())
.setConnectTimeout(Duration.ofSeconds(10L))
.additionalInterceptors(new RequestResponseLoggingInterceptor())
.setReadTimeout(Duration.ofSeconds(25L))
.build();
}
Expand All @@ -132,7 +130,6 @@ public RestTemplate digitalTwinRegistryCreateShellRestTemplate() {
public RestTemplate edcNotificationTemplate(@Autowired EdcProperties edcProperties) {
return new RestTemplateBuilder()
.defaultHeader(EDC_API_KEY_HEADER_NAME, edcProperties.getApiAuthKey())
.additionalInterceptors(new RequestResponseLoggingInterceptor())
.build();
}

Expand All @@ -143,7 +140,6 @@ public RestTemplate irsAdminTemplate(@Autowired TraceabilityProperties traceabil
.rootUri(traceabilityProperties.getIrsBase())
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) // Set Content-Type header
.defaultHeader(IRS_API_KEY_HEADER_NAME, traceabilityProperties.getAdminApiKey())
.messageConverters(customMessageConverters())
.build();
}

Expand Down Expand Up @@ -184,17 +180,8 @@ public RestTemplate digitalTwinRegistryRestTemplate(
/* RestTemplate used by the edc client library*/
@Bean(EDC_CLIENT_REST_TEMPLATE)
public RestTemplate edcClientRestTemplate() {
ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
RestTemplate restTemplate = new RestTemplate(factory);

List<ClientHttpRequestInterceptor> interceptors = restTemplate.getInterceptors();
if (CollectionUtils.isEmpty(interceptors)) {
interceptors = new ArrayList<>();
}
interceptors.add(new RequestResponseLoggingInterceptor());
restTemplate.setErrorHandler(new DefaultResponseErrorHandler());
restTemplate.setInterceptors(interceptors);
return restTemplate;
return new RestTemplateBuilder()
.build();
}

private RestTemplateBuilder oAuthRestTemplate(final RestTemplateBuilder restTemplateBuilder,
Expand Down Expand Up @@ -225,7 +212,6 @@ private List<HttpMessageConverter<?>> customMessageConverters() {
.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true)
.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
.build()
.registerModules(javaTimeModule));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ public Notification startNotification(StartNotification startNotification) {
}

private void createMessages(StartNotification startNotification, BPN applicationBPN, Notification notification, AssetAsBuiltRepository assetAsBuiltRepository) {
Map<String, List<AssetBase>> assetsAsBuiltBPNMap = assetAsBuiltRepository.getAssetsById(startNotification.getAffectedPartIds()).stream().collect(groupingBy(AssetBase::getManufacturerId));
assetsAsBuiltBPNMap
Map<String, List<AssetBase>> assetsAsBuiltBPNMap =
assetAsBuiltRepository
.getAssetsById(startNotification.getAffectedPartIds())
.stream()
.filter(asset -> Objects.nonNull(asset.getManufacturerId()))
.collect(groupingBy(AssetBase::getManufacturerId)); assetsAsBuiltBPNMap
.entrySet()
.stream()
.map(it -> {
Expand Down

0 comments on commit 6eedeab

Please sign in to comment.