summaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/test/java/org
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-06-22 17:17:28 -0500
committerJorge Hernandez <jh1730@att.com>2017-06-22 17:17:28 -0500
commit8f61e18ef0457745719f05bd5c186992a7155416 (patch)
tree884f4653f957a88a65ea981727dfe26494fb7c55 /policy-endpoints/src/test/java/org
parent3cc1a85a832771cb70ed9cbaab9031bc4a114308 (diff)
[POLICY-30] remove problematic layers
add configurability through telemetry API Change-Id: I77ebde12a417d421b98646c32dc74824f4494c2e Signed-off-by: Jorge Hernandez <jh1730@att.com>
Diffstat (limited to 'policy-endpoints/src/test/java/org')
-rw-r--r--policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpClientTest.java14
-rw-r--r--policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpServerTest.java30
2 files changed, 19 insertions, 25 deletions
diff --git a/policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpClientTest.java b/policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpClientTest.java
index cd149f7a..df57fcfc 100644
--- a/policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpClientTest.java
+++ b/policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpClientTest.java
@@ -31,12 +31,16 @@ import org.junit.Test;
import org.openecomp.policy.drools.http.client.HttpClient;
import org.openecomp.policy.drools.http.server.HttpServletServer;
import org.openecomp.policy.drools.properties.PolicyProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class HttpClientTest {
+ private static Logger logger = LoggerFactory.getLogger(HttpClientTest.class);
+
@Test
public void testHttpNoAuthClient() throws Exception {
- System.out.println("-- testHttpNoAuthClient() --");
+ logger.info("-- testHttpNoAuthClient() --");
HttpServletServer server = HttpServletServer.factory.build("echo", "localhost", 6666, "/", false, true);
server.addServletPackage("/*", this.getClass().getPackage().getName());
@@ -57,7 +61,7 @@ public class HttpClientTest {
@Test
public void testHttpAuthClient() throws Exception {
- System.out.println("-- testHttpAuthClient() --");
+ logger.info("-- testHttpAuthClient() --");
HttpServletServer server = HttpServletServer.factory.build("echo", "localhost", 6666, "/", false, true);
server.setBasicAuthentication("x", "y", null);
@@ -79,7 +83,7 @@ public class HttpClientTest {
@Test
public void testHttpAuthClient401() throws Exception {
- System.out.println("-- testHttpAuthClient401() --");
+ logger.info("-- testHttpAuthClient401() --");
HttpServletServer server = HttpServletServer.factory.build("echo", "localhost", 6666, "/", false, true);
server.setBasicAuthentication("x", "y", null);
@@ -98,7 +102,7 @@ public class HttpClientTest {
//@Test
public void testHttpAuthClientHttps() throws Exception {
- System.out.println("-- testHttpAuthClientHttps() --");
+ logger.info("-- testHttpAuthClientHttps() --");
HttpClient client = HttpClient.factory.build("testHttpAuthClientHttps", true, true, "somehost.somewhere.com",
9091, "pap/test", "testpap", "alpha123", true);
@@ -116,7 +120,7 @@ public class HttpClientTest {
//@Test
public void testHttpAuthClientProps() throws Exception {
- System.out.println("-- testHttpAuthClientProps() --");
+ logger.info("-- testHttpAuthClientProps() --");
Properties httpProperties = new Properties();
diff --git a/policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpServerTest.java b/policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpServerTest.java
index 6a369814..931d968b 100644
--- a/policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpServerTest.java
+++ b/policy-endpoints/src/test/java/org/openecomp/policy/drools/http/server/test/HttpServerTest.java
@@ -29,15 +29,19 @@ import java.util.UUID;
import org.junit.Test;
import org.openecomp.policy.drools.http.server.HttpServletServer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* HttpServletServer JUNIT tests
*/
public class HttpServerTest {
+
+ private static Logger logger = LoggerFactory.getLogger(HttpServerTest.class);
@Test
public void testSingleServer() throws Exception {
- System.out.println("-- testSingleServer() --");
+ logger.info("-- testSingleServer() --");
HttpServletServer server = HttpServletServer.factory.build("echo", "localhost", 5678, "/", false, true);
server.addServletPackage("/*", this.getClass().getPackage().getName());
@@ -48,7 +52,6 @@ public class HttpServerTest {
String echo = "hello";
URL url = new URL("http://localhost:5678/junit/echo/" + echo);
String response = response(url);
- System.out.println("Received .. " + response);
assertTrue(response.equals(echo));
String responseSwagger = null;
@@ -67,7 +70,7 @@ public class HttpServerTest {
@Test
public void testMultipleServers() throws Exception {
- System.out.println("-- testMultipleServers() --");
+ logger.info("-- testMultipleServers() --");
HttpServletServer server1 = HttpServletServer.factory.build("echo-1", "localhost", 5678, "/", true, true);
server1.addServletPackage("/*", this.getClass().getPackage().getName());
@@ -84,18 +87,14 @@ public class HttpServerTest {
URL url1 = new URL("http://localhost:5678/junit/echo/" + echo);
String response1 = response(url1);
- System.out.println("Received .. " + response1);
assertTrue(response1.equals(echo));
URL urlSwagger = new URL("http://localhost:5678/swagger.json");
- String responseSwagger = response(urlSwagger);
-
- System.out.println("Received .. " + responseSwagger);
+ String responseSwagger = response(urlSwagger);
assertTrue(responseSwagger != null);
URL url2 = new URL("http://localhost:5679/junit/echo/" + echo);
String response2 = response(url2);
- System.out.println("Received .. " + response2);
assertTrue(response2.equals(echo));
String responseSwagger2 = null;
@@ -105,8 +104,6 @@ public class HttpServerTest {
} catch(IOException ioe) {
// Expected
}
-
- System.out.println("Received .. " + responseSwagger2);
assertTrue(responseSwagger2 == null);
HttpServletServer.factory.destroy();
@@ -115,7 +112,7 @@ public class HttpServerTest {
@Test
public void testMultiServicePackage() throws Exception {
- System.out.println("-- testMultiServicePackage() --");
+ logger.info("-- testMultiServicePackage() --");
String randomName = UUID.randomUUID().toString();
@@ -128,12 +125,10 @@ public class HttpServerTest {
String echo = "hello";
URL urlService1 = new URL("http://localhost:5678/junit/echo/" + echo);
String responseService1 = response(urlService1);
- System.out.println("Received .. " + responseService1);
assertTrue(responseService1.equals(echo));
URL urlService2 = new URL("http://localhost:5678/junit/endpoints/http/servers");
String responseService2 = response(urlService2);
- System.out.println("Received .. " + responseService2);
assertTrue(responseService2.contains(randomName));
HttpServletServer.factory.destroy();
@@ -142,7 +137,7 @@ public class HttpServerTest {
@Test
public void testServiceClass() throws Exception {
- System.out.println("-- testServiceClass() --");
+ logger.info("-- testServiceClass() --");
String randomName = UUID.randomUUID().toString();
HttpServletServer server = HttpServletServer.factory.build(randomName, "localhost", 5678, "/", false, true);
@@ -154,7 +149,6 @@ public class HttpServerTest {
String echo = "hello";
URL urlService1 = new URL("http://localhost:5678/junit/echo/" + echo);
String responseService1 = response(urlService1);
- System.out.println("Received .. " + responseService1);
assertTrue(responseService1.equals(echo));
HttpServletServer.factory.destroy();
@@ -163,7 +157,7 @@ public class HttpServerTest {
@Test
public void testMultiServiceClass() throws Exception {
- System.out.println("-- testMultiServiceClass() --");
+ logger.info("-- testMultiServiceClass() --");
String randomName = UUID.randomUUID().toString();
@@ -177,12 +171,10 @@ public class HttpServerTest {
String echo = "hello";
URL urlService1 = new URL("http://localhost:5678/junit/echo/" + echo);
String responseService1 = response(urlService1);
- System.out.println("Received .. " + responseService1);
assertTrue(responseService1.equals(echo));
URL urlService2 = new URL("http://localhost:5678/junit/endpoints/http/servers");
String responseService2 = response(urlService2);
- System.out.println("Received .. " + responseService2);
assertTrue(responseService2.contains(randomName));
HttpServletServer.factory.destroy();
@@ -200,8 +192,6 @@ public class HttpServerTest {
while ((line = ioReader.readLine()) != null) {
response += line;
}
-
- System.out.println("R is " + response);
ioReader.close();
return response;
}