Fix sonar code smells 20/129520/2
authoremaclee <lee.anjella.macabuhay@est.tech>
Wed, 8 Jun 2022 10:41:59 +0000 (11:41 +0100)
committeremaclee <lee.anjella.macabuhay@est.tech>
Fri, 10 Jun 2022 09:31:44 +0000 (10:31 +0100)
- Remove this unused method parameter "operation"
(https://sonarcloud.io/project/issues?resolved=false&types=CODE_SMELL&id=onap_cps-ncmp-dmi-plugin&open=AYEgIe-wVOe7T_lfxJBt)

- Change method to private

Issue-ID: CPS-475
Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech>
Change-Id: I07e9b8150da935387f2a63c5b0e622d5157412de

src/main/java/org/onap/cps/ncmp/dmi/notifications/async/AsyncTaskExecutor.java
src/test/groovy/org/onap/cps/ncmp/dmi/notifications/async/AsyncTaskExecutorIntegrationSpec.groovy

index 7189f6c..6a1c6d1 100644 (file)
@@ -78,7 +78,7 @@ public class AsyncTaskExecutor {
                     publishAsyncEvent(topicName, requestId, resourceDataAsJson, status, code);
                 } else {
                     log.error("Error occurred with async request {}", throwable.getMessage());
-                    publishAsyncFailureEvent(topicName, requestId, operation, throwable);
+                    publishAsyncFailureEvent(topicName, requestId, throwable);
                 }
             });
         log.info("Async task completed.");
@@ -95,9 +95,8 @@ public class AsyncTaskExecutor {
         dmiAsyncRequestResponseEventProducer.sendMessage(requestId, cpsAsyncRequestResponseEvent);
     }
 
-    protected void publishAsyncFailureEvent(final String topicName,
+    private void publishAsyncFailureEvent(final String topicName,
                                             final String requestId,
-                                            final DataAccessRequest.OperationEnum operation,
                                             final Throwable throwable) {
         HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
 
index 54c0fe0..b377a37 100644 (file)
@@ -117,7 +117,7 @@ class AsyncTaskExecutorIntegrationSpec extends Specification {
     def 'Publish and Subscribe message - failure'() {
         when: 'a failure event is published'
             def exception = new HttpClientRequestException('some cm handle', 'Node not found', HttpStatus.INTERNAL_SERVER_ERROR)
-            objectUnderTest.publishAsyncFailureEvent(TEST_TOPIC, '67890', DataAccessRequest.OperationEnum.READ, exception)
+            objectUnderTest.publishAsyncFailureEvent(TEST_TOPIC, '67890', exception)
         and: 'the topic is polled'
             def records = consumer.poll(Duration.ofMillis(1500))
         then: 'the record received is the event sent'