From 2ebe1425ae8e90d5243960a5ac66dd009251b75b Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 17 Jun 2021 14:54:22 -0400 Subject: Use lombok in drools-apps Issue-ID: POLICY-3398 Change-Id: I2afedc900bc268dc83f689624b4daabdb64a09f9 Signed-off-by: Jim Hahn --- .../apps/controller/usecases/UsecasesConstants.java | 12 ++++++------ .../controlloop/eventmanager/ActorConstants.java | 11 +++++------ .../policy/controlloop/utils/ControlLoopUtils.java | 11 +++++------ .../trans/CacheBasedControlLoopMetricsManager.java | 21 ++++++--------------- .../feature/trans/ControlLoopMetricsManager.java | 9 ++++----- .../controlloop/common/rules/test/HttpClients.java | 10 +--------- .../controlloop/common/rules/test/Simulators.java | 9 +-------- .../controlloop/common/rules/test/Topics.java | 8 -------- 8 files changed, 28 insertions(+), 63 deletions(-) (limited to 'controlloop/common') diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesConstants.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesConstants.java index 17db745ad..92654ff3b 100644 --- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesConstants.java +++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesConstants.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. @@ -20,7 +20,11 @@ package org.onap.policy.drools.apps.controller.usecases; -public class UsecasesConstants { +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class UsecasesConstants { public static final String GET_TARGET_ENTITY_ACTOR = "pseudo/getTargetEntity"; public static final String GET_TARGET_ENTITY_OPERATION = "pseudo/getTargetEntity"; @@ -42,8 +46,4 @@ public class UsecasesConstants { // additional properties that the Operations may need public static final String AAI_DEFAULT_GENERIC_VNF = "AAI/default/genericVnf"; - - private UsecasesConstants() { - super(); - } } diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ActorConstants.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ActorConstants.java index 26d5ab8bf..7cba9063c 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ActorConstants.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ActorConstants.java @@ -20,16 +20,15 @@ package org.onap.policy.controlloop.eventmanager; -public class ActorConstants { +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class ActorConstants { public static final String CL_TIMEOUT_ACTOR = "-CL-TIMEOUT-"; public static final String LOCK_ACTOR = "LOCK"; public static final String LOCK_OPERATION = "Lock"; public static final String UNLOCK_OPERATION = "Unlock"; public static final String PAYLOAD_KEY_VF_COUNT = "vfCount"; - - - private ActorConstants() { - // do nothing - } } diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java index 3e990efc4..b04e32003 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * 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. @@ -18,6 +18,8 @@ package org.onap.policy.controlloop.utils; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import org.onap.policy.controlloop.ControlLoopException; import org.onap.policy.controlloop.drl.legacy.ControlLoopParams; import org.onap.policy.controlloop.processor.ControlLoopProcessor; @@ -28,14 +30,11 @@ import org.slf4j.LoggerFactory; /** * Control Loop Utils. */ -public class ControlLoopUtils { +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class ControlLoopUtils { public static final Logger logger = LoggerFactory.getLogger(ControlLoopUtils.class); - private ControlLoopUtils() { - super(); - } - /** * Get a Control Loop Parameters object from a Tosca Policy. */ 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 64fe2467e..d0b79125b 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 @@ -32,6 +32,8 @@ import java.util.Map; import java.util.Objects; import java.util.UUID; import java.util.concurrent.TimeUnit; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.collections4.CollectionUtils; import org.onap.policy.controlloop.ControlLoopNotificationType; import org.onap.policy.controlloop.ControlLoopOperation; @@ -53,8 +55,12 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics { private static final Logger logger = LoggerFactory.getLogger(CacheBasedControlLoopMetricsManager.class); private LoadingCache cache; + + @Getter private long cacheSize = ControlLoopMetricsFeature.CL_CACHE_TRANS_SIZE_DEFAULT; + @Getter + @Setter private long transactionTimeout = ControlLoopMetricsFeature.CL_CACHE_TRANS_TIMEOUT_SECONDS_DEFAULT; /** @@ -247,26 +253,11 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics { .setResponseDescription("EVICTED").setStatusCode(false).metric().resetTransaction(); } - @Override - public long getCacheSize() { - return this.cacheSize; - } - @Override public void setMaxCacheSize(long cacheSize) { this.cacheSize = cacheSize; } - @Override - public long getTransactionTimeout() { - return this.transactionTimeout; - } - - @Override - public void setTransactionTimeout(long transactionTimeout) { - this.transactionTimeout = transactionTimeout; - } - @Override public long getCacheOccupancy() { return this.cache.size(); diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsManager.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsManager.java index c4ae11bdf..59442a226 100644 --- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsManager.java +++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsManager.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 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. @@ -20,11 +20,14 @@ package org.onap.policy.drools.apps.controlloop.feature.trans; +import lombok.AccessLevel; import lombok.Getter; +import lombok.NoArgsConstructor; /** * Control Loop Metrics Tracker. */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) public class ControlLoopMetricsManager { /** @@ -32,8 +35,4 @@ public class ControlLoopMetricsManager { */ @Getter private static final ControlLoopMetrics manager = new CacheBasedControlLoopMetricsManager(); - - private ControlLoopMetricsManager() { - // do nothing - } } diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/HttpClients.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/HttpClients.java index eb729ad6d..208cdc937 100644 --- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/HttpClients.java +++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/HttpClients.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. @@ -30,14 +30,6 @@ import org.onap.policy.drools.persistence.SystemPersistenceConstants; */ public class HttpClients { - /** - * Constructs the object. - */ - public HttpClients() { - super(); - } - - /** * Adds Http Clients specified in the property file. * diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Simulators.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Simulators.java index 4a325a447..b1d3d544e 100644 --- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Simulators.java +++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Simulators.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. @@ -37,13 +37,6 @@ public class Simulators { @Getter(AccessLevel.PROTECTED) private final List servers = new LinkedList<>(); - /** - * Constructs the object. - */ - public Simulators() { - super(); - } - /** * Invokes the given functions to start the simulators. Destroys all of the * simulators if any fail to start. 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 ff3abed48..051270f6f 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 @@ -49,14 +49,6 @@ public class Topics { */ private final List> listeners = new LinkedList<>(); - - /** - * Constructs the object. - */ - public Topics() { - super(); - } - /** * Unregisters all of the listeners. */ -- cgit 1.2.3-korg