diff options
author | Michal Kabaj <michal.kabaj@nokia.com> | 2018-03-16 14:53:36 +0100 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-03-20 12:49:47 +0000 |
commit | 1f03b498a2bf4c125f8cbd3a0b6a2eddffbbea4f (patch) | |
tree | 9f3beb7c535c29f8b3d589afc7fdad5605587d19 /appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java | |
parent | b7a9acc09f070ed2cff1820b799afaa3e351006f (diff) |
ChefAdapterImpl Junits
- Added new Unit tests for ChefAdapterImpl checkPushJob method
to class ChefAdapterImplJobPusherTest
- Added param check in implementation method
- Small refactor of nested conditions for improved readability
Change-Id: Id65b897535874eea6aafda66b7ac227832446cf4
Issue-ID: APPC-437
Signed-off-by: Michal Kabaj <michal.kabaj@nokia.com>
Diffstat (limited to 'appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java')
-rw-r--r-- | appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java index 9853bcff9..f689668bb 100644 --- a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java +++ b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/impl/ChefAdapterImpl.java @@ -565,7 +565,7 @@ public class ChefAdapterImpl implements ChefAdapter { String jobID = params.get("jobid"); String retry = params.get("retryTimes"); String intrva = params.get("retryInterval"); - if (StringUtils.isNotBlank(retry) && StringUtils.isNotBlank(intrva)) { + if (StringUtils.isNotBlank(jobID) && StringUtils.isNotBlank(retry) && StringUtils.isNotBlank(intrva)) { int retryTimes = Integer.parseInt(params.get("retryTimes")); int retryInterval = Integer.parseInt(params.get("retryInterval")); @@ -604,14 +604,12 @@ public class ChefAdapterImpl implements ChefAdapter { if ("complete".equals(status)) { svcLogic.setAttribute(CHEF_SERVER_RESULT_CODE_STR, "200"); svcLogic.setAttribute(CHEF_SERVER_RESULT_MSG_STR, message); + } else if ("running".equals(status)) { + svcLogic.setAttribute(CHEF_SERVER_RESULT_CODE_STR, "202"); + svcLogic.setAttribute(CHEF_SERVER_RESULT_MSG_STR, "chef client runtime out"); } else { - if ("running".equals(status)) { - svcLogic.setAttribute(CHEF_SERVER_RESULT_CODE_STR, "202"); - svcLogic.setAttribute(CHEF_SERVER_RESULT_MSG_STR, "chef client runtime out"); - } else { - svcLogic.setAttribute(CHEF_SERVER_RESULT_CODE_STR, "500"); - svcLogic.setAttribute(CHEF_SERVER_RESULT_MSG_STR, message); - } + svcLogic.setAttribute(CHEF_SERVER_RESULT_CODE_STR, "500"); + svcLogic.setAttribute(CHEF_SERVER_RESULT_MSG_STR, message); } } |