summaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/test
diff options
context:
space:
mode:
authormmis <michael.morris@ericsson.com>2018-07-19 13:21:08 +0100
committermmis <michael.morris@ericsson.com>2018-07-25 09:14:33 +0100
commit64f53ef14f5a9ea98208fd2b835bfb01fda9a5f9 (patch)
tree60afa251c126287a85c89e0b1dc7fd5d1a766439 /policy-endpoints/src/test
parente8f1b7235f8338fbb9eba28d8cff29d3d6adf6e7 (diff)
Copy policy-endpoints from drools-pdp to common
Removed policy-endpoints, and 3 classes from policy-core. Replaced refenences to the deleted classes with references to the corresponding classes in policy-common Issue-ID: POLICY-967 Change-Id: I547cde4894424b8f40b7ddd4e2342ebb729cb588 Signed-off-by: mmis <michael.morris@ericsson.com>
Diffstat (limited to 'policy-endpoints/src/test')
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/HttpClientTest.java203
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/HttpServerTest.java232
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/NoopTopicTest.java117
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestEchoService.java46
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestEndpoints.java45
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestMockHealthCheck.java48
-rw-r--r--policy-endpoints/src/test/resources/logback-test.xml36
7 files changed, 0 insertions, 727 deletions
diff --git a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/HttpClientTest.java b/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/HttpClientTest.java
deleted file mode 100644
index 6a84d142..00000000
--- a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/HttpClientTest.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-endpoints
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.policy.drools.http.server.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-
-import javax.ws.rs.core.Response;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.drools.http.client.HttpClient;
-import org.onap.policy.drools.http.server.HttpServletServer;
-import org.onap.policy.drools.properties.PolicyProperties;
-import org.onap.policy.drools.utils.NetworkUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class HttpClientTest {
-
- private static Logger logger = LoggerFactory.getLogger(HttpClientTest.class);
-
- @BeforeClass
- public static void setUp() throws InterruptedException, IOException {
- logger.info("-- setup() --");
-
- /* echo server */
-
- final HttpServletServer echoServerNoAuth =
- HttpServletServer.factory.build("echo", "localhost", 6666, "/", false, true);
- echoServerNoAuth.addServletPackage("/*", HttpClientTest.class.getPackage().getName());
- echoServerNoAuth.waitedStart(5000);
-
- if (!NetworkUtil.isTcpPortOpen("localhost", echoServerNoAuth.getPort(), 5, 10000L))
- throw new IllegalStateException("cannot connect to port " + echoServerNoAuth.getPort());
-
- /* no auth echo server */
-
- final HttpServletServer echoServerAuth =
- HttpServletServer.factory.build("echo", "localhost", 6667, "/", false, true);
- echoServerAuth.setBasicAuthentication("x", "y", null);
- echoServerAuth.addServletPackage("/*", HttpClientTest.class.getPackage().getName());
- echoServerAuth.waitedStart(5000);
-
- if (!NetworkUtil.isTcpPortOpen("localhost", echoServerAuth.getPort(), 5, 10000L))
- throw new IllegalStateException("cannot connect to port " + echoServerAuth.getPort());
- }
-
- @AfterClass
- public static void tearDown() {
- logger.info("-- tearDown() --");
-
- HttpServletServer.factory.destroy();
- HttpClient.factory.destroy();
- }
-
- @Test
- public void testHttpNoAuthClient() throws Exception {
- logger.info("-- testHttpNoAuthClient() --");
-
- final HttpClient client = HttpClient.factory.build("testHttpNoAuthClient", false, false,
- "localhost", 6666, "junit/echo", null, null, true);
- final Response response = client.get("hello");
- final String body = HttpClient.getBody(response, String.class);
-
- assertTrue(response.getStatus() == 200);
- assertTrue(body.equals("hello"));
- }
-
- @Test
- public void testHttpAuthClient() throws Exception {
- logger.info("-- testHttpAuthClient() --");
-
- final HttpClient client = HttpClient.factory.build("testHttpAuthClient", false, false,
- "localhost", 6667, "junit/echo", "x", "y", true);
- final Response response = client.get("hello");
- final String body = HttpClient.getBody(response, String.class);
-
- assertTrue(response.getStatus() == 200);
- assertTrue(body.equals("hello"));
- }
-
- @Test
- public void testHttpAuthClient401() throws Exception {
- logger.info("-- testHttpAuthClient401() --");
-
- final HttpClient client = HttpClient.factory.build("testHttpAuthClient401", false, false,
- "localhost", 6667, "junit/echo", null, null, true);
- final Response response = client.get("hello");
- assertTrue(response.getStatus() == 401);
- }
-
- @Test
- public void testHttpAuthClientProps() throws Exception {
- logger.info("-- testHttpAuthClientProps() --");
-
- final Properties httpProperties = new Properties();
-
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES, "PAP,PDP");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_HOST_SUFFIX, "localhost");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_PORT_SUFFIX, "7777");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX, "testpap");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX, "alpha123");
- httpProperties.setProperty(
- PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX,
- RestMockHealthCheck.class.getName());
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_MANAGED_SUFFIX, "true");
-
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_HOST_SUFFIX, "localhost");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_PORT_SUFFIX, "7778");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX, "testpdp");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX, "alpha123");
- httpProperties.setProperty(
- PolicyProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX,
- RestMockHealthCheck.class.getName());
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_MANAGED_SUFFIX, "true");
-
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES, "PAP,PDP");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_HOST_SUFFIX, "localhost");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_PORT_SUFFIX, "7777");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_URL_SUFFIX, "pap/test");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_HTTPS_SUFFIX, "false");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX, "testpap");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX, "alpha123");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PAP"
- + PolicyProperties.PROPERTY_MANAGED_SUFFIX, "true");
-
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_HOST_SUFFIX, "localhost");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_PORT_SUFFIX, "7778");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_URL_SUFFIX, "pdp");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_HTTPS_SUFFIX, "false");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX, "testpdp");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX, "alpha123");
- httpProperties.setProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES + "." + "PDP"
- + PolicyProperties.PROPERTY_MANAGED_SUFFIX, "true");
-
- final List<HttpServletServer> servers = HttpServletServer.factory.build(httpProperties);
- assertTrue(servers.size() == 2);
-
- final List<HttpClient> clients = HttpClient.factory.build(httpProperties);
- assertTrue(clients.size() == 2);
-
- for (final HttpServletServer server : servers) {
- server.waitedStart(10000);
- }
-
- final HttpClient clientPAP = HttpClient.factory.get("PAP");
- final Response response = clientPAP.get();
- assertTrue(response.getStatus() == 200);
-
- final HttpClient clientPDP = HttpClient.factory.get("PDP");
- final Response response2 = clientPDP.get("test");
- assertTrue(response2.getStatus() == 500);
- }
-
-
-}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/HttpServerTest.java b/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/HttpServerTest.java
deleted file mode 100644
index aa3fa584..00000000
--- a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/HttpServerTest.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-endpoints
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.policy.drools.http.server.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.ConnectException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.UUID;
-
-import org.junit.Test;
-import org.onap.policy.drools.http.server.HttpServletServer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * HttpServletServer JUNIT tests
- */
-public class HttpServerTest {
-
- /**
- * Logger
- */
- private static Logger logger = LoggerFactory.getLogger(HttpServerTest.class);
-
- @Test
- public void testSingleServer() throws Exception {
- logger.info("-- testSingleServer() --");
-
- HttpServletServer server = HttpServletServer.factory.build("echo", "localhost", 5678, "/", false, true);
- server.addServletPackage("/*", this.getClass().getPackage().getName());
- server.waitedStart(5000);
-
- assertTrue(HttpServletServer.factory.get(5678).isAlive());
-
- String response =
- http(HttpServletServer.factory.get(5678), "http://localhost:5678/junit/echo/hello");
- assertTrue("hello".equals(response));
-
- response = null;
- try {
- response = http(HttpServletServer.factory.get(5678), "http://localhost:5678/swagger.json");
- } catch (IOException e) {
- // Expected
- }
- assertTrue(response == null);
-
- assertTrue(HttpServletServer.factory.get(5678).isAlive());
- assertTrue(HttpServletServer.factory.inventory().size() == 1);
-
- HttpServletServer.factory.destroy(5678);
- assertTrue(HttpServletServer.factory.inventory().size() == 0);
- }
-
- @Test
- public void testMultipleServers() throws Exception {
- logger.info("-- testMultipleServers() --");
-
- HttpServletServer server1 = HttpServletServer.factory.build("echo-1", "localhost", 5688, "/", true, true);
- server1.addServletPackage("/*", this.getClass().getPackage().getName());
- server1.waitedStart(5000);
-
- HttpServletServer server2 = HttpServletServer.factory.build("echo-2", "localhost", 5689, "/", false, true);
- server2.addServletPackage("/*", this.getClass().getPackage().getName());
- server2.waitedStart(5000);
-
- assertTrue(HttpServletServer.factory.get(5688).isAlive());
- assertTrue(HttpServletServer.factory.get(5689).isAlive());
-
- String response =
- http(HttpServletServer.factory.get(5688), "http://localhost:5688/junit/echo/hello");
- assertTrue("hello".equals(response));
-
- response =
- http(HttpServletServer.factory.get(5688), "http://localhost:5688/swagger.json");
- assertTrue(response != null);
-
- response =
- http(HttpServletServer.factory.get(5689), "http://localhost:5689/junit/echo/hello");
- assertTrue("hello".equals(response));
-
- response = null;
- try {
- response = http(HttpServletServer.factory.get(5689), "http://localhost:5689/swagger.json");
- } catch (IOException e) {
- // Expected
- }
- assertTrue(response == null);
-
- HttpServletServer.factory.destroy();
- assertTrue(HttpServletServer.factory.inventory().size() == 0);
- }
-
- @Test
- public void testMultiServicePackage() throws Exception {
- logger.info("-- testMultiServicePackage() --");
-
- String randomName = UUID.randomUUID().toString();
-
- HttpServletServer server = HttpServletServer.factory.build(randomName, "localhost", 5668, "/", false, true);
- server.addServletPackage("/*", this.getClass().getPackage().getName());
- server.waitedStart(5000);
-
- assertTrue(HttpServletServer.factory.get(5668).isAlive());
-
- String response =
- http(HttpServletServer.factory.get(5668), "http://localhost:5668/junit/echo/hello");
- assertTrue("hello".equals(response));
-
- response =
- http(HttpServletServer.factory.get(5668), "http://localhost:5668/junit/endpoints/http/servers");
- assertTrue(response.contains(randomName));
-
- HttpServletServer.factory.destroy();
- assertTrue(HttpServletServer.factory.inventory().size() == 0);
- }
-
- @Test
- public void testServiceClass() throws Exception {
- logger.info("-- testServiceClass() --");
- String randomName = UUID.randomUUID().toString();
-
- HttpServletServer server = HttpServletServer.factory.build(randomName, "localhost", 5658, "/", false, true);
- server.addServletClass("/*", RestEchoService.class.getCanonicalName());
- server.waitedStart(5000);
-
- assertTrue(HttpServletServer.factory.get(5658).isAlive());
-
- String response =
- http(HttpServletServer.factory.get(5658), "http://localhost:5658/junit/echo/hello");
- assertTrue("hello".equals(response));
-
- HttpServletServer.factory.destroy();
- assertTrue(HttpServletServer.factory.inventory().size() == 0);
- }
-
- @Test
- public void testMultiServiceClass() throws Exception {
- logger.info("-- testMultiServiceClass() --");
-
- String randomName = UUID.randomUUID().toString();
-
- HttpServletServer server = HttpServletServer.factory.build(randomName, "localhost", 5648, "/", false, true);
- server.addServletClass("/*", RestEchoService.class.getCanonicalName());
- server.addServletClass("/*", RestEndpoints.class.getCanonicalName());
- server.waitedStart(5000);
-
- assertTrue(HttpServletServer.factory.get(5648).isAlive());
-
- String response =
- http(HttpServletServer.factory.get(5648), "http://localhost:5648/junit/echo/hello");
- assertTrue("hello".equals(response));
-
- response =
- http(HttpServletServer.factory.get(5648), "http://localhost:5648/junit/endpoints/http/servers");
- assertTrue(response.contains(randomName));
-
- HttpServletServer.factory.destroy();
- assertTrue(HttpServletServer.factory.inventory().size() == 0);
- }
-
- /**
- * performs an http request
- *
- * @throws MalformedURLException
- * @throws IOException
- * @throws InterruptedException
- */
- protected String http(HttpServletServer server, String aUrl)
- throws MalformedURLException, IOException, InterruptedException {
- URL url = new URL(aUrl);
- String response = null;
- int numRetries = 1, maxNumberRetries = 5;
- while (numRetries <= maxNumberRetries) {
- try {
- response = response(url);
- break;
- } catch (ConnectException e) {
- logger.warn("http server {} @ {} ({}) - cannot connect yet ..",
- server, aUrl, numRetries, e);
- numRetries++;
- Thread.sleep(10000L);
- } catch (Exception e) {
- throw e;
- }
- }
-
- return response;
- }
-
- /**
- * gets http response
- *
- * @param url url
- *
- * @throws IOException
- */
- protected String response(URL url) throws IOException {
- String response = "";
- try (BufferedReader ioReader = new BufferedReader(new InputStreamReader(url.openStream()))) {
- String line;
- while ((line = ioReader.readLine()) != null) {
- response += line;
- }
- }
- return response;
- }
-
-
-
-}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/NoopTopicTest.java b/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/NoopTopicTest.java
deleted file mode 100644
index 65269038..00000000
--- a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/NoopTopicTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-endpoints
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.policy.drools.http.server.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.Test;
-import org.onap.policy.drools.event.comm.Topic.CommInfrastructure;
-import org.onap.policy.drools.event.comm.TopicEndpoint;
-import org.onap.policy.drools.event.comm.TopicListener;
-import org.onap.policy.drools.event.comm.TopicSink;
-import org.onap.policy.drools.event.comm.bus.NoopTopicSink;
-import org.onap.policy.drools.properties.PolicyProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * NOOP Endpoint Tests
- */
-public class NoopTopicTest implements TopicListener {
-
- /**
- * Logger
- */
- private static Logger logger = LoggerFactory.getLogger(NoopTopicTest.class);
-
- private final String topicName = "junit-noop";
- private final String outMessage = "blah";
- private String inMessage = null;
-
- @Test
- public void testNoopEndpoint() {
- logger.info("-- testNoopEndpoint() --");
-
- Properties noopSinkProperties = new Properties();
- noopSinkProperties.put(PolicyProperties.PROPERTY_NOOP_SINK_TOPICS, topicName);
-
- List<? extends TopicSink> noopTopics =
- TopicEndpoint.manager.addTopicSinks(noopSinkProperties);
-
- TopicSink sink = NoopTopicSink.factory.get(topicName);
-
- assertTrue(noopTopics.size() == 1);
- assertTrue(noopTopics.size() == NoopTopicSink.factory.inventory().size());
- assertTrue(noopTopics.get(0) == sink);
- assertTrue(sink == NoopTopicSink.factory.inventory().get(0));
-
- assertTrue(!sink.isAlive());
-
- boolean badState = false;
- try{
- sink.send(outMessage);
- } catch(IllegalStateException e) {
- badState = true;
- }
- assertTrue(badState);
-
- sink.start();
- assertTrue(sink.isAlive());
-
- sink.send(outMessage);
- assertTrue(sink.getRecentEvents().length == 1);
- assertTrue(sink.getRecentEvents()[0].equals(outMessage));
- assertTrue(this.inMessage == null);
-
- sink.register(this);
- sink.send(this.outMessage);
- assertTrue(outMessage.equals(this.inMessage));
- this.inMessage = null;
-
- sink.unregister(this);
- sink.send(this.outMessage);
- assertTrue(!outMessage.equals(this.inMessage));
-
- sink.stop();
- try{
- sink.send(outMessage);
- } catch(IllegalStateException e) {
- badState = true;
- }
- assertTrue(badState);
-
- NoopTopicSink.factory.destroy(topicName);
- assertTrue(NoopTopicSink.factory.inventory().size() == 0);
- }
-
- @Override
- public void onTopicEvent(CommInfrastructure commType, String topic, String event) {
- if (commType != CommInfrastructure.NOOP)
- return;
-
- if (topic == null || !topic.equals(topicName))
- return;
-
- this.inMessage = event;
- }
-}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestEchoService.java b/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestEchoService.java
deleted file mode 100644
index 3978caf2..00000000
--- a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestEchoService.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-endpoints
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.policy.drools.http.server.test;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
-@Api(value="echo")
-@Path("/junit/echo")
-public class RestEchoService {
-
- @GET
- @Path("{word}")
- @Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(
- value="echoes back whatever received"
- )
- public String echo(@PathParam("word") String word) {
- return word;
- }
-
-}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestEndpoints.java b/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestEndpoints.java
deleted file mode 100644
index a21c9d3b..00000000
--- a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestEndpoints.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-endpoints
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.policy.drools.http.server.test;
-
-import java.util.List;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.onap.policy.drools.http.server.HttpServletServer;
-
-@Path("/junit/endpoints")
-public class RestEndpoints {
-
- @GET
- @Path("http/servers")
- @Produces(MediaType.TEXT_PLAIN)
- public String httpServers() {
- List<HttpServletServer> servers =
- HttpServletServer.factory.inventory();
- return servers.toString();
- }
-
-
-}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestMockHealthCheck.java b/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestMockHealthCheck.java
deleted file mode 100644
index cb1405f6..00000000
--- a/policy-endpoints/src/test/java/org/onap/policy/drools/http/server/test/RestMockHealthCheck.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * policy-endpoints
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.policy.drools.http.server.test;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-
-@Path("/")
-public class RestMockHealthCheck {
-
- @GET
- @Path("pap/test")
- @Produces(MediaType.APPLICATION_JSON)
- public Response papHealthCheck() {
- return Response.status(Status.OK).entity("All Alive").build();
- }
-
- @GET
- @Path("pdp/test")
- @Produces(MediaType.APPLICATION_JSON)
- public Response pdpHealthCheck() {
- return Response.status(Status.INTERNAL_SERVER_ERROR).entity("At least some Dead").build();
- }
-
-
-}
diff --git a/policy-endpoints/src/test/resources/logback-test.xml b/policy-endpoints/src/test/resources/logback-test.xml
deleted file mode 100644
index b3feef90..00000000
--- a/policy-endpoints/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- ONAP
- ================================================================================
- Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- 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=========================================================
- -->
-<configuration>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <Pattern>
- %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
- </Pattern>
- </encoder>
- </appender>
-
- <logger name="org.onap.policy.drools.http.server.test" level="INFO"/>
-
- <root level="WARN">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration> \ No newline at end of file