aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
diff options
context:
space:
mode:
authorEinat Vinouze <einat.vinouze@intl.att.com>2020-05-18 12:59:57 +0300
committerEinat Vinouze <einat.vinouze@intl.att.com>2020-05-19 08:53:30 +0300
commit19016e3c0951ff994956e93b1c24e412a7ed542e (patch)
tree9459b6a941617cf9c7c90261d3305391f26dab50 /vid-app-common/src/test
parentaaec5296d2fa63828c320e4a3fb1e5ed0e168de2 (diff)
Introduce FeatureManager to ResourceCommand
Issue-ID: VID-821 Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com> Change-Id: Id6c663d4612d69a48b4a9425db082fb6c33e08b1 Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java36
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java24
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java59
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/VfmoduleCommandTest.kt3
6 files changed, 83 insertions, 47 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java
index 3f2bf7318..468fb41c3 100644
--- a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java
+++ b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java
@@ -174,8 +174,9 @@ public class JobCommandsConfigWithMockedMso {
InProgressStatusService inProgressStatusService,
WatchChildrenJobsBL watchChildrenJobsBL,
RestMsoImplementation restMso,
- AuditService auditService) {
- return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService);
+ AuditService auditService,
+ FeatureManager featureManager) {
+ return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService, featureManager);
}
@Bean
@@ -189,8 +190,9 @@ public class JobCommandsConfigWithMockedMso {
InProgressStatusService inProgressStatusService,
WatchChildrenJobsBL watchChildrenJobsBL,
RestMsoImplementation restMso,
- AuditService auditService) {
- return new MacroServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService);
+ AuditService auditService,
+ FeatureManager featureManager) {
+ return new MacroServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService, featureManager);
}
@@ -204,9 +206,10 @@ public class JobCommandsConfigWithMockedMso {
InProgressStatusService inProgressStatusService,
WatchChildrenJobsBL watchChildrenJobsBL,
JobsBrokerService jobsBrokerService,
- JobAdapter jobAdapter) {
+ JobAdapter jobAdapter,
+ FeatureManager featureManager) {
return new NetworkCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
- inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter);
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@@ -218,8 +221,10 @@ public class JobCommandsConfigWithMockedMso {
WatchChildrenJobsBL watchChildrenJobsBL,
RestMsoImplementation restMso,
JobsBrokerService jobsBrokerService,
- JobAdapter jobAdapter) {
- return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter);
+ JobAdapter jobAdapter,
+ FeatureManager featureManager) {
+ return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService,
+ watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager);
}
@Bean
@@ -232,9 +237,10 @@ public class JobCommandsConfigWithMockedMso {
WatchChildrenJobsBL watchChildrenJobsBL,
RestMsoImplementation restMso,
JobsBrokerService jobsBrokerService,
- JobAdapter jobAdapter) {
+ JobAdapter jobAdapter,
+ FeatureManager featureManager) {
return new InstanceGroupMemberCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService,
- watchChildrenJobsBL, jobsBrokerService, jobAdapter);
+ watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager);
}
@@ -265,9 +271,10 @@ public class JobCommandsConfigWithMockedMso {
InProgressStatusService inProgressStatusService,
WatchChildrenJobsBL watchChildrenJobsBL,
JobsBrokerService jobsBrokerService,
- JobAdapter jobAdapter) {
+ JobAdapter jobAdapter,
+ FeatureManager featureManager) {
return new VolumeGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
- inProgressStatusService, watchChildrenJobsBL, jobsBrokerService ,jobAdapter);
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService ,jobAdapter, featureManager);
}
@Bean
@@ -280,9 +287,10 @@ public class JobCommandsConfigWithMockedMso {
InProgressStatusService inProgressStatusService,
WatchChildrenJobsBL watchChildrenJobsBL,
JobsBrokerService jobsBrokerService,
- JobAdapter jobAdapter) {
+ JobAdapter jobAdapter,
+ FeatureManager featureManager) {
return new VfmoduleCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
- inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter);
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager);
}
@Bean
public AuditService auditService(RestMsoImplementation msoClient, AsyncInstantiationRepository asyncInstantiationRepository) {
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java
index c68c5f754..3817ac27a 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java
@@ -20,7 +20,19 @@
package org.onap.vid.job.command;
+import static java.util.function.Function.identity;
+import static java.util.stream.Collectors.toMap;
+import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.only;
+import static org.mockito.Mockito.same;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import com.google.common.collect.ImmutableMap;
+import java.util.Optional;
+import java.util.Set;
import org.apache.commons.beanutils.BeanUtils;
import org.mockito.Answers;
import org.mockito.InjectMocks;
@@ -39,15 +51,7 @@ import org.springframework.http.HttpMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-
-import java.util.Optional;
-import java.util.Set;
-
-import static java.util.function.Function.identity;
-import static java.util.stream.Collectors.toMap;
-import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.*;
+import org.togglz.core.manager.FeatureManager;
public class InstanceGroupCommandTest {
@@ -75,6 +79,8 @@ public class InstanceGroupCommandTest {
@Mock InProgressStatusService inProgressStatusService;
+ @Mock FeatureManager featureManager;
+
@InjectMocks
private InstanceGroupCommand command;
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java
index e4771611c..cf1322e21 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java
@@ -54,6 +54,7 @@ import org.onap.vid.services.AuditService;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
public class MacroServiceCommandTest {
@@ -84,6 +85,9 @@ public class MacroServiceCommandTest {
@Mock
private AuditService auditService;
+ @Mock
+ FeatureManager featureManager;
+
@InjectMocks
private MacroServiceCommand macroServiceCommand;
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
index 8d60b8477..9d466f4b3 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
@@ -81,6 +81,7 @@ import org.onap.vid.mso.model.ModelInfo;
import org.springframework.http.HttpMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
public class ResourceCommandTest {
@@ -97,7 +98,8 @@ public class ResourceCommandTest {
mock(MsoResultHandlerService.class, RETURNS_MOCKS),
mock(WatchChildrenJobsBL.class),
mock(JobsBrokerService.class, RETURNS_MOCKS),
- mock(JobAdapter.class, RETURNS_MOCKS));
+ mock(JobAdapter.class, RETURNS_MOCKS),
+ mock(FeatureManager.class));
this.mockedJobStatus = mockedJobStatus;
this.mockState = mockState;
this.mockPhase = mockPhase;
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java
index 992325049..463d720d2 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java
@@ -20,12 +20,45 @@
package org.onap.vid.job.command;
+import static java.util.Collections.emptyList;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.core.Is.is;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.vid.job.Job.JobStatus.COMPLETED;
+import static org.onap.vid.job.Job.JobStatus.COMPLETED_WITH_NO_ACTION;
+import static org.onap.vid.job.Job.JobStatus.IN_PROGRESS;
+import static org.onap.vid.job.command.ResourceCommandKt.ACTION_PHASE;
+import static org.onap.vid.job.command.ResourceCommandKt.CHILD_JOBS;
+import static org.onap.vid.job.command.ResourceCommandKt.INTERNAL_STATE;
+import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createNetwork;
+import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createService;
+import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createVnf;
+import static org.onap.vid.model.Action.Create;
+import static org.onap.vid.testUtils.TestUtils.testWithSystemProperty;
+import static org.testng.AssertJUnit.assertEquals;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import java.time.Instant;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
+import java.util.Arrays;
+import java.util.UUID;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.onap.vid.job.*;
+import org.onap.vid.job.Job;
+import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobType;
+import org.onap.vid.job.JobsBrokerService;
+import org.onap.vid.job.NextCommand;
import org.onap.vid.job.impl.JobSharedData;
import org.onap.vid.model.Action;
import org.onap.vid.model.serviceInstantiation.Network;
@@ -42,27 +75,6 @@ import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.togglz.core.manager.FeatureManager;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.temporal.ChronoUnit;
-import java.util.Arrays;
-import java.util.UUID;
-
-import static java.util.Collections.emptyList;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.hamcrest.core.Is.is;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
-import static org.onap.vid.job.Job.JobStatus.*;
-import static org.onap.vid.job.command.ResourceCommandKt.*;
-import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.*;
-import static org.onap.vid.model.Action.Create;
-import static org.onap.vid.testUtils.TestUtils.testWithSystemProperty;
-import static org.testng.AssertJUnit.assertEquals;
-
public class ServiceInProgressStatusCommandTest {
@@ -134,7 +146,8 @@ public class ServiceInProgressStatusCommandTest {
msoResultHandlerService,
jobAdapter,
restMsoImplementation,
- auditService
+ auditService,
+ featureManager
);
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/VfmoduleCommandTest.kt b/vid-app-common/src/test/java/org/onap/vid/job/command/VfmoduleCommandTest.kt
index ea67f2372..3d8ec94f7 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/VfmoduleCommandTest.kt
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/VfmoduleCommandTest.kt
@@ -14,6 +14,7 @@ import org.onap.vid.services.AsyncInstantiationBusinessLogic
import org.onap.vid.testUtils.TestUtils.initMockitoMocks
import org.testng.annotations.BeforeMethod
import org.testng.annotations.Test
+import org.togglz.core.manager.FeatureManager
class VfmoduleCommandTest {
@@ -25,6 +26,8 @@ class VfmoduleCommandTest {
@Mock lateinit var watchChildrenJobsBL: WatchChildrenJobsBL;
@Mock lateinit var jobsBrokerService: JobsBrokerService;
@Mock lateinit var jobAdapter: JobAdapter;
+ @Mock lateinit var featureManager: FeatureManager;
+
@InjectMocks lateinit var vfModuleCommand: VfmoduleCommand;