summaryrefslogtreecommitdiffstats
path: root/controlloop/common/rules-test/src
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/rules-test/src')
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java6
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/NamedRunner.java5
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Rules.java16
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Topics.java4
4 files changed, 15 insertions, 16 deletions
diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
index 9a82389be..4e4fb829c 100644
--- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
+++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
@@ -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.
@@ -206,7 +206,7 @@ public abstract class BaseTest {
waitForLockAndPermit(policy, policyClMgt);
// restart request should be sent and fail four times (i.e., because retry=3)
- for (int count = 0; count < 4; ++count) {
+ for (var count = 0; count < 4; ++count) {
AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName()));
topics.inject(APPC_LCM_WRITE_TOPIC, SERVICE123_APPC_RESTART_FAILURE,
@@ -258,7 +258,7 @@ public abstract class BaseTest {
topics.inject(DCAE_TOPIC, DUPLICATES_ONSET_1, UUID.randomUUID().toString());
// should see two restarts
- for (int count = 0; count < 2; ++count) {
+ for (var count = 0; count < 2; ++count) {
AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName()));
// indicate success
diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/NamedRunner.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/NamedRunner.java
index 1cbe5a56a..5642f35fd 100644
--- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/NamedRunner.java
+++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/NamedRunner.java
@@ -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.
@@ -21,7 +21,6 @@
package org.onap.policy.controlloop.common.rules.test;
import org.junit.Ignore;
-import org.junit.runner.Description;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
@@ -41,7 +40,7 @@ public class NamedRunner extends BlockJUnit4ClassRunner {
@Override
protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
- Description description = describeChild(method);
+ var description = describeChild(method);
if (method.getAnnotation(Ignore.class) != null) {
notifier.fireTestIgnored(description);
diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Rules.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Rules.java
index 1b8f94cae..06eab0d88 100644
--- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Rules.java
+++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Rules.java
@@ -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.
@@ -113,10 +113,10 @@ public class Rules {
pdpdRepo.setConfigurationDir("src/test/resources/config");
try {
- File kmoduleFile = new File(resourceDir + "/META-INF/kmodule.xml");
- File pomFile = new File("src/test/resources/" + controllerName + ".pom");
- String resourceDir2 = resourceDir + "/org/onap/policy/controlloop/";
- File ruleFile = new File(resourceDir + File.separator + controllerName + ".drl");
+ var kmoduleFile = new File(resourceDir + "/META-INF/kmodule.xml");
+ var pomFile = new File("src/test/resources/" + controllerName + ".pom");
+ var resourceDir2 = resourceDir + "/org/onap/policy/controlloop/";
+ var ruleFile = new File(resourceDir + File.separator + controllerName + ".drl");
List<File> ruleFiles = Collections.singletonList(ruleFile);
installArtifact(kmoduleFile, pomFile, resourceDir2, ruleFiles);
@@ -183,7 +183,7 @@ public class Rules {
}
private ToscaPolicy getPolicyFromTemplate(String resourcePath, String policyName) throws CoderException {
- String policyJson = ResourceUtils.getResourceAsString(resourcePath);
+ var policyJson = ResourceUtils.getResourceAsString(resourcePath);
if (policyJson == null) {
throw new CoderException(new FileNotFoundException(resourcePath));
}
@@ -227,7 +227,7 @@ public class Rules {
* Get policy from file.
*/
public static ToscaPolicy getPolicyFromFile(String policyPath) throws CoderException {
- String policyJson = ResourceUtils.getResourceAsString(policyPath);
+ var policyJson = ResourceUtils.getResourceAsString(policyPath);
if (policyJson == null) {
throw new CoderException(new FileNotFoundException(policyPath));
}
@@ -267,7 +267,7 @@ public class Rules {
* Sets up Drools Logging for events of interest.
*/
private void setupDroolsLogging() {
- KieSession session = getKieSession();
+ var session = getKieSession();
session.addEventListener(new RuleListenerLogger());
session.addEventListener(new AgendaListenerLogger());
diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Topics.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Topics.java
index f71559acb..ff3abed48 100644
--- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Topics.java
+++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Topics.java
@@ -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.
@@ -85,7 +85,7 @@ public class Topics {
*/
public void inject(String topicName, String file, String newText) {
try {
- String text = ResourceUtils.getResourceAsString(file);
+ var text = ResourceUtils.getResourceAsString(file);
if (text == null) {
throw new FileNotFoundException(file);
}