aboutsummaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2021-11-22 09:27:23 +0000
committerGerrit Code Review <gerrit@onap.org>2021-11-22 09:27:23 +0000
commit226d4c344baa504d90ba7a3a4f3e17733ebc1df8 (patch)
treeea106a86cb5bf7cdd48a9915ecf84f6420cd84f7 /runtime
parentf0a58426aa87795d4fa29eedb5bf2c14f5f6896f (diff)
parenta72ce28fb60c1903ed3ef3da6bb3faac1ae801ba (diff)
Merge "Added Camel Unit Tests"
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/main/resources/application-noaaf.properties6
-rw-r--r--runtime/src/main/resources/application.properties6
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java2
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java22
-rw-r--r--runtime/src/test/resources/application.properties6
-rw-r--r--runtime/src/test/resources/http-cache/third_party_proxy.py9
-rw-r--r--runtime/src/test/resources/robotframework/robotframework-test.properties4
7 files changed, 43 insertions, 12 deletions
diff --git a/runtime/src/main/resources/application-noaaf.properties b/runtime/src/main/resources/application-noaaf.properties
index 12a08704f..9f13a314c 100644
--- a/runtime/src/main/resources/application-noaaf.properties
+++ b/runtime/src/main/resources/application-noaaf.properties
@@ -150,10 +150,10 @@ clamp.config.httpclient.connectTimeout=10000
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http://localhost:8085
-clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.userName=policyadmin
clamp.config.policy.api.password=zb!XztG34
clamp.config.policy.pap.url=http://localhost:8085
-clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.userName=policyadmin
clamp.config.policy.pap.password=zb!XztG34
#
@@ -194,5 +194,5 @@ clamp.config.cds.password=ccsdkapps
# Configuration settings for ControlLoop Runtime Rest API
clamp.config.controlloop.runtime.url=http://localhost:6969
-clamp.config.controlloop.runtime.userName=healthcheck
+clamp.config.controlloop.runtime.userName=runtimeUser
clamp.config.controlloop.runtime.password=zb!XztG34
diff --git a/runtime/src/main/resources/application.properties b/runtime/src/main/resources/application.properties
index 08260047e..21b37c69f 100644
--- a/runtime/src/main/resources/application.properties
+++ b/runtime/src/main/resources/application.properties
@@ -149,10 +149,10 @@ clamp.config.httpclient.connectTimeout=10000
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http://policy.api.simpledemo.onap.org:6969
-clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.userName=policyadmin
clamp.config.policy.api.password=zb!XztG34
clamp.config.policy.pap.url=http://policy.api.simpledemo.onap.org:6969
-clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.userName=policyadmin
clamp.config.policy.pap.password=zb!XztG34
#
@@ -204,5 +204,5 @@ clamp.config.cds.password=ccsdkapps
# Configuration settings for ControlLoop Runtime Rest API
clamp.config.controlloop.runtime.url=http://localhost:6969
-clamp.config.controlloop.runtime.userName=healthcheck
+clamp.config.controlloop.runtime.userName=runtimeUser
clamp.config.controlloop.runtime.password=zb!XztG34
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java
index eeed51c12..79f3b12d7 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java
@@ -46,7 +46,7 @@ public class CldsReferencePropertiesItTestCase {
*/
@Test
public void testGetStringValue() {
- assertEquals("healthcheck", refProp.getStringValue("policy.api.userName"));
+ assertEquals("policyadmin", refProp.getStringValue("policy.api.userName"));
}
/**
diff --git a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java
index ae80d0498..fdb815d75 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java
@@ -41,6 +41,8 @@ public class RuntimeInstantiationResponseItTestCase {
private static final String DIRECT_GET_TOSCA_INSTANTIATION = "direct:get-tosca-instantiation";
+ private static final String DIRECT_POST_TOSCA_INSTANTANCE_PROPERTIES = "direct:post-tosca-instance-properties";
+
private static final String SERVICE_TEMPLATE_NAME = "name";
private static final String SERVICE_TEMPLATE_VERSION = "version";
@@ -51,6 +53,12 @@ public class RuntimeInstantiationResponseItTestCase {
+ "\"version\": \"1.0.1\",\"definition\": {},\"state\": \"UNINITIALISED\",\"orderedState\": \"UNINITIALISED\","
+ "\"description\": \"PMSH control loop instance 0\",\"elements\": {}}]}";
+ private static final String SAMPLE_TOSCA_TEMPLATE =
+ "{\"tosca_definitions_version\": \"tosca_simple_yaml_1_1_0\","
+ + "\"data_types\": {},\"node_types\": {}, \"policy_types\": {},"
+ + " \"topology_template\": {},"
+ + " \"name\": \"ToscaServiceTemplateSimple\", \"version\": \"1.0.0\", \"metadata\": {}}";
+
@Test
public void testToscaServiceTemplateStatus() {
ProducerTemplate prodTemplate = camelContext.createProducerTemplate();
@@ -93,4 +101,18 @@ public class RuntimeInstantiationResponseItTestCase {
assertThat(HttpStatus.valueOf((Integer) exchangeResponse.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE))
.is2xxSuccessful()).isTrue();
}
+
+ @Test
+ public void testCommissioningOfToscaServiceTemplateStatus() {
+ ProducerTemplate prodTemplate = camelContext.createProducerTemplate();
+
+ Exchange exchangeResponse =
+ prodTemplate.send(DIRECT_POST_TOSCA_INSTANTANCE_PROPERTIES, ExchangeBuilder.anExchange(camelContext)
+ .withBody(SAMPLE_TOSCA_TEMPLATE)
+ .withProperty("raiseHttpExceptionFlag", "true")
+ .build());
+
+ assertThat(HttpStatus.valueOf((Integer) exchangeResponse.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE))
+ .is2xxSuccessful()).isTrue();
+ }
}
diff --git a/runtime/src/test/resources/application.properties b/runtime/src/test/resources/application.properties
index bc0c290db..f2cf0dd33 100644
--- a/runtime/src/test/resources/application.properties
+++ b/runtime/src/test/resources/application.properties
@@ -139,10 +139,10 @@ clamp.config.httpclient.connectTimeout=10000
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.userName=policyadmin
clamp.config.policy.api.password=zb!XztG34
clamp.config.policy.pap.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.userName=policyadmin
clamp.config.policy.pap.password=zb!XztG34
# Sdc service properties
@@ -183,5 +183,5 @@ clamp.config.tosca.converter.dictionary.support.enabled=true
# Configuration settings for ControlLoop Runtime Rest API
clamp.config.controlloop.runtime.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.controlloop.runtime.userName=healthcheck
+clamp.config.controlloop.runtime.userName=runtimeUser
clamp.config.controlloop.runtime.password=zb!XztG34
diff --git a/runtime/src/test/resources/http-cache/third_party_proxy.py b/runtime/src/test/resources/http-cache/third_party_proxy.py
index 5c80cdda4..67af21470 100644
--- a/runtime/src/test/resources/http-cache/third_party_proxy.py
+++ b/runtime/src/test/resources/http-cache/third_party_proxy.py
@@ -331,6 +331,15 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
jsonGenerated = "{\"controlLoopList\": [{\"name\": \"PMSHInstance0\",\"version\": \"1.0.1\",\"definition\": {},\"state\": \"UNINITIALISED\",\"orderedState\": \"UNINITIALISED\",\"description\": \"PMSH control loop instance 0\",\"elements\": {}}]}";
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
+ elif (self.path.startswith("/onap/controlloop/v2/instanceProperties")) and http_type == "POST":
+ print("self.path start with POST /onap/controlloop/v2/instanceProperties, copying body to response ...")
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0o777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len(self.data_string)) + "\", \"Content-Type\": \""+str(self.headers['Content-Type'])+"\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(self.data_string)
+ return True
else:
return False
diff --git a/runtime/src/test/resources/robotframework/robotframework-test.properties b/runtime/src/test/resources/robotframework/robotframework-test.properties
index 499719aa6..493c83c3d 100644
--- a/runtime/src/test/resources/robotframework/robotframework-test.properties
+++ b/runtime/src/test/resources/robotframework/robotframework-test.properties
@@ -136,10 +136,10 @@ clamp.config.httpclient.connectTimeout=10000
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.userName=policyadmin
clamp.config.policy.api.password=zb!XztG34
clamp.config.policy.pap.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.userName=policyadmin
clamp.config.policy.pap.password=zb!XztG34
# Sdc service properties