summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRupinder <rupinsi1@in.ibm.com>2020-05-04 15:54:03 +0530
committerRupinder <rupinsi1@in.ibm.com>2020-05-04 15:54:13 +0530
commitbe4b0e203dae1448d1750c4db08d983623e7c6ec (patch)
tree99adbae7dc1fa61df2b987a0cb72db6d141ec303
parent82f1151defb2e3cb19228a4dc7e26f59fe145da9 (diff)
lowered code smells
Issue-ID: APPC-1859 Change-Id: I4ec9adbc3070ca3371c948e4a01c7c869e1fd24a Signed-off-by: Rupinder <rupinsi1@in.ibm.com>
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java14
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java16
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java14
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java14
4 files changed, 29 insertions, 29 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java
index cdff1673a..6a7d00093 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java
@@ -64,9 +64,9 @@ public class StartServer extends ProviderServerOperation {
try {
validateParametersExist(params, ProviderAdapter.PROPERTY_INSTANCE_URL,
ProviderAdapter.PROPERTY_PROVIDER_NAME);
- String vm_url = params.get(ProviderAdapter.PROPERTY_INSTANCE_URL);
- VMURL vm = VMURL.parseURL(vm_url);
- if (validateVM(rc, appName, vm_url, vm))
+ String vmUrl = params.get(ProviderAdapter.PROPERTY_INSTANCE_URL);
+ VMURL vm = VMURL.parseURL(vmUrl);
+ if (validateVM(rc, appName, vmUrl, vm))
return null;
IdentityURL ident = IdentityURL.parseURL(params.get(ProviderAdapter.PROPERTY_IDENTITY_URL));
String identStr = (ident == null) ? null : ident.toString();
@@ -79,12 +79,12 @@ public class StartServer extends ProviderServerOperation {
skipHypervisorCheck = ctx.getAttribute(ProviderAdapter.SKIP_HYPERVISOR_CHECK);
}
try {
- context = getContext(rc, vm_url, identStr);
+ context = getContext(rc, vmUrl, identStr);
if (context != null) {
tenantName = context.getTenantName();// this varaible also is used in case of exception
rc.reset();
server = lookupServer(rc, context, vm.getServerId());
- logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
+ logger.debug(Msg.SERVER_FOUND, vmUrl, tenantName, server.getStatus().toString());
if (skipHypervisorCheck == null || (!skipHypervisorCheck.equalsIgnoreCase("true"))) {
// Check of the Hypervisor for the VM Server is UP and reachable
checkHypervisor(server);
@@ -159,12 +159,12 @@ public class StartServer extends ProviderServerOperation {
ctx.setAttribute("START_STATUS", "CONTEXT_NOT_FOUND");
}
} catch (ResourceNotFoundException e) {
- String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vm_url);
+ String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vmUrl);
logger.error(msg);
doFailure(rc, HttpStatus.NOT_FOUND_404, msg);
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
- e1.getClass().getSimpleName(), START_SERVICE.toString(), vm_url, tenantName);
+ e1.getClass().getSimpleName(), START_SERVICE.toString(), vmUrl, tenantName);
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java
index d502a7924..9e053cc6a 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java
@@ -72,10 +72,10 @@ public class StopServer extends ProviderServerOperation {
try {
validateParametersExist(params, ProviderAdapter.PROPERTY_INSTANCE_URL,
ProviderAdapter.PROPERTY_PROVIDER_NAME);
- String vm_url = params.get(ProviderAdapter.PROPERTY_INSTANCE_URL);
+ String vmUrl = params.get(ProviderAdapter.PROPERTY_INSTANCE_URL);
ctx.setAttribute("STOP_STATUS", "SUCCESS");
- VMURL vm = VMURL.parseURL(vm_url);
- if (validateVM(rc, appName, vm_url, vm))
+ VMURL vm = VMURL.parseURL(vmUrl);
+ if (validateVM(rc, appName, vmUrl, vm))
return null;
IdentityURL ident = IdentityURL.parseURL(params.get(ProviderAdapter.PROPERTY_IDENTITY_URL));
String identStr = (ident == null) ? null : ident.toString();
@@ -87,11 +87,11 @@ public class StopServer extends ProviderServerOperation {
skipHypervisorCheck = ctx.getAttribute(ProviderAdapter.SKIP_HYPERVISOR_CHECK);
}
try {
- context = getContext(rc, vm_url, identStr);
+ context = getContext(rc, vmUrl, identStr);
if (context != null) {
rc.reset();
server = lookupServer(rc, context, vm.getServerId());
- logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+ logger.debug(Msg.SERVER_FOUND, vmUrl, context.getTenantName(), server.getStatus().toString());
// Always perform Hypervisor check
// unless the skip is set to true
if (skipHypervisorCheck == null || (!skipHypervisorCheck.equalsIgnoreCase("true"))) {
@@ -167,18 +167,18 @@ public class StopServer extends ProviderServerOperation {
context.close();
doSuccess(rc);
ctx.setAttribute("STOP_STATUS", "SUCCESS");
- msg = EELFResourceManager.format(Msg.SUCCESS_EVENT_MESSAGE, "StopServer", vm_url);
+ msg = EELFResourceManager.format(Msg.SUCCESS_EVENT_MESSAGE, "StopServer", vmUrl);
ctx.setAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE, msg);
} else {
ctx.setAttribute("STOP_STATUS", "CONTEXT_NOT_FOUND");
}
} catch (ResourceNotFoundException e) {
- String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vm_url);
+ String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vmUrl);
logger.error(msg);
doFailure(rc, HttpStatus.NOT_FOUND_404, msg);
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
- e1.getClass().getSimpleName(), STOP_SERVICE.toString(), vm_url,
+ e1.getClass().getSimpleName(), STOP_SERVICE.toString(), vmUrl,
context == null ? "Unknown" : context.getTenantName());
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java
index 160364ec6..f3d4121a0 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java
@@ -188,11 +188,11 @@ public class TerminateServer extends ProviderServerOperation {
validateParametersExist(params, ProviderAdapter.PROPERTY_INSTANCE_URL,
ProviderAdapter.PROPERTY_PROVIDER_NAME);
- String vm_url = params.get(ProviderAdapter.PROPERTY_INSTANCE_URL);
+ String vmUrl = params.get(ProviderAdapter.PROPERTY_INSTANCE_URL);
ctx.setAttribute("TERMINATE_STATUS", "SUCCESS");
- VMURL vm = VMURL.parseURL(vm_url);
- if (validateVM(rc, appName, vm_url, vm))
+ VMURL vm = VMURL.parseURL(vmUrl);
+ if (validateVM(rc, appName, vmUrl, vm))
return null;
IdentityURL ident = IdentityURL.parseURL(params.get(ProviderAdapter.PROPERTY_IDENTITY_URL));
@@ -201,11 +201,11 @@ public class TerminateServer extends ProviderServerOperation {
Context context = null;
String tenantName = "Unknown";//to be used also in case of exception
try {
- context = getContext(rc, vm_url, identStr);
+ context = getContext(rc, vmUrl, identStr);
if (context != null) {
tenantName = context.getTenantName();//this varaible also is used in case of exception
server = lookupServer(rc, context, vm.getServerId());
- logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
+ logger.debug(Msg.SERVER_FOUND, vmUrl, tenantName, server.getStatus().toString());
logger.info(EELFResourceManager.format(Msg.TERMINATING_SERVER, server.getName()));
terminateServer(rc, server);
logger.info(EELFResourceManager.format(Msg.TERMINATE_SERVER, server.getName()));
@@ -215,13 +215,13 @@ public class TerminateServer extends ProviderServerOperation {
ctx.setAttribute("TERMINATE_STATUS", "SERVER_NOT_FOUND");
}
} catch (ResourceNotFoundException e) {
- String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vm_url);
+ String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vmUrl);
logger.error(msg);
doFailure(rc, HttpStatus.NOT_FOUND_404, msg);
ctx.setAttribute("TERMINATE_STATUS", "SERVER_NOT_FOUND");
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
- e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vm_url,
+ e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vmUrl,
tenantName);
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java
index ad0eca87a..796407fca 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java
@@ -69,10 +69,10 @@ public class VmStatuschecker extends ProviderServerOperation {
validateParametersExist(params, ProviderAdapter.PROPERTY_INSTANCE_URL,
ProviderAdapter.PROPERTY_PROVIDER_NAME);
- String vm_url = params.get(ProviderAdapter.PROPERTY_INSTANCE_URL);
+ String vmUrl = params.get(ProviderAdapter.PROPERTY_INSTANCE_URL);
- VMURL vm = VMURL.parseURL(vm_url);
- if (validateVM(rc, appName, vm_url, vm))
+ VMURL vm = VMURL.parseURL(vmUrl);
+ if (validateVM(rc, appName, vmUrl, vm))
return null;
IdentityURL ident = IdentityURL.parseURL(params.get(ProviderAdapter.PROPERTY_IDENTITY_URL));
@@ -81,11 +81,11 @@ public class VmStatuschecker extends ProviderServerOperation {
Context context = null;
String tenantName = "Unknown";//to be used also in case of exception
try {
- context = getContext(rc, vm_url, identStr);
+ context = getContext(rc, vmUrl, identStr);
if (context != null) {
tenantName = context.getTenantName();//this varaible also is used in case of exception
server = lookupServer(rc, context, vm.getServerId());
- logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
+ logger.debug(Msg.SERVER_FOUND, vmUrl, tenantName, server.getStatus().toString());
String statusvm;
switch (server.getStatus()) {
@@ -133,12 +133,12 @@ public class VmStatuschecker extends ProviderServerOperation {
Integer.toString(HttpStatus.OK_200.getStatusCode()));
}
} catch (ResourceNotFoundException e) {
- String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vm_url);
+ String msg = EELFResourceManager.format(Msg.SERVER_NOT_FOUND, e, vmUrl);
logger.error(msg);
doFailure(rc, HttpStatus.NOT_FOUND_404, msg);
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
- e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vm_url,
+ e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vmUrl,
tenantName);
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);