aboutsummaryrefslogtreecommitdiffstats
path: root/common-app-api/src/test/java/org
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-03-04 14:53:33 +0200
committerMichael Lando <ml636r@att.com>2018-03-07 13:19:05 +0000
commita5445100050e49e83f73424198d73cd72d672a4d (patch)
treecacf4df817df31be23e4e790d1dda857bdae061e /common-app-api/src/test/java/org
parent51157f92c21976cba4914c378aaa3cba49826931 (diff)
Sync Integ to Master
Change-Id: I71e3acc26fa612127756ac04073a522b9cc6cd74 Issue-ID: SDC-977 Signed-off-by: Gitelman, Tal (tg851x) <tg851x@intl.att.com>
Diffstat (limited to 'common-app-api/src/test/java/org')
-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
4 files changed, 84 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())
+ ;
+ }
+}