diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-07-26 12:00:59 -0400 |
---|---|---|
committer | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-07-28 15:44:01 -0400 |
commit | daab14bd058de198c80b71d63e108fd788b7f5ee (patch) | |
tree | 252cfdef5b2e1500e5bd152f3f5c52602b6b0deb /ms/sdclistener | |
parent | 82e396d6917519468376d177dd6a2710e84fa23a (diff) |
Revert "Renaming Files having BluePrint to have Blueprint"
The renaming in CCSDK-3098 caused breaking changes to the grpc api and
compile issues for kotlin scripts.
Issue-ID: CCSDK-3385
Change-Id: I0d745cb858371678eabcb2284671c1fd76a1ab6d
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Diffstat (limited to 'ms/sdclistener')
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java | 4 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java (renamed from ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcesssorHandler.java) | 20 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java | 4 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java | 20 | ||||
-rw-r--r-- | ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java (renamed from ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcessorHandlerTest.java) | 32 | ||||
-rw-r--r-- | ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java | 12 |
6 files changed, 46 insertions, 46 deletions
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java index 45fb36736..b8868325a 100644 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java @@ -122,13 +122,13 @@ public class SdcListenerNotificationCallback implements INotificationCallback { final String archivePath = cbaArchivePath.toString(); // Extract CBA archive from CSAR package and store it into local disk - csarFiles.forEach(file -> listenerService.extractBlueprint(file.getAbsolutePath(), archivePath)); + csarFiles.forEach(file -> listenerService.extractBluePrint(file.getAbsolutePath(), archivePath)); csarFiles.forEach(file -> FileUtil.deleteFile(file, csarArchivePath.toString())); } else { LOGGER.error("Could not able to read CSAR files from this location {}", csarArchivePath); } - listenerService.saveBlueprintToCdsDatabase(cbaArchivePath, sdcListenerDto.getManagedChannelForGrpc()); + listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, sdcListenerDto.getManagedChannelForGrpc()); } } diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcesssorHandler.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java index 41475cd6b..b80dd260d 100644 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcesssorHandler.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java @@ -18,10 +18,10 @@ package org.onap.ccsdk.cds.sdclistener.handler; import io.grpc.ManagedChannel; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementOutput; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementServiceGrpc; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementServiceGrpc.BlueprintManagementServiceBlockingStub; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintUploadInput; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc.BluePrintManagementServiceBlockingStub; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -29,29 +29,29 @@ import org.springframework.stereotype.Component; @ConfigurationProperties("listenerservice") @Component -public class BlueprintProcesssorHandler implements AutoCloseable { +public class BluePrintProcesssorHandler implements AutoCloseable { - private static final Logger LOGGER = LoggerFactory.getLogger(BlueprintProcesssorHandler.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BluePrintProcesssorHandler.class); private ManagedChannel channel; /** * Sending CBA archive to CDS backend to store into its Database. * - * @param request BlueprintManagementInput object holds CBA archive, its version and blueprints. + * @param request BluePrintManagementInput object holds CBA archive, its version and blueprints. * @param managedChannel - ManagedChannel object helps to access the server or application end point. * * @return A response object */ - public Status sendRequest(BlueprintUploadInput request, ManagedChannel managedChannel) { + public Status sendRequest(BluePrintUploadInput request, ManagedChannel managedChannel) { LOGGER.info("Sending request to blueprint processor"); this.channel = managedChannel; - final BlueprintManagementServiceBlockingStub syncStub = BlueprintManagementServiceGrpc.newBlockingStub(channel); + final BluePrintManagementServiceBlockingStub syncStub = BluePrintManagementServiceGrpc.newBlockingStub(channel); // Send the request to CDS backend. - final BlueprintManagementOutput response = syncStub.uploadBlueprint(request); + final BluePrintManagementOutput response = syncStub.uploadBlueprint(request); return response.getStatus(); } diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java index 231054f06..5fa3fb327 100644 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java @@ -29,7 +29,7 @@ public interface ListenerService { * @param csarArchivePath The path where CSAR archive is stored. * @param cbaArchivePath The destination path where CBA will be stored. */ - void extractBlueprint(String csarArchivePath, String cbaArchivePath); + void extractBluePrint(String csarArchivePath, String cbaArchivePath); /** * Store the Zip file into CDS database. @@ -37,7 +37,7 @@ public interface ListenerService { * @param path path where zip file exists. * @param managedChannel To access the blueprint processor application end point */ - void saveBlueprintToCdsDatabase(Path path, ManagedChannel managedChannel); + void saveBluePrintToCdsDatabase(Path path, ManagedChannel managedChannel); /** * Extract and store the csar package to local disk. diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java index 1aebd74b8..ee27a9475 100644 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java @@ -23,12 +23,12 @@ import org.apache.commons.io.IOUtils; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintUploadInput; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput; import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk; import org.onap.ccsdk.cds.controllerblueprints.management.api.UploadAction; 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.handler.BluePrintProcesssorHandler; import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; import org.onap.ccsdk.cds.sdclistener.util.FileUtil; import org.onap.sdc.api.results.IDistributionClientDownloadResult; @@ -64,7 +64,7 @@ import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK; public class ListenerServiceImpl implements ListenerService { @Autowired - private BlueprintProcesssorHandler bluePrintProcesssorHandler; + private BluePrintProcesssorHandler bluePrintProcesssorHandler; @Autowired private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor; @@ -87,7 +87,7 @@ public class ListenerServiceImpl implements ListenerService { private static final Logger LOGGER = LoggerFactory.getLogger(ListenerServiceImpl.class); @Override - public void extractBlueprint(String csarArchivePath, String cbaArchivePath) { + public void extractBluePrint(String csarArchivePath, String cbaArchivePath) { int validPathCount = 0; final String distributionId = getDistributionId(); final String artifactUrl = getArtifactUrl(); @@ -101,7 +101,7 @@ public class ListenerServiceImpl implements ListenerService { validPathCount++; final String cbaArchiveName = Paths.get(fileName).getFileName().toString(); LOGGER.info("Storing the CBA archive {}", cbaArchiveName); - storeBlueprint(zipFile, cbaArchiveName, cbaStorageDir, entry); + storeBluePrint(zipFile, cbaArchiveName, cbaStorageDir, entry); } } @@ -121,7 +121,7 @@ public class ListenerServiceImpl implements ListenerService { } } - private void storeBlueprint(ZipFile zipFile, String fileName, Path cbaArchivePath, ZipEntry entry) { + private void storeBluePrint(ZipFile zipFile, String fileName, Path cbaArchivePath, ZipEntry entry) { Path targetLocation = cbaArchivePath.resolve(fileName); LOGGER.info("The target location for zip file is {}", targetLocation); File targetZipFile = new File(targetLocation.toString()); @@ -144,7 +144,7 @@ public class ListenerServiceImpl implements ListenerService { } @Override - public void saveBlueprintToCdsDatabase(Path cbaArchivePath, ManagedChannel channel) { + public void saveBluePrintToCdsDatabase(Path cbaArchivePath, ManagedChannel channel) { List<File> zipFiles = FileUtil.getFilesFromDisk(cbaArchivePath); if (!zipFiles.isEmpty()) { prepareRequestForCdsBackend(zipFiles, channel, cbaArchivePath.toString()); @@ -193,7 +193,7 @@ public class ListenerServiceImpl implements ListenerService { files.forEach(zipFile -> { try { - final BlueprintUploadInput request = generateBlueprintUploadInputBuilder(zipFile, path); + final BluePrintUploadInput request = generateBluePrintUploadInputBuilder(zipFile, path); // Send request to CDS Backend. final Status responseStatus = bluePrintProcesssorHandler.sendRequest(request, managedChannel); @@ -219,11 +219,11 @@ public class ListenerServiceImpl implements ListenerService { }); } - private BlueprintUploadInput generateBlueprintUploadInputBuilder(File file, String path) throws IOException { + private BluePrintUploadInput generateBluePrintUploadInputBuilder(File file, String path) throws IOException { byte[] bytes = FileUtils.readFileToByteArray(file); FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build(); FileUtil.deleteFile(file, path); - return BlueprintUploadInput.newBuilder() + return BluePrintUploadInput.newBuilder() .setCommonHeader(CommonHeader.newBuilder().setRequestId(UUID.randomUUID().toString()) .setSubRequestId(UUID.randomUUID().toString()).setOriginatorId("SDC-LISTENER").build()) .setActionIdentifiers( diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcessorHandlerTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java index b48a98e15..7cde45d9e 100644 --- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcessorHandlerTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java @@ -30,9 +30,9 @@ import org.junit.runner.RunWith; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementOutput; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementServiceGrpc.BlueprintManagementServiceImplBase; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintUploadInput; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput; import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk; import org.onap.ccsdk.cds.controllerblueprints.management.api.UploadAction; import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor; @@ -50,12 +50,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @RunWith(SpringRunner.class) -@EnableConfigurationProperties({BlueprintProcesssorHandler.class, SdcListenerAuthClientInterceptor.class}) -@SpringBootTest(classes = {BlueprintProcessorHandlerTest.class}) -public class BlueprintProcessorHandlerTest { +@EnableConfigurationProperties({BluePrintProcesssorHandler.class, SdcListenerAuthClientInterceptor.class}) +@SpringBootTest(classes = {BluePrintProcessorHandlerTest.class}) +public class BluePrintProcessorHandlerTest { @Autowired - private BlueprintProcesssorHandler bluePrintProcesssorHandler; + private BluePrintProcesssorHandler bluePrintProcesssorHandler; @Autowired private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor; @@ -70,11 +70,11 @@ public class BlueprintProcessorHandlerTest { @Before public void setUp() throws IOException { - final BlueprintManagementServiceImplBase serviceImplBase = new BlueprintManagementServiceImplBase() { + final BluePrintManagementServiceImplBase serviceImplBase = new BluePrintManagementServiceImplBase() { @Override - public void uploadBlueprint(BlueprintUploadInput request, - StreamObserver<BlueprintManagementOutput> responseObserver) { - responseObserver.onNext(getBlueprintManagementOutput()); + public void uploadBlueprint(BluePrintUploadInput request, + StreamObserver<BluePrintManagementOutput> responseObserver) { + responseObserver.onNext(getBluePrintManagementOutput()); responseObserver.onCompleted(); } }; @@ -93,7 +93,7 @@ public class BlueprintProcessorHandlerTest { @Test public void testApplicationEndPointSucess() throws IOException { // Arrange - BlueprintUploadInput request = generateRequest(); + BluePrintUploadInput request = generateRequest(); // Act Status output = bluePrintProcesssorHandler.sendRequest(request, channel); @@ -103,12 +103,12 @@ public class BlueprintProcessorHandlerTest { assertTrue(output.getMessage().contains(SUCCESS_MSG)); } - private BlueprintUploadInput generateRequest() throws IOException { + private BluePrintUploadInput generateRequest() throws IOException { File file = Paths.get(CBA_ARCHIVE).toFile(); byte[] bytes = FileUtils.readFileToByteArray(file); FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build(); - return BlueprintUploadInput.newBuilder() + return BluePrintUploadInput.newBuilder() .setCommonHeader(CommonHeader.newBuilder().setRequestId(UUID.randomUUID().toString()) .setSubRequestId(UUID.randomUUID().toString()).setOriginatorId("SDC-LISTENER").build()) .setActionIdentifiers( @@ -116,8 +116,8 @@ public class BlueprintProcessorHandlerTest { .setFileChunk(fileChunk).build(); } - private BlueprintManagementOutput getBlueprintManagementOutput() { - return BlueprintManagementOutput.newBuilder() + private BluePrintManagementOutput getBluePrintManagementOutput() { + return BluePrintManagementOutput.newBuilder() .setStatus(Status.newBuilder().setMessage(SUCCESS_MSG).setCode(200).build()).build(); } 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 2e55c8e25..4179ccab0 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 @@ -29,7 +29,7 @@ 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.handler.BluePrintProcesssorHandler; import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; import org.onap.sdc.api.results.IDistributionClientDownloadResult; import org.onap.sdc.impl.mock.DistributionClientResultStubImpl; @@ -50,7 +50,7 @@ import static org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.Notificati import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK; @RunWith(SpringRunner.class) -@EnableConfigurationProperties({SdcListenerAuthClientInterceptor.class, BlueprintProcesssorHandler.class, +@EnableConfigurationProperties({SdcListenerAuthClientInterceptor.class, BluePrintProcesssorHandler.class, SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class, SdcListenerConfiguration.class}) @SpringBootTest(classes = {ListenerServiceImplTest.class}) public class ListenerServiceImplTest { @@ -90,9 +90,9 @@ public class ListenerServiceImplTest { } @Test - public void extractBlueprintSuccessfully() throws IOException { + public void extractBluePrintSuccessfully() throws IOException { // Act - listenerService.extractBlueprint(CSAR_SAMPLE, tempDirectoryPath.toString()); + listenerService.extractBluePrint(CSAR_SAMPLE, tempDirectoryPath.toString()); // Verify. String result = checkFileExists(tempDirectoryPath); @@ -100,7 +100,7 @@ public class ListenerServiceImplTest { } @Test - public void extractBlueprintFailure() { + public void extractBluePrintFailure() { // Arrange Mockito.when(listenerDto.getDistributionId()).thenReturn(DISTRIBUTION_ID); Mockito.when(listenerDto.getArtifactUrl()).thenReturn(URL); @@ -108,7 +108,7 @@ public class ListenerServiceImplTest { SDC_LISTENER_COMPONENT); // Act - listenerService.extractBlueprint(WRONG_CSAR_SAMPLE, tempDirectoryPath.toString()); + listenerService.extractBluePrint(WRONG_CSAR_SAMPLE, tempDirectoryPath.toString()); // Verify Mockito.verify(status).sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, |