Define constants in place of repeated literals 40/86040/1
authorh00397475 <hena.choudhury@huawei.com>
Tue, 23 Apr 2019 10:55:42 +0000 (16:25 +0530)
committerh00397475 <hena.choudhury@huawei.com>
Tue, 23 Apr 2019 10:55:42 +0000 (16:25 +0530)
Defined constants to avoid repeated use of literals
Issue-ID: SO-1490
bash: c: command not found

Change-Id: I6e3808fc462c9c87f5cfbe81f39aad3187b49930
Signed-off-by: h00397475 <hena.choudhury@huawei.com>
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java

index f193967..e0176eb 100644 (file)
@@ -42,6 +42,7 @@ import com.google.common.base.Optional;
 public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class);
+    public static final String RECEIVED_RESPONSE_WITHOUT_BODY = "Received response without body: {}";
 
     private final VnfmAdapterUrlProvider urlProvider;
     private final HttpRestServiceProvider httpServiceProvider;
@@ -69,7 +70,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
             }
 
             if (!response.hasBody()) {
-                LOGGER.error("Received response without body: {}", response);
+                LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response);
                 return Optional.absent();
             }
 
@@ -107,7 +108,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
             }
 
             if (!response.hasBody()) {
-                LOGGER.error("Received response without body: {}", response);
+                LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response);
                 return Optional.absent();
             }
             final DeleteVnfResponse deleteVnfResponse = response.getBody();
@@ -139,7 +140,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
             }
 
             if (!response.hasBody()) {
-                LOGGER.error("Received response without body: {}", response);
+                LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response);
                 return Optional.absent();
             }
             return Optional.of(response.getBody());
index ef882b4..f9bd8c5 100644 (file)
@@ -47,6 +47,9 @@ import org.springframework.stereotype.Component;
 @Component
 public class AppcRunTasks {
     private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class);
+    public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop";
+    public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock";
+    public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic";
     @Autowired
     private ExceptionBuilder exceptionUtil;
     @Autowired
@@ -71,9 +74,9 @@ public class AppcRunTasks {
         execution.setVariable("actionHealthCheck", Action.HealthCheck);
         execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic);
         execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
-        execution.setVariable("rollbackVnfStop", false);
-        execution.setVariable("rollbackVnfLock", false);
-        execution.setVariable("rollbackQuiesceTraffic", false);
+        execution.setVariable(ROLLBACK_VNF_STOP, false);
+        execution.setVariable(ROLLBACK_VNF_LOCK, false);
+        execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false);
     }
 
     public void runAppcCommand(BuildingBlockExecution execution, Action action) {
@@ -153,17 +156,17 @@ public class AppcRunTasks {
     protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
         if (appcCode.equals("0") && action != null) {
             if (action.equals(Action.Lock)) {
-                execution.setVariable("rollbackVnfLock", true);
+                execution.setVariable(ROLLBACK_VNF_LOCK, true);
             } else if (action.equals(Action.Unlock)) {
-                execution.setVariable("rollbackVnfLock", false);
+                execution.setVariable(ROLLBACK_VNF_LOCK, false);
             } else if (action.equals(Action.Start)) {
-                execution.setVariable("rollbackVnfStop", false);
+                execution.setVariable(ROLLBACK_VNF_STOP, false);
             } else if (action.equals(Action.Stop)) {
-                execution.setVariable("rollbackVnfStop", true);
+                execution.setVariable(ROLLBACK_VNF_STOP, true);
             } else if (action.equals(Action.QuiesceTraffic)) {
-                execution.setVariable("rollbackQuiesceTraffic", true);
+                execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, true);
             } else if (action.equals(Action.ResumeTraffic)) {
-                execution.setVariable("rollbackQuiesceTraffic", false);
+                execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false);
             }
         }
     }