summaryrefslogtreecommitdiffstats
path: root/asdctool/src/test/java
diff options
context:
space:
mode:
authorChrisC <christophe.closset@intl.att.com>2021-03-12 15:54:32 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2021-03-13 15:19:51 +0000
commitdefcbad3b225e098be507b99ae5ea5f6ef587399 (patch)
treeea8fe164e2b7ea5c6e702b1fa49c69beefa84f5b /asdctool/src/test/java
parentda1e922cf682af524ab9392d341ede8b9d28093d (diff)
Remove unused code
Remove unused and untested or poorly tested code for migrating old DB Issue-ID: SDC-3428 Signed-off-by: ChrisC <christophe.closset@intl.att.com> Change-Id: I39b086111b5be8d1caf4d6d45bf92105d03709eb
Diffstat (limited to 'asdctool/src/test/java')
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java65
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java77
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java74
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java95
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java66
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/Version.java36
6 files changed, 0 insertions, 413 deletions
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java
deleted file mode 100644
index 2223d2847d..0000000000
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1802/SdcCatalogMigrationTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.asdctool.migration.tasks.mig1802;
-
-import org.junit.Test;
-import org.openecomp.sdc.asdctool.migration.core.DBVersion;
-import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
-import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
-
-public class SdcCatalogMigrationTest {
-
- private SdcCatalogMigration createTestSubject() {
- return new SdcCatalogMigration(new TopologyTemplateOperation(), new JanusGraphDao(new JanusGraphClient()));
- }
-
- @Test
- public void testDescription() throws Exception {
- SdcCatalogMigration testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.description();
- }
-
- @Test
- public void testGetVersion() throws Exception {
- SdcCatalogMigration testSubject;
- DBVersion result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getVersion();
- }
-
- @Test
- public void testMigrate() throws Exception {
- SdcCatalogMigration testSubject;
- MigrationResult result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.migrate();
- }
-}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java
deleted file mode 100644
index 5a1f0bf0dc..0000000000
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.asdctool.migration.tasks.mig1806;
-
-import static org.junit.Assert.assertThat;
-
-import java.math.BigInteger;
-import org.hamcrest.core.Is;
-import org.hamcrest.core.IsNull;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.openecomp.sdc.asdctool.migration.core.DBVersion;
-import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
-
-@ExtendWith(MockitoExtension.class)
-class ForwardPathMigrationTest {
-
- private ForwardPathMigration forwardPathMigration = null;
-
- @Mock
- private JanusGraphDao janusGraphDao;
-
- @Mock
- private UserAdminOperation userAdminOperation;
-
- @Mock
- private ToscaOperationFacade toscaOperationFacade;
-
- @BeforeEach
- public void setUp() throws Exception {
- forwardPathMigration = new ForwardPathMigration(janusGraphDao, userAdminOperation, toscaOperationFacade);
- }
-
- @Test
- void testDescription() {
- assertThat(forwardPathMigration, IsNull.notNullValue());
- assertThat("remove corrupted forwarding paths ", Is.is(forwardPathMigration.description()));
- }
-
- @Test
- void testGetVersion() {
- DBVersion dbVersion = DBVersion.from(BigInteger.valueOf(Version.MAJOR.getValue()), BigInteger.valueOf(Version.MINOR.getValue()));
- assertThat(dbVersion, Is.is(forwardPathMigration.getVersion()));
- }
-
- @Test
- void testMigrate() {
- assertThat(forwardPathMigration, IsNull.notNullValue());
- Assertions.assertThrows(NullPointerException.class, () -> {
- forwardPathMigration.migrate();
- });
- }
-}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java
deleted file mode 100644
index d11f70c4bb..0000000000
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ResourceLifecycleMigrationTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.asdctool.migration.tasks.mig1806;
-
-import org.hamcrest.core.Is;
-import org.hamcrest.core.IsNull;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.openecomp.sdc.asdctool.migration.core.DBVersion;
-import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
-import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
-import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
-
-import java.math.BigInteger;
-
-import static org.junit.Assert.assertThat;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ResourceLifecycleMigrationTest {
-
- @Mock
- private JanusGraphDao janusGraphDao;
- @Mock
- private LifecycleBusinessLogic lifecycleBusinessLogic;
- @Mock
- private UserAdminOperation userAdminOperation;
-
- ResourceLifecycleMigration resourceLifecycleMigration = null;
-
- @Before
- public void setUp() throws Exception {
- resourceLifecycleMigration =
- new ResourceLifecycleMigration(janusGraphDao, lifecycleBusinessLogic, userAdminOperation);
- }
-
- @Test
- public void testDescription() {
- assertThat(resourceLifecycleMigration,IsNull.notNullValue());
- assertThat("change resource lifecycle state from testing to certified", Is.is(resourceLifecycleMigration.description()));
- }
-
- @Test
- public void testGetVersion() {
- DBVersion dbVersion = DBVersion.from(BigInteger.valueOf(Version.MAJOR.getValue()), BigInteger.valueOf(Version.MINOR.getValue()));
- assertThat(dbVersion, Is.is(resourceLifecycleMigration.getVersion()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testMigrate() {
- assertThat(resourceLifecycleMigration,IsNull.notNullValue());
- resourceLifecycleMigration.migrate();
- }
-}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java
deleted file mode 100644
index 4721b1eb02..0000000000
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SDCInstancesMigrationTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.asdctool.migration.tasks.mig1806;
-
-import fj.data.Either;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
-import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult.MigrationStatus;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
-import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
-import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
-import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation;
-import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class SDCInstancesMigrationTest{
- @Mock
- private JanusGraphDao janusGraphDao;
- @Mock
- private NodeTemplateOperation nodeTemplateOperation;
- @Mock
- GraphVertex topologyTemplateVertex;
-
-
- @Test
- public void testFailedMigration(){
- SDCInstancesMigration instancesMigration = new SDCInstancesMigration(janusGraphDao, nodeTemplateOperation);
- when(janusGraphDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.right(
- JanusGraphOperationStatus.GENERAL_ERROR));
-
- MigrationResult migrate = instancesMigration.migrate();
- MigrationStatus migrationStatus = migrate.getMigrationStatus();
- assertEquals(MigrationStatus.FAILED, migrationStatus);
- }
- @Test
- public void testSuccessMigration(){
- SDCInstancesMigration instancesMigration = new SDCInstancesMigration(janusGraphDao, nodeTemplateOperation);
- List<GraphVertex> list = new ArrayList<>();
- GraphVertex vertexOrig = new GraphVertex();
- Map<String, CompositionDataDefinition> jsonComposition = new HashMap<>();
- CompositionDataDefinition composition = new CompositionDataDefinition();
- Map<String, ComponentInstanceDataDefinition> componentInstances = new HashMap<>();
- ComponentInstanceDataDefinition instance = new ComponentInstanceDataDefinition();
- componentInstances.put("instanceId", instance);
- composition.setComponentInstances(componentInstances);
- jsonComposition.put(JsonConstantKeysEnum.COMPOSITION.getValue(), composition);
- vertexOrig.setJson(jsonComposition);
- vertexOrig.setType(ComponentTypeEnum.SERVICE);
- list.add(vertexOrig);
-
-
- when(janusGraphDao.getVertexById(any())).thenReturn(Either.left(vertexOrig));
- when(janusGraphDao.getByCriteria(any(), any(), any(), any() )).thenReturn(Either.left(list));
- when(nodeTemplateOperation.createInstanceEdge(vertexOrig, instance)).thenReturn(StorageOperationStatus.OK);
- when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
-
- MigrationResult migrate = instancesMigration.migrate();
- MigrationStatus migrationStatus = migrate.getMigrationStatus();
- assertEquals(MigrationStatus.COMPLETED, migrationStatus);
- }
-}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java
deleted file mode 100644
index 03695367b0..0000000000
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/SdcArchiveMigrationTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.asdctool.migration.tasks.mig1806;
-
-import org.hamcrest.core.Is;
-import org.hamcrest.core.IsNull;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.openecomp.sdc.asdctool.migration.core.DBVersion;
-import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
-
-import java.math.BigInteger;
-
-import static org.junit.Assert.assertThat;
-
-@RunWith(MockitoJUnitRunner.class)
-public class SdcArchiveMigrationTest {
- @Mock
- private JanusGraphDao janusGraphDao;
-
- SdcArchiveMigration sdcArchiveMigration = null;
-
- @Before
- public void setUp() throws Exception {
- sdcArchiveMigration = new SdcArchiveMigration(janusGraphDao);
- }
-
- @Test
- public void testDescription() {
- assertThat(sdcArchiveMigration,IsNull.notNullValue());
- assertThat("add archive node for archiving/restoring components ", Is.is(sdcArchiveMigration.description()));
- }
-
- @Test
- public void testGetVersion() {
- DBVersion dbVersion = DBVersion.from(BigInteger.valueOf(Version.MAJOR.getValue()), BigInteger.valueOf(Version.MINOR.getValue()));
- assertThat(dbVersion, Is.is(sdcArchiveMigration.getVersion()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testMigrate() {
- assertThat(sdcArchiveMigration,IsNull.notNullValue());
- sdcArchiveMigration.migrate();
- }
-}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/Version.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/Version.java
deleted file mode 100644
index 9df5232cce..0000000000
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/Version.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.asdctool.migration.tasks.mig1806;
-
-public enum Version {
-
- MINOR(0), MAJOR(1806);
-
- private final int value;
-
- private Version(final int newValue) {
- value = newValue;
- }
-
- public int getValue() {
- return value;
- }
-}