summaryrefslogtreecommitdiffstats
path: root/controlloop/common
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-07-08 10:56:34 -0400
committerJim Hahn <jrh3@att.com>2019-07-09 12:06:21 -0400
commit2a1a7893b445ebca44ec8e1b90f84bb66fbca92f (patch)
treecc038059f8ed141af8c24b41bf064353f286e7c8 /controlloop/common
parentaa7342c95dc0a0fa4995e3cf3b9e9fd10ca0fddc (diff)
Fix drools-applications due to sonar changes in common
Fixed breakages due to changes made in policy/common to satisfy sonar. Repointed op.pom to correct parent, which allowed the other version to be dropped and properties used in the rest of the pom. Change-Id: Ib19c228c38b7f27fb9e9f508e5cf2566a8939cdd Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common')
-rw-r--r--controlloop/common/coordination/src/test/java/org/onap/policy/coordination/CoordinationDirectiveTest.java2
-rw-r--r--controlloop/common/coordination/src/test/java/org/onap/policy/coordination/UtilTest.java2
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java4
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java4
-rw-r--r--controlloop/common/feature-controlloop-management/src/test/java/org/onap/policy/drools/server/restful/RestControlLoopManagerTest.java28
-rw-r--r--controlloop/common/feature-controlloop-management/src/test/resources/op.pom9
-rw-r--r--controlloop/common/feature-controlloop-utils/src/test/java/org/onap/policy/drools/apps/controlloop/feature/utils/ControlLoopUtilsFeatureTest.java14
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java6
8 files changed, 32 insertions, 37 deletions
diff --git a/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/CoordinationDirectiveTest.java b/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/CoordinationDirectiveTest.java
index 30606d1fd..47d11dd62 100644
--- a/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/CoordinationDirectiveTest.java
+++ b/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/CoordinationDirectiveTest.java
@@ -21,12 +21,10 @@
package org.onap.policy.coordination;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.util.Arrays;
-import org.assertj.core.api.Assertions;
import org.junit.Test;
public class CoordinationDirectiveTest {
diff --git a/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/UtilTest.java b/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/UtilTest.java
index 76ae3b41c..21998a7b4 100644
--- a/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/UtilTest.java
+++ b/controlloop/common/coordination/src/test/java/org/onap/policy/coordination/UtilTest.java
@@ -21,11 +21,9 @@
package org.onap.policy.coordination;
import static org.assertj.core.api.Assertions.assertThatNullPointerException;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
import org.junit.Test;
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index 3a4b27770..b7dc1f0d9 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
@@ -54,7 +54,7 @@ import org.onap.policy.aai.Relationship;
import org.onap.policy.aai.RelationshipData;
import org.onap.policy.aai.RelationshipList;
import org.onap.policy.aai.util.AaiException;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.utils.io.Serializer;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopException;
@@ -122,7 +122,7 @@ public class ControlLoopEventManagerTest {
@AfterClass
public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
+ HttpServletServerFactoryInstance.getServerFactory().destroy();
}
/**
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
index 835b4ac82..13fe72517 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
@@ -53,7 +53,7 @@ import org.onap.policy.appclcm.LcmRequest;
import org.onap.policy.appclcm.LcmRequestWrapper;
import org.onap.policy.appclcm.LcmResponse;
import org.onap.policy.appclcm.LcmResponseWrapper;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.utils.io.Serializer;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopException;
@@ -155,7 +155,7 @@ public class ControlLoopOperationManagerTest {
public static void tearDown() {
em.close();
emf.close();
- HttpServletServer.factory.destroy();
+ HttpServletServerFactoryInstance.getServerFactory().destroy();
}
@Test
diff --git a/controlloop/common/feature-controlloop-management/src/test/java/org/onap/policy/drools/server/restful/RestControlLoopManagerTest.java b/controlloop/common/feature-controlloop-management/src/test/java/org/onap/policy/drools/server/restful/RestControlLoopManagerTest.java
index 3d89e5a1e..849b4189b 100644
--- a/controlloop/common/feature-controlloop-management/src/test/java/org/onap/policy/drools/server/restful/RestControlLoopManagerTest.java
+++ b/controlloop/common/feature-controlloop-management/src/test/java/org/onap/policy/drools/server/restful/RestControlLoopManagerTest.java
@@ -38,7 +38,7 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kie.api.builder.ReleaseId;
-import org.onap.policy.common.endpoints.http.client.HttpClient;
+import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.drools.persistence.SystemPersistence;
import org.onap.policy.drools.properties.DroolsProperties;
@@ -100,7 +100,7 @@ public class RestControlLoopManagerTest {
PolicyEngine.manager.createPolicyController(CONTROLLER, controllerProperties);
PolicyEngine.manager.start();
- HttpClient.factory.build(SystemPersistence.manager.getProperties(CLIENT_CONFIG));
+ HttpClientFactoryInstance.getClientFactory().build(SystemPersistence.manager.getProperties(CLIENT_CONFIG));
if (!NetworkUtil.isTcpPortOpen("localhost", 9696, 6, 10000L)) {
throw new IllegalStateException("cannot connect to port 9696");
@@ -143,30 +143,30 @@ public class RestControlLoopManagerTest {
*/
@Test
public void testOperationalPolicy() throws IOException {
- assertEquals(Status.OK.getStatusCode(),
- HttpClient.factory.get(CONTROLLER).get(URL_CONTEXT_PATH_CONTROLLOOPS).getStatus());
+ assertEquals(Status.OK.getStatusCode(), HttpClientFactoryInstance.getClientFactory().get(CONTROLLER)
+ .get(URL_CONTEXT_PATH_CONTROLLOOPS).getStatus());
- assertEquals(Status.OK.getStatusCode(),
- HttpClient.factory.get(CONTROLLER).get(URL_CONTEXT_PATH_CONTROLLOOP).getStatus());
+ assertEquals(Status.OK.getStatusCode(), HttpClientFactoryInstance.getClientFactory().get(CONTROLLER)
+ .get(URL_CONTEXT_PATH_CONTROLLOOP).getStatus());
- assertEquals(Status.NOT_FOUND.getStatusCode(),
- HttpClient.factory.get(CONTROLLER).get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY).getStatus());
+ assertEquals(Status.NOT_FOUND.getStatusCode(), HttpClientFactoryInstance.getClientFactory().get(CONTROLLER)
+ .get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY).getStatus());
String policyFromFile = new String(Files.readAllBytes(Paths.get(POLICY)));
- HttpClient.factory.get(CONTROLLER)
- .put(URL_CONTEXT_PATH_CONTROLLOOP_POLICY, Entity.text(policyFromFile), Collections.emptyMap());
+ HttpClientFactoryInstance.getClientFactory().get(CONTROLLER).put(URL_CONTEXT_PATH_CONTROLLOOP_POLICY,
+ Entity.text(policyFromFile), Collections.emptyMap());
- assertEquals(Status.OK.getStatusCode(),
- HttpClient.factory.get(CONTROLLER).get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY).getStatus());
+ assertEquals(Status.OK.getStatusCode(), HttpClientFactoryInstance.getClientFactory().get(CONTROLLER)
+ .get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY).getStatus());
- String policyFromPdpD = HttpClient.factory.get(CONTROLLER)
+ String policyFromPdpD = HttpClientFactoryInstance.getClientFactory().get(CONTROLLER)
.get(URL_CONTEXT_PATH_CONTROLLOOP_POLICY)
.readEntity(String.class);
assertEquals(policyFromFile, policyFromPdpD);
assertEquals(Status.CONFLICT.getStatusCode(),
- HttpClient.factory.get(CONTROLLER).put(URL_CONTEXT_PATH_CONTROLLOOP_POLICY,
+ HttpClientFactoryInstance.getClientFactory().get(CONTROLLER).put(URL_CONTEXT_PATH_CONTROLLOOP_POLICY,
Entity.text(policyFromFile), Collections.emptyMap()).getStatus());
}
diff --git a/controlloop/common/feature-controlloop-management/src/test/resources/op.pom b/controlloop/common/feature-controlloop-management/src/test/resources/op.pom
index 91b651cbb..517410d66 100644
--- a/controlloop/common/feature-controlloop-management/src/test/resources/op.pom
+++ b/controlloop/common/feature-controlloop-management/src/test/resources/op.pom
@@ -3,7 +3,7 @@
============LICENSE_START=======================================================
ONAP
================================================================================
- Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
Modifications Copyright (C) 2019 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,14 +26,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>model-impl</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
+ <artifactId>common</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.drools.apps.test</groupId>
<artifactId>op</artifactId>
- <version>1.5.0-SNAPSHOT</version>
<dependencies>
<dependency>
diff --git a/controlloop/common/feature-controlloop-utils/src/test/java/org/onap/policy/drools/apps/controlloop/feature/utils/ControlLoopUtilsFeatureTest.java b/controlloop/common/feature-controlloop-utils/src/test/java/org/onap/policy/drools/apps/controlloop/feature/utils/ControlLoopUtilsFeatureTest.java
index fd73b6293..899b7ce8e 100644
--- a/controlloop/common/feature-controlloop-utils/src/test/java/org/onap/policy/drools/apps/controlloop/feature/utils/ControlLoopUtilsFeatureTest.java
+++ b/controlloop/common/feature-controlloop-utils/src/test/java/org/onap/policy/drools/apps/controlloop/feature/utils/ControlLoopUtilsFeatureTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -23,7 +23,7 @@ package org.onap.policy.drools.apps.controlloop.feature.utils;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.drools.utils.logging.LoggerUtil;
import org.onap.policy.simulators.Util;
@@ -39,11 +39,11 @@ public class ControlLoopUtilsFeatureTest {
LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
final ControlLoopUtilsFeature feature = new ControlLoopUtilsFeature();
feature.afterStart(PolicyEngine.manager);
- assertNotNull(HttpServletServer.factory.get(Util.AAISIM_SERVER_PORT));
- assertNotNull(HttpServletServer.factory.get(Util.SOSIM_SERVER_PORT));
- assertNotNull(HttpServletServer.factory.get(Util.SOSIM_SERVER_PORT));
- assertNotNull(HttpServletServer.factory.get(Util.GUARDSIM_SERVER_PORT));
- assertNotNull(HttpServletServer.factory.get(Util.SDNCSIM_SERVER_PORT));
+ assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.AAISIM_SERVER_PORT));
+ assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.SOSIM_SERVER_PORT));
+ assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.SOSIM_SERVER_PORT));
+ assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.GUARDSIM_SERVER_PORT));
+ assertNotNull(HttpServletServerFactoryInstance.getServerFactory().get(Util.SDNCSIM_SERVER_PORT));
}
}
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java
index 19fed30a0..9d252b9f1 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java
@@ -27,7 +27,7 @@ import java.util.Properties;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.drools.utils.logging.LoggerUtil;
@@ -48,7 +48,7 @@ public class PolicyGuardXacmlHelperTest {
LoggerUtil.setLevel("ROOT", "INFO");
LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
- HttpServletServer.factory.destroy();
+ HttpServletServerFactoryInstance.getServerFactory().destroy();
org.onap.policy.simulators.Util.buildGuardSim();
//
@@ -62,7 +62,7 @@ public class PolicyGuardXacmlHelperTest {
*/
@AfterClass
public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
+ HttpServletServerFactoryInstance.getServerFactory().destroy();
// Null/ Bad Connection Case
PolicyGuardXacmlRequestAttributes xacmlReq = new PolicyGuardXacmlRequestAttributes(