Fix Sonar issues
Fix issues reported by Sonar on CldsService class
Issue-ID: CLAMP-147
Change-Id: I9eef9ccf4e69b19e2f63db1ef8634c29a84f3c56
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java
index 2b6862d..cfea253 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -32,7 +32,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.security.GeneralSecurityException;
-import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
@@ -121,6 +120,7 @@
private SecureServicePermission permissionUpdateCl;
private SecureServicePermission permissionReadTemplate;
private SecureServicePermission permissionUpdateTemplate;
+ private static final long DCAE_DEPLOY_WAITING_TIME = TimeUnit.SECONDS.toNanos(30);
@PostConstruct
private final void afterConstruction() {
@@ -161,8 +161,7 @@
public List<CldsMonitoringDetails> getCLDSDetails() {
Date startTime = new Date();
LoggingUtils.setRequestContext("CldsService: GET model details", getPrincipalName());
- List<CldsMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CldsMonitoringDetails>();
- cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails();
+ List<CldsMonitoringDetails> cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails();
// audit log
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "Get cldsDetails success", this.getClass().getName());
@@ -831,12 +830,14 @@
String createNewDeploymentStatusUrl = dcaeDispatcherServices.createNewDeployment(deploymentId,
model.getTypeId(), modelProp.getGlobal().getDeployParameters());
String operationStatus = "processing";
- long waitingTime = System.nanoTime() + TimeUnit.MINUTES.toNanos(10);
+ long waitingTime = System.nanoTime() + DCAE_DEPLOY_WAITING_TIME;
while ("processing".equalsIgnoreCase(operationStatus)) {
- // Break the loop if waiting for more than 10 mins
if (waitingTime < System.nanoTime()) {
+ logger.info("Waiting is over for DCAE deployment");
break;
}
+ logger.info("Waiting 5s before sending query to DCAE");
+ Thread.sleep(5000);
operationStatus = dcaeDispatcherServices.getOperationStatus(createNewDeploymentStatusUrl);
}
if ("succeeded".equalsIgnoreCase(operationStatus)) {