summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/pomba/contextbuilder/sdc/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/pomba/contextbuilder/sdc/test')
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdc/test/JerseyConfigurationTest.java36
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java52
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCContextConfigTest.java57
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdc/test/ToscaBuildConfigTest.java45
4 files changed, 190 insertions, 0 deletions
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/JerseyConfigurationTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/JerseyConfigurationTest.java
new file mode 100644
index 0000000..f10ac09
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/JerseyConfigurationTest.java
@@ -0,0 +1,36 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://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.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.pomba.contextbuilder.sdc.test;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.ws.rs.client.Client;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdc.JerseyConfiguration;
+
+
+public class JerseyConfigurationTest {
+
+ @Test
+ public void runTest() {
+ JerseyConfiguration jerseyConfiguration = new JerseyConfiguration();
+ Client client = jerseyConfiguration.jerseyClient();
+ String protocol = client.getSslContext().getProtocol();
+ assertEquals(protocol, "TLS");
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java
new file mode 100644
index 0000000..c838a1c
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://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.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.pomba.contextbuilder.sdc.test;
+
+import org.onap.pomba.contextbuilder.sdc.SDCClientConfiguration;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class SDCClientConfigurationTest {
+
+ @Test
+ public void testSDCClientConfig() throws Exception {
+ SDCClientConfiguration config = new SDCClientConfiguration();
+ config.setConsumerID("consumerID");
+ config.setPassword("password");
+ config.setSdcAddress("10.147.58.6:30204");
+ config.setUsername("username");
+ config.setPollingTimeout("6666");
+
+ assertEquals("username", config.getUsername());
+ assertEquals("consumerID", config.getConsumerID());
+ assertEquals("password", config.getPassword());
+ assertEquals("6666", config.getPollingTimeout());
+ assertEquals("10.147.58.6:30204", config.getSdcAddress());
+ }
+
+
+ @Test
+ public void testGetHttpBasicAuth() {
+ String msg = "Basic YWRtaW46YWRtaW4=";
+ SDCClientConfiguration config = new SDCClientConfiguration();
+ config.setHttpUserId("admin");
+ config.setHttpPassword("admin");
+ assertEquals(msg, config.getHttpBasicAuth());
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCContextConfigTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCContextConfigTest.java
new file mode 100644
index 0000000..a02fffd
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCContextConfigTest.java
@@ -0,0 +1,57 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://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.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.pomba.contextbuilder.sdc.test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdc.SDCContextConfig;
+
+
+public class SDCContextConfigTest {
+
+ @Test
+ public void testSDCContextConfig() throws Exception {
+
+ SDCContextConfig sdcContextConfig= new SDCContextConfig();
+
+ sdcContextConfig.setUser("pomba");
+ sdcContextConfig.setAsdcAddress("10.69.100.139");
+ sdcContextConfig.setPassword("pomba");
+ sdcContextConfig.setUseHttpsWithDmaap(false);
+ sdcContextConfig.setConsumerId("pomba");
+ sdcContextConfig.setActivateServerTLSAuth(false);
+ sdcContextConfig.setPollingTimeout(Integer.parseInt("12000"));
+ sdcContextConfig.setConsumerGroup("consumerGroup");
+ sdcContextConfig.setEnvironmentName("environmentName");
+ sdcContextConfig.setKeyStorePassword("aegwhfef234e3dd111cdcd");
+
+ assertEquals("pomba", sdcContextConfig.getUser());
+ assertEquals("10.69.100.139", sdcContextConfig.getAsdcAddress());
+ assertEquals("pomba", sdcContextConfig.getPassword());
+ assertEquals("pomba", sdcContextConfig.getConsumerID());
+ assertEquals(12000, sdcContextConfig.getPollingTimeout());
+ assertEquals(false, sdcContextConfig.activateServerTLSAuth());
+ assertEquals(false, sdcContextConfig.isUseHttpsWithDmaap());
+ assertEquals("consumerGroup", sdcContextConfig.getConsumerGroup());
+ assertEquals("environmentName", sdcContextConfig.getEnvironmentName());
+ assertEquals("aegwhfef234e3dd111cdcd", sdcContextConfig.getKeyStorePassword());
+
+
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/ToscaBuildConfigTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/ToscaBuildConfigTest.java
new file mode 100644
index 0000000..8f16d5e
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/ToscaBuildConfigTest.java
@@ -0,0 +1,45 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://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.
+ * ============LICENSE_END=====================================================
+ */
+package org.onap.pomba.contextbuilder.sdc.test;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdc.ToscaBuilderConfig;
+
+public class ToscaBuildConfigTest {
+
+
+ @Test
+ public void testToscaBuilderConfig() throws Exception {
+
+ String urlTemplate = "/sdc/v1/catalog/services/e9851a43-c068-4eb2-9fe7-2d123bd94ff0/toscaModel";
+ ToscaBuilderConfig configTest= new ToscaBuilderConfig();
+ configTest.setCsarFilePrefix("csar-");
+ configTest.setCsarFileSuffix(".zip");
+ configTest.setArtifactType("TOSCA_CSAR");
+ configTest.setUrlTemplate(urlTemplate);
+
+
+ assertEquals(configTest.getCsarFilePrefix().toString(), "csar-");
+ assertEquals(configTest.getCsarFileSuffix().toString(), ".zip");
+ assertEquals(configTest.getArtifactType().toString(), "TOSCA_CSAR");
+ assertEquals(configTest.getUrlTemplate().toString(), urlTemplate);
+
+ }
+
+}