diff options
author | 2019-05-13 11:53:08 -0400 | |
---|---|---|
committer | 2019-05-15 15:38:03 +0000 | |
commit | 250b5b2a4ad4020df9c0dd053743d28616e28485 (patch) | |
tree | 4be9f1cf7994720bb03a51f2ddc53fe58e325834 /ms/sdclistener/application/src/test | |
parent | 5acce93a0594a249d972c2871a0631021d95de35 (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.java | 16 |
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 |