summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org
diff options
context:
space:
mode:
authorshrikantawachar <shrikant.awachar@amdocs.com>2018-11-20 19:08:06 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-12-02 08:48:20 +0000
commitc2a1b7c2eea934f309838f0082b2b851012be9a1 (patch)
tree12b3dac98cec264a12d96fe76c727df714ca4601 /openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org
parent594a8c618a763e79e05229509dbf2b60ab831213 (diff)
Enhance or write new tests
Enhance or write new tests Change-Id: I4281b83410645ca0b6f64ab719adcd01c2a04ed3 Issue-ID: SDC-1816 Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org')
-rw-r--r--openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java66
1 files changed, 32 insertions, 34 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java
index 87edc9a0d4..dc101ae955 100644
--- a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java
@@ -18,6 +18,8 @@ package org.openecomp.sdc.action.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
+import org.openecomp.core.dao.UniqueValueDao;
+import org.openecomp.core.dao.UniqueValueDao;
import org.openecomp.core.dao.UniqueValueDaoFactory;
import org.openecomp.core.util.UniqueValueUtil;
import org.openecomp.core.utilities.CommonMethods;
@@ -73,40 +75,38 @@ public class ActionManagerImpl implements ActionManager {
private final ActionVersioningManager versioningManager;
private final ActionArtifactDao actionArtifactDao;
private final VersionInfoDao versionInfoDao;
+ private final UniqueValueDao uniqueValueDao;
private final Logger log = LoggerFactory.getLogger(this.getClass()
.getName());
- public ActionManagerImpl() {
- actionDao = ActionDaoFactory.getInstance()
- .createInterface();
- versioningManager = ActionVersioningManagerFactory.getInstance()
- .createInterface();
- actionArtifactDao = ActionArtifactDaoFactory.getInstance()
- .createInterface();
- versionInfoDao = VersionInfoDaoFactory.getInstance()
- .createInterface();
- actionDao.registerVersioning(ACTION_VERSIONABLE_TYPE);
- }
-
- public ActionManagerImpl(ActionDao actionDao, ActionVersioningManager versioningManager,
- ActionArtifactDao actionArtifactDao, VersionInfoDao versionInfoDao) {
- this.actionDao = actionDao;
- this.versioningManager = versioningManager;
- this.actionArtifactDao = actionArtifactDao;
- this.versionInfoDao = versionInfoDao;
- }
-
- /**
- * List All Major, Last Minor and Candidate version (if any) for Given
- * Action Invariant UUID
- *
- * @param invariantId
- * Invariant UUID of the action for which the information is
- * required
- * @return List of All Major, Last Minor and Candidate version if any Of
- * {@link Action} with given actionInvariantUuId.
- */
+ public ActionManagerImpl() {
+ actionDao = ActionDaoFactory.getInstance().createInterface();
+ versioningManager = ActionVersioningManagerFactory.getInstance().createInterface();
+ actionArtifactDao = ActionArtifactDaoFactory.getInstance().createInterface();
+ versionInfoDao = VersionInfoDaoFactory.getInstance().createInterface();
+ actionDao.registerVersioning(ACTION_VERSIONABLE_TYPE);
+ uniqueValueDao = UniqueValueDaoFactory.getInstance().createInterface();
+ }
+
+ public ActionManagerImpl(ActionDao actionDao, ActionVersioningManager versioningManager,
+ ActionArtifactDao actionArtifactDao, VersionInfoDao versionInfoDao,
+ UniqueValueDao uniqueValueDao) {
+ this.actionDao = actionDao;
+ this.versioningManager = versioningManager;
+ this.actionArtifactDao = actionArtifactDao;
+ this.versionInfoDao = versionInfoDao;
+ this.uniqueValueDao = uniqueValueDao;
+ }
+ /**
+ * List All Major, Last Minor and Candidate version (if any) for Given Action Invariant UUID
+ *
+ * @param invariantId Invariant UUID of the action for which the information is required
+ * @return List of All Major, Last Minor and Candidate version if any Of {@link Action} with given
+ * actionInvariantUuId.
+ * @throws ActionException Exception with an action library specific code, short description and
+ * detailed message for the error occurred during the operation
+ */
@Override
public List<Action> getActionsByActionInvariantUuId(String invariantId) {
@@ -239,8 +239,7 @@ public class ActionManagerImpl implements ActionManager {
*/
@Override
public Action createAction(Action action, String user) {
- UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance()
- .createInterface());
+ UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
try {
actionLogPreProcessor(ActionSubOperation.VALIDATE_ACTION_UNIQUE_NAME, TARGET_ENTITY_API);
uniqueValueUtil.validateUniqueValue(ActionConstants.UniqueValues.ACTION_NAME, action.getName());
@@ -403,8 +402,7 @@ public class ActionManagerImpl implements ActionManager {
if (version.equals(new Version(0, 0))) {
actionLogPreProcessor(ActionSubOperation.DELETE_UNIQUEVALUE, TARGET_ENTITY_API);
- UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance()
- .createInterface());
+ UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
uniqueValueUtil.deleteUniqueValue(ActionConstants.UniqueValues.ACTION_NAME, action.getName());
actionLogPostProcessor(StatusCode.COMPLETE);
log.metrics("");