diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2018-06-12 10:50:47 +0300 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2018-06-12 10:54:28 +0300 |
commit | 95b8fb296567ab71e2661a56ad4a9cbbd84fd31a (patch) | |
tree | 732533df7cce2828a73a0cbd2537c97fc7c2f9db /catalog-model/src | |
parent | 4dc878ccce1219a78cd64c3bdaee78421c68d11d (diff) |
new unit tests for sdc-model
Change-Id: I118cb69c2874987191c320d71b17c4a060eaa2dc
Issue-ID: SDC-1333
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-model/src')
18 files changed, 338 insertions, 128 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java index 77980a823d..53ddbb3f58 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java @@ -6,7 +6,6 @@ import java.util.Map; import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.unittests.utils.ModelConfDependentTest; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java index 1fe8d6d764..f9a696bf8d 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/ComponentCacheTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.cache; -import java.io.IOException; -import java.io.UncheckedIOException; import java.nio.ByteBuffer; import java.util.Date; import java.util.HashMap; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/DaoInfoTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/DaoInfoTest.java index ba33ce9733..2e2f36b9c7 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/DaoInfoTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/DaoInfoTest.java @@ -9,7 +9,6 @@ public class DaoInfoTest { private DaoInfo createTestSubject() { return new DaoInfo(new ToscaOperationFacade(), new ComponentCache()); } - @Test public void testGetToscaOperationFacade() throws Exception { @@ -20,7 +19,6 @@ public class DaoInfoTest { testSubject = createTestSubject(); result = testSubject.getToscaOperationFacade(); } - @Test public void testGetComponentCache() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/jobs/CheckAndUpdateJobTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/jobs/CheckAndUpdateJobTest.java new file mode 100644 index 0000000000..148e2377ef --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/cache/jobs/CheckAndUpdateJobTest.java @@ -0,0 +1,215 @@ +package org.openecomp.sdc.be.model.cache.jobs; + +import java.util.function.Function; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.cache.ComponentCache; +import org.openecomp.sdc.be.model.cache.DaoInfo; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.resources.data.ComponentMetadataData; +import org.openecomp.sdc.be.resources.data.ResourceMetadataData; + +import fj.data.Either; +import mockit.Deencapsulation; + +public class CheckAndUpdateJobTest { + + CheckAndUpdateJob testSubject; + + @Mock + DaoInfo daoInfo; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + + testSubject = new CheckAndUpdateJob(daoInfo, "mock", NodeTypeEnum.Resource, 0L); + } + + @Test + public void testDoWorkException() throws Exception { + Object result; + + // default test + ToscaOperationFacade answer = Mockito.mock(ToscaOperationFacade.class); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer); + + result = testSubject.doWork(); + } + + @Test + public void testDoWorkFalse() throws Exception { + Object result; + + // default test + ComponentCache answer = Mockito.mock(ComponentCache.class); + Mockito.when(answer.getComponentAndTime(Mockito.anyString(), Mockito.any(Function.class))) + .thenReturn(Either.right(ActionStatus.ACCEPTED)); + Mockito.when(daoInfo.getComponentCache()).thenReturn(answer); + ToscaOperationFacade answer1 = Mockito.mock(ToscaOperationFacade.class); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer1); + + result = testSubject.doWork(); + } + + @Test + public void testDoWorkResourceNotFound() throws Exception { + Object result; + + // default test + ComponentCache answer = Mockito.mock(ComponentCache.class); + Either<ImmutablePair<Component, Long>, ActionStatus> value; + Mockito.when(answer.getComponentAndTime(Mockito.anyString(), Mockito.any(Function.class))) + .thenReturn(Either.right(ActionStatus.RESOURCE_NOT_FOUND)); + Mockito.when(daoInfo.getComponentCache()).thenReturn(answer); + ToscaOperationFacade answer1 = Mockito.mock(ToscaOperationFacade.class); + Mockito.when(answer1.getComponentMetadata(Mockito.anyString())) + .thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND)); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer1); + + result = testSubject.doWork(); + } + + @Test + public void testDoWork() throws Exception { + Object result; + + // default test + ComponentCache answer = Mockito.mock(ComponentCache.class); + ImmutablePair<Component, Long> value = ImmutablePair.of(new Resource(), 0L); + Mockito.when(answer.getComponentAndTime(Mockito.anyString(), Mockito.any(Function.class))) + .thenReturn(Either.left(value)); + Mockito.when(daoInfo.getComponentCache()).thenReturn(answer); + ToscaOperationFacade answer1 = Mockito.mock(ToscaOperationFacade.class); + Mockito.when(answer1.getComponentMetadata(Mockito.anyString())) + .thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND)); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer1); + + result = testSubject.doWork(); + } + + @Test + public void testDoWork1() throws Exception { + Object result; + + // default test + ComponentCache answer = Mockito.mock(ComponentCache.class); + ImmutablePair<Component, Long> value = ImmutablePair.of(new Resource(), 1L); + Mockito.when(answer.getComponentAndTime(Mockito.anyString(), Mockito.any(Function.class))) + .thenReturn(Either.left(value)); + Mockito.when(daoInfo.getComponentCache()).thenReturn(answer); + ToscaOperationFacade answer1 = Mockito.mock(ToscaOperationFacade.class); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer1); + + result = testSubject.doWork(); + } + + @Test + public void testUpdateCache() throws Exception { + String componentId = "mock"; + NodeTypeEnum nodeTypeEnum = null; + Long timestamp = null; + boolean result; + + // default test + ToscaOperationFacade answer1 = Mockito.mock(ToscaOperationFacade.class); + ComponentMetadataData a = new ResourceMetadataData(); + a.getMetadataDataDefinition().setLastUpdateDate(0L); + Mockito.when(answer1.getComponentMetadata(Mockito.anyString())) + .thenReturn(Either.left(a)); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer1); + + Mockito.when(answer1.getToscaElement(Mockito.anyString())).thenReturn(Either.left(new Resource())); + ComponentCache compCache = Mockito.mock(ComponentCache.class); + Mockito.when(compCache.setComponent(Mockito.any(), Mockito.any())).thenReturn(true); + Mockito.when(daoInfo.getComponentCache()).thenReturn(compCache); + + result = Deencapsulation.invoke(testSubject, "updateCache", componentId, NodeTypeEnum.Resource, 0L); + } + + @Test + public void testUpdateCacheFailedToUpdateCache() throws Exception { + String componentId = "mock"; + NodeTypeEnum nodeTypeEnum = null; + Long timestamp = null; + boolean result; + + // default test + ToscaOperationFacade answer1 = Mockito.mock(ToscaOperationFacade.class); + ComponentMetadataData a = new ResourceMetadataData(); + a.getMetadataDataDefinition().setLastUpdateDate(0L); + Mockito.when(answer1.getComponentMetadata(Mockito.anyString())) + .thenReturn(Either.left(a)); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer1); + + Mockito.when(answer1.getToscaElement(Mockito.anyString())).thenReturn(Either.left(new Resource())); + ComponentCache compCache = Mockito.mock(ComponentCache.class); + Mockito.when(daoInfo.getComponentCache()).thenReturn(compCache); + + result = Deencapsulation.invoke(testSubject, "updateCache", componentId, NodeTypeEnum.Resource, 0L); + } + + @Test + public void testUpdateCacheToscaElemntNotFound() throws Exception { + String componentId = "mock"; + NodeTypeEnum nodeTypeEnum = null; + Long timestamp = null; + boolean result; + + // default test + ToscaOperationFacade answer1 = Mockito.mock(ToscaOperationFacade.class); + ComponentMetadataData a = new ResourceMetadataData(); + a.getMetadataDataDefinition().setLastUpdateDate(0L); + Mockito.when(answer1.getComponentMetadata(Mockito.anyString())) + .thenReturn(Either.left(a)); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer1); + + Mockito.when(answer1.getToscaElement(Mockito.anyString())).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); + + result = Deencapsulation.invoke(testSubject, "updateCache", componentId, NodeTypeEnum.Resource, 0L); + } + + @Test + public void testUpdateCacheNotUpdatedTimestamp() throws Exception { + String componentId = "mock"; + NodeTypeEnum nodeTypeEnum = null; + Long timestamp = null; + boolean result; + + // default test + ToscaOperationFacade answer1 = Mockito.mock(ToscaOperationFacade.class); + ComponentMetadataData a = new ResourceMetadataData(); + a.getMetadataDataDefinition().setLastUpdateDate(1L); + Mockito.when(answer1.getComponentMetadata(Mockito.anyString())) + .thenReturn(Either.left(a)); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer1); + + result = Deencapsulation.invoke(testSubject, "updateCache", componentId, NodeTypeEnum.Resource, 0L); + } + + @Test + public void testUpdateCacheNotFound() throws Exception { + String componentId = "mock"; + NodeTypeEnum nodeTypeEnum = null; + Long timestamp = null; + boolean result; + + // default test + ToscaOperationFacade answer1 = Mockito.mock(ToscaOperationFacade.class); + Mockito.when(answer1.getComponentMetadata(Mockito.anyString())) + .thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND)); + Mockito.when(daoInfo.getToscaOperationFacade()).thenReturn(answer1); + + result = Deencapsulation.invoke(testSubject, "updateCache", componentId, NodeTypeEnum.Resource, 0L); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperationTest.java index c0ba256957..efa4020d0c 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperationTest.java @@ -1,6 +1,14 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -19,13 +27,7 @@ import org.openecomp.sdc.be.model.jsontitan.utils.IdMapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; +import fj.data.Either; /** * Created by yavivi on 26/01/2018. diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java index df92016f50..b7e6c1dc72 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java @@ -3,9 +3,6 @@ package org.openecomp.sdc.be.model.jsontitan.operations; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; -import fj.data.Either; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -15,7 +12,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; + import javax.annotation.Resource; + import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.junit.After; import org.junit.Assert; @@ -56,6 +55,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; + +import fj.data.Either; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:application-context-test.xml") public class InterfacesOperationTest extends ModelTestBase{ diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java index 971ebcca2b..65baa42e16 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java @@ -7,10 +7,7 @@ import static org.mockito.Mockito.when; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.BiPredicate; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.structure.T; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -19,41 +16,26 @@ import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition; import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.MapCapabiltyProperty; import org.openecomp.sdc.be.datatypes.elements.MapListCapabiltyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.ComponentInstanceInput; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; -import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.RelationshipImpl; import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import com.google.common.collect.Lists; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationIntegrationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationIntegrationTest.java index d4188744d8..6a257d33de 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationIntegrationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationIntegrationTest.java @@ -1,6 +1,15 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import static org.apache.commons.collections.ListUtils.union; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -26,14 +35,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import javax.annotation.Resource; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import static org.apache.commons.collections.ListUtils.union; -import static org.assertj.core.api.Assertions.assertThat; +import fj.data.Either; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TitanSpringConfig.class, ModelOperationsSpringConfig.class}) diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationTest.java index 136f95b987..23b6b3153d 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperationTest.java @@ -1,6 +1,13 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -19,13 +26,7 @@ import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.Arrays; -import java.util.Collections; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class PolicyOperationTest { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationCapabilityIntegrationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationCapabilityIntegrationTest.java index 103b27d3e6..325b4c9ef8 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationCapabilityIntegrationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationCapabilityIntegrationTest.java @@ -1,5 +1,14 @@ package org.openecomp.sdc.be.model.jsontitan.operations; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -23,14 +32,6 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import javax.annotation.Resource; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; - @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TitanSpringConfig.class, ModelOperationsSpringConfig.class}) public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTestBase { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationIntegrationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationIntegrationTest.java index d104cd3d42..d7a698654e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationIntegrationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationIntegrationTest.java @@ -1,5 +1,14 @@ package org.openecomp.sdc.be.model.jsontitan.operations; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -23,14 +32,6 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import javax.annotation.Resource; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; - @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TitanSpringConfig.class, ModelOperationsSpringConfig.class}) public class TopologyTemplateOperationIntegrationTest extends ModelTestBase { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationTest.java index 4559eb0f3e..e8655b5036 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperationTest.java @@ -1,6 +1,12 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.HashMap; import org.junit.Test; import org.junit.runner.RunWith; @@ -21,13 +27,7 @@ import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import com.thinkaurelius.titan.core.TitanVertex; -import java.util.Collections; -import java.util.HashMap; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) //error scenarios diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadePoliciesTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadePoliciesTest.java index 6a4a117360..9b31b0bfd7 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadePoliciesTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadePoliciesTest.java @@ -1,6 +1,16 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -25,16 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertTrue; +import fj.data.Either; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TitanSpringConfig.class, ModelOperationsSpringConfig.class}) diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java index 658165c126..46ef5f39f0 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java @@ -1,6 +1,19 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -24,19 +37,7 @@ import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class ToscaOperationFacadeTest { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java index 809134ecb6..15c5e6497f 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java @@ -1,6 +1,19 @@ package org.openecomp.sdc.be.model.operations.impl; -import fj.data.Either; +import static com.google.common.collect.Sets.newHashSet; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + import org.apache.tinkerpop.gremlin.structure.Edge; import org.junit.After; import org.junit.BeforeClass; @@ -21,16 +34,7 @@ import org.openecomp.sdc.be.resources.data.GroupTypeData; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.google.common.collect.Sets.newHashSet; -import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.*; +import fj.data.Either; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:application-context-test.xml") diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperationTest.java index f2d4a524ff..46db317707 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperationTest.java @@ -20,11 +20,13 @@ package org.openecomp.sdc.be.model.operations.impl; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.eq; import static org.mockito.Mockito.when; import java.util.ArrayList; @@ -43,7 +45,6 @@ import org.openecomp.sdc.be.model.HeatParameterDefinition; import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.heat.HeatParameterType; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.model.operations.impl.HeatParametersOperation; import org.openecomp.sdc.be.resources.data.HeatParameterData; import org.openecomp.sdc.be.resources.data.HeatParameterValueData; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java index c7e59006cf..355155561e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java @@ -20,9 +20,16 @@ package org.openecomp.sdc.be.model.operations.impl; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; -import fj.data.Either; +import static com.google.common.collect.Sets.newHashSet; +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Iterator; +import java.util.List; +import java.util.stream.Stream; + import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Before; @@ -44,15 +51,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.Iterator; -import java.util.List; -import java.util.stream.Stream; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; -import static com.google.common.collect.Sets.newHashSet; -import static java.util.Arrays.asList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import fj.data.Either; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:application-context-test.xml") diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java index c3e23ba001..612dd7bf21 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java @@ -34,7 +34,6 @@ import java.util.Map; import java.util.Set; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.structure.T; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -51,7 +50,6 @@ import org.openecomp.sdc.be.model.IComplexDefaultValue; import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.operations.api.DerivedFromOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.model.tosca.ToscaType; |