diff options
21 files changed, 35 insertions, 65 deletions
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafAuthProvider.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafAuthProvider.java index 96f2ef2..61c1eb8 100755 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafAuthProvider.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafAuthProvider.java @@ -55,7 +55,7 @@ public class AafAuthProvider implements AuthenticationProvider { AafClientCache clientCache;
@Override
- public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+ public Authentication authenticate(Authentication authentication) {
String name = authentication.getName();
String password = authentication.getCredentials().toString();
String sessionId = null;
@@ -66,10 +66,8 @@ public class AafAuthProvider implements AuthenticationProvider { sessionId = webAuthDetails.getRemoteAddress() + ":" + webAuthDetails.getSessionId();
}
}
- if (env.getProperty(AafProperties.aafEnabled.toString(), Boolean.class, true)) {
- if (clientCache.authenticate(name, password, sessionId) != AuthorizationResult.Authenticated) {
+ if ((env.getProperty(AafProperties.aafEnabled.toString(), Boolean.class, true)) && (clientCache.authenticate(name, password, sessionId) != AuthorizationResult.Authenticated)) {
return null;
- }
}
return new UsernamePasswordAuthenticationToken(name, password, new ArrayList<>());
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafClientCache.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafClientCache.java index 0dc18db..1ce581a 100755 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafClientCache.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafClientCache.java @@ -138,14 +138,12 @@ public class AafClientCache { cacheAge = now;
}
permissions = cache.get(getCacheKey(auth));
- if (permissions == null) {
- if (!auth.get("password").equals("")) {
+ if ((permissions == null) && (!auth.get("password").equals(""))) {
permissions = getPermissionsFromAaf(auth);
if (permissions != null) {
cache.put(getCacheKey(auth), permissions);
}
}
- }
}
return permissions;
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafUserRole.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafUserRole.java index 295221c..cda740f 100755 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafUserRole.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/aaf/AafUserRole.java @@ -158,7 +158,7 @@ public class AafUserRole { while (!inNodes.isEmpty() && !matchNodes.isEmpty()) {
String inNode = inNodes.remove(0);
String matchNode = matchNodes.get(0);
- if (matchNode.equals(inNode) || matchNode.equals("*")) {
+ if (matchNode.equals(inNode) || "*".equals(matchNode)) {
matchNodes.remove(0);
} else {
if (!matchNode.equals("**")) {
@@ -174,10 +174,10 @@ public class AafUserRole { // We have incoming nodes remaining, see if we can wildcard them
if (matchNodes.size() == 1) {
- if (matchNodes.get(0).equals("**")) {
+ if ("**".equals(matchNodes.get(0))) {
return true;
}
- if (inNodes.size() == 1 && matchNodes.get(0).equals("*")) {
+ if (inNodes.size() == 1 && "*".equals(matchNodes.get(0))) {
return true;
}
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java index b3829c3..bbed8ad 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java @@ -237,9 +237,7 @@ public class RecurringWindows { String rdata = "RRULE:FREQ=MINUTELY;INTERVAL=" + durationInSeconds / 60; DateTime start = new DateTime(window.getStartTime().toInstant().toEpochMilli()); - DateTimeIterator recur = - DateTimeIteratorFactory.createDateTimeIterator(rdata, start, DateTimeZone.UTC, true); - return recur; + return DateTimeIteratorFactory.createDateTimeIterator(rdata, start, DateTimeZone.UTC, true); } diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java index 1ba21e0..109493b 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java @@ -119,7 +119,7 @@ public class TicketMgtClient { } private ActiveTicketsRequest buildRequest(OptimizerRequest optimizerRequest) - throws JsonParseException, JsonMappingException, IOException { + throws IOException { UUID uuid = UUID.fromString(optimizerRequest.getRequestId()); Topology topologyRow = topologyRequestManager.getExistingTopology(uuid); String topologyString = topologyRow.getTopology(); diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyRequestManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyRequestManager.java index f62a851..a3f4e6d 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyRequestManager.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyRequestManager.java @@ -96,8 +96,7 @@ public class TopologyRequestManager { * @throws JsonMappingException the json mapping exception * @throws IOException Signals that an I/O exception has occurred. */ - public TopologyResponse getTopologyResponse(UUID uuid) - throws JsonParseException, JsonMappingException, IOException { + public TopologyResponse getTopologyResponse(UUID uuid) throws IOException { Topology row = getExistingTopology(uuid); if (row != null) { String responseString = row.getTopology(); diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/BasicAuthenticatorFilter.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/BasicAuthenticatorFilter.java index 20a6b21..f098ed2 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/BasicAuthenticatorFilter.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/BasicAuthenticatorFilter.java @@ -102,8 +102,7 @@ public class BasicAuthenticatorFilter implements ClientRequestFilter { private static String getToken(String auth) { try { - String token = new String(DatatypeConverter.parseBase64Binary(auth)); - return token; + return new String(DatatypeConverter.parseBase64Binary(auth)); } catch (Exception e) { return auth; } diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoClientFilters.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoClientFilters.java index 9aa439c..02d8886 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoClientFilters.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/filters/CmsoClientFilters.java @@ -68,10 +68,8 @@ public class CmsoClientFilters implements ClientRequestFilter, ClientResponseFil String transactionId = (String) headers.getFirst(MessageHeaders.HeadersEnum.TransactionID.toString()); String mdcId = MDC.get(MDC_KEY_REQUEST_ID); - if (transactionId == null || transactionId.equals("")) { - if (mdcId != null) { + if ((transactionId == null || transactionId.equals("")) && (mdcId != null)) { headers.add(HeadersEnum.TransactionID.toString(), mdcId); - } } headers.add(HeadersEnum.FromAppID.toString(), appId); } diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/AdminToolImpl.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/AdminToolImpl.java index 93da842..2aea09c 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/AdminToolImpl.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/AdminToolImpl.java @@ -53,8 +53,7 @@ public class AdminToolImpl implements AdminTool { return Response.ok("").build(); } String encrypted = PropertiesManagement.getEncryptedValue(id); - Response response = Response.ok(encrypted).build(); - return response; + return Response.ok(encrypted).build(); } } diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java index d324f18..b8e7f5b 100755 --- a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java @@ -90,9 +90,9 @@ public class AafPerm { */
public boolean ok(AafPerm userPerm) {
if (type.equals(userPerm.getType())) {
- if (userPerm.getInstance().equals("*") || instance.equals("*") || userPerm.getInstance().equals(instance)) {
+ if ("*".equals(userPerm.getInstance()) || "*".equals(instance) || userPerm.getInstance().equals(instance)) {
for (String userAction : userPerm.getActions()) {
- if (userAction.equals("*") || actions.contains("*") || actions.contains(userAction)) {
+ if ("*".equals(userAction) || actions.contains("*") || actions.contains(userAction)) {
return true;
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java index c31c275..f6197a3 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java @@ -163,8 +163,7 @@ public class CmsoClient { }
}
- private void processScheduleResponse(ChangeManagementSchedule cmSchedule, Schedule schedule, Response response)
- throws SchedulerException {
+ private void processScheduleResponse(ChangeManagementSchedule cmSchedule, Schedule schedule, Response response) {
WfChangeManagementResponse resp = response.readEntity(WfChangeManagementResponse.class);
for (WfVidCmResponse cmResponse : resp.getCmResponses()) {
if (cmResponse.getVnfName().equals(cmSchedule.getVnfName())) {
@@ -182,8 +181,7 @@ public class CmsoClient { updateScheduleStatus(cmSchedule, schedule);
}
- private void processScheduleResponse200(ChangeManagementSchedule cmSchedule, Schedule schedule, Response response)
- throws SchedulerException {
+ private void processScheduleResponse200(ChangeManagementSchedule cmSchedule, Schedule schedule, Response response){
JsonNode node = response.readEntity(JsonNode.class);
log.info("Message returned from VID callback: " + node.toString());
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java index ccbc430..f663240 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java @@ -140,10 +140,8 @@ public class DispatchJob { // Validate ticket is still active with tm
//
// TODO
- if (cmSchedule.getTmChangeId() != null && !cmSchedule.getTmChangeId().equals("")) {
- if (!isChangeApproved(schedule, cmSchedule, scheduleImmediateEnabled)) {
+ if (cmSchedule.getTmChangeId() != null && !cmSchedule.getTmChangeId().equals("") && !isChangeApproved(schedule, cmSchedule, scheduleImmediateEnabled)) {
return false;
- }
}
// *******************************************************************
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java index 84ff91e..d8fd7c3 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java @@ -75,8 +75,7 @@ public class DispatcherServiceImpl implements DispacherService { errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
}
- Response response = Response.ok().build();
- return response;
+ return Response.ok().build();
}
@Override
@@ -105,8 +104,7 @@ public class DispatcherServiceImpl implements DispacherService { errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
}
- Response response = Response.ok().build();
- return response;
+ return Response.ok().build();
}
@Override
@@ -119,8 +117,7 @@ public class DispatcherServiceImpl implements DispacherService { errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
}
- Response response = Response.ok().build();
- return response;
+ return Response.ok().build();
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java b/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java index d43c60b..804fe68 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java @@ -72,10 +72,8 @@ public class CmsoClientFilters implements ClientRequestFilter, ClientResponseFil String transactionId = (String) headers.getFirst(MessageHeaders.HeadersEnum.TransactionID.toString()); String mdcId = MDC.get(MDC_KEY_REQUEST_ID); - if (transactionId == null || transactionId.equals("")) { - if (mdcId != null) { + if ((transactionId == null || "".equals(transactionId)) && (mdcId != null)) { headers.add(HeadersEnum.TransactionID.toString(), mdcId); - } } headers.add(HeadersEnum.FromAppID.toString(), appId); } diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java index fa182b4..79ceb44 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java @@ -62,8 +62,7 @@ public class AdminToolImpl implements AdminTool { return Response.ok("").build();
}
String encrypted = PropertiesManagement.getEncryptedValue(id);
- Response response = Response.ok(encrypted).build();
- return response;
+ return Response.ok(encrypted).build();
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java index 1e4a46a..9ddb893 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java @@ -224,8 +224,7 @@ public class CmQueryParameters { private static DateTime convertDate(String utcDate, String urlName) throws CmsoException {
try {
- DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
- return dateTime;
+ return ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
}
catch (Exception e) {
throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/BuildCreateRequest.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/BuildCreateRequest.java index 8c8cd6f..8ab915c 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/BuildCreateRequest.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/BuildCreateRequest.java @@ -104,8 +104,7 @@ public class BuildCreateRequest { public JsonNode createChangeRecordRequest(Map<String, Object> variables, List<TmAsset> assetList,
String workflowName) {
JsonNode rawjson = getYaml("CreateChangeTicket");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
/**
@@ -116,8 +115,7 @@ public class BuildCreateRequest { */
public JsonNode createCloseCancelChangeRecord(Map<String, Object> variables) {
JsonNode rawjson = getYaml("CloseCancelChangeRecord");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
/**
@@ -128,8 +126,7 @@ public class BuildCreateRequest { */
public JsonNode createCancelChangeRecord(Map<String, Object> variables) {
JsonNode rawjson = getYaml("CancelChangeRecord");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
/**
@@ -140,8 +137,7 @@ public class BuildCreateRequest { */
public JsonNode createUpdateChangeRecord(Map<String, Object> variables) {
JsonNode rawjson = getYaml("UpdateChangeRecord");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
/**
@@ -152,8 +148,7 @@ public class BuildCreateRequest { */
public JsonNode createGetChangeRecord(Map<String, Object> variables) {
JsonNode rawjson = getYaml("GetChangeRecord");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
private JsonNode substituteJson(JsonNode json, Map<String, Object> variables) {
diff --git a/cmso-topology/src/main/java/org/onap/observations/MessageHeaders.java b/cmso-topology/src/main/java/org/onap/observations/MessageHeaders.java index ccb7e56..6fc579e 100644 --- a/cmso-topology/src/main/java/org/onap/observations/MessageHeaders.java +++ b/cmso-topology/src/main/java/org/onap/observations/MessageHeaders.java @@ -65,7 +65,7 @@ public class MessageHeaders { } /** The Constant supportedMajorVersions. */ - private static final Map<String, String> supportedMajorVersions = new HashMap<String, String>(); + private static final Map<String, String> supportedMajorVersions = new HashMap<>(); static { supportedMajorVersions.put("v1", "0"); @@ -73,7 +73,7 @@ public class MessageHeaders { } /** The Constant supportedMajorMinorVersions. */ - private static final Set<String> supportedMajorMinorVersions = new HashSet<String>(); + private static final Set<String> supportedMajorMinorVersions = new HashSet<>(); static { supportedMajorMinorVersions.add("v1.0"); diff --git a/cmso-topology/src/main/java/org/onap/optf/cmso/aaf/AafAuthProvider.java b/cmso-topology/src/main/java/org/onap/optf/cmso/aaf/AafAuthProvider.java index 328bd3e..e8510f0 100755 --- a/cmso-topology/src/main/java/org/onap/optf/cmso/aaf/AafAuthProvider.java +++ b/cmso-topology/src/main/java/org/onap/optf/cmso/aaf/AafAuthProvider.java @@ -55,7 +55,7 @@ public class AafAuthProvider implements AuthenticationProvider { AafClientCache clientCache;
@Override
- public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+ public Authentication authenticate(Authentication authentication) {
String name = authentication.getName();
String password = authentication.getCredentials().toString();
String sessionId = null;
diff --git a/cmso-topology/src/main/java/org/onap/optf/cmso/aaf/AafClientCache.java b/cmso-topology/src/main/java/org/onap/optf/cmso/aaf/AafClientCache.java index 1b2facb..67894eb 100755 --- a/cmso-topology/src/main/java/org/onap/optf/cmso/aaf/AafClientCache.java +++ b/cmso-topology/src/main/java/org/onap/optf/cmso/aaf/AafClientCache.java @@ -138,13 +138,11 @@ public class AafClientCache { cacheAge = now;
}
permissions = cache.get(getCacheKey(auth));
- if (permissions == null) {
- if (!auth.get("password").equals("")) {
- permissions = getPermissionsFromAaf(auth);
+ if ((permissions == null)&&(!auth.get("password").equals(""))) {
+ permissions = getPermissionsFromAaf(auth);
if (permissions != null) {
cache.put(getCacheKey(auth), permissions);
}
- }
}
}
return permissions;
@@ -255,8 +253,7 @@ public class AafClientCache { private String getToken(String auth) {
try {
- String token = new String(DatatypeConverter.parseBase64Binary(auth));
- return token;
+ return new String(DatatypeConverter.parseBase64Binary(auth));
} catch (Exception e) {
return auth;
}
@@ -38,7 +38,7 @@ <parent>
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
- <version>2.0.0</version>
+ <version>2.1.0</version>
</parent>
<groupId>org.onap.optf.cmso</groupId>
|