Allow HTTP with SDC 03/117303/5
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Mon, 1 Feb 2021 15:09:23 +0000 (16:09 +0100)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Mon, 1 Feb 2021 16:40:01 +0000 (17:40 +0100)
New version of SDC client allows to either use https or http.
Default version is set to https.
We allow here to configure this.

Issue-ID: OOM-2670
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I22c21573d99ac4e6eecc9ca78215635e52e98449

pom.xml
src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java

diff --git a/pom.xml b/pom.xml
index 1a89a54..4f02dd0 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -57,7 +57,7 @@
                <hamcrest-all.version>1.3</hamcrest-all.version>
                <babel.version>1.6.2</babel.version>
                <aai.rest.client.version>1.2.1</aai.rest.client.version>
                <hamcrest-all.version>1.3</hamcrest-all.version>
                <babel.version>1.6.2</babel.version>
                <aai.rest.client.version>1.2.1</aai.rest.client.version>
-               <sdc-distribution-client.version>1.3.0</sdc-distribution-client.version>
+               <sdc-distribution-client.version>1.4.1</sdc-distribution-client.version>
                <logback.version>1.2.3</logback.version>
                <!-- docker related properties -->
                <docker.fabric.version>0.28.0</docker.fabric.version>
                <logback.version>1.2.3</logback.version>
                <!-- docker related properties -->
                <docker.fabric.version>0.28.0</docker.fabric.version>
@@ -72,7 +72,7 @@
                <sonar.jacoco.reportPath />
                <sonar.jacoco.itReportPath />
                <sonar.jacoco.reportMissing.force.zero />
                <sonar.jacoco.reportPath />
                <sonar.jacoco.itReportPath />
                <sonar.jacoco.reportMissing.force.zero />
-               
+
                <jacoco.line.coverage.limit>0.75</jacoco.line.coverage.limit>
                <jacoco.version>0.8.5</jacoco.version>
                <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
                <jacoco.line.coverage.limit>0.75</jacoco.line.coverage.limit>
                <jacoco.version>0.8.5</jacoco.version>
                <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
                                </executions>
                        </plugin>
 
                                </executions>
                        </plugin>
 
-                       <!-- once we connect aai-parent or oparent 3.0+ we can take out this 
+                       <!-- once we connect aai-parent or oparent 3.0+ we can take out this
                             whole section -->
 
                        <plugin>
                             whole section -->
 
                        <plugin>
                          <artifactId>jacoco-maven-plugin</artifactId>
                          <version>${jacoco.version}</version>
                          <configuration>
                          <artifactId>jacoco-maven-plugin</artifactId>
                          <version>${jacoco.version}</version>
                          <configuration>
-                           <!-- Note: This exclusion list should match <sonar.exclusions> property 
+                           <!-- Note: This exclusion list should match <sonar.exclusions> property
                                 above -->
                            <excludes>
                              <exclude>**/gen/**</exclude>
                                 above -->
                            <excludes>
                              <exclude>**/gen/**</exclude>
                            </excludes>
                          </configuration>
                          <executions>
                            </excludes>
                          </configuration>
                          <executions>
-                           <!-- Prepares the property pointing to the JaCoCo runtime agent which 
+                           <!-- Prepares the property pointing to the JaCoCo runtime agent which
                                 is passed as VM argument when Maven the Surefire plugin is executed. -->
                            <execution>
                              <id>pre-unit-test</id>
                                 is passed as VM argument when Maven the Surefire plugin is executed. -->
                            <execution>
                              <id>pre-unit-test</id>
                                <goal>prepare-agent</goal>
                              </goals>
                              <configuration>
                                <goal>prepare-agent</goal>
                              </goals>
                              <configuration>
-                               <!-- Sets the path to the file which contains the execution data 
+                               <!-- Sets the path to the file which contains the execution data
                                     . -->
                                <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
                                     . -->
                                <destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
-                               <!-- Sets the name of the property containing the settings for JaCoCo 
+                               <!-- Sets the name of the property containing the settings for JaCoCo
                                     runtime agent. -->
                                <propertyName>surefireArgLine</propertyName>
                              </configuration>
                            </execution>
                                     runtime agent. -->
                                <propertyName>surefireArgLine</propertyName>
                              </configuration>
                            </execution>
-                           <!-- Ensures that the code coverage report for unit tests is created 
+                           <!-- Ensures that the code coverage report for unit tests is created
                                 after unit tests have been run. -->
                            <execution>
                              <id>post-unit-test</id>
                                 after unit tests have been run. -->
                            <execution>
                              <id>post-unit-test</id>
                                <goal>report</goal>
                              </goals>
                              <configuration>
                                <goal>report</goal>
                              </goals>
                              <configuration>
-                               <!-- Sets the path to the file which contains the execution data 
+                               <!-- Sets the path to the file which contains the execution data
                                     . -->
                                <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                                     . -->
                                <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                                <goal>prepare-agent</goal>
                              </goals>
                              <configuration>
                                <goal>prepare-agent</goal>
                              </goals>
                              <configuration>
-                               <!-- Sets the path to the file which contains the execution data 
+                               <!-- Sets the path to the file which contains the execution data
                                     . -->
                                <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
                                     . -->
                                <destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
-                               <!-- Sets the name of the property containing the settings for JaCoCo 
+                               <!-- Sets the name of the property containing the settings for JaCoCo
                                     runtime agent. -->
                                <propertyName>failsafeArgLine</propertyName>
                              </configuration>
                            </execution>
                                     runtime agent. -->
                                <propertyName>failsafeArgLine</propertyName>
                              </configuration>
                            </execution>
-                           <!-- Ensures that the code coverage report for integration tests after 
+                           <!-- Ensures that the code coverage report for integration tests after
                                 integration tests have been run. -->
                            <execution>
                              <id>post-integration-test</id>
                                 integration tests have been run. -->
                            <execution>
                              <id>post-integration-test</id>
                                <goal>report</goal>
                              </goals>
                              <configuration>
                                <goal>report</goal>
                              </goals>
                              <configuration>
-                               <!-- Sets the path to the file which contains the execution data 
+                               <!-- Sets the path to the file which contains the execution data
                                     . -->
                                <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                                     . -->
                                <dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                          <artifactId>maven-failsafe-plugin</artifactId>
                          <version>3.0.0-M4</version>
                          <executions>
                          <artifactId>maven-failsafe-plugin</artifactId>
                          <version>3.0.0-M4</version>
                          <executions>
-                           <!-- Ensures that both integration-test and verify goals of the Failsafe 
+                           <!-- Ensures that both integration-test and verify goals of the Failsafe
                                 Maven plugin are executed. -->
                            <execution>
                              <id>integration-tests</id>
                                 Maven plugin are executed. -->
                            <execution>
                              <id>integration-tests</id>
index 7523fce..88735d4 100644 (file)
@@ -56,6 +56,7 @@ public class ModelLoaderConfig implements IConfiguration {
     protected static final String PROP_ML_DISTRIBUTION_ASDC_CONNECTION_DISABLED =
             PREFIX_DISTRIBUTION_CLIENT + "ASDC_CONNECTION_DISABLE";
     protected static final String PROP_ML_DISTRIBUTION_ASDC_ADDRESS = PREFIX_DISTRIBUTION_CLIENT + "ASDC_ADDRESS";
     protected static final String PROP_ML_DISTRIBUTION_ASDC_CONNECTION_DISABLED =
             PREFIX_DISTRIBUTION_CLIENT + "ASDC_CONNECTION_DISABLE";
     protected static final String PROP_ML_DISTRIBUTION_ASDC_ADDRESS = PREFIX_DISTRIBUTION_CLIENT + "ASDC_ADDRESS";
+    protected static final String PROP_ML_DISTRIBUTION_ASDC_USE_HTTPS = PREFIX_DISTRIBUTION_CLIENT + "ASDC_USE_HTTPS";
     protected static final String PROP_ML_DISTRIBUTION_CONSUMER_GROUP = PREFIX_DISTRIBUTION_CLIENT + "CONSUMER_GROUP";
     protected static final String PROP_ML_DISTRIBUTION_CONSUMER_ID = PREFIX_DISTRIBUTION_CLIENT + "CONSUMER_ID";
     protected static final String PROP_ML_DISTRIBUTION_ENVIRONMENT_NAME =
     protected static final String PROP_ML_DISTRIBUTION_CONSUMER_GROUP = PREFIX_DISTRIBUTION_CLIENT + "CONSUMER_GROUP";
     protected static final String PROP_ML_DISTRIBUTION_CONSUMER_ID = PREFIX_DISTRIBUTION_CLIENT + "CONSUMER_ID";
     protected static final String PROP_ML_DISTRIBUTION_ENVIRONMENT_NAME =
@@ -155,6 +156,16 @@ public class ModelLoaderConfig implements IConfiguration {
         return get(PROP_ML_DISTRIBUTION_ASDC_ADDRESS);
     }
 
         return get(PROP_ML_DISTRIBUTION_ASDC_ADDRESS);
     }
 
+    @Override
+    public Boolean isUseHttpsWithSDC() {
+        /* if PROP_ML_DISTRIBUTION_ASDC_USE_HTTPS is null, https will be used, as before */
+        String value = get(PROP_ML_DISTRIBUTION_ASDC_USE_HTTPS);
+        if (value == null) {
+          return true;
+        }
+        return Boolean.parseBoolean(value);
+    }
+
     @Override
     public String getConsumerGroup() {
         return get(PROP_ML_DISTRIBUTION_CONSUMER_GROUP);
     @Override
     public String getConsumerGroup() {
         return get(PROP_ML_DISTRIBUTION_CONSUMER_GROUP);
@@ -320,7 +331,7 @@ public class ModelLoaderConfig implements IConfiguration {
 
     /**
      * Read the value of the property and replace any wildcard OXM version "v*" with the supplied default OXM version
 
     /**
      * Read the value of the property and replace any wildcard OXM version "v*" with the supplied default OXM version
-     * 
+     *
      * @param propertyName
      *            the name of the property storing the OXM version (possibly containing v*)
      * @param version
      * @param propertyName
      *            the name of the property storing the OXM version (possibly containing v*)
      * @param version