aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/src/main
diff options
context:
space:
mode:
authorsaul.gill <saul.gill@est.tech>2021-06-29 12:57:29 +0100
committersaul.gill <saul.gill@est.tech>2021-07-02 12:34:08 +0100
commitc19601d2080baa401cd17286985b6a0ee47d9a07 (patch)
treee8e69ef79f3ea1ff8bb0d6a3efe7da8a8d88914a /runtime/src/main
parent7d04c23c7c51738d68f325e450ac408c1ae9905f (diff)
Added ITs for Commissioning Camel Endpoints
Changed emulator to deal with new endpoint tests Added spring property to deal with camel endpoint issue Fixed lingering checkstyle violations Issue-ID: POLICY-3440 Change-Id: I5810913c4418e7893f3ad848618deec1b1a85a0f Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'runtime/src/main')
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/Application.java12
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java111
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java4
-rw-r--r--runtime/src/main/resources/application-noaaf.properties3
-rw-r--r--runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml8
5 files changed, 20 insertions, 118 deletions
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java b/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java
index bdab9c9a2..aad678bf7 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java
@@ -121,8 +121,8 @@ public class Application extends SpringBootServletInitializer {
@Bean
public ServletRegistrationBean<ClampServlet> camelServletRegistrationBean() throws IOException {
eelfLogger.info(ResourceFileUtils.getResourceAsString("boot-message.txt") + "(v"
- + ClampVersioning.getCldsVersionFromProps() + ")" + System.getProperty("line.separator")
- + getSslExpirationDate());
+ + ClampVersioning.getCldsVersionFromProps() + ")" + System.getProperty("line.separator")
+ + getSslExpirationDate());
var registration = new ServletRegistrationBean<ClampServlet>(new ClampServlet(), "/restservices/clds/*");
registration.setName("CamelServlet");
return registration;
@@ -150,7 +150,7 @@ public class Application extends SpringBootServletInitializer {
private Connector createRedirectConnector(int redirectSecuredPort) {
if (redirectSecuredPort <= 0) {
eelfLogger.warn("HTTP port redirection to HTTPS is disabled because the HTTPS port is 0 (random port) or -1"
- + " (Connector disabled)");
+ + " (Connector disabled)");
return null;
}
var connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
@@ -167,15 +167,15 @@ public class Application extends SpringBootServletInitializer {
if (keystoreFile != null) {
var keystore = KeyStore.getInstance(keyStoreType);
keystore.load(ResourceFileUtils.getResourceAsStream(keystoreFile.replace("classpath:", "")),
- PassDecoder.decode(keyStorePass, keyFile).toCharArray());
+ PassDecoder.decode(keyStorePass, keyFile).toCharArray());
Enumeration<String> aliases = keystore.aliases();
while (aliases.hasMoreElements()) {
String alias = aliases.nextElement();
if ("X.509".equals(keystore.getCertificate(alias).getType())) {
result.append("* " + alias + " expires "
- + ((X509Certificate) keystore.getCertificate(alias)).getNotAfter()
- + System.getProperty("line.separator"));
+ + ((X509Certificate) keystore.getCertificate(alias)).getNotAfter()
+ + System.getProperty("line.separator"));
}
}
} else {
diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java b/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java
index 52f1c5d23..f1ab35722 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java
@@ -40,6 +40,8 @@ import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
+import lombok.Getter;
+import lombok.Setter;
import org.hibernate.annotations.SortNatural;
import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
import org.onap.policy.clamp.loop.Loop;
@@ -52,7 +54,8 @@ import org.onap.policy.clamp.policy.operational.OperationalPolicy;
* This class represents a micro service/operational/... model for a loop template.
* So it's an element in the flow (a box shown in the loop).
*/
-
+@Getter
+@Setter
@Entity
@Table(name = "loop_element_models")
public class LoopElementModel extends AuditEntity implements Serializable {
@@ -113,15 +116,6 @@ public class LoopElementModel extends AuditEntity implements Serializable {
private Set<LoopTemplateLoopElementModel> usedByLoopTemplates = new HashSet<>();
/**
- * policyModels getter.
- *
- * @return the policyModel
- */
- public SortedSet<PolicyModel> getPolicyModels() {
- return policyModels;
- }
-
- /**
* Method to add a new policyModel to the list.
*
* @param policyModel The policy model
@@ -132,103 +126,6 @@ public class LoopElementModel extends AuditEntity implements Serializable {
}
/**
- * name getter.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * name setter.
- *
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * blueprint getter.
- *
- * @return the blueprint
- */
- public String getBlueprint() {
- return blueprint;
- }
-
- /**
- * blueprint setter.
- *
- * @param blueprint the blueprint to set
- */
- public void setBlueprint(String blueprint) {
- this.blueprint = blueprint;
- }
-
- /**
- * dcaeBlueprintId getter.
- *
- * @return the dcaeBlueprintId
- */
- public String getDcaeBlueprintId() {
- return dcaeBlueprintId;
- }
-
- /**
- * dcaeBlueprintId setter.
- *
- * @param dcaeBlueprintId the dcaeBlueprintId to set
- */
- public void setDcaeBlueprintId(String dcaeBlueprintId) {
- this.dcaeBlueprintId = dcaeBlueprintId;
- }
-
- /**
- * loopElementType getter.
- *
- * @return the loopElementType
- */
- public String getLoopElementType() {
- return loopElementType;
- }
-
- /**
- * loopElementType setter.
- *
- * @param loopElementType the loopElementType to set
- */
- public void setLoopElementType(String loopElementType) {
- this.loopElementType = loopElementType;
- }
-
- /**
- * shortName getter.
- *
- * @return the shortName
- */
- public String getShortName() {
- return shortName;
- }
-
- /**
- * * @param shortName the shortName to set.
- */
- public void setShortName(String shortName) {
- this.shortName = shortName;
- }
-
- /**
- * usedByLoopTemplates getter.
- *
- * @return the usedByLoopTemplates
- */
- public Set<LoopTemplateLoopElementModel> getUsedByLoopTemplates() {
- return usedByLoopTemplates;
- }
-
- /**
* Default constructor for serialization.
*/
public LoopElementModel() {
diff --git a/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java b/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java
index 40ea25ff8..da6454a44 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java
@@ -177,9 +177,9 @@ public class Dictionary extends AuditEntity implements Serializable {
/**
* Constructor.
*
- * @param name The Dictionary name
+ * @param name The Dictionary name
* @param secondLevelDictionary defines if dictionary is a secondary level
- * @param subDictionaryType defines the type of secondary level dictionary
+ * @param subDictionaryType defines the type of secondary level dictionary
*/
public Dictionary(String name, int secondLevelDictionary, String subDictionaryType) {
this.name = name;
diff --git a/runtime/src/main/resources/application-noaaf.properties b/runtime/src/main/resources/application-noaaf.properties
index a8f4399c4..e698cc0ce 100644
--- a/runtime/src/main/resources/application-noaaf.properties
+++ b/runtime/src/main/resources/application-noaaf.properties
@@ -4,6 +4,7 @@
# ================================================================================
# Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights
# reserved.
+# Modifications Copyright (C) 2021 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,6 +17,8 @@
# 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
# ============LICENSE_END============================================
# ===================================================================
#
diff --git a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml
index 009e00fca..d12cd9df1 100644
--- a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml
+++ b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml
@@ -20,8 +20,7 @@
</setProperty>
<log loggingLevel="INFO"
message="Endpoint to get Tosca Service Template: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/toscaservicetemplate"></log>
- <toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/toscaservicetemplate?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <toD uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/toscaservicetemplate?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -40,10 +39,13 @@
<setHeader name="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
+ <setHeader name="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
<log loggingLevel="INFO"
message="Endpoint to send Tosca Service Template: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission"></log>
<toD
- uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>