aboutsummaryrefslogtreecommitdiffstats
path: root/services/activity-spec/activity-spec-web/activity-spec-service/src
diff options
context:
space:
mode:
authorsheetalm <sheetal.mudholkar@amdocs.com>2018-03-26 15:23:57 +0530
committerOren Kleks <orenkle@amdocs.com>2018-03-27 08:56:33 +0000
commit4a065a54483b0d64e2bb2b54c82f167e28d4dcf8 (patch)
treec8f8d4a1d2b70ef417b67592096ae9f285c89063 /services/activity-spec/activity-spec-web/activity-spec-service/src
parent56e56b8860cf6e7ad70dc65134e8fd87eaf01123 (diff)
Activity Spec Service - Refactor unit test
Resolve review comments Refactor unit test. Remove mock classes. Change-Id: I9185121e84c2d9337db3b35b9156d328bf0e0d8c Issue-ID: SDC-1048 Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'services/activity-spec/activity-spec-web/activity-spec-service/src')
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java247
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ActivitySpecDaoMock.java39
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ItemManagerMock.java86
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/UniqueValueDaoMock.java49
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/VersionManagerMock.java105
5 files changed, 161 insertions, 365 deletions
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java
index 3576ae81c7..ac44b031bf 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/be/impl/ActivitySpecManagerImplTest.java
@@ -16,8 +16,10 @@
package org.openecomp.activityspec.be.impl;
+import java.util.Arrays;
import java.util.Collection;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.activityspec.api.rest.types.ActivitySpecAction;
@@ -25,11 +27,8 @@ import org.openecomp.activityspec.be.dao.ActivitySpecDao;
import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity;
import org.openecomp.activityspec.be.datatypes.ActivitySpecParameter;
import org.openecomp.core.dao.UniqueValueDao;
-import org.openecomp.activityspec.mocks.ActivitySpecDaoMock;
-import org.openecomp.activityspec.mocks.ItemManagerMock;
-import org.openecomp.activityspec.mocks.UniqueValueDaoMock;
-import org.openecomp.activityspec.mocks.VersionManagerMock;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.SdcRuntimeException;
import org.openecomp.sdc.common.session.SessionContextProviderFactory;
import org.openecomp.sdc.versioning.ItemManager;
import org.openecomp.sdc.versioning.VersioningManager;
@@ -44,36 +43,42 @@ import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.verify;
+import static org.openecomp.activityspec.utils.ActivitySpecConstant.VERSION_ID_DEFAULT_VALUE;
+
public class ActivitySpecManagerImplTest {
private static final String STRING_TYPE = "String";
- private ActivitySpecEntity activitySpec;
- private ActivitySpecEntity retrieved;
+ private static final String ACTIVITYSPEC_NOT_FOUND = "ACTIVITYSPEC_NOT_FOUND";
+ private static final String TEST_ERROR_MSG = "Test Error";
+ private static final String ERROR_MSG_PREFIX = "STATUS_NOT_";
private ActivitySpecEntity input;
- private ActivitySpecEntity activitySpecToCreate;
+ private static final Version VERSION01 = new Version("12345");
+ private static final String ID = "ID1";
@Spy
@InjectMocks
private ActivitySpecManagerImpl activitySpecManager;
+ @Mock
+ private ItemManager itemManagerMock;
- private ActivitySpecDao activitySpecDaoMock = new ActivitySpecDaoMock();
-
-
- private ItemManager itemManagerMock = new ItemManagerMock();
-
+ @Mock
+ private VersioningManager versionManagerMock;
- private VersioningManager versionManagerMock = new VersionManagerMock() {
- };
+ @Mock
+ private ActivitySpecDao activitySpecDaoMock;
- private UniqueValueDao uniqueValueDaoMock = new UniqueValueDaoMock();
- private ActivitySpecEntity retrivedAfterNameUpdate;
+ //This is used to mock UniqueValueUtil. This should not be removed.
+ @Mock
+ private UniqueValueDao uniqueValueDaoMock;
@BeforeMethod
- public void setUp() {
+ public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- activitySpecManager = new ActivitySpecManagerImpl(itemManagerMock, versionManagerMock,
- activitySpecDaoMock, uniqueValueDaoMock);
}
@AfterMethod
@@ -81,15 +86,12 @@ public class ActivitySpecManagerImplTest {
activitySpecManager = null;
}
-
- public static final Version VERSION01 = new Version("12345");
-
@Test
public void testCreate() {
SessionContextProviderFactory.getInstance().createInterface().create("testUser", "testTenant");
- activitySpecToCreate = new ActivitySpecEntity();
+ ActivitySpecEntity activitySpecToCreate = new ActivitySpecEntity();
activitySpecToCreate.setName("startserver");
activitySpecToCreate.setDescription("start the server");
activitySpecToCreate.setVersion(VERSION01);
@@ -114,124 +116,196 @@ public class ActivitySpecManagerImplTest {
outputs.add(outputParams);
activitySpecToCreate.setOutputs(outputs);
- activitySpec = activitySpecManager.createActivitySpec
+ activitySpecToCreate.setId("ID1");
+ activitySpecToCreate.setVersion(VERSION01);
+
+ Item item = new Item();
+ doReturn(item).when(itemManagerMock).create(anyObject());
+
+ ActivitySpecEntity activitySpec = activitySpecManager.createActivitySpec
(activitySpecToCreate);
Assert.assertNotNull(activitySpec);
- activitySpecToCreate.setId(activitySpec.getId());
- activitySpecToCreate.setVersion(VERSION01);
+ activitySpec.setId("ID1");
+ activitySpec.setStatus(VersionStatus.Draft.name());
assertActivitySpecEquals(activitySpec, activitySpecToCreate);
}
- @Test(dependsOnMethods = "testCreate")
+
+
+ @Test
public void testList () {
- //List
+ ActivitySpecEntity activitySpec = new ActivitySpecEntity();
+ activitySpec.setName("stopServer");
+ doReturn(Arrays.asList(
+ activitySpec))
+ .when(itemManagerMock).list(anyObject());
final Collection<Item> activitySpecs = activitySpecManager.list("Certified");
Assert.assertEquals(activitySpecs.size(), 1);
}
- @Test(dependsOnMethods = "testCreate")
+ @Test
+ public void testListInvalidFilter () {
+ final Collection<Item> activitySpecs = activitySpecManager.list("invalid_status");
+ Assert.assertEquals(activitySpecs.size(), 0);
+ }
+
+ @Test
+ public void testListNoFilter () {
+ final Collection<Item> activitySpecs = activitySpecManager.list(null);
+ Assert.assertEquals(activitySpecs.size(), 0);
+ }
+
+ @Test
public void testGet () {
- //Get
input = new ActivitySpecEntity();
- input.setId(activitySpec.getId());
- input.setVersion(activitySpec.getVersion());
- retrieved = activitySpecManager.get(input);
- assertActivitySpecEquals(retrieved, activitySpec);
+ input.setId(ID);
+ input.setVersion(VERSION01);
+
+ doReturn(Arrays.asList(VERSION01)).when(versionManagerMock).list(anyObject());
+ doReturn(input).when(activitySpecDaoMock).get(anyObject());
+ VERSION01.setStatus(VersionStatus.Draft);
+ doReturn(VERSION01).when(versionManagerMock).get(anyObject(), anyObject());
+ ActivitySpecEntity retrieved = activitySpecManager.get(input);
+ assertActivitySpecEquals(retrieved, input);
Assert.assertEquals(retrieved.getStatus(), VersionStatus.Draft.name());
- input.setVersion(new Version("LATEST"));
+
+ input.setVersion(new Version(VERSION_ID_DEFAULT_VALUE));
retrieved = activitySpecManager.get(input);
- assertActivitySpecEquals(retrieved, activitySpec);
+ assertActivitySpecEquals(retrieved, input);
Assert.assertEquals(retrieved.getStatus(), VersionStatus.Draft.name());
}
- @Test(dependsOnMethods = "testGet")
+ @Test
+ public void testGetActivitySpecDaoFail () {
+ input = new ActivitySpecEntity();
+ input.setId(ID);
+ input.setVersion(VERSION01);
+ doReturn(Arrays.asList(VERSION01)).when(versionManagerMock).list(anyObject());
+ doReturn(input).when(activitySpecDaoMock).get(anyObject());
+ doThrow(new SdcRuntimeException(TEST_ERROR_MSG)).when(activitySpecDaoMock).get(anyObject());
+ try {
+ activitySpecManager.get(input);
+ Assert.fail();
+ } catch (CoreException exception) {
+ Assert.assertEquals(exception.code().id(), ACTIVITYSPEC_NOT_FOUND);
+ }
+ }
+
+ @Test
+ public void testListVersionFail () {
+ input = new ActivitySpecEntity();
+ input.setId(ID);
+ input.setVersion(VERSION01);
+ input.getVersion().setId(VERSION_ID_DEFAULT_VALUE);
+ doThrow(new SdcRuntimeException(TEST_ERROR_MSG)).when(versionManagerMock).list(anyObject());
+ try {
+ activitySpecManager.get(input);
+ Assert.fail();
+ } catch (CoreException exception) {
+ Assert.assertEquals(exception.code().id(), ACTIVITYSPEC_NOT_FOUND);
+ }
+ }
+
+ @Test
public void testInvalidDeprecate () {
try {
- activitySpecManager.actOnAction(retrieved.getId(),
+ activitySpecManager.actOnAction(ID,
VERSION01.getId(), ActivitySpecAction.DEPRECATE);
}
catch (CoreException exception) {
- Assert.assertEquals(exception.code().id(), "STATUS_NOT_"+VersionStatus.Certified.name()
+ Assert.assertEquals(exception.code().id(), ERROR_MSG_PREFIX +VersionStatus.Certified.name()
.toUpperCase());
}
}
- @Test(dependsOnMethods = "testGet")
+ @Test
public void testInvalidDelete () {
try {
- activitySpecManager.actOnAction(retrieved.getId(),
+ activitySpecManager.actOnAction(ID,
VERSION01.getId(), ActivitySpecAction.DELETE);
}
catch (CoreException exception) {
- Assert.assertEquals(exception.code().id(), "STATUS_NOT_"+VersionStatus.Deprecated.name()
+ Assert.assertEquals(exception.code().id(), ERROR_MSG_PREFIX+VersionStatus.Deprecated.name()
.toUpperCase());
}
}
- @Test(dependsOnMethods = "testGet")
- public void testUpdate () {
- //Update
- retrieved.setDescription("Updated_install");
- activitySpecManager.update(retrieved);
-
- final ActivitySpecEntity retrivedAfterUpdate = activitySpecManager.get(input);
- assertActivitySpecEquals(retrivedAfterUpdate, activitySpecToCreate);
-
- //Update Name
- ActivitySpecEntity activitySpecToUpdate = new ActivitySpecEntity();
- activitySpecToUpdate.setId(activitySpec.getId());
- activitySpecToUpdate.setName("Updated_start_server");
- activitySpecToUpdate.setVersion(activitySpec.getVersion());
-
- activitySpecManager.update(activitySpecToUpdate);
-
- retrivedAfterNameUpdate = activitySpecManager.get(input);
- assertActivitySpecEquals(retrivedAfterNameUpdate, activitySpecToUpdate);
- Assert.assertEquals(retrivedAfterNameUpdate.getStatus(), VersionStatus.Draft.name());
- }
-
- @Test(dependsOnMethods = "testUpdate")
+ @Test
public void testCertify () {
- activitySpecManager.actOnAction(retrivedAfterNameUpdate.getId(),
+ doReturn(Arrays.asList(VERSION01)).when(versionManagerMock).list(anyObject());
+ doReturn(VERSION01).when(versionManagerMock).get(anyObject(), anyObject());
+ activitySpecManager.actOnAction(ID,
VERSION01.getId(), ActivitySpecAction.CERTIFY);
- final ActivitySpecEntity retrivedAfterCertify = activitySpecManager.get(retrivedAfterNameUpdate);
- assertActivitySpecEquals(retrivedAfterCertify, retrivedAfterNameUpdate );
- Assert.assertEquals(retrivedAfterCertify.getStatus(), VersionStatus.Certified.name());
+ verify(versionManagerMock).updateVersion(ID, VERSION01);
+ verify(itemManagerMock).updateVersionStatus(ID, VersionStatus.Certified,
+ VersionStatus.Draft);
+ verify(versionManagerMock).publish(anyObject(), anyObject(), anyObject());
}
- @Test(dependsOnMethods = "testCertify")
+ @Test
public void testInvalidCertify () {
try {
- activitySpecManager.actOnAction(retrieved.getId(),
+ activitySpecManager.actOnAction(ID,
VERSION01.getId(), ActivitySpecAction.CERTIFY);
}
catch (CoreException exception) {
- Assert.assertEquals(exception.code().id(), "STATUS_NOT_"+VersionStatus.Draft.name()
+ Assert.assertEquals(exception.code().id(), ERROR_MSG_PREFIX+VersionStatus.Draft.name()
.toUpperCase());
}
}
- @Test(dependsOnMethods = "testCertify")
- public void testDeprecate () {
- activitySpecManager.actOnAction(retrivedAfterNameUpdate.getId(),
- retrivedAfterNameUpdate.getVersion().getId(), ActivitySpecAction.DEPRECATE);
+ @Test
+ public void testGetVersionFailOnStatusChangeAction () {
+ doReturn(Arrays.asList(VERSION01)).when(versionManagerMock).list(anyObject());
+ doThrow(new SdcRuntimeException(TEST_ERROR_MSG)).when(versionManagerMock).get(anyObject(), anyObject());
+ try {
+ activitySpecManager.actOnAction(ID,
+ VERSION01.getId(), ActivitySpecAction.CERTIFY);
+ Assert.fail();
+ } catch (CoreException exception) {
+ Assert.assertEquals(exception.code().id(), ACTIVITYSPEC_NOT_FOUND);
+ }
+ }
- final ActivitySpecEntity retrivedAfterDeprecate = activitySpecManager.get(retrivedAfterNameUpdate);
- assertActivitySpecEquals(retrivedAfterDeprecate, retrivedAfterNameUpdate );
- Assert.assertEquals(retrivedAfterDeprecate.getStatus(), VersionStatus.Deprecated.name());
+ @Test
+ public void testDeprecate () {
+ VERSION01.setStatus(VersionStatus.Certified);
+ Version retrivedVersion = new Version("12");
+ retrivedVersion.setStatus(VersionStatus.Certified);
+ doReturn(Arrays.asList(VERSION01)).when(versionManagerMock).list(anyObject());
+ doReturn(retrivedVersion).when(versionManagerMock).get(anyObject(), anyObject());
+ activitySpecManager.actOnAction(ID,
+ VERSION_ID_DEFAULT_VALUE, ActivitySpecAction.DEPRECATE);
+
+ verify(versionManagerMock).updateVersion(ID, retrivedVersion);
+ verify(itemManagerMock).updateVersionStatus(ID, VersionStatus.Deprecated,
+ VersionStatus.Certified);
+ verify(versionManagerMock).publish(anyObject(), anyObject(), anyObject());
}
- @Test(dependsOnMethods = "testDeprecate")
+ @Test
public void testDelete () {
- activitySpecManager.actOnAction(retrivedAfterNameUpdate.getId(),
- retrivedAfterNameUpdate.getVersion().getId(), ActivitySpecAction.DELETE);
-
- final ActivitySpecEntity retrivedAfterDelete = activitySpecManager.get(retrivedAfterNameUpdate);
- assertActivitySpecEquals(retrivedAfterDelete, retrivedAfterNameUpdate );
- Assert.assertEquals(retrivedAfterDelete.getStatus(), VersionStatus.Deleted.name());
+ ActivitySpecEntity activitySpec = new ActivitySpecEntity();
+ VERSION01.setStatus(VersionStatus.Deprecated);
+ activitySpec.setName("stopServer");
+ activitySpec.setVersion(VERSION01);
+
+ Version retrivedVersion = new Version("12");
+ retrivedVersion.setStatus(VersionStatus.Deprecated);
+
+ doReturn(Arrays.asList(VERSION01)).when(versionManagerMock).list(anyObject());
+ doReturn(retrivedVersion).when(versionManagerMock).get(anyObject(), anyObject());
+ doReturn(activitySpec).when(activitySpecDaoMock).get(anyObject());
+ activitySpecManager.actOnAction(ID,
+ VERSION_ID_DEFAULT_VALUE, ActivitySpecAction.DELETE);
+
+ verify(versionManagerMock).updateVersion(ID, VERSION01);
+ verify(itemManagerMock).updateVersionStatus(ID, VersionStatus.Deleted,
+ VersionStatus.Deprecated);
+ verify(versionManagerMock).publish(anyObject(), anyObject(), anyObject());
}
private void assertActivitySpecEquals(ActivitySpecEntity actual, ActivitySpecEntity expected) {
@@ -242,4 +316,5 @@ public class ActivitySpecManagerImplTest {
Assert.assertEquals(actual.getInputs(), expected.getInputs());
Assert.assertEquals(actual.getOutputs(), expected.getOutputs());
}
+
}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ActivitySpecDaoMock.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ActivitySpecDaoMock.java
deleted file mode 100644
index 4e21435900..0000000000
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ActivitySpecDaoMock.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.activityspec.mocks;
-
-import org.openecomp.activityspec.be.dao.ActivitySpecDao;
-import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity;
-
-public class ActivitySpecDaoMock implements ActivitySpecDao {
- public ActivitySpecEntity activitySpec;
-
- @Override
- public void create(ActivitySpecEntity activitySpecEntity) {
- activitySpec = activitySpecEntity;
- }
-
- @Override
- public ActivitySpecEntity get(ActivitySpecEntity activitySpecEntity) {
- return activitySpec;
- }
-
- @Override
- public void update(ActivitySpecEntity activitySpecEntity) {
- activitySpec = activitySpecEntity;
- }
-}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ItemManagerMock.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ItemManagerMock.java
deleted file mode 100644
index 060e29ccb1..0000000000
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/ItemManagerMock.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.activityspec.mocks;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdc.versioning.types.Item;
-import org.openecomp.sdc.versioning.ItemManager;
-import java.util.Collection;
-import java.util.UUID;
-import java.util.function.Predicate;
-
-public class ItemManagerMock implements ItemManager {
-
- private String id;
- private Item item;
-
-
- @Override
- public Collection<Item> list(Predicate<Item> predicate) {
- List<Item> items = new ArrayList<>();
- items.add(item);
- return items;
- }
-
- @Override
- public Item get(String itemId) {
- return null;
- }
-
- @Override
- public Item create(Item item) {
- this.id = UUID.randomUUID().toString();
- item.setId(this.id);
- this.item = item;
- return item;
- }
-
- @Override
- public void updateVersionStatus(String itemId, VersionStatus addedVersionStatus,
- VersionStatus removedVersionStatus) {
- // noop
- }
-
- @Override
- public void archive(Item item) {
- // noop
- }
-
- public void restore(Item item) {
- // noop
- }
-
-
- @Override
- public void updateName(String itemId, String name) {
- // noop
- }
-
- @Override
- public void update(Item item) {
- // noop
- }
-
- @Override
- public void delete(Item item) {
- // noop
- }
-
-}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/UniqueValueDaoMock.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/UniqueValueDaoMock.java
deleted file mode 100644
index 675c3b1878..0000000000
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/UniqueValueDaoMock.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.activityspec.mocks;
-
-import org.openecomp.core.dao.UniqueValueDao;
-import org.openecomp.core.dao.types.UniqueValueEntity;
-
-import java.util.Collection;
-
-public class UniqueValueDaoMock implements UniqueValueDao {
- @Override
- public Collection<UniqueValueEntity> list(UniqueValueEntity entity) {
- return null;
- }
-
- @Override
- public void create(UniqueValueEntity entity) {
-
- }
-
- @Override
- public void update(UniqueValueEntity entity) {
-
- }
-
- @Override
- public UniqueValueEntity get(UniqueValueEntity entity) {
- return null;
- }
-
- @Override
- public void delete(UniqueValueEntity entity) {
-
- }
-}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/VersionManagerMock.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/VersionManagerMock.java
deleted file mode 100644
index 4b1deb3741..0000000000
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/test/java/org/openecomp/activityspec/mocks/VersionManagerMock.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.activityspec.mocks;
-
-import org.openecomp.sdc.versioning.VersioningManager;
-import org.openecomp.sdc.versioning.dao.types.Revision;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdc.versioning.types.VersionCreationMethod;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Certified;
-import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Deprecated;
-import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Deleted;
-
-public class VersionManagerMock implements VersioningManager {
-
- private String id;
- private Version version;
-
-
- @Override
- public List<Version> list(String itemId) {
- List<Version> versions = new ArrayList<Version>();
- versions.add(version);
- return versions;
- }
-
-
- @Override
- public Version get(String itemId, Version version) {
- return this.version;
- }
-
- @Override
- public Version create(String itemId, Version version, VersionCreationMethod creationMethod) {
- this.id = UUID.randomUUID().toString();
- version.setId(this.id);
- version.setStatus(VersionStatus.Draft);
- this.version = version;
-
- return version;
- }
-
- @Override
- public void submit(String itemId, Version version, String submitDescription) {
-
- }
-
-
- @Override
- public void publish(String itemId, Version version, String message) {
-
- }
-
- @Override
- public void sync(String itemId, Version version) {
-
- }
-
- @Override
- public void forceSync(String itemId, Version version) {
-
- }
-
- @Override
- public void revert(String itemId, Version version, String revisionId) {
-
- }
-
- @Override
- public List<Revision> listRevisions(String itemId, Version version) {
- return null;
- }
-
- @Override
- public void updateVersion(String itemId, Version version) {
- if (version.getStatus() == Certified) {
- this.version.setStatus(Certified);
- }
- if (version.getStatus() == Deprecated) {
- this.version.setStatus(Deprecated);
- }
- if (version.getStatus() == Deleted) {
- this.version.setStatus(Deleted);
- }
- }
-}