summaryrefslogtreecommitdiffstats
path: root/ms/sdclistener/application/src/test
diff options
context:
space:
mode:
authorprathamesh morde <prathamesh.morde@bell.ca>2019-05-13 11:53:08 -0400
committerAlexis de Talhouƫt <adetalhouet89@gmail.com>2019-05-15 15:39:17 +0000
commitd5a428efae211b281caeffe1cec9eaa34b92ecb9 (patch)
tree22ee734e7ae141bf0a0b082a97a9b2ef0295f89e /ms/sdclistener/application/src/test
parentc6bc12d878753aceb887838b926666595d480a86 (diff)
Upates in sdc-listener notification part.
-Added COMPOENT_DONE_OK status if sdc-listener fails to parse the CBA archive. -Make use of IComponentDoneStatusMessage instead of IFinalDistrStatusMessage. -Added DownloadStausMessage to handle download CSAR notification. -Change the sli-version in blueprint-processor to 0.5.0-SNAPSHOT. Change-Id: Ie6bb0569e6daffb13e06532f670aac27af1f935e Issus-ID:CCSDK-1319 Signed-off-by: prathamesh morde <prathamesh.morde@bell.ca>
Diffstat (limited to 'ms/sdclistener/application/src/test')
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
index aed4b8b30..ecb753892 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
@@ -16,13 +16,14 @@
package org.onap.ccsdk.cds.sdclistener.service;
import static junit.framework.TestCase.assertTrue;
+import static org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.NotificationType.SDC_LISTENER_COMPONENT;
import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_ERROR;
+import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import mockit.Mock;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Rule;
@@ -31,18 +32,16 @@ import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.mockito.internal.junit.JUnitRule;
import org.mockito.junit.MockitoJUnit;
-import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.MockitoRule;
import org.onap.ccsdk.cds.sdclistener.SdcListenerConfiguration;
import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
import org.onap.ccsdk.cds.sdclistener.handler.BluePrintProcesssorHandler;
import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus;
+import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.NotificationType;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
import org.onap.sdc.impl.mock.DistributionClientResultStubImpl;
-import org.onap.sdc.utils.DistributionStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
@@ -62,6 +61,7 @@ public class ListenerServiceImplTest {
private static final String ZIP_FILE = ".zip";
private static final String CSAR_FILE = ".csar";
private static final String DISTRIBUTION_ID = "1";
+ private static final String URL = "/sdc/v1/artifact";
private String csarArchivePath;
@@ -94,7 +94,7 @@ public class ListenerServiceImplTest {
// Act
listenerService.extractBluePrint(CSAR_SAMPLE, tempDirectoryPath.toString());
- // Verify
+ // Verify.
String result = checkFileExists(tempDirectoryPath);
assertTrue(result.contains(ZIP_FILE));
}
@@ -105,14 +105,16 @@ public class ListenerServiceImplTest {
final String errorMessage = String
.format("The CBA Archive doesn't exist as per this given regex %s", CBA_ZIP_PATH);
Mockito.when(listenerDto.getDistributionId()).thenReturn(DISTRIBUTION_ID);
+ Mockito.when(listenerDto.getArtifactUrl()).thenReturn(URL);
Mockito.doCallRealMethod().when(status)
- .sendResponseStatusBackToSDC(DISTRIBUTION_ID, COMPONENT_DONE_ERROR, errorMessage);
+ .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT);
// Act
listenerService.extractBluePrint(WRONG_CSAR_SAMPLE, tempDirectoryPath.toString());
// Verify
- Mockito.verify(status).sendResponseStatusBackToSDC(DISTRIBUTION_ID, COMPONENT_DONE_ERROR, errorMessage);
+ Mockito.verify(status)
+ .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT);
}
@Test