diff --git a/AUTHORS.md b/AUTHORS.md
index 1ebafba0..b1e2475c 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -1,8 +1,11 @@
-### The following people have contributed to this repository
+# Authors
-Aditya Kumar, doubleSlash Net-Business GmbH, https://github.com/adkumar1
-Aditya Gajbhiye, doubleSlash Net-Business GmbH, https://github.com/adityagajbhiye
-Sachin Argade, doubleSlash Net-Business GmbH, https://github.com/sachinargade123
-Dmitrii Vasiunin, doubleSlash Net-Business GmbH, https://github.com/dvasunin
-Amol Dashwant, doubleSlash Net-Business GmbH, https://github.com/amoldashwant
-Fedor Nazarov, doubleSlash Net-Business GmbH, https://github.com/Wulghash
\ No newline at end of file
+The following people have contributed to this repository:
+
+* Sachin Argade, T-Systems International GmbH, https://github.com/sachinargade123
+* Chetan Parate, T-Systems International GmbH, https://github.com/ChetanT-System
+* Aditya Gajbhiye, T-Systems International GmbH, https://github.com/adityagajbhiye
+* Aditya Kumar, T-Systems International GmbH, https://github.com/adkumar1
+* Dmitrii Vasiunin, T-Systems International GmbH, https://github.com/dvasunin
+* Amol Dashwant, T-Systems International GmbH, https://github.com/amoldashwant
+* Fedor Nazarov,, T-Systems International GmbH, https://github.com/Wulghash
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b1729bc3..08c63780 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased]
+## [1.2.1] - 2023-03-20
+
+### Fixed
+ - Sonar code duplication issue fix
## [1.2.0] - 2023-03-14
diff --git a/Dockerfile b/Dockerfile
index 0a428cdb..8ec5bcd1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,8 +19,7 @@
#*******************************************************************************
# our base build image
-#FROM maven:3.8-openjdk-18 as builder
-FROM maven:3.9.0-eclipse-temurin-19 as builder
+FROM maven:3.8.7-eclipse-temurin-17 AS builder
# copy the project files
COPY ./pom.xml /pom.xml
@@ -34,12 +33,8 @@ COPY ./src ./src
# build for release
RUN mvn clean install -Dmaven.test.skip=true
-# our final base image
-#FROM eclipse-temurin:18.0.1_10-jre
-#FROM eclipse-temurin:19_36-jre
-
-FROM eclipse-temurin:latest
+FROM eclipse-temurin:17.0.6_10-jdk
ARG USERNAME=autosetupuser
ARG USER_UID=1000
@@ -48,19 +43,14 @@ ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
-# && apt-get update \
-# && apt-get install -y sudo \
-# && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
-# && chmod 0440 /etc/sudoers.d/$USERNAME
-# set deployment directory
+USER $USERNAME
+
WORKDIR /autosetup
# copy over the built artifact from the maven image
COPY --from=builder target/*.jar ./app.jar
-USER $USERNAME
-
EXPOSE 9999
# set the startup command to run your binary
CMD ["java", "-jar", "./app.jar"]
diff --git a/INSTALL.md b/INSTALL.md
index 51fb66f3..d0c5b48a 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -4,13 +4,13 @@ Helm charts are provided inside https://github.com/eclipse-tractusx/autosetup-ba
- Using helm commands
-How to install application using helm:-
+How to install application using helm:
helm install ReleaseName ChartName
- a.) Add helm repository in tractusx:-
+ a.) Add helm repository in tractusx:
helm repo add autosetup https://eclipse-tractusx.github.io/charts/dev
b.) To search the specific repo in helm repositories
helm search repo tractusx-dev
- c.) To install using helm command:-
+ c.) To install using helm command:
helm install autosetup tractusx-dev/autosetup
diff --git a/README.md b/README.md
index cae196d7..6dce7be2 100644
--- a/README.md
+++ b/README.md
@@ -12,8 +12,8 @@ This service will help service provider to set up DFT/SDE with EDC and EDC as se
### Software Version
```shell
-Application version: 1.2.0
-Helm release version: 1.2.0
+Application version: 1.2.1
+Helm release version: 1.2.1
```
@@ -40,7 +40,7 @@ You can find the standard credentials as well as further database configurations
### Steps
1. Clone the GitHub Repository - https://github.com/eclipse-tractusx/autosetup-backend
-2. Get your instance of postgres running.
+2. Get your instance of postgres running
3. Setup your project environment to JDK 18
4. Start the application from your IDE.
diff --git a/charts/.helmignore b/charts/.helmignore
deleted file mode 100644
index 0e8a0eb3..00000000
--- a/charts/.helmignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# Patterns to ignore when building packages.
-# This supports shell glob matching, relative path matching, and
-# negation (prefixed with !). Only one pattern per line.
-.DS_Store
-# Common VCS dirs
-.git/
-.gitignore
-.bzr/
-.bzrignore
-.hg/
-.hgignore
-.svn/
-# Common backup files
-*.swp
-*.bak
-*.tmp
-*.orig
-*~
-# Various IDEs
-.project
-.idea/
-*.tmproj
-.vscode/
diff --git a/charts/orchestrator/Chart.yaml b/charts/orchestrator/Chart.yaml
index bb155dcd..78be3efe 100644
--- a/charts/orchestrator/Chart.yaml
+++ b/charts/orchestrator/Chart.yaml
@@ -38,14 +38,14 @@ sources:
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 1.2.0
+version: 1.2.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
-appVersion: "1.2.0"
+appVersion: "1.2.1"
dependencies:
- condition: postgresql.enabled
name: postgresql
diff --git a/charts/orchestrator/README.md b/charts/orchestrator/README.md
index ad6156e9..7d130d31 100644
--- a/charts/orchestrator/README.md
+++ b/charts/orchestrator/README.md
@@ -1,6 +1,6 @@
# autosetup
-![Version: 1.2.0](https://img.shields.io/badge/Version-1.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.2.0](https://img.shields.io/badge/AppVersion-1.2.0-informational?style=flat-square)
+![Version: 1.2.1](https://img.shields.io/badge/Version-1.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.2.1](https://img.shields.io/badge/AppVersion-1.2.1-informational?style=flat-square)
This service will help service provider to set up DFT/SDE with EDC and EDC as service in service provider environment.
diff --git a/pom.xml b/pom.xml
index dbc1ed66..588b3abd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
org.eclipse.tractusx
auto-setup
- 1.2.0
+ 1.2.1
auto-setup
auto-setup
diff --git a/src/main/java/org/eclipse/tractusx/autosetup/constant/DAPsConfigurationProperty.java b/src/main/java/org/eclipse/tractusx/autosetup/constant/DAPsConfigurationProperty.java
new file mode 100644
index 00000000..42486807
--- /dev/null
+++ b/src/main/java/org/eclipse/tractusx/autosetup/constant/DAPsConfigurationProperty.java
@@ -0,0 +1,41 @@
+/********************************************************************************
+#* Copyright (c) 2022, 2023 T-Systems International GmbH
+#* Copyright (c) 2022, 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.autosetup.constant;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import lombok.Getter;
+
+@Getter
+@Component
+public class DAPsConfigurationProperty {
+
+ @Value("${daps.url}")
+ private String url;
+
+ @Value("${daps.jskurl}")
+ private String jskUrl;
+
+ @Value("${daps.token.url}")
+ private String tokenUrl;
+
+}
diff --git a/src/main/java/org/eclipse/tractusx/autosetup/manager/SDEConfigurationProperty.java b/src/main/java/org/eclipse/tractusx/autosetup/constant/SDEConfigurationProperty.java
similarity index 97%
rename from src/main/java/org/eclipse/tractusx/autosetup/manager/SDEConfigurationProperty.java
rename to src/main/java/org/eclipse/tractusx/autosetup/constant/SDEConfigurationProperty.java
index e2445516..8f30498e 100644
--- a/src/main/java/org/eclipse/tractusx/autosetup/manager/SDEConfigurationProperty.java
+++ b/src/main/java/org/eclipse/tractusx/autosetup/constant/SDEConfigurationProperty.java
@@ -18,7 +18,7 @@
#* SPDX-License-Identifier: Apache-2.0
#********************************************************************************/
-package org.eclipse.tractusx.autosetup.manager;
+package org.eclipse.tractusx.autosetup.constant;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
diff --git a/src/main/java/org/eclipse/tractusx/autosetup/factory/builder/AppConfigurationBuilder.java b/src/main/java/org/eclipse/tractusx/autosetup/factory/builder/AppConfigurationBuilder.java
index 4e71eb63..43b0876d 100644
--- a/src/main/java/org/eclipse/tractusx/autosetup/factory/builder/AppConfigurationBuilder.java
+++ b/src/main/java/org/eclipse/tractusx/autosetup/factory/builder/AppConfigurationBuilder.java
@@ -42,6 +42,7 @@ public String buildConfiguration(AppDetails appDetails, Map inpu
String sb=stringSubstitutor1.replace(appDetails.getExpectedInputData());
dyanamicYamlValues.put("yamlValues", sb);
dyanamicYamlValues.put("dnsName", inputProperties.get("dnsName"));
+ dyanamicYamlValues.putAll(inputProperties);
// Initialize StringSubstitutor instance with value map
diff --git a/src/main/java/org/eclipse/tractusx/autosetup/manager/ConnectorCommonUtilityManager.java b/src/main/java/org/eclipse/tractusx/autosetup/manager/ConnectorCommonUtilityManager.java
new file mode 100644
index 00000000..e8c495b8
--- /dev/null
+++ b/src/main/java/org/eclipse/tractusx/autosetup/manager/ConnectorCommonUtilityManager.java
@@ -0,0 +1,74 @@
+/********************************************************************************
+ * Copyright (c) 2023 T-Systems International GmbH
+ * 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.autosetup.manager;
+
+import java.util.Map;
+
+import org.eclipse.tractusx.autosetup.constant.DAPsConfigurationProperty;
+import org.eclipse.tractusx.autosetup.utility.PasswordGenerator;
+import org.springframework.stereotype.Component;
+
+import lombok.RequiredArgsConstructor;
+
+@Component
+@RequiredArgsConstructor
+public class ConnectorCommonUtilityManager {
+
+
+ private final DAPsConfigurationProperty dAPsConfigurationProperty;
+
+ public Map prepareConnectorInput(String packageName, Map inputData) {
+
+ String generateRandomPassword = PasswordGenerator.generateRandomPassword(50);
+ String dnsName = inputData.get("dnsName");
+ String dnsNameURLProtocol = inputData.get("dnsNameURLProtocol");
+
+ String controlplaneurl = dnsNameURLProtocol + "://" + dnsName;
+
+ inputData.put("dapsurl", dAPsConfigurationProperty.getUrl());
+ inputData.put("dapsjsksurl", dAPsConfigurationProperty.getJskUrl());
+ inputData.put("dapstokenurl", dAPsConfigurationProperty.getTokenUrl());
+
+ inputData.put("dataPlanePublicUrl",
+ dnsNameURLProtocol + "://" + packageName + "-edcdataplane-edc-dataplane:8185/api/public");
+
+ String localControlplane = dnsNameURLProtocol + "://" + packageName
+ + "-edccontrolplane-edc-controlplane:8182/validation/token";
+
+ inputData.put("controlPlaneValidationEndpoint", localControlplane);
+
+ inputData.put("controlPlaneEndpoint", controlplaneurl);
+ inputData.put("controlPlaneDataEndpoint", controlplaneurl + "/data");
+ inputData.put("edcApiKey", "X-Api-Key");
+ inputData.put("edcApiKeyValue", generateRandomPassword);
+ inputData.put("controlPlaneIdsEndpoint", controlplaneurl + "/api/v1/ids/data");
+ inputData.put("dataplaneendpoint", controlplaneurl);
+ inputData.put("dataPlanePublicEndpoint", controlplaneurl + "/public");
+
+ String dftAddress = dnsNameURLProtocol + "://" + dnsName + "/dftbackend/api";
+ inputData.put("dftAddress", dftAddress);
+
+ String edcDb = "jdbc:postgresql://" + packageName + "-postgresdb-postgresql:5432/postgres";
+ inputData.put("edcdatabaseurl", edcDb);
+
+ return inputData;
+ }
+}
diff --git a/src/main/java/org/eclipse/tractusx/autosetup/manager/DFTBackendManager.java b/src/main/java/org/eclipse/tractusx/autosetup/manager/DFTBackendManager.java
index 46c6c31c..65a99d48 100644
--- a/src/main/java/org/eclipse/tractusx/autosetup/manager/DFTBackendManager.java
+++ b/src/main/java/org/eclipse/tractusx/autosetup/manager/DFTBackendManager.java
@@ -26,6 +26,7 @@
import java.util.UUID;
import org.eclipse.tractusx.autosetup.constant.AppActions;
+import org.eclipse.tractusx.autosetup.constant.SDEConfigurationProperty;
import org.eclipse.tractusx.autosetup.constant.TriggerStatusEnum;
import org.eclipse.tractusx.autosetup.entity.AutoSetupTriggerDetails;
import org.eclipse.tractusx.autosetup.entity.AutoSetupTriggerEntry;
@@ -100,9 +101,6 @@ public Map managePackage(Customer customerDetails, AppActions ac
String packageName = tool.getLabel();
- String dftDb = "jdbc:postgresql://" + packageName + "-postgresdb-postgresql:5432/postgres";
- inputData.put("dftdatabaseurl", dftDb);
-
if (AppActions.CREATE.equals(action))
appManagement.createPackage(DFT_BACKEND, packageName, inputData);
else
diff --git a/src/main/java/org/eclipse/tractusx/autosetup/manager/EDCControlplaneManager.java b/src/main/java/org/eclipse/tractusx/autosetup/manager/EDCControlplaneManager.java
index f6bbef19..7632e9ff 100644
--- a/src/main/java/org/eclipse/tractusx/autosetup/manager/EDCControlplaneManager.java
+++ b/src/main/java/org/eclipse/tractusx/autosetup/manager/EDCControlplaneManager.java
@@ -33,8 +33,6 @@
import org.eclipse.tractusx.autosetup.exception.ServiceException;
import org.eclipse.tractusx.autosetup.model.Customer;
import org.eclipse.tractusx.autosetup.model.SelectedTools;
-import org.eclipse.tractusx.autosetup.utility.PasswordGenerator;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.retry.support.RetrySynchronizationManager;
@@ -50,15 +48,7 @@ public class EDCControlplaneManager {
private final KubeAppsPackageManagement appManagement;
private final AutoSetupTriggerManager autoSetupTriggerManager;
-
- @Value("${daps.url}")
- private String dapsurl;
-
- @Value("${daps.jskurl}")
- private String dapsjsksurl;
-
- @Value("${daps.token.url}")
- private String dapstokenurl;
+ private final ConnectorCommonUtilityManager connectorCommonUtilityManager;
@Retryable(value = {
ServiceException.class }, maxAttemptsExpression = "${retry.maxAttempts}", backoff = @Backoff(delayExpression = "${retry.backOffDelay}"))
@@ -67,42 +57,11 @@ public Map managePackage(Customer customerDetails, AppActions ac
Map outputData = new HashMap<>();
AutoSetupTriggerDetails autoSetupTriggerDetails = AutoSetupTriggerDetails.builder()
- .id(UUID.randomUUID().toString()).step(EDC_CONTROLPLANE.name())
- .build();
+ .id(UUID.randomUUID().toString()).step(EDC_CONTROLPLANE.name()).build();
try {
String packageName = tool.getLabel();
- String generateRandomPassword = PasswordGenerator.generateRandomPassword(50);
- String dnsName = inputData.get("dnsName");
- String dnsNameURLProtocol = inputData.get("dnsNameURLProtocol");
-
- String controlplaneurl = dnsNameURLProtocol + "://" + dnsName;
-
- inputData.put("dapsurl", dapsurl);
- inputData.put("dapsjsksurl", dapsjsksurl);
- inputData.put("dapstokenurl", dapstokenurl);
-
- inputData.put("dataPlanePublicUrl",
- dnsNameURLProtocol + "://" + packageName + "-edcdataplane-edc-dataplane:8185/api/public");
-
- String localControlplane = dnsNameURLProtocol + "://" + packageName
- + "-edccontrolplane-edc-controlplane:8182/validation/token";
-
- outputData.put("controlPlaneValidationEndpoint", localControlplane);
-
- outputData.put("controlPlaneEndpoint", controlplaneurl);
- outputData.put("controlPlaneDataEndpoint", controlplaneurl + "/data");
- outputData.put("edcApiKey", "X-Api-Key");
- outputData.put("edcApiKeyValue", generateRandomPassword);
- outputData.put("controlPlaneIdsEndpoint", controlplaneurl + "/api/v1/ids/data");
-
- inputData.putAll(outputData);
-
- String dftAddress = dnsNameURLProtocol + "://" + dnsName + "/dftbackend/api";
- inputData.put("dftAddress", dftAddress);
-
- String edcDb = "jdbc:postgresql://" + packageName + "-postgresdb-postgresql:5432/postgres";
- inputData.put("edcdatabaseurl", edcDb);
+ outputData = connectorCommonUtilityManager.prepareConnectorInput(packageName, inputData);
if (AppActions.CREATE.equals(action))
appManagement.createPackage(EDC_CONTROLPLANE, packageName, inputData);
diff --git a/src/main/java/org/eclipse/tractusx/autosetup/manager/TractusConnectorManager.java b/src/main/java/org/eclipse/tractusx/autosetup/manager/TractusConnectorManager.java
index 0186ea9c..fa90c240 100644
--- a/src/main/java/org/eclipse/tractusx/autosetup/manager/TractusConnectorManager.java
+++ b/src/main/java/org/eclipse/tractusx/autosetup/manager/TractusConnectorManager.java
@@ -33,8 +33,6 @@
import org.eclipse.tractusx.autosetup.exception.ServiceException;
import org.eclipse.tractusx.autosetup.model.Customer;
import org.eclipse.tractusx.autosetup.model.SelectedTools;
-import org.eclipse.tractusx.autosetup.utility.PasswordGenerator;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.retry.support.RetrySynchronizationManager;
@@ -50,15 +48,7 @@ public class TractusConnectorManager {
private final KubeAppsPackageManagement appManagement;
private final AutoSetupTriggerManager autoSetupTriggerManager;
-
- @Value("${daps.url}")
- private String dapsurl;
-
- @Value("${daps.jskurl}")
- private String dapsjsksurl;
-
- @Value("${daps.token.url}")
- private String dapstokenurl;
+ private final ConnectorCommonUtilityManager connectorCommonUtilityManager;
@Retryable(value = {
ServiceException.class }, maxAttemptsExpression = "${retry.maxAttempts}", backoff = @Backoff(delayExpression = "${retry.backOffDelay}"))
@@ -71,38 +61,7 @@ public Map managePackage(Customer customerDetails, AppActions ac
try {
String packageName = tool.getLabel();
- String generateRandomPassword = PasswordGenerator.generateRandomPassword(50);
- String dnsName = inputData.get("dnsName");
- String dnsNameURLProtocol = inputData.get("dnsNameURLProtocol");
-
- String controlplaneurl = dnsNameURLProtocol + "://" + dnsName;
-
- inputData.put("dapsurl", dapsurl);
- inputData.put("dapsjsksurl", dapsjsksurl);
- inputData.put("dapstokenurl", dapstokenurl);
-
- inputData.put("dataPlanePublicUrl",
- dnsNameURLProtocol + "://" + packageName + "-edcdataplane-edc-dataplane:8185/api/public");
- String localControlplane = dnsNameURLProtocol + "://" + packageName
- + "-edccontrolplane-edc-controlplane:8182/validation/token";
-
- outputData.put("controlPlaneValidationEndpoint", localControlplane);
-
- outputData.put("controlPlaneEndpoint", controlplaneurl);
- outputData.put("controlPlaneDataEndpoint", controlplaneurl + "/data");
- outputData.put("edcApiKey", "X-Api-Key");
- outputData.put("edcApiKeyValue", generateRandomPassword);
- outputData.put("controlPlaneIdsEndpoint", controlplaneurl + "/api/v1/ids/data");
- outputData.put("dataplaneendpoint", controlplaneurl);
- outputData.put("dataPlanePublicEndpoint", controlplaneurl + "/public");
-
- inputData.putAll(outputData);
-
- String dftAddress = dnsNameURLProtocol + "://" + dnsName + "/dftbackend/api";
- inputData.put("dftAddress", dftAddress);
-
- String edcDb = "jdbc:postgresql://" + packageName + "-postgresdb-postgresql:5432/postgres";
- inputData.put("edcdatabaseurl", edcDb);
+ outputData = connectorCommonUtilityManager.prepareConnectorInput(packageName, inputData);
if (AppActions.CREATE.equals(action))
appManagement.createPackage(TRACTUS_CONNECTOR, packageName, inputData);
diff --git a/src/main/java/org/eclipse/tractusx/autosetup/service/DFTAppWorkFlow.java b/src/main/java/org/eclipse/tractusx/autosetup/service/DFTAppWorkFlow.java
index 586472fc..b6087949 100644
--- a/src/main/java/org/eclipse/tractusx/autosetup/service/DFTAppWorkFlow.java
+++ b/src/main/java/org/eclipse/tractusx/autosetup/service/DFTAppWorkFlow.java
@@ -22,7 +22,6 @@
import static org.eclipse.tractusx.autosetup.constant.AppNameConstant.DFT_BACKEND;
import static org.eclipse.tractusx.autosetup.constant.AppNameConstant.DFT_FRONTEND;
-import static org.eclipse.tractusx.autosetup.constant.AppNameConstant.POSTGRES_DB;
import java.util.Map;
@@ -31,7 +30,6 @@
import org.eclipse.tractusx.autosetup.manager.AppDeleteManager;
import org.eclipse.tractusx.autosetup.manager.DFTBackendManager;
import org.eclipse.tractusx.autosetup.manager.DFTFrontendManager;
-import org.eclipse.tractusx.autosetup.manager.PostgresDBManager;
import org.eclipse.tractusx.autosetup.model.Customer;
import org.eclipse.tractusx.autosetup.model.SelectedTools;
import org.springframework.stereotype.Component;
@@ -42,7 +40,6 @@
@RequiredArgsConstructor
public class DFTAppWorkFlow {
- private final PostgresDBManager postgresManager;
private final DFTBackendManager dftBackendManager;
private final DFTFrontendManager dftFrontendManager;
@@ -51,8 +48,6 @@ public class DFTAppWorkFlow {
public Map getWorkFlow(Customer customerDetails, SelectedTools tool, AppActions workflowAction,
Map inputConfiguration, AutoSetupTriggerEntry triger) {
- inputConfiguration.putAll(
- postgresManager.managePackage(customerDetails, workflowAction, tool, inputConfiguration, triger));
inputConfiguration.putAll(
dftBackendManager.managePackage(customerDetails, workflowAction, tool, inputConfiguration, triger));
inputConfiguration.putAll(
@@ -64,7 +59,6 @@ public Map getWorkFlow(Customer customerDetails, SelectedTools t
public void deletePackageWorkFlow(SelectedTools tool, Map inputConfiguration,
AutoSetupTriggerEntry triger) {
- appDeleteManager.deletePackage(POSTGRES_DB, tool, inputConfiguration, triger);
appDeleteManager.deletePackage(DFT_BACKEND, tool, inputConfiguration, triger);
appDeleteManager.deletePackage(DFT_FRONTEND, tool, inputConfiguration, triger);
diff --git a/src/main/resources/flyway/V1__auto-setup-table.sql b/src/main/resources/flyway/V1__auto-setup-table.sql
index 68323352..2c26c246 100644
--- a/src/main/resources/flyway/V1__auto-setup-table.sql
+++ b/src/main/resources/flyway/V1__auto-setup-table.sql
@@ -64,12 +64,6 @@ spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.open-in-view=false
-spring.datasource.url=$\{dftdatabaseurl\}
-
-spring.datasource.username=$\{username\}
-
-spring.datasource.password=$\{appdbpass\}
-
digital-twins.hostname=$\{sde.digital-twins.hostname\}
digital-twins.authentication.url=$\{sde.digital-twins.authentication.url\}
@@ -118,7 +112,7 @@ connector.discovery.token-url=$\{sde.connector.discovery.token-url\}
connector.discovery.clientId=$\{sde.connector.discovery.clientId\}
-connector.discovery.clientSecret=$\{sde.connector.discovery.clientSecret\}', NULL, 'sde-backend/dftbackend', '1.4.6', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftbackend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
+connector.discovery.clientSecret=$\{sde.connector.discovery.clientSecret\}', NULL, 'sde-backend/dftbackend', '1.9.0', 'helm.packages', 'v1alpha1', '{"dftpostgresql": {"enabled": true, "auth" : {"secretKeys":{"password":"$\{postgresPassword}"\},"username":"$\{username\}","database":"$\{database\}"}},"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftbackend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
INSERT INTO app_tbl
(app_name, context_cluster, context_namespace, expected_input_data, output_data, package_identifier, package_version, plugin_name, plugin_version, required_yaml_configuration, yaml_value_field_type)
VALUES('DFT_FRONTEND', 'default', 'kubeapps', 'REACT_APP_API_URL=$\{dftBackEndUrl\}
@@ -131,7 +125,7 @@ REACT_APP_CLIENT_ID=$\{dftfrontendkeycloakclientid\}
REACT_APP_DEFAULT_COMPANY_BPN=$\{bpnNumber\}
-REACT_APP_FILESIZE=268435456', NULL, 'sde-frontend/dftfrontend', '1.4.7', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftfrontend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
+REACT_APP_FILESIZE=268435456', NULL, 'sde-frontend/dftfrontend', '1.9.0', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname":"$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["default"], "tls":{"enabled":true, "secretName":"dftfrontend"}, "certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
INSERT INTO app_tbl
(app_name, context_cluster, context_namespace, expected_input_data, output_data, package_identifier, package_version, plugin_name, plugin_version, required_yaml_configuration, yaml_value_field_type)
VALUES('EDC_CONTROLPLANE', 'default', 'kubeapps', 'edc.receiver.http.endpoint=$\{dftAddress\}
@@ -236,7 +230,7 @@ VALUES('EDC_CONTROLPLANE', 'default', 'kubeapps', 'edc.receiver.http.endpoint=$\
edc.datasource.transferprocess.user=$\{username\}
- edc.datasource.transferprocess.password=$\{appdbpass\}', NULL, 'edcrepo/edc-controlplane', '0.1.1', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname": "$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["ids", "data", "control", "default"], "tls":{"enabled": true, "secretName":"edccontrolplane"},"certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
+ edc.datasource.transferprocess.password=$\{appdbpass\}', NULL, 'orchestrator/edc-controlplane', '0.1.6', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname": "$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["ids", "data", "control", "default"], "tls":{"enabled": true, "secretName":"edccontrolplane"},"certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
INSERT INTO app_tbl
(app_name, context_cluster, context_namespace, expected_input_data, output_data, package_identifier, package_version, plugin_name, plugin_version, required_yaml_configuration, yaml_value_field_type)
VALUES('EDC_DATAPLANE', 'default', 'kubeapps', 'edc.hostname=$\{dnsName\}
@@ -247,7 +241,7 @@ edc.vault.hashicorp.token=$\{vaulttoken\}
edc.vault.hashicorp.timeout.seconds=$\{vaulttimeout\}
-edc.dataplane.token.validation.endpoint=$\{controlPlaneValidationEndpoint\}', NULL, 'edcrepo/edc-dataplane', '0.1.1', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname": "$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["public"], "tls":{"enabled": true, "secretName":"edcdataplane"},"certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
+edc.dataplane.token.validation.endpoint=$\{controlPlaneValidationEndpoint\}', NULL, 'orchestrator/edc-dataplane', '0.1.6', 'helm.packages', 'v1alpha1', '{"ingresses":[{"enabled": true, "hostname": "$\{dnsName\}", "annotations": {}, "className": "nginx", "endpoints":["public"], "tls":{"enabled": true, "secretName":"edcdataplane"},"certManager":{"clusterIssuer":"letsencrypt-prod"}}], "configuration": {"properties": "$\{yamlValues\}"}}', 'PROPERTY');
INSERT INTO app_tbl
(app_name, context_cluster, context_namespace, expected_input_data, output_data, package_identifier, package_version, plugin_name, plugin_version, required_yaml_configuration, yaml_value_field_type)
VALUES('POSTGRES_DB', 'default', 'kubeapps', '{"postgresPassword":"$\{postgresPassword\}",
diff --git a/src/test/java/org/eclipse/tractusx/autosetup/manager/DFTBackendManagerTest.java b/src/test/java/org/eclipse/tractusx/autosetup/manager/DFTBackendManagerTest.java
index a24b42ed..c901d277 100644
--- a/src/test/java/org/eclipse/tractusx/autosetup/manager/DFTBackendManagerTest.java
+++ b/src/test/java/org/eclipse/tractusx/autosetup/manager/DFTBackendManagerTest.java
@@ -25,6 +25,7 @@
import java.util.Map;
import org.eclipse.tractusx.autosetup.constant.AppActions;
+import org.eclipse.tractusx.autosetup.constant.SDEConfigurationProperty;
import org.eclipse.tractusx.autosetup.constant.ToolType;
import org.eclipse.tractusx.autosetup.model.SelectedTools;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/org/eclipse/tractusx/autosetup/manager/EDCControlplaneManagerTest.java b/src/test/java/org/eclipse/tractusx/autosetup/manager/EDCControlplaneManagerTest.java
index 8b1a8651..e92f1fc8 100644
--- a/src/test/java/org/eclipse/tractusx/autosetup/manager/EDCControlplaneManagerTest.java
+++ b/src/test/java/org/eclipse/tractusx/autosetup/manager/EDCControlplaneManagerTest.java
@@ -22,19 +22,23 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.tractusx.autosetup.constant.AppActions;
+import org.eclipse.tractusx.autosetup.constant.AppNameConstant;
import org.eclipse.tractusx.autosetup.constant.ToolType;
import org.eclipse.tractusx.autosetup.model.SelectedTools;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.ActiveProfiles;
@SpringBootTest
@@ -43,28 +47,29 @@
@ActiveProfiles("test")
class EDCControlplaneManagerTest {
- @Mock
- private KubeAppsPackageManagement appManagement;
+ @MockBean
+ private KubeAppsPackageManagement appManagement;
- @Mock
- private AutoSetupTriggerManager autoSetupTriggerManager;
+ @MockBean
+ private AutoSetupTriggerManager autoSetupTriggerManager;
- @InjectMocks
- private EDCControlplaneManager edcControlplaneManager;
+ @Autowired
+ private EDCControlplaneManager edcControlplaneManager;
- @Test
- void managePackage() {
- Map mockInputMap = new HashMap<>();
- mockInputMap.put("targetCluster","test");
- mockInputMap.put("dnsName", "test");
- mockInputMap.put("dnsNameURLProtocol","https");
+ @Test
+ void managePackage() {
+ Map mockInputMap = new HashMap<>();
+ mockInputMap.put("targetCluster", "test");
+ mockInputMap.put("dnsName", "test");
+ mockInputMap.put("dnsNameURLProtocol", "https");
+ String result = "packageCreated";
- SelectedTools selectedTools = SelectedTools.builder()
- .tool(ToolType.DFT)
- .label("DFT")
- .build();
- mockInputMap = edcControlplaneManager.managePackage(null, AppActions.CREATE,selectedTools,mockInputMap, null);
- assertEquals(6, mockInputMap.size());
- assertNotNull(mockInputMap.get("controlPlaneEndpoint"));
- }
+ when(appManagement.createPackage(eq(AppNameConstant.EDC_CONTROLPLANE), eq(ToolType.DFT.name()), anyMap()))
+ .thenReturn(result);
+
+ SelectedTools selectedTools = SelectedTools.builder().tool(ToolType.DFT).label("DFT").build();
+ mockInputMap = edcControlplaneManager.managePackage(null, AppActions.CREATE, selectedTools, mockInputMap, null);
+ assertEquals(17, mockInputMap.size());
+ assertNotNull(mockInputMap.get("controlPlaneEndpoint"));
+ }
}
\ No newline at end of file