aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-04-15 14:37:46 -0400
committerJim Hahn <jrh3@att.com>2019-04-15 17:29:44 -0400
commit8714a151ff87751b54c362c8a9248995e665e896 (patch)
treec7becba4a7d3d77aae47ae2ff41d62314efb4186
parent7d8509acbf1a6ce1c0dc8bbd87e0a793420cafd4 (diff)
Fix sonar issues in PAP
Moved methods into nested class of PdpModifyRequestMap. Note: they will have to be moved back out when the broadcast capability is added. Removed extra "continue" from Publisher. Rather than remove unused parameters and cause significant clutter to the code, chose to use the parameters in a logger call for RequestImpl. Removed unnecessary cast from UpdateReq. Use version constant in PapRestControllerV1. Log exception in PdpGroupQueryControllerV1. Log exception in PdpGroupStateChangeControllerV1. Shortened functional in PdpGroupDeleteProvider. Removed unnecessary type parameters from PdpGroupDeployProvider. Removed unneeded parameter and exception from ProviderBase. Extracted common string from Main. Shorted functionals in PapActivator. Changed uses of getCanonicalName() to getName(); the former only has limited use, while the latter is typically what is wanted and is actually required whenever forClass(name) is used. Fix junit tests broken by rename of ToscaPolicy version from "typeVersion" to "type_version". Change-Id: Ia00e1b3541c9e25b196a951e45681f67aa7f1bfe Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/comm/PdpModifyRequestMap.java112
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/comm/Publisher.java6
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java6
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/comm/msgdata/UpdateReq.java2
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java2
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PapRestServer.java14
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupQueryControllerV1.java6
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeControllerV1.java6
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeleteProvider.java7
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java4
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java8
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/startstop/Main.java10
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java16
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/startstop/PapCommandLineArguments.java2
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/parameters/CommonTestData.java2
-rw-r--r--main/src/test/resources/simpleDeploy/createGroupNewPolicy.json2
-rw-r--r--main/src/test/resources/simpleDeploy/daoPolicyList.json2
-rw-r--r--main/src/test/resources/simpleDeploy/policy.json2
-rw-r--r--main/src/test/resources/simpleDeploy/upgradeGroupDao.json2
-rw-r--r--main/src/test/resources/simpleDeploy/upgradeGroupPolicy2.json2
-rw-r--r--main/src/test/resources/simpleDeploy/upgradeGroupPolicy3.json2
-rw-r--r--main/src/test/resources/simpleDeploy/upgradeGroupPolicy4.json2
22 files changed, 110 insertions, 107 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/PdpModifyRequestMap.java b/main/src/main/java/org/onap/policy/pap/main/comm/PdpModifyRequestMap.java
index c65ebb3a..8dcb9794 100644
--- a/main/src/main/java/org/onap/policy/pap/main/comm/PdpModifyRequestMap.java
+++ b/main/src/main/java/org/onap/policy/pap/main/comm/PdpModifyRequestMap.java
@@ -206,62 +206,6 @@ public class PdpModifyRequestMap {
}
/**
- * Starts the next request associated with a PDP.
- *
- * @param requests current set of requests
- * @param request the request that just completed
- */
- private void startNextRequest(PdpRequests requests, Request request) {
- if (!requests.startNextRequest(request)) {
- pdp2requests.remove(requests.getPdpName(), requests);
- }
- }
-
- /**
- * Disables a PDP by removing it from its subgroup and then sending it a PASSIVE
- * request.
- *
- * @param requests the requests associated with the PDP to be disabled
- */
- private void disablePdp(PdpRequests requests) {
-
- // remove the requests from the map
- if (!pdp2requests.remove(requests.getPdpName(), requests)) {
- // don't have the info we need to disable it
- logger.warn("no requests with which to disable {}", requests.getPdpName());
- return;
- }
-
- logger.warn("disabling {}", requests.getPdpName());
-
- requests.stopPublishing();
-
- // remove the PDP from all groups
- boolean removed = false;
- try {
- removed = removeFromGroups(requests.getPdpName());
- } catch (PfModelException e) {
- logger.info("unable to remove PDP {} from subgroup", requests.getPdpName(), e);
- }
-
- // send the state change
- PdpStateChange change = new PdpStateChange();
- change.setName(requests.getPdpName());
- change.setState(PdpState.PASSIVE);
-
- if (removed) {
- // send an update, too
- PdpUpdate update = new PdpUpdate();
- update.setName(requests.getPdpName());
-
- addRequest(update, change);
-
- } else {
- addRequest(change);
- }
- }
-
- /**
* Removes a PDP from all active groups.
*
* @param pdpName name of the PDP to be removed
@@ -384,5 +328,61 @@ public class PdpModifyRequestMap {
public void retryCountExhausted() {
disablePdp(requests);
}
+
+ /**
+ * Starts the next request associated with a PDP.
+ *
+ * @param requests current set of requests
+ * @param request the request that just completed
+ */
+ private void startNextRequest(PdpRequests requests, Request request) {
+ if (!requests.startNextRequest(request)) {
+ pdp2requests.remove(requests.getPdpName(), requests);
+ }
+ }
+
+ /**
+ * Disables a PDP by removing it from its subgroup and then sending it a PASSIVE
+ * request.
+ *
+ * @param requests the requests associated with the PDP to be disabled
+ */
+ private void disablePdp(PdpRequests requests) {
+
+ // remove the requests from the map
+ if (!pdp2requests.remove(requests.getPdpName(), requests)) {
+ // don't have the info we need to disable it
+ logger.warn("no requests with which to disable {}", requests.getPdpName());
+ return;
+ }
+
+ logger.warn("disabling {}", requests.getPdpName());
+
+ requests.stopPublishing();
+
+ // remove the PDP from all groups
+ boolean removed = false;
+ try {
+ removed = removeFromGroups(requests.getPdpName());
+ } catch (PfModelException e) {
+ logger.info("unable to remove PDP {} from subgroup", requests.getPdpName(), e);
+ }
+
+ // send the state change
+ PdpStateChange change = new PdpStateChange();
+ change.setName(requests.getPdpName());
+ change.setState(PdpState.PASSIVE);
+
+ if (removed) {
+ // send an update, too
+ PdpUpdate update = new PdpUpdate();
+ update.setName(requests.getPdpName());
+
+ addRequest(update, change);
+
+ } else {
+ addRequest(change);
+ }
+ }
}
}
diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/Publisher.java b/main/src/main/java/org/onap/policy/pap/main/comm/Publisher.java
index 6032d17e..ec54dd5a 100644
--- a/main/src/main/java/org/onap/policy/pap/main/comm/Publisher.java
+++ b/main/src/main/java/org/onap/policy/pap/main/comm/Publisher.java
@@ -107,11 +107,9 @@ public class Publisher implements Runnable {
}
PdpMessage data = token.replaceItem(null);
- if (data == null) {
- continue;
+ if (data != null) {
+ client.send(data);
}
-
- client.send(data);
}
}
diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java b/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java
index 45ca2db4..b9a0a6dc 100644
--- a/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java
+++ b/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java
@@ -112,7 +112,7 @@ public abstract class RequestImpl implements Request {
() -> timer = params.getTimers().register(this.message.getRequestId(), this::handleTimeout),
() -> timer.cancel())
.addAction("enqueue",
- () -> enqueue(),
+ this::enqueue,
() -> {
// do not remove from the queue - token may be re-used
});
@@ -260,7 +260,7 @@ public abstract class RequestImpl implements Request {
String reason = checkResponse(response);
if (reason != null) {
- logger.info("{} PDP data mismatch: {}", getName(), reason);
+ logger.info("{} PDP data mismatch via {}: {}", getName(), infra, reason);
listener.failure(pdpName, reason);
return;
}
@@ -286,7 +286,7 @@ public abstract class RequestImpl implements Request {
stopPublishing();
if (!bumpRetryCount()) {
- logger.info("{} timeout - retry count {} exhausted", getName(), retryCount);
+ logger.info("{} timeout {} - retry count {} exhausted", getName(), timerName, retryCount);
listener.retryCountExhausted();
return;
}
diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/UpdateReq.java b/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/UpdateReq.java
index 0f6d73fc..9067131f 100644
--- a/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/UpdateReq.java
+++ b/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/UpdateReq.java
@@ -62,7 +62,7 @@ public class UpdateReq extends RequestImpl {
return reason;
}
- PdpUpdate message = (PdpUpdate) getMessage();
+ PdpUpdate message = getMessage();
if (!StringUtils.equals(message.getPdpGroup(), response.getPdpGroup())) {
return "group does not match";
}
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java
index fb5d2d89..ccdebc33 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java
@@ -100,7 +100,7 @@ public class PapRestControllerV1 {
*/
public ResponseBuilder addVersionControlHeaders(ResponseBuilder respBuilder) {
return respBuilder.header(VERSION_MINOR_NAME, "0").header(VERSION_PATCH_NAME, "0").header(VERSION_LATEST_NAME,
- "1.0.0");
+ API_VERSION);
}
/**
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PapRestServer.java b/main/src/main/java/org/onap/policy/pap/main/rest/PapRestServer.java
index 01c33611..87db6ad3 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PapRestServer.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PapRestServer.java
@@ -66,7 +66,7 @@ public class PapRestServer implements Startable {
servers = HttpServletServer.factory.build(getServerProperties());
for (final HttpServletServer server : servers) {
if (server.isAaf()) {
- server.addFilterClass(null, PapAafFilter.class.getCanonicalName());
+ server.addFilterClass(null, PapAafFilter.class.getName());
}
server.start();
}
@@ -93,12 +93,12 @@ public class PapRestServer implements Startable {
props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX,
Integer.toString(restServerParameters.getPort()));
props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX,
- String.join(",", HealthCheckRestControllerV1.class.getCanonicalName(),
- StatisticsRestControllerV1.class.getCanonicalName(),
- PdpGroupDeployControllerV1.class.getCanonicalName(),
- PdpGroupDeleteControllerV1.class.getCanonicalName(),
- PdpGroupStateChangeControllerV1.class.getCanonicalName(),
- PdpGroupQueryControllerV1.class.getCanonicalName()));
+ String.join(",", HealthCheckRestControllerV1.class.getName(),
+ StatisticsRestControllerV1.class.getName(),
+ PdpGroupDeployControllerV1.class.getName(),
+ PdpGroupDeleteControllerV1.class.getName(),
+ PdpGroupStateChangeControllerV1.class.getName(),
+ PdpGroupQueryControllerV1.class.getName()));
props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false");
props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX, "true");
props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX,
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupQueryControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupQueryControllerV1.java
index 74d6e619..51270f27 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupQueryControllerV1.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupQueryControllerV1.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,6 +41,8 @@ import javax.ws.rs.core.Response.Status;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.pdp.concepts.PdpGroups;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Class to provide REST end points for PAP component to query details of all PDP groups.
@@ -48,6 +51,8 @@ import org.onap.policy.models.pdp.concepts.PdpGroups;
*/
public class PdpGroupQueryControllerV1 extends PapRestControllerV1 {
+ private static final Logger LOGGER = LoggerFactory.getLogger(PdpGroupQueryControllerV1.class);
+
private final PdpGroupQueryProvider provider = new PdpGroupQueryProvider();
/**
@@ -89,6 +94,7 @@ public class PdpGroupQueryControllerV1 extends PapRestControllerV1 {
return addLoggingHeaders(addVersionControlHeaders(Response.status(pair.getLeft())), requestId)
.entity(pair.getRight()).build();
} catch (final PfModelException exp) {
+ LOGGER.info("group query failed", exp);
return addLoggingHeaders(
addVersionControlHeaders(Response.status(exp.getErrorResponse().getResponseCode())), requestId)
.entity(exp.getErrorResponse()).build();
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeControllerV1.java
index c9369a23..e739b2fc 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeControllerV1.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeControllerV1.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +44,8 @@ import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.pap.concepts.PdpGroupStateChangeResponse;
import org.onap.policy.models.pdp.enums.PdpState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Class to provide REST end points for PAP component to change state of a PDP group.
@@ -51,6 +54,8 @@ import org.onap.policy.models.pdp.enums.PdpState;
*/
public class PdpGroupStateChangeControllerV1 extends PapRestControllerV1 {
+ private static final Logger LOGGER = LoggerFactory.getLogger(PdpGroupQueryControllerV1.class);
+
private final PdpGroupStateChangeProvider provider = new PdpGroupStateChangeProvider();
/**
@@ -96,6 +101,7 @@ public class PdpGroupStateChangeControllerV1 extends PapRestControllerV1 {
return addLoggingHeaders(addVersionControlHeaders(Response.status(pair.getLeft())), requestId)
.entity(pair.getRight()).build();
} catch (final PfModelException exp) {
+ LOGGER.info("group state-change failed", exp);
return addLoggingHeaders(
addVersionControlHeaders(Response.status(exp.getErrorResponse().getResponseCode())), requestId)
.entity(exp.getErrorResponse()).build();
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeleteProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeleteProvider.java
index 7d47b3e2..c64a0efe 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeleteProvider.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeleteProvider.java
@@ -138,10 +138,7 @@ public class PdpGroupDeleteProvider extends ProviderBase<PdpGroupDeleteResponse>
protected BiFunction<PdpGroup, PdpSubGroup, Boolean> makeUpdater(ToscaPolicy policy) {
ToscaPolicyIdentifier desiredIdent = policy.getIdentifier();
- return (group, subgroup) -> {
-
- // remove the policy from the subgroup
- return subgroup.getPolicies().remove(desiredIdent);
- };
+ // remove the policy from the subgroup
+ return (group, subgroup) -> subgroup.getPolicies().remove(desiredIdent);
}
}
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java
index 3d44a0cd..5fd1213c 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java
@@ -328,8 +328,8 @@ public class PdpGroupDeployProvider extends ProviderBase<PdpGroupDeployResponse>
*/
private <T> boolean updateList(List<T> dblist, List<T> newList, Consumer<List<T>> setter) {
- Set<T> dbTypes = new HashSet<T>(dblist);
- Set<T> newTypes = new HashSet<T>(newList);
+ Set<T> dbTypes = new HashSet<>(dblist);
+ Set<T> newTypes = new HashSet<>(newList);
if (dbTypes.equals(newTypes)) {
return false;
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java
index b7575df3..999941f2 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java
@@ -179,7 +179,7 @@ public abstract class ProviderBase<R extends SimpleResponse> {
BiFunction<PdpGroup, PdpSubGroup, Boolean> updater = makeUpdater(policy);
for (PdpGroup group : groups) {
- upgradeGroup(data, policy, group, updater);
+ upgradeGroup(data, group, updater);
}
}
@@ -212,13 +212,11 @@ public abstract class ProviderBase<R extends SimpleResponse> {
* Updates a group, assigning a new version number, if it actually changes.
*
* @param data session data
- * @param policy policy to be added to or removed from the group
* @param group the original group, to be updated
* @param updater function to update a group
- * @throws PfModelException if a DAO error occurred
*/
- private void upgradeGroup(SessionData data, ToscaPolicy policy, PdpGroup group,
- BiFunction<PdpGroup, PdpSubGroup, Boolean> updater) throws PfModelException {
+ private void upgradeGroup(SessionData data, PdpGroup group,
+ BiFunction<PdpGroup, PdpSubGroup, Boolean> updater) {
boolean updated = false;
diff --git a/main/src/main/java/org/onap/policy/pap/main/startstop/Main.java b/main/src/main/java/org/onap/policy/pap/main/startstop/Main.java
index f1598165..e8b48e60 100644
--- a/main/src/main/java/org/onap/policy/pap/main/startstop/Main.java
+++ b/main/src/main/java/org/onap/policy/pap/main/startstop/Main.java
@@ -40,6 +40,8 @@ import org.slf4j.LoggerFactory;
*/
public class Main {
+ private static final String START_FAILED = "start of policy pap service failed";
+
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
private PapActivator activator;
@@ -66,7 +68,7 @@ public class Main {
// Validate that the arguments are sane
arguments.validate();
} catch (final PolicyPapException e) {
- LOGGER.error("start of policy pap service failed", e);
+ LOGGER.error(START_FAILED, e);
return;
}
@@ -74,7 +76,7 @@ public class Main {
try {
parameterGroup = new PapParameterHandler().getParameters(arguments);
} catch (final Exception e) {
- LOGGER.error("start of policy pap service failed", e);
+ LOGGER.error(START_FAILED, e);
return;
}
@@ -86,7 +88,7 @@ public class Main {
props.load(stream);
}
} catch (final Exception e) {
- LOGGER.error("start of policy pap service failed", e);
+ LOGGER.error(START_FAILED, e);
return;
}
@@ -94,7 +96,7 @@ public class Main {
try {
new PapDatabaseInitializer().initializePapDatabase(parameterGroup.getDatabaseProviderParameters());
} catch (final PolicyPapException exp) {
- LOGGER.error("start of policy pap service failed, used parameters are {}", Arrays.toString(args), exp);
+ LOGGER.error(START_FAILED + ", used parameters are {}", Arrays.toString(args), exp);
return;
}
diff --git a/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java b/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java
index f34d13ad..8f3583e1 100644
--- a/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java
+++ b/main/src/main/java/org/onap/policy/pap/main/startstop/PapActivator.java
@@ -135,12 +135,12 @@ public class PapActivator extends ServiceManagerContainer {
() -> msgDispatcher.unregister(PdpMessageType.PDP_STATUS.name()));
addAction("Message Dispatcher",
- () -> registerMsgDispatcher(),
- () -> unregisterMsgDispatcher());
+ this::registerMsgDispatcher,
+ this::unregisterMsgDispatcher);
addAction("topics",
- () -> TopicEndpoint.manager.start(),
- () -> TopicEndpoint.manager.shutdown());
+ TopicEndpoint.manager::start,
+ TopicEndpoint.manager::shutdown);
addAction("PAP statistics",
() -> Registry.register(PapConstants.REG_STATISTICS_MANAGER, new PapStatisticsManager()),
@@ -183,12 +183,8 @@ public class PapActivator extends ServiceManagerContainer {
() -> Registry.unregister(PapConstants.REG_PDP_MODIFY_MAP));
addAction("Create REST server",
- () -> {
- restServer = new PapRestServer(papParameterGroup.getRestServerParameters());
- },
- () -> {
- restServer = null;
- });
+ () -> restServer = new PapRestServer(papParameterGroup.getRestServerParameters()),
+ () -> restServer = null);
addAction("REST server",
() -> restServer.start(),
diff --git a/main/src/main/java/org/onap/policy/pap/main/startstop/PapCommandLineArguments.java b/main/src/main/java/org/onap/policy/pap/main/startstop/PapCommandLineArguments.java
index b0bbfd8a..fd728d28 100644
--- a/main/src/main/java/org/onap/policy/pap/main/startstop/PapCommandLineArguments.java
+++ b/main/src/main/java/org/onap/policy/pap/main/startstop/PapCommandLineArguments.java
@@ -138,7 +138,7 @@ public class PapCommandLineArguments {
}
if (commandLine.hasOption('h')) {
- return help(Main.class.getCanonicalName());
+ return help(Main.class.getName());
}
if (commandLine.hasOption('v')) {
diff --git a/main/src/test/java/org/onap/policy/pap/main/parameters/CommonTestData.java b/main/src/test/java/org/onap/policy/pap/main/parameters/CommonTestData.java
index e7ffce07..10e500fb 100644
--- a/main/src/test/java/org/onap/policy/pap/main/parameters/CommonTestData.java
+++ b/main/src/test/java/org/onap/policy/pap/main/parameters/CommonTestData.java
@@ -170,7 +170,7 @@ public class CommonTestData {
public Map<String, Object> getPolicyModelsProviderParametersMap() {
final Map<String, Object> map = new TreeMap<>();
map.put("name", PolicyModelsProviderParameters.class.getSimpleName());
- map.put("implementation", DatabasePolicyModelsProviderImpl.class.getCanonicalName());
+ map.put("implementation", DatabasePolicyModelsProviderImpl.class.getName());
map.put("databaseDriver", "org.h2.Driver");
map.put("databaseUrl", "jdbc:h2:mem:testdb");
map.put("databaseUser", "policy");
diff --git a/main/src/test/resources/simpleDeploy/createGroupNewPolicy.json b/main/src/test/resources/simpleDeploy/createGroupNewPolicy.json
index 285db315..9aa54cb9 100644
--- a/main/src/test/resources/simpleDeploy/createGroupNewPolicy.json
+++ b/main/src/test/resources/simpleDeploy/createGroupNewPolicy.json
@@ -4,7 +4,7 @@
"name": "policyB",
"version": "1.2.3",
"type": "typeA",
- "typeVersion": "100.2.3"
+ "type_version": "100.2.3"
}
]
}
diff --git a/main/src/test/resources/simpleDeploy/daoPolicyList.json b/main/src/test/resources/simpleDeploy/daoPolicyList.json
index 93ee9146..873cb711 100644
--- a/main/src/test/resources/simpleDeploy/daoPolicyList.json
+++ b/main/src/test/resources/simpleDeploy/daoPolicyList.json
@@ -4,7 +4,7 @@
"name": "policyA",
"version": "1.2.3",
"type": "typeA",
- "typeVersion": "100.2.3"
+ "type_version": "100.2.3"
}
]
}
diff --git a/main/src/test/resources/simpleDeploy/policy.json b/main/src/test/resources/simpleDeploy/policy.json
index 7786aab7..084aafcc 100644
--- a/main/src/test/resources/simpleDeploy/policy.json
+++ b/main/src/test/resources/simpleDeploy/policy.json
@@ -2,5 +2,5 @@
"name": "policyA",
"version": "1.2.3",
"type": "typeA",
- "typeVersion": "100.2.3"
+ "type_version": "100.2.3"
}
diff --git a/main/src/test/resources/simpleDeploy/upgradeGroupDao.json b/main/src/test/resources/simpleDeploy/upgradeGroupDao.json
index 278b69a6..bee81bed 100644
--- a/main/src/test/resources/simpleDeploy/upgradeGroupDao.json
+++ b/main/src/test/resources/simpleDeploy/upgradeGroupDao.json
@@ -47,7 +47,7 @@
"name": "policyA",
"version": "1.2.3",
"type": "typeA",
- "typeVersion": "100.2.3"
+ "type_version": "100.2.3"
}
]
},
diff --git a/main/src/test/resources/simpleDeploy/upgradeGroupPolicy2.json b/main/src/test/resources/simpleDeploy/upgradeGroupPolicy2.json
index 3a13d0c3..54201b94 100644
--- a/main/src/test/resources/simpleDeploy/upgradeGroupPolicy2.json
+++ b/main/src/test/resources/simpleDeploy/upgradeGroupPolicy2.json
@@ -4,7 +4,7 @@
"name": "policyB",
"version": "1.2.3",
"type": "typeB",
- "typeVersion": "100.2.3"
+ "type_version": "100.2.3"
}
]
}
diff --git a/main/src/test/resources/simpleDeploy/upgradeGroupPolicy3.json b/main/src/test/resources/simpleDeploy/upgradeGroupPolicy3.json
index bf5602ea..57a8f849 100644
--- a/main/src/test/resources/simpleDeploy/upgradeGroupPolicy3.json
+++ b/main/src/test/resources/simpleDeploy/upgradeGroupPolicy3.json
@@ -4,7 +4,7 @@
"name": "policyC",
"version": "1.2.3",
"type": "typeC",
- "typeVersion": "100.2.3"
+ "type_version": "100.2.3"
}
]
}
diff --git a/main/src/test/resources/simpleDeploy/upgradeGroupPolicy4.json b/main/src/test/resources/simpleDeploy/upgradeGroupPolicy4.json
index 3c0fb72f..8b7c96c5 100644
--- a/main/src/test/resources/simpleDeploy/upgradeGroupPolicy4.json
+++ b/main/src/test/resources/simpleDeploy/upgradeGroupPolicy4.json
@@ -4,7 +4,7 @@
"name": "policyD",
"version": "1.2.3",
"type": "typeA",
- "typeVersion": "100.2.3"
+ "type_version": "100.2.3"
}
]
}