aboutsummaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/test
diff options
context:
space:
mode:
authorwasala <przemyslaw.wasala@nokia.com>2018-04-25 19:26:31 +0200
committerwasala <przemyslaw.wasala@nokia.com>2018-04-25 19:31:18 +0200
commitc215daf12e5047f7292dfac124a7fac0411b169d (patch)
tree31b53e34f6db8c89404e8c94fe1ae38bd00cd913 /prh-app-server/src/test
parentd7640cf52a678a63698e1a2293e116b350eaa7f7 (diff)
Parsing arguments from cloudify.
*Added functionality for replacing default value from command line tosca template. Change-Id: I5923d9b5192f2f9df026320e1c6c56d4eaf9756a Issue-ID: DCAEGEN2-458 Signed-off-by: wasala <przemyslaw.wasala@nokia.com>
Diffstat (limited to 'prh-app-server/src/test')
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
index 93555665..764bafec 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
@@ -47,13 +47,15 @@ class PrhAppConfigTest {
private static final String jsonString = "{\"configs\":{\"aai\":{\"aaiHttpClientConfiguration\":{\"aaiHost\":\"\",\"aaiHostPortNumber\":8080,\"aaiIgnoreSSLCertificateErrors\":true,\"aaiProtocol\":\"https\",\"aaiUserName\":\"admin\",\"aaiUserPassword\":\"admin\"}},\"dmaap\":{\"dmaapConsumerConfiguration\":{\"consumerGroup\":\"other\",\"consumerId\":\"1\",\"dmaapContentType\":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2222,\"dmaapProtocol\":\"http\",\"dmaapTopicName\":\"temp\",\"dmaapUserName\":\"admin\",\"dmaapUserPassword\":\"admin\",\"messageLimit\":1000,\"timeoutMS\":1000},\"dmaapProducerConfiguration\":{\"dmaapContentType\":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2223,\"dmaapProtocol\":\"http\",\"dmaapTopicName\":\"temp\",\"dmaapUserName\":\"admin\",\"dmaapUserPassword\":\"admin\"}}}}";
private static final String incorrectJsonString = "{\"configs\":{\"aai\":{\"aaiHttpClientConfiguration\":{\"aaiHost\":\"\",\"aaiHostPortNumber\":8080,\"aaiIgnoreSSLCertificateErrors\":true,\"aaiProtocol\":\"https\",\"aaiUserName\":\"admin\",\"aaiUserPassword\":\"admin\"}},\"dmaap\":{\"dmaapConsumerConfiguration\":{\"consumerGroup\":\"other\",\"consumerId\":\"1\",\"dmaapContentType\":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2222,\"dmaapProtocol\":\"http\",\"dmaapTopicName\":\"temp\",\"dmaapUserName\":\"admin\",\"dmaapUserPassword\":\"admin\",\"messageLimit\":1000,\"timeoutMS\":1000},\"dmaapProducerConfiguration\":{\"dmaapContentType\":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2223,\"dmaapProtocol\":\"http\",\"dmaaptopicName\":\"temp\",\"dmaapuserName\":\"admin\",\"dmaapuserPassword\":\"admin\"}}}}";
private static PrhAppConfig prhAppConfig;
+ private static AppConfig appConfig;
private static String filePath = Objects
.requireNonNull(PrhAppConfigTest.class.getClassLoader().getResource(PRH_ENDPOINTS)).getFile();
@BeforeEach
public void setUp() {
- prhAppConfig = spy(new PrhAppConfig());
+ prhAppConfig = spy(PrhAppConfig.class);
+ appConfig = spy(new AppConfig());
}
@Test
@@ -84,6 +86,9 @@ class PrhAppConfigTest {
prhAppConfig.setFilepath(filePath);
doReturn(inputStream).when(prhAppConfig).getInputStream(any());
prhAppConfig.initFileStreamReader();
+ appConfig.dmaapConsumerConfiguration = prhAppConfig.getDmaapConsumerConfiguration();
+ appConfig.dmaapPublisherConfiguration = prhAppConfig.getDmaapPublisherConfiguration();
+ appConfig.aaiHttpClientConfiguration = prhAppConfig.getAAIHttpClientConfiguration();
//
// Then
//
@@ -92,6 +97,13 @@ class PrhAppConfigTest {
Assertions.assertNotNull(prhAppConfig.getAAIHttpClientConfiguration());
Assertions.assertNotNull(prhAppConfig.getDmaapConsumerConfiguration());
Assertions.assertNotNull(prhAppConfig.getDmaapPublisherConfiguration());
+ Assertions
+ .assertEquals(appConfig.getDmaapPublisherConfiguration(), prhAppConfig.getDmaapPublisherConfiguration());
+ Assertions
+ .assertEquals(appConfig.getDmaapConsumerConfiguration(), prhAppConfig.getDmaapConsumerConfiguration());
+ Assertions
+ .assertEquals(appConfig.getAAIHttpClientConfiguration(), prhAppConfig.getAAIHttpClientConfiguration());
+
}
@Test
@@ -129,6 +141,7 @@ class PrhAppConfigTest {
prhAppConfig.setFilepath(filePath);
doReturn(inputStream).when(prhAppConfig).getInputStream(any());
prhAppConfig.initFileStreamReader();
+
//
// Then
//
@@ -138,5 +151,6 @@ class PrhAppConfigTest {
Assertions.assertNotNull(prhAppConfig.getDmaapConsumerConfiguration());
Assertions.assertNull(prhAppConfig.getDmaapPublisherConfiguration());
+
}
} \ No newline at end of file