summaryrefslogtreecommitdiffstats
path: root/common-app-api/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'common-app-api/src/test')
-rw-r--r--common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java2
-rw-r--r--common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestResponseAsByteArrayTest.java99
-rw-r--r--common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestResponseTest.java88
-rw-r--r--common-app-api/src/test/java/org/openecomp/sdc/common/test/E2EHttpClientTest.java83
-rw-r--r--common-app-api/src/test/resources/config/common/distribution-engine-configuration.yaml32
5 files changed, 116 insertions, 188 deletions
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java
index 15508c540f..0604e80ffc 100644
--- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java
+++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java
@@ -1433,7 +1433,7 @@ public class ConfigurationTest {
@Test
public void testGetDefaultImports() throws Exception {
Configuration testSubject;
- LinkedList<Map<String, Map<String, String>>> result;
+ List<Map<String, Map<String, String>>> result;
// default test
testSubject = createTestSubject();
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestResponseAsByteArrayTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestResponseAsByteArrayTest.java
deleted file mode 100644
index c1bcae31cd..0000000000
--- a/common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestResponseAsByteArrayTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.openecomp.sdc.common.rest.api;
-
-import org.junit.Test;
-
-
-public class RestResponseAsByteArrayTest {
-
- private RestResponseAsByteArray createTestSubject() {
- return new RestResponseAsByteArray(null, "", 0);
- }
-
-
- @Test
- public void testGetResponse() throws Exception {
- RestResponseAsByteArray testSubject;
- byte[] result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResponse();
- }
-
-
- @Test
- public void testSetResponse() throws Exception {
- RestResponseAsByteArray testSubject;
- byte[] response = new byte[] { ' ' };
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResponse(response);
- }
-
-
- @Test
- public void testGetHttpStatusCode() throws Exception {
- RestResponseAsByteArray testSubject;
- int result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getHttpStatusCode();
- }
-
-
- @Test
- public void testSetHttpStatusCode() throws Exception {
- RestResponseAsByteArray testSubject;
- int httpStatusCode = 0;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setHttpStatusCode(httpStatusCode);
- }
-
-
- @Test
- public void testGetStatusDescription() throws Exception {
- RestResponseAsByteArray testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getStatusDescription();
- }
-
-
- @Test
- public void testSetStatusDescription() throws Exception {
- RestResponseAsByteArray testSubject;
- String statusDescription = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setStatusDescription(statusDescription);
- }
-
-
- @Test
- public void testToString() throws Exception {
- RestResponseAsByteArray testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
- }
-
-
- @Test
- public void testToPrettyString() throws Exception {
- RestResponseAsByteArray testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toPrettyString();
- }
-} \ No newline at end of file
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestResponseTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestResponseTest.java
deleted file mode 100644
index 1ca37b16df..0000000000
--- a/common-app-api/src/test/java/org/openecomp/sdc/common/rest/api/RestResponseTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.openecomp.sdc.common.rest.api;
-
-import org.junit.Test;
-
-
-public class RestResponseTest {
-
- private RestResponse createTestSubject() {
- return new RestResponse("", "", 0);
- }
-
-
- @Test
- public void testGetResponse() throws Exception {
- RestResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResponse();
- }
-
-
- @Test
- public void testSetResponse() throws Exception {
- RestResponse testSubject;
- String response = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResponse(response);
- }
-
-
- @Test
- public void testGetHttpStatusCode() throws Exception {
- RestResponse testSubject;
- int result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getHttpStatusCode();
- }
-
-
- @Test
- public void testSetHttpStatusCode() throws Exception {
- RestResponse testSubject;
- int httpStatusCode = 0;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setHttpStatusCode(httpStatusCode);
- }
-
-
- @Test
- public void testGetStatusDescription() throws Exception {
- RestResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getStatusDescription();
- }
-
-
- @Test
- public void testSetStatusDescription() throws Exception {
- RestResponse testSubject;
- String statusDescription = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setStatusDescription(statusDescription);
- }
-
-
- @Test
- public void testToString() throws Exception {
- RestResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
- }
-} \ No newline at end of file
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/test/E2EHttpClientTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/test/E2EHttpClientTest.java
new file mode 100644
index 0000000000..9dbb146d5a
--- /dev/null
+++ b/common-app-api/src/test/java/org/openecomp/sdc/common/test/E2EHttpClientTest.java
@@ -0,0 +1,83 @@
+package org.openecomp.sdc.common.test;
+
+import java.net.MalformedURLException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openecomp.sdc.common.http.client.api.HttpExecuteException;
+import org.openecomp.sdc.common.http.client.api.HttpRequest;
+import org.openecomp.sdc.common.http.client.api.HttpResponse;
+import org.openecomp.sdc.common.http.config.HttpClientConfig;
+import org.openecomp.sdc.common.http.config.Timeouts;
+
+public class E2EHttpClientTest {
+
+ @Ignore
+ @Test
+ public void testSsl() throws MalformedURLException {
+
+ String url = "https://135.76.210.29:2443/certificate-manager-fe/v1";
+// String url = "http://135.76.123.110:1111//aai/v1/aai/cloud-infrastructure/operational-environments/operational-environment/12345";
+ try {
+ HttpClientConfig httpClientConfig = new HttpClientConfig(new Timeouts(10000, 5000));
+
+ HttpResponse<String> response = HttpRequest.get(url, httpClientConfig);
+ System.out.println(response);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Ignore
+ @Test
+ public void testSslMutliThread() throws MalformedURLException {
+
+ String url = "https://135.76.210.29:2443/certificate-manager-fe/v1";
+// String url = "http://135.76.210.29:2080/certificate-manager-fe/v1";
+ String url2 = "http://135.76.123.110:1111//aai/v1/aai/cloud-infrastructure/operational-environments/operational-environment/12345";
+
+ HttpClientConfig httpClientConfig = new HttpClientConfig(new Timeouts(1000, 5000));
+
+ int threadCount = 10;
+ ExecutorService executor = Executors.newFixedThreadPool(threadCount);
+ for (int i = 0; i < threadCount; i++) {
+ Runnable worker = new Runnable() {
+ @Override
+ public void run() {
+ int count = 10;
+ try {
+ int i = 0;
+ while (i < count) {
+ if(i%2==0) {
+ HttpResponse<String> response = HttpRequest.get(url, httpClientConfig);
+ System.out.println("Thead id=" + Thread.currentThread() + " Count = " + ++i + " " + response);
+ }
+ else {
+ HttpResponse<String> response = HttpRequest.get(url2, httpClientConfig);
+ System.out.println("Thead id=" + Thread.currentThread() + " Count = " + ++i + " " + response);
+ }
+ }
+ }
+ catch (HttpExecuteException e) {
+ e.printStackTrace();
+ }
+ }
+ };
+ executor.execute(worker);
+ }
+
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ }
+ catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ executor.shutdown();
+ while (!executor.isTerminated())
+ ;
+ }
+}
diff --git a/common-app-api/src/test/resources/config/common/distribution-engine-configuration.yaml b/common-app-api/src/test/resources/config/common/distribution-engine-configuration.yaml
index a4ce7cc08c..b4aaef59c7 100644
--- a/common-app-api/src/test/resources/config/common/distribution-engine-configuration.yaml
+++ b/common-app-api/src/test/resources/config/common/distribution-engine-configuration.yaml
@@ -33,3 +33,35 @@ distributionStatusTopic:
createTopic:
partitionCount: 1
replicationCount: 1
+
+aaiConfig:
+ httpRequestConfig:
+ serverRootUrl: https://127.0.0.1/aai/v1
+ resourceNamespaces:
+ operationalEnvironments: /aai/cloud-infrastructure/operational-environments
+
+ httpClientConfig:
+ timeouts:
+ readTimeoutMs: 5000
+ connectTimeoutMs: 1000
+ clientCertificate:
+ keyStore: /opt/app/jetty/base/be/etc/non-prod.jks
+ keyStorePassword: hmXYcznAljMSisdy8zgcag==
+ headers:
+ X-FromAppId: asdc
+ numOfRetries: 3
+
+msoConfig:
+ httpRequestConfig:
+ serverRootUrl: http://127.0.0.1:8080/onap/so/infra/modelDistributions/v1
+ resourceNamespaces:
+ distributions: /distributions
+
+ httpClientConfig:
+ timeouts:
+ readTimeoutMs: 2000
+ connectTimeoutMs: 500
+ basicAuthorization:
+ userName: asdc
+ password: OTLEp5lfVhYdyw5EAtTUBQ==
+ numOfRetries: 3