More sonars in drools-apps 22/117722/1
authorJim Hahn <jrh3@att.com>
Wed, 10 Feb 2021 22:07:25 +0000 (17:07 -0500)
committerJim Hahn <jrh3@att.com>
Wed, 10 Feb 2021 22:13:44 +0000 (17:13 -0500)
Addressed the following issues:
- commented-out code
- don't use eq() with verify()
- use class::cast lambda

Issue-ID: POLICY-2910
Change-Id: I12f4f85fb226f3ddb8305105e988fa90e276e9f6
Signed-off-by: Jim Hahn <jrh3@att.com>
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/LockDataTest.java
controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java

index 153b081..39c32fa 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -47,9 +47,6 @@ public class ControlLoopProcessor implements Serializable {
     @Getter
     private transient ToscaPolicy toscaOpPolicy;
 
-    //@Getter
-    //private ControlLoop controlLoop;
-
     /**
      * Construct an instance from yaml.
      *
index 164dfb4..4adb59e 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
@@ -186,8 +185,8 @@ public class LockDataTest {
         assertNotNull(end);
         assertTrue(start.compareTo(end) <= 0);
 
-        verify(callback1).accept(eq(outcome));
-        verify(callback2).accept(eq(outcome));
-        verify(callback3).accept(eq(outcome));
+        verify(callback1).accept(outcome);
+        verify(callback2).accept(outcome);
+        verify(callback3).accept(outcome);
     }
 }
index b814c6f..3c7afb7 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ public class ControlLoopManagementFeature implements PolicyEngineFeatureApi {
             .facts(sessionName, ControlLoopParams.class.getName(), false)
             .stream()
             .filter(c -> c instanceof ControlLoopParams)
-            .map(c -> (ControlLoopParams) c);
+            .map(ControlLoopParams.class::cast);
     }
 
     /**