aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java39
-rw-r--r--controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.java4
-rw-r--r--controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java6
-rw-r--r--controlloop/common/coordination/src/main/java/org/onap/policy/coordination/Util.java11
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEvent.java4
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithOutcome.java8
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithSteps.java5
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java4
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.java6
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/LockData.java4
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java36
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java2
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java2
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java5
-rw-r--r--controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java5
-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
19 files changed, 75 insertions, 97 deletions
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
index cb71f8ea0..4d2dfa303 100644
--- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
+++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
@@ -128,16 +128,14 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
}
/*
- * This is needed to satisfy drools.
+ * This is needed to satisfy drools, thus disabling sonar.
*/
@Override
- public Deque<Step2> getSteps() {
+ public Deque<Step2> getSteps() { // NOSONAR
return super.getSteps();
}
- /**
- * Loads the preprocessor steps needed by the step that's at the front of the queue.
- */
+ @Override
public void loadPreprocessorSteps() {
super.loadPreprocessorSteps();
@@ -145,10 +143,10 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
final Step2 step = getSteps().peek();
// determine if any A&AI queries are needed
- boolean needCq = false;
- boolean needPnf = false;
- boolean needTenant = false;
- boolean needTargetEntity = false;
+ var needCq = false;
+ var needPnf = false;
+ var needTenant = false;
+ var needTargetEntity = false;
for (String propName : step.getPropertyNames()) {
needCq = needCq || CQ_PROPERTIES.contains(propName);
@@ -199,12 +197,7 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
}
}
- /**
- * Determines if the TOSCA should be aborted due to the given outcome.
- *
- * @param outcome outcome to examine
- * @return {@code true} if the TOSCA should be aborted, {@code false} otherwise
- */
+ @Override
public boolean isAbort(OperationOutcome outcome) {
return (super.isAbort(outcome) && ABORT_ACTORS.contains(outcome.getActor()));
}
@@ -218,14 +211,9 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
storeInDataBase(outcome, getProperty(OperationProperties.AAI_TARGET_ENTITY));
}
- /**
- * Makes a control loop response.
- *
- * @param outcome operation outcome
- * @return a new control loop response, or {@code null} if none is required
- */
+ @Override
public ControlLoopResponse makeControlLoopResponse(OperationOutcome outcome) {
- ControlLoopResponse clRsp = super.makeControlLoopResponse(outcome);
+ var clRsp = super.makeControlLoopResponse(outcome);
Object obj = outcome.getResponse();
if (!(obj instanceof PciMessage)) {
@@ -240,12 +228,7 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
return clRsp;
}
- /**
- * Check an event syntax.
- *
- * @param event the event syntax
- * @throws ControlLoopException if an error occurs
- */
+ @Override
protected void checkEventSyntax(VirtualControlLoopEvent event) throws ControlLoopException {
super.checkEventSyntax(event);
validateAaiData(event);
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.java
index abc2bcb46..abc9ff2b2 100644
--- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.java
+++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2.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.
@@ -154,7 +154,7 @@ public class GuardStep2 extends Step2 {
params.getPayload().put(PAYLOAD_KEY_VNF_ID, targetEntity);
AaiCqResponse cq = this.getCustomQueryData();
- GenericVnf vnf = cq.getGenericVnfByVnfId(targetEntity);
+ var vnf = cq.getGenericVnfByVnfId(targetEntity);
if (vnf == null) {
return;
}
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java
index dbdc6b9fa..78234a783 100644
--- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java
+++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/step/Step2.java
@@ -365,7 +365,7 @@ public class Step2 extends Step {
StandardCoderObject tenant = stepContext.getProperty(AaiGetTenantOperation.getKey(vserver));
verifyNotNull("tenant data", tenant);
- String resourceLink = tenant.getString(RESULT_DATA, 0, RESOURCE_LINK);
+ var resourceLink = tenant.getString(RESULT_DATA, 0, RESOURCE_LINK);
verifyNotNull("tenant data resource-link", resourceLink);
return stripPrefix(resourceLink, 3);
@@ -391,7 +391,7 @@ public class Step2 extends Step {
}
protected String getEnrichment(String propName) {
- String enrichmentKey = propName.substring(ENRICHMENT_PREFIX.length());
+ var enrichmentKey = propName.substring(ENRICHMENT_PREFIX.length());
String value = event.getAai().get(enrichmentKey);
verifyNotNull(propName, value);
@@ -438,7 +438,7 @@ public class Step2 extends Step {
protected static String stripPrefix(String resourceLink, int ncomponents) {
int previdx = -1;
- for (int nslashes = 0; nslashes < ncomponents; ++nslashes) {
+ for (var nslashes = 0; nslashes < ncomponents; ++nslashes) {
int idx = resourceLink.indexOf('/', previdx + 1);
if (idx < 0) {
break;
diff --git a/controlloop/common/coordination/src/main/java/org/onap/policy/coordination/Util.java b/controlloop/common/coordination/src/main/java/org/onap/policy/coordination/Util.java
index 03b041a59..af8cc2529 100644
--- a/controlloop/common/coordination/src/main/java/org/onap/policy/coordination/Util.java
+++ b/controlloop/common/coordination/src/main/java/org/onap/policy/coordination/Util.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -23,7 +23,6 @@ package org.onap.policy.coordination;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -52,12 +51,12 @@ public final class Util {
* @return the CoordinationDirective
*/
public static CoordinationDirective loadCoordinationDirectiveFromFile(String directiveFilename) {
- try (InputStream is = new FileInputStream(new File(directiveFilename))) {
- String contents = IOUtils.toString(is, StandardCharsets.UTF_8);
+ try (var is = new FileInputStream(new File(directiveFilename))) {
+ var contents = IOUtils.toString(is, StandardCharsets.UTF_8);
//
// Read the yaml into our Java Object
//
- Yaml yaml = new Yaml(new Constructor(CoordinationDirective.class));
+ var yaml = new Yaml(new Constructor(CoordinationDirective.class));
Object obj = yaml.load(contents);
logger.debug(contents);
@@ -86,7 +85,7 @@ public final class Util {
/*
* Values to be used for placeholders
*/
- final String uniqueId = UUID.randomUUID().toString();
+ final var uniqueId = UUID.randomUUID().toString();
final String cLOne = cd.getControlLoop(0);
final String cLTwo = cd.getControlLoop(1);
/*
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEvent.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEvent.java
index fef35e498..5a0352bfe 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEvent.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEvent.java
@@ -68,7 +68,7 @@ public abstract class ClEventManagerWithEvent<T extends Step> extends ClEventMan
* @throws ControlLoopException if the event is invalid or if a YAML processor cannot
* be created
*/
- public ClEventManagerWithEvent(EventManagerServices services, ControlLoopParams params,
+ protected ClEventManagerWithEvent(EventManagerServices services, ControlLoopParams params,
VirtualControlLoopEvent event, WorkingMemory workMem) throws ControlLoopException {
super(services, params, event.getRequestId(), workMem);
@@ -108,7 +108,7 @@ public abstract class ClEventManagerWithEvent<T extends Step> extends ClEventMan
@Override
public ControlLoopResponse makeControlLoopResponse(OperationOutcome outcome) {
- ControlLoopResponse clRsp = super.makeControlLoopResponse(outcome);
+ var clRsp = super.makeControlLoopResponse(outcome);
clRsp.setTarget("DCAE");
clRsp.setClosedLoopControlName(event.getClosedLoopControlName());
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithOutcome.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithOutcome.java
index 9d5d15808..79fe0b78d 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithOutcome.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithOutcome.java
@@ -77,7 +77,7 @@ public abstract class ClEventManagerWithOutcome<T extends Step> extends ClEventM
* @throws ControlLoopException if the event is invalid or if a YAML processor cannot
* be created
*/
- public ClEventManagerWithOutcome(EventManagerServices services, ControlLoopParams params, UUID requestId,
+ protected ClEventManagerWithOutcome(EventManagerServices services, ControlLoopParams params, UUID requestId,
WorkingMemory workMem) throws ControlLoopException {
super(services, params, requestId, workMem);
@@ -130,7 +130,7 @@ public abstract class ClEventManagerWithOutcome<T extends Step> extends ClEventM
}
}
- OperationOutcome2 outcome2 = makeOperationOutcome2(outcome);
+ var outcome2 = makeOperationOutcome2(outcome);
partialHistory.add(outcome2);
fullHistory.add(outcome2);
}
@@ -141,7 +141,7 @@ public abstract class ClEventManagerWithOutcome<T extends Step> extends ClEventM
* @return a new notification
*/
public VirtualControlLoopNotification makeNotification() {
- VirtualControlLoopNotification notif = new VirtualControlLoopNotification();
+ var notif = new VirtualControlLoopNotification();
populateNotification(notif);
if (getFinalResult() != null) {
@@ -187,7 +187,7 @@ public abstract class ClEventManagerWithOutcome<T extends Step> extends ClEventM
* @return a new control loop response, or {@code null} if none is required
*/
public ControlLoopResponse makeControlLoopResponse(OperationOutcome outcome) {
- ControlLoopResponse clRsp = new ControlLoopResponse();
+ var clRsp = new ControlLoopResponse();
clRsp.setFrom(outcome.getActor());
return clRsp;
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithSteps.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithSteps.java
index 0187db751..db0bfae9e 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithSteps.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithSteps.java
@@ -39,7 +39,6 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.controlloop.actorserviceprovider.TargetType;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
-import org.onap.policy.drools.domain.models.operational.ActorOperation;
import org.onap.policy.drools.domain.models.operational.Operation;
import org.onap.policy.drools.domain.models.operational.OperationalTarget;
import org.onap.policy.drools.system.PolicyEngine;
@@ -137,7 +136,7 @@ public abstract class ClEventManagerWithSteps<T extends Step> extends ControlLoo
* @throws ControlLoopException if the event is invalid or if a YAML processor cannot
* be created
*/
- public ClEventManagerWithSteps(EventManagerServices services, ControlLoopParams params, UUID requestId,
+ protected ClEventManagerWithSteps(EventManagerServices services, ControlLoopParams params, UUID requestId,
WorkingMemory workMem) throws ControlLoopException {
super(services, params, requestId);
@@ -218,7 +217,7 @@ public abstract class ClEventManagerWithSteps<T extends Step> extends ControlLoo
policy = getProcessor().getCurrentPolicy();
- ActorOperation actor = policy.getActorOperation();
+ var actor = policy.getActorOperation();
OperationalTarget target = actor.getTarget();
String targetType = (target != null ? target.getTargetType() : null);
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index f23f559e4..3a7531c03 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -203,7 +203,7 @@ public class ControlLoopEventManager implements StepContext, Serializable {
int remainingSec = 15 + Math.max(0, (int) TimeUnit.SECONDS.convert(remainingMs, TimeUnit.MILLISECONDS));
LockData data = target2lock.computeIfAbsent(targetEntity, key -> {
- LockData data2 = new LockData(key, requestId);
+ var data2 = new LockData(key, requestId);
makeLock(targetEntity, requestId.toString(), remainingSec, data2);
data2.addUnavailableCallback(this::onComplete);
@@ -255,7 +255,7 @@ public class ControlLoopEventManager implements StepContext, Serializable {
}
private OperationOutcome makeUnlockOutcome(String targetEntity) {
- OperationOutcome outcome = new OperationOutcome();
+ var outcome = new OperationOutcome();
outcome.setActor(ActorConstants.LOCK_ACTOR);
outcome.setOperation(ActorConstants.UNLOCK_OPERATION);
outcome.setTarget(targetEntity);
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.java
index 42bc3d141..4fef9f9d4 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.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.
@@ -80,7 +80,7 @@ public class EventManagerServices {
*/
public Properties startActorService(String configFileName) {
try {
- Properties props = SystemPersistenceConstants.getManager().getProperties(configFileName);
+ var props = SystemPersistenceConstants.getManager().getProperties(configFileName);
Map<String, Object> parameters = PropertyObjectUtils.toObject(props, ACTOR_SERVICE_PROPERTIES);
PropertyObjectUtils.compressLists(parameters);
@@ -145,7 +145,7 @@ public class EventManagerServices {
throw new IllegalArgumentException("invalid data manager properties:\n" + result.getResult());
}
- OperationHistoryDataManagerImpl mgr = new OperationHistoryDataManagerImpl(params);
+ var mgr = new OperationHistoryDataManagerImpl(params);
mgr.start();
return mgr;
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/LockData.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/LockData.java
index 67eddba34..3b14928b8 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/LockData.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/LockData.java
@@ -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.
@@ -168,7 +168,7 @@ public class LockData implements LockCallback {
* @return a new lock operation outcome
*/
private OperationOutcome makeOutcome() {
- OperationOutcome outcome = new OperationOutcome();
+ var outcome = new OperationOutcome();
outcome.setActor(ActorConstants.LOCK_ACTOR);
outcome.setOperation(ActorConstants.LOCK_OPERATION);
outcome.setTarget(targetEntity);
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
index 7632a087f..8e8b1e5c7 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
@@ -113,7 +113,7 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
this.batchSize = params.getBatchSize();
// create the factory using the properties
- Properties props = toProperties(params);
+ var props = toProperties(params);
this.emFactory = makeEntityManagerFactory(params.getPersistenceUnit(), props);
}
@@ -225,20 +225,20 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
private void storeBatch(EntityManager entityManager, Record firstRecord) {
logger.info("store operation history record batch");
- try (EntityMgrCloser emc = new EntityMgrCloser(entityManager);
- EntityTransCloser trans = new EntityTransCloser(entityManager.getTransaction())) {
+ try (var emc = new EntityMgrCloser(entityManager);
+ var trans = new EntityTransCloser(entityManager.getTransaction())) {
- int nrecords = 0;
- Record record = firstRecord;
+ var nrecords = 0;
+ var rec = firstRecord;
- while (record != null && record != END_MARKER) {
- storeRecord(entityManager, record);
+ while (rec != null && rec != END_MARKER) {
+ storeRecord(entityManager, rec);
if (++nrecords >= batchSize) {
break;
}
- record = operations.poll();
+ rec = operations.poll();
}
trans.commit();
@@ -250,13 +250,13 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
* Stores a record.
*
* @param entityManager entity manager
- * @param record record to be stored
+ * @param rec record to be stored
*/
- private void storeRecord(EntityManager entityMgr, Record record) {
+ private void storeRecord(EntityManager entityMgr, Record rec) {
- final String reqId = record.getRequestId();
- final String clName = record.getClName();
- final ControlLoopOperation operation = record.getOperation();
+ final String reqId = rec.getRequestId();
+ final String clName = rec.getClName();
+ final ControlLoopOperation operation = rec.getOperation();
logger.info("store operation history record for {}", reqId);
@@ -264,9 +264,9 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
.createQuery("select e from OperationsHistory e" + " where e.closedLoopName= ?1"
+ " and e.requestId= ?2" + " and e.subrequestId= ?3" + " and e.actor= ?4"
+ " and e.operation= ?5" + " and e.target= ?6", OperationsHistory.class)
- .setParameter(1, clName).setParameter(2, record.getRequestId())
+ .setParameter(1, clName).setParameter(2, rec.getRequestId())
.setParameter(3, operation.getSubRequestId()).setParameter(4, operation.getActor())
- .setParameter(5, operation.getOperation()).setParameter(6, record.getTargetEntity())
+ .setParameter(5, operation.getOperation()).setParameter(6, rec.getTargetEntity())
.getResultList();
if (results.size() > 1) {
@@ -276,10 +276,10 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
OperationsHistory entry = (results.isEmpty() ? new OperationsHistory() : results.get(0));
entry.setClosedLoopName(clName);
- entry.setRequestId(record.getRequestId());
+ entry.setRequestId(rec.getRequestId());
entry.setActor(operation.getActor());
entry.setOperation(operation.getOperation());
- entry.setTarget(record.getTargetEntity());
+ entry.setTarget(rec.getTargetEntity());
entry.setSubrequestId(operation.getSubRequestId());
entry.setMessage(operation.getMessage());
entry.setOutcome(operation.getOutcome());
@@ -312,7 +312,7 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
* @return a new property set
*/
private Properties toProperties(OperationHistoryDataManagerParams params) {
- Properties props = new Properties();
+ var props = new Properties();
props.put(PersistenceUnitProperties.JDBC_DRIVER, params.getDriver());
props.put(PersistenceUnitProperties.JDBC_URL, params.getUrl());
props.put(PersistenceUnitProperties.JDBC_USER, params.getUserName());
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
index 39c32fa83..cf9cf90d5 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
@@ -92,7 +92,7 @@ public class ControlLoopProcessor implements Serializable {
* Get ControlLoopParams.
*/
public ControlLoopParams getControlLoopParams() {
- ControlLoopParams controlLoopParams = new ControlLoopParams();
+ var controlLoopParams = new ControlLoopParams();
controlLoopParams.setClosedLoopControlName(this.policy.getProperties().getId());
controlLoopParams.setPolicyScope(policy.getType() + ":" + policy.getTypeVersion());
diff --git a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java
index 3c7afb7fd..db078b20c 100644
--- a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java
+++ b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java
@@ -60,7 +60,7 @@ public class ControlLoopManagementFeature implements PolicyEngineFeatureApi {
return controller.getDrools()
.facts(sessionName, ControlLoopParams.class.getName(), false)
.stream()
- .filter(c -> c instanceof ControlLoopParams)
+ .filter(ControlLoopParams.class::isInstance)
.map(ControlLoopParams.class::cast);
}
diff --git a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java
index ba7885678..0a721e8f5 100644
--- a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java
+++ b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java
@@ -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.
@@ -39,7 +39,6 @@ import javax.ws.rs.core.Response.Status;
import org.onap.policy.aai.AaiManager;
import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
import org.onap.policy.drools.apps.controlloop.feature.management.ControlLoopManagementFeature;
-import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.drools.system.PolicyEngineConstants;
import org.onap.policy.rest.RestManager;
import org.slf4j.Logger;
@@ -124,7 +123,7 @@ public class RestControlLoopManager {
@Path("engine/tools/controlloops/aai/customQuery/{vserverId}")
@ApiOperation(value = "AAI Custom Query")
public Response aaiCustomQuery(@ApiParam(value = "vserver Identifier") String vserverId) {
- PolicyEngine mgr = PolicyEngineConstants.getManager();
+ var mgr = PolicyEngineConstants.getManager();
return Response
.status(Status.OK)
diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java
index 468c2ea9a..64fe2467e 100644
--- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java
+++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java
@@ -30,7 +30,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.apache.commons.collections4.CollectionUtils;
@@ -76,7 +75,7 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
public CacheBasedControlLoopMetricsManager() {
- Properties properties = SystemPersistenceConstants.getManager()
+ var properties = SystemPersistenceConstants.getManager()
.getProperties(ControlLoopMetricsFeature.CONFIGURATION_PROPERTIES_NAME);
/* cache size */
@@ -274,7 +273,7 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
}
protected void metric(VirtualControlLoopNotification notification) {
- MdcTransaction trans = getMdcTransaction(notification);
+ var trans = getMdcTransaction(notification);
List<ControlLoopOperation> operations = notification.getHistory();
switch (notification.getNotification()) {
case ACTIVE:
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);
}