aboutsummaryrefslogtreecommitdiffstats
path: root/policy-utils/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-06-19 14:32:10 -0400
committerJim Hahn <jrh3@att.com>2020-06-19 15:44:28 -0400
commit56a15039437ba5bf5d0fb422551bfb12e1f59eb1 (patch)
tree1fc57df4d9462790d4c4dd811425ab029d8ec710 /policy-utils/src
parent1d810e0be1188c07ec9292b348c9d286f36963d9 (diff)
Address checkstyle version issues in drools-pdp
Also added serializationId to several classes to address eclipse warnings. Issue-ID: POLICY-2188 Change-Id: I3df5e8abaad8da9261c0d5cd19a93ed68dceb870 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-utils/src')
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/Pair.java8
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/PropertyUtil.java7
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/Triple.java8
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java18
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java26
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java2
6 files changed, 34 insertions, 35 deletions
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/Pair.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/Pair.java
index d044ca6f..c37084f4 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/Pair.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/Pair.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,11 +20,11 @@
package org.onap.policy.drools.utils;
-public class Pair<F,S> {
+public class Pair<F, S> {
protected F first;
protected S second;
-
+
public Pair(F first, S second) {
this.first = first;
this.second = second;
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/PropertyUtil.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/PropertyUtil.java
index e6195fa4..4d287170 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/PropertyUtil.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/PropertyUtil.java
@@ -330,8 +330,7 @@ public class PropertyUtil {
public void run() {
try {
poll();
- }
- catch (Exception e) {
+ } catch (Exception e) {
logger.warn("Polling for property changes", e);
}
}
@@ -347,7 +346,7 @@ public class PropertyUtil {
*/
synchronized Properties addListener(Listener listener) {
listeners.add(listener);
- return (Properties)properties.clone();
+ return (Properties) properties.clone();
}
/**
@@ -420,7 +419,7 @@ public class PropertyUtil {
// Copy 'properties' and 'changedProperties', so it doesn't
// cause problems if the recipient makes changes.
final Properties tmpProperties =
- (Properties)(properties.clone());
+ (Properties) properties.clone();
final HashSet<String> tmpChangedProperties =
new HashSet<>(changedProperties);
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/Triple.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/Triple.java
index 04817346..d37a5d92 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/Triple.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/Triple.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,7 @@
package org.onap.policy.drools.utils;
-public class Triple<F,S,T> {
+public class Triple<F, S, T> {
private F first;
private S second;
@@ -32,7 +32,7 @@ public class Triple<F,S,T> {
/**
* Constructor.
- *
+ *
* @param first first
* @param second second
* @param third third
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java
index ee376ba8..ca792a1c 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,11 +26,11 @@ import static org.junit.Assert.assertNotNull;
import org.junit.Test;
public class PairTripleTest {
-
+
@Test
public void testPair() {
Pair<String, String> pair = new Pair<String, String>("foo", "bar");
-
+
assertEquals("foo", pair.first());
assertEquals("bar", pair.second());
assertEquals("foo", pair.getFirst());
@@ -45,13 +45,13 @@ public class PairTripleTest {
assertEquals("two", pair.getSecond());
assertNotNull(pair.toString());
-
- }
+
+ }
@Test
public void testTriple() {
- Triple<String, String, String> triple = new Triple<String, String,String>("foo", "bar", "fiz");
-
+ Triple<String, String, String> triple = new Triple<String, String, String>("foo", "bar", "fiz");
+
assertEquals("foo", triple.first());
assertEquals("bar", triple.second());
assertEquals("fiz", triple.third());
@@ -62,7 +62,7 @@ public class PairTripleTest {
assertEquals("one", triple.first());
assertEquals("two", triple.second());
- assertEquals("three", triple.third());
+ assertEquals("three", triple.third());
}
}
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java
index efcef272..b7feaf06 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,38 +29,38 @@ import static org.junit.Assert.fail;
import org.junit.Test;
public class ReflectionUtilTest {
-
+
public class ParentClass {
}
-
+
public class ChildClass extends ParentClass{
}
@Test
public void testReflection() {
-
+
try {
Class<?> class1 = Class.forName("org.onap.policy.drools.utils.ReflectionUtil");
-
+
ClassLoader classLoader = class1.getClassLoader();
-
+
Class<?> class2 = ReflectionUtil.fetchClass(classLoader, "org.onap.policy.drools.utils.ReflectionUtil");
-
-
+
+
assertTrue(ReflectionUtil.isClass(classLoader, "org.onap.policy.drools.utils.ReflectionUtil"));
- assertEquals(class1,class2);
+ assertEquals(class1, class2);
assertTrue(ReflectionUtil.isSubclass(ParentClass.class, ChildClass.class));
assertFalse(ReflectionUtil.isSubclass(ChildClass.class, ParentClass.class));
-
-
+
+
} catch (ClassNotFoundException e) {
fail();
}
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testException1() {
ReflectionUtil.fetchClass(null, "org.onap.policy.drools.utils.ReflectionUtil");
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
index 4a7da81c..dbf6a67c 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
@@ -169,7 +169,7 @@ public class MdcTransactionTest {
MDC.get(MdcTransactionConstants.ELAPSED_TIME));
assertEquals(trans.getServiceInstanceId(), MDC.get(MdcTransactionConstants.SERVICE_INSTANCE_ID));
assertEquals(trans.getInstanceUuid(), MDC.get(MdcTransactionConstants.INSTANCE_UUID));
- assertEquals(trans.getProcessKey(),MDC.get(MdcTransactionConstants.PROCESS_KEY));
+ assertEquals(trans.getProcessKey(), MDC.get(MdcTransactionConstants.PROCESS_KEY));
assertEquals(trans.getStatusCode(), MDC.get(MdcTransactionConstants.STATUS_CODE));
assertEquals(trans.getResponseCode(), MDC.get(MdcTransactionConstants.RESPONSE_CODE));
assertEquals(trans.getResponseDescription(), MDC.get(MdcTransactionConstants.RESPONSE_DESCRIPTION));