summaryrefslogtreecommitdiffstats
path: root/appc-sdc-listener/appc-sdc-listener-bundle
diff options
context:
space:
mode:
authorAbhai Singh <Abhai.Singh@amdocs.com>2017-09-25 17:39:30 +0530
committerSkip Wonnell <skip@att.com>2017-09-26 00:13:48 +0000
commit8b88bb6f258cf8af9d1658a0514eba6daa31f93c (patch)
treed3ea0bc85fa6fad3040cdf9bb785437b99f78b30 /appc-sdc-listener/appc-sdc-listener-bundle
parent34f7372f8a1c398b6af428d87fe6dfc3b8e4ffc8 (diff)
[APPC-232] Increase coverage of SDC Event Listener
Updated unit test in SdcCallbackTest Issue-Id :APPC-232 Change-Id: Ifa6d998d97de7637e9addc3c6e90984c3accc72d Signed-off-by: Abhai Singh <Abhai.Singh@amdocs.com>
Diffstat (limited to 'appc-sdc-listener/appc-sdc-listener-bundle')
-rw-r--r--appc-sdc-listener/appc-sdc-listener-bundle/src/test/java/org/openecomp/appc/sdc/listener/SdcCallbackTest.java34
1 files changed, 19 insertions, 15 deletions
diff --git a/appc-sdc-listener/appc-sdc-listener-bundle/src/test/java/org/openecomp/appc/sdc/listener/SdcCallbackTest.java b/appc-sdc-listener/appc-sdc-listener-bundle/src/test/java/org/openecomp/appc/sdc/listener/SdcCallbackTest.java
index 9e2a86051..66550acea 100644
--- a/appc-sdc-listener/appc-sdc-listener-bundle/src/test/java/org/openecomp/appc/sdc/listener/SdcCallbackTest.java
+++ b/appc-sdc-listener/appc-sdc-listener-bundle/src/test/java/org/openecomp/appc/sdc/listener/SdcCallbackTest.java
@@ -25,6 +25,7 @@
package org.openecomp.appc.sdc.listener;
import org.junit.Before;
+import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mockito;
@@ -32,6 +33,7 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.openecomp.appc.adapter.message.EventSender;
import org.openecomp.appc.sdc.artifacts.helper.ArtifactStorageService;
+import org.openecomp.appc.sdc.artifacts.helper.DependencyModelGenerator;
import org.openecomp.appc.sdc.artifacts.impl.ArtifactProcessorFactory;
import org.openecomp.appc.sdc.artifacts.impl.ToscaCsarArtifactProcessor;
import org.openecomp.appc.sdc.artifacts.object.SDCArtifact;
@@ -62,10 +64,11 @@ import java.util.List;
@RunWith(PowerMockRunner.class)
@PrepareForTest({IDistributionClient.class,
- EventSender.class,
- ArtifactStorageService.class,
- ToscaCsarArtifactProcessor.class,
- ArtifactProcessorFactory.class})
+ EventSender.class,
+ ArtifactStorageService.class,
+ ToscaCsarArtifactProcessor.class,
+ ArtifactProcessorFactory.class,
+ DependencyModelGenerator.class})
public class SdcCallbackTest {
IDistributionClient client;
@@ -85,11 +88,12 @@ public class SdcCallbackTest {
,getServiceArtifacts().get(0),null));
storageService = PowerMockito.mock(ArtifactStorageService.class);
Whitebox.setInternalState(artifactProcessor,"artifactStorageService", storageService);
-
+ DependencyModelGenerator dependencyModelGeneratorMock=PowerMockito.mock(DependencyModelGenerator.class);
+ Whitebox.setInternalState(artifactProcessor,"dependencyModelGenerator",dependencyModelGeneratorMock);
+ PowerMockito.when(dependencyModelGeneratorMock.getDependencyModel(Matchers.anyString(),Matchers.anyString())).thenReturn("Dependency_Model");
PowerMockito.doCallRealMethod().when(artifactProcessor).processArtifact((IDistributionClientDownloadResult) Matchers.anyObject());
PowerMockito.doCallRealMethod().when(artifactProcessor).run();
-
PowerMockito.mockStatic(ArtifactProcessorFactory.class);
PowerMockito.when(ArtifactProcessorFactory.getArtifactProcessor((IDistributionClient)Matchers.anyObject(), (EventSender)Matchers.anyObject(),
(INotificationData)Matchers.anyObject(), (IResourceInstance)Matchers.anyObject(),
@@ -124,23 +128,23 @@ public class SdcCallbackTest {
}
-// @Test
+ @Test
public void testSDCListener() throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException {
INotificationData notificationData = getNotificationData();
sdcCallback.activateCallback(notificationData);
-// pause();
+ pause();
}
-// private void pause(){
-// try {
-// Thread.sleep(50000000);
-// } catch (InterruptedException e) {
-// e.printStackTrace();
-// }
-// }
+ private void pause() {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
private INotificationData getNotificationData() throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {