aboutsummaryrefslogtreecommitdiffstats
path: root/ms/neng/src
diff options
context:
space:
mode:
Diffstat (limited to 'ms/neng/src')
-rw-r--r--ms/neng/src/main/docker/startService.sh15
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java5
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/AaiResponseTest.java41
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java5
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/GeneratedNameTest.java90
5 files changed, 151 insertions, 5 deletions
diff --git a/ms/neng/src/main/docker/startService.sh b/ms/neng/src/main/docker/startService.sh
index 2e3e454c..17f53ce5 100644
--- a/ms/neng/src/main/docker/startService.sh
+++ b/ms/neng/src/main/docker/startService.sh
@@ -19,11 +19,18 @@
touch /app.jar
APP_ARGS=-Dspring.profiles.active=${SPRING_PROFILE}
-APP_ARGS=${APP_ARGS}" -Dpolicymgr_url="${POLICYMGR_URL}" -Dinstar_aaf_enc_pass="${AAF_PASS_ENC}
-APP_ARGS=${APP_ARGS}" -Daai_cert_pass="${AAI_CERT_PASSWORD}" -Daai_uribase="${AAI_URI_BASE}
-APP_ARGS=${APP_ARGS}" -Dneng_db_user="${NENG_DB_USER}" -Dneng_db_pass="${NENG_DB_PASS}
-APP_ARGS=${APP_ARGS}" -Dneng_db_url="${NENG_DB_URL}
+APP_ARGS=${APP_ARGS}" -Dneng_db_user="${NENG_DB_USER}" -Dneng_db_pass="${NENG_DB_PASS}
+APP_ARGS=${APP_ARGS}" -Dneng_db_url="${NENG_DB_URL}
+APP_ARGS=${APP_ARGS}" -Dpol_client_auth="${POL_CLIENT_AUTH}
+APP_ARGS=${APP_ARGS}" -Dpol_basic_auth="${POL_BASIC_AUTH}
+APP_ARGS=${APP_ARGS}" -Dpol_url="${POL_URL}
+APP_ARGS=${APP_ARGS}" -Dpol_env="${POL_ENV}
+APP_ARGS=${APP_ARGS}" -Dpol_req_id="${POL_REQ_ID}
+APP_ARGS=${APP_ARGS}" -Daai_cert_pass="${AAI_CERT_PASS}
+APP_ARGS=${APP_ARGS}" -Daai_cert_path="${AAI_CERT_PATH}
+APP_ARGS=${APP_ARGS}" -Daai_uri="${AAI_URI}
APP_ARGS=${APP_ARGS}" -cp /opt/etc/config"
echo "APP_ARGS ="${APP_ARGS}
java -Djava.security.egd=file:/dev/./urandom ${APP_ARGS} -Xms1024m -Xmx1024m -jar /app.jar --spring.config.location=/opt/etc/config/ > /tmp/app.out 2> /tmp/app.err
+
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java
index 392567b7..e93675bf 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImpl.java
@@ -27,7 +27,9 @@ import java.security.cert.X509Certificate;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
+import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
@@ -142,7 +144,8 @@ public class PolicyFinderServiceImpl implements PolicyFinder {
TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
.loadTrustMaterial(null, acceptingTrustStrategy).build();
- SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
+ HostnameVerifier verifier = (String arg0, SSLSession arg1) -> true;
+ SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext, verifier);
CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
requestFactory.setHttpClient(httpClient);
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/AaiResponseTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/AaiResponseTest.java
new file mode 100644
index 00000000..81279b9d
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/AaiResponseTest.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
+ * 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.ccsdk.apps.ms.neng.core.resource.model;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AaiResponseTest {
+ private AaiResponse aai;
+
+ @Before
+ public void setup() {
+ aai = new AaiResponse();
+ }
+
+ @Test
+ public void isRecFound() {
+ aai.setRecFound(true);
+ assertEquals(true, aai.isRecFound());
+ }
+
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java
index 7ea63e61..22063a4d 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java
@@ -109,6 +109,11 @@ public class SpringServiceTest {
Assert.assertNotNull(springserviceImpl.releaseNetworkElementName(request));
}
+ @Test(expected=Exception.class)
+ public void releaseNetworkElementNameTestForNull() throws Exception {
+ springserviceImpl.releaseNetworkElementName(null);
+ }
+
@Test
public void testGetQuickHello() {
Assert.assertTrue(springserviceImpl.getQuickHello("testMessage") instanceof HelloWorld);
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/GeneratedNameTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/GeneratedNameTest.java
new file mode 100644
index 00000000..7965b7a4
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/GeneratedNameTest.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
+ * 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.ccsdk.apps.ms.neng.persistence.entity;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class GeneratedNameTest {
+ private GeneratedName generatedName;
+
+ @Before
+ public void setUp() {
+ generatedName = new GeneratedName();
+ }
+
+ @Test
+ public void testGetSetGeneratedNameId() {
+ generatedName.setGeneratedNameId(1);
+ Integer expected = 1;
+ Assert.assertEquals(expected, generatedName.getGeneratedNameId());
+ }
+
+ @Test
+ public void testGetSetSequenceNumber() {
+ generatedName.setSequenceNumber(2121314312321L);
+ Long expected = 2121314312321L;
+ Assert.assertEquals(expected, generatedName.getSequenceNumber());
+ }
+
+ @Test
+ public void testGetSetSequenceNumberEnc() {
+ generatedName.setSequenceNumberEnc("TestSequenceNumberEnc");
+ String expected = "TestSequenceNumberEnc";
+ Assert.assertEquals(expected, generatedName.getSequenceNumberEnc());
+ }
+
+ @Test
+ public void testGetSetElementType() {
+ generatedName.setElementType("TestElementType");
+ String expected = "TestElementType";
+ Assert.assertEquals(expected, generatedName.getElementType());
+ }
+
+ @Test
+ public void testGetSetName() {
+ generatedName.setName("TestName");
+ String expected = "TestName";
+ Assert.assertEquals(expected, generatedName.getName());
+ }
+
+ @Test
+ public void testGetSetPrefix() {
+ generatedName.setPrefix("TestPrefix");
+ String expected = "TestPrefix";
+ Assert.assertEquals(expected, generatedName.getPrefix());
+ }
+
+ @Test
+ public void testGetSetSuffix() {
+ generatedName.setSuffix("TestSuffix");
+ String expected = "TestSuffix";
+ Assert.assertEquals(expected, generatedName.getSuffix());
+ }
+
+ @Test
+ public void testGetSetIsReleased() {
+ generatedName.setIsReleased("TestIsReleased");
+ String expected = "TestIsReleased";
+ Assert.assertEquals(expected, generatedName.getIsReleased());
+ }
+
+}