diff options
author | Jerry Flood <jflood@att.com> | 2019-04-16 09:06:17 -0400 |
---|---|---|
committer | Jerry Flood <jflood@att.com> | 2019-04-16 11:29:13 -0400 |
commit | b1ba8ef51edabee26acaf74e226eeb269297aec7 (patch) | |
tree | 54fcd741ae9b0f05ca1d438de1a4dbacf06cf1ac /cmso-optimizer/src/main/java/org/onap | |
parent | 134ae90b8d8f5b19d9915adbc9b1a70d8c27540e (diff) |
More checkstyle changes for Dublin
Issue-ID: OPTFRA-466
Change-Id: Ied602196284bf3aed56ff491a749f14503395c88
Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-optimizer/src/main/java/org/onap')
6 files changed, 35 insertions, 16 deletions
diff --git a/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java b/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java index fe6cea2..ccb7e56 100644 --- a/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java +++ b/cmso-optimizer/src/main/java/org/onap/observations/MessageHeaders.java @@ -65,7 +65,7 @@ public class MessageHeaders { } /** The Constant supportedMajorVersions. */ - public static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); + private static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); static { supportedMajorVersions.put("v1", "0"); @@ -73,7 +73,7 @@ public class MessageHeaders { } /** The Constant supportedMajorMinorVersions. */ - public static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); + private static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); static { supportedMajorMinorVersions.add("v1.0"); @@ -81,10 +81,10 @@ public class MessageHeaders { } /** The Constant latestVersion. */ - public static final String latestVersion = "2.0.0"; + private static final String latestVersion = "2.0.0"; /** The Constant patchVersion. */ - public static final String patchVersion = "0"; + private static final String patchVersion = "0"; /** * From string. @@ -152,4 +152,20 @@ public class MessageHeaders { } return true; } + + public static Map<String, String> getSupportedmajorversions() { + return supportedMajorVersions; + } + + public static Set<String> getSupportedmajorminorversions() { + return supportedMajorMinorVersions; + } + + public static String getLatestversion() { + return latestVersion; + } + + public static String getPatchversion() { + return patchVersion; + } } diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java index 7c6db2a..b42ff9c 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java @@ -230,7 +230,7 @@ public class OptimizerClient { apiResponse.setErrorMessage(LogMessages.UNEXPECTED_EXCEPTION.format(e.getMessage())); Observation.report(LogMessages.UNEXPECTED_RESPONSE, e, e.getMessage()); } finally { - if (process.isAlive()) { + if (process != null && process.isAlive()) { process.destroyForcibly(); } if (workingFolder.exists()) { diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerRequestManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerRequestManager.java index 6724551..cfe23ba 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerRequestManager.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerRequestManager.java @@ -76,7 +76,7 @@ public class OptimizerRequestManager { */ public OptimizerEngineResponse createOptimizerRequest(Request requestRow) { // - if (okToDispatch()) { + if (okToDispatch(false)) { Optimizer optimizer = getExistingOptmizer(requestRow.getUuid()); if (optimizer == null) { optimizer = new Optimizer(); @@ -146,11 +146,14 @@ public class OptimizerRequestManager { - private boolean okToDispatch() { - // TODO Auto-generated method stub - - // Will probably change to @Async on makeRequest to queue requests in a different thread. - return true; + private boolean okToDispatch(boolean checkDispatchability) { + if (checkDispatchability) { + // not yet implemented + return false; + } + else { + return true; + } } diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java index c333651..ca6bdb3 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java @@ -21,7 +21,6 @@ package org.onap.optf.cmso.optimizer.clients.topology; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.att.eelf.i18n.EELFResourceManager; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; @@ -102,6 +101,7 @@ public class TopologyClient { topologyResponse.setStatus(TopologyRequestStatus.FAILED); topologyResponse.setErrorMessage(LogMessages.UNEXPECTED_EXCEPTION.format(e.getMessage())); Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); + return topologyResponse; } topologyRequest = new TopologyRequest(); topologyRequest.setRequestId(optimizerRequest.getRequestId()); diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoContainerFilters.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoContainerFilters.java index e8fe5f0..3a13805 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoContainerFilters.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoContainerFilters.java @@ -68,8 +68,8 @@ public class CmsoContainerFilters implements ContainerRequestFilter, ContainerRe MultivaluedMap<String, Object> respHeaders = responseContext.getHeaders(); String minorVersion = reqHeaders.getFirst(HeadersEnum.MinorVersion.toString()); respHeaders.add(HeadersEnum.MinorVersion.toString(), minorVersion); - respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.latestVersion); - respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.patchVersion); + respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.getLatestversion()); + respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.getPatchversion()); } catch (Exception e) { if (e instanceof WebApplicationException) { @@ -110,7 +110,7 @@ public class CmsoContainerFilters implements ContainerRequestFilter, ContainerRe } String minorVersion = headers.getFirst(HeadersEnum.MinorVersion.toString()); if (minorVersion == null) { - minorVersion = MessageHeaders.supportedMajorVersions.get(majorVersion); + minorVersion = MessageHeaders.getSupportedmajorversions().get(majorVersion); headers.add(HeadersEnum.MinorVersion.toString(), minorVersion); } if (!MessageHeaders.validateMajorMinorVersion(majorVersion, minorVersion)) { diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java index 0e8b758..bec1de7 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java @@ -107,7 +107,7 @@ public class ChangeWindow implements Serializable { return true; } // end is before start or start is before end, cannot overlap - if (endstart == -1 || startend == 1) { + if (endstart < 0 || startend > 0) { return false; } return true; |