diff options
Diffstat (limited to 'applications')
18 files changed, 33 insertions, 69 deletions
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java index a4fc03fd..0e2a5326 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java @@ -68,16 +68,6 @@ public class OnapPolicyFinderFactory extends PolicyFinderFactory { private Properties properties; /** - * Empty private constructor. We do not want to create - * an instance of this without giving Properties object. - * - * @throws OnapPolicyFinderFactoryException Exception will be thrown - */ - public OnapPolicyFinderFactory() throws OnapPolicyFinderFactoryException { - throw new OnapPolicyFinderFactoryException("Please use the constructor with Properties object."); - } - - /** * Constructor with properties passed. This will be preferred. * * @param properties Properties object diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtils.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtils.java index 860189f9..596a3cc6 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtils.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtils.java @@ -47,7 +47,7 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class XacmlPolicyUtils { +public final class XacmlPolicyUtils { private static final Logger LOGGER = LoggerFactory.getLogger(XacmlPolicyUtils.class); diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyType.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyType.java index fe79e861..ca29c96a 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyType.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyType.java @@ -69,8 +69,8 @@ public class MatchablePolicyType { ); //@formatter:on - ToscaConceptIdentifier policyId; - Map<String, MatchableProperty> matchables = new HashMap<>(); + private ToscaConceptIdentifier policyId; + private Map<String, MatchableProperty> matchables = new HashMap<>(); public MatchablePolicyType(@NonNull ToscaPolicyType policyType, @NonNull MatchableCallback callback) { this.policyId = new ToscaConceptIdentifier(policyType.getName(), policyType.getVersion()); diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchableProperty.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchableProperty.java index 9b5de5c8..6e9c4559 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchableProperty.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchableProperty.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,7 +30,7 @@ import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public class MatchableProperty { @NonNull - String property; + private String property; @NonNull - MatchablePropertyType<?> type; + private MatchablePropertyType<?> type; } diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeList.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeList.java index 52f4ae11..0c42d357 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeList.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeList.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. * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,7 +33,7 @@ import org.onap.policy.pdp.xacml.application.common.ToscaPolicyConversionExcepti import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslatorUtils; public class MatchablePropertyTypeList extends MatchablePropertyTypeBase<List<MatchablePropertyType<?>>> { - MatchableProperty primitiveProperty; + private MatchableProperty primitiveProperty; /** * constructor. diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeMap.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeMap.java index f6d8414a..79b34529 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeMap.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePropertyTypeMap.java @@ -36,7 +36,7 @@ import org.onap.policy.pdp.xacml.application.common.ToscaPolicyConversionExcepti import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslatorUtils; public class MatchablePropertyTypeMap extends MatchablePropertyTypeBase<Map<String, MatchablePropertyType<?>>> { - MatchableProperty primitiveProperty; + private MatchableProperty primitiveProperty; /** * constructor. diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequest.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequest.java index 9618d5b7..3e7c10af 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequest.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequest.java @@ -31,6 +31,7 @@ import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; import org.onap.policy.models.decisions.concepts.DecisionRequest; @@ -38,6 +39,7 @@ import org.onap.policy.models.decisions.concepts.DecisionRequest; @Getter @Setter @ToString +@NoArgsConstructor @XACMLRequest(ReturnPolicyIdList = true) public class StdCombinedPolicyRequest { @@ -62,10 +64,6 @@ public class StdCombinedPolicyRequest { @XACMLResource(attributeId = "urn:org:onap:policy-type", includeInResults = true) private Collection<String> resourcePolicyType = new ArrayList<>(); - public StdCombinedPolicyRequest() { - super(); - } - /** * Parses the DecisionRequest into a MonitoringRequest. * diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java index 57560715..5bf9151e 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java @@ -32,6 +32,7 @@ import com.att.research.xacml.std.annotations.RequestParser; import com.google.common.base.Strings; import java.util.Collection; import java.util.Map; +import lombok.NoArgsConstructor; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.EffectType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType; @@ -49,14 +50,11 @@ import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslatorUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@NoArgsConstructor public class StdCombinedPolicyResultsTranslator extends StdBaseTranslator { private static final Logger LOGGER = LoggerFactory.getLogger(StdCombinedPolicyResultsTranslator.class); - public StdCombinedPolicyResultsTranslator() { - super(); - } - @Override public Object convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException { // diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java index c038f383..42e3d43e 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java @@ -43,6 +43,7 @@ import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; import org.onap.policy.models.decisions.concepts.DecisionRequest; @@ -54,6 +55,7 @@ import org.slf4j.LoggerFactory; @Getter @Setter @ToString +@NoArgsConstructor @XACMLRequest(ReturnPolicyIdList = true) public class StdMatchablePolicyRequest { @@ -75,10 +77,6 @@ public class StdMatchablePolicyRequest { protected static DataTypeFactory dataTypeFactory = null; - public StdMatchablePolicyRequest() { - super(); - } - protected static synchronized DataTypeFactory getDataTypeFactory() { try { if (dataTypeFactory != null) { diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java index 8d712768..cca2d218 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java @@ -43,6 +43,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import lombok.NoArgsConstructor; import lombok.Setter; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType; @@ -83,6 +84,7 @@ import org.slf4j.LoggerFactory; * @author pameladragosh * */ +@NoArgsConstructor public class StdMatchableTranslator extends StdBaseTranslator implements MatchableCallback { private static final Logger LOGGER = LoggerFactory.getLogger(StdMatchableTranslator.class); @@ -96,10 +98,6 @@ public class StdMatchableTranslator extends StdBaseTranslator implements Matcha @Setter private Path pathForData; - public StdMatchableTranslator() { - super(); - } - @Override public Request convertRequest(DecisionRequest request) throws ToscaPolicyConversionException { LOGGER.info("Converting Request {}", request); diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java index e8839ecb..d57da301 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java @@ -42,11 +42,13 @@ import java.util.Iterator; import java.util.Properties; import javax.persistence.EntityManager; import javax.persistence.Persistence; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import org.onap.policy.pdp.xacml.application.common.ToscaDictionary; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class StdOnapPip extends StdConfigurableEngine { protected static Logger logger = LoggerFactory.getLogger(StdOnapPip.class); @@ -70,10 +72,6 @@ public abstract class StdOnapPip extends StdConfigurableEngine { protected String issuer; protected boolean shutdown = false; - protected StdOnapPip() { - super(); - } - @Override public Collection<PIPRequest> attributesProvided() { return Collections.emptyList(); diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java index f29c4e76..40968758 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java @@ -39,7 +39,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; +import lombok.AccessLevel; import lombok.Getter; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.models.decisions.concepts.DecisionRequest; @@ -54,6 +56,7 @@ import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class StdXacmlApplicationServiceProvider implements XacmlApplicationServiceProvider { private static final Logger LOGGER = LoggerFactory.getLogger(StdXacmlApplicationServiceProvider.class); @@ -69,10 +72,6 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica private PDPEngine pdpEngine = null; private Map<ToscaPolicy, Path> mapLoadedPolicies = new HashMap<>(); - protected StdXacmlApplicationServiceProvider() { - super(); - } - @Override public String applicationName() { return applicationName; diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactoryTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactoryTest.java index b5b8f7b1..5df2552d 100644 --- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactoryTest.java +++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactoryTest.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.pdp.xacml.application.common; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import java.io.FileInputStream; import java.util.Properties; @@ -32,13 +31,6 @@ import org.junit.Test; public class OnapPolicyFinderFactoryTest { @Test - public void testNoUseConstructor() throws Exception { - assertThatExceptionOfType(OnapPolicyFinderFactoryException.class).isThrownBy(() -> { - new OnapPolicyFinderFactory(); - }).withMessageContaining("Please use the constructor with Properties object."); - } - - @Test public void testFinder() throws Exception { // // Load our test properties to use diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java index 90f56a90..162b0626 100644 --- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java +++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java @@ -34,6 +34,7 @@ import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; import java.util.UUID; +import lombok.NoArgsConstructor; import org.apache.commons.io.IOUtils; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardYamlCoder; @@ -46,14 +47,11 @@ import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@NoArgsConstructor public class CoordinationGuardTranslator implements ToscaPolicyTranslator { private static final Logger LOGGER = LoggerFactory.getLogger(CoordinationGuardTranslator.class); - public CoordinationGuardTranslator() { - super(); - } - @Override public Object convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException { LOGGER.debug("Using CoordinationGuardTranslator.convertPolicy"); diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPolicyRequest.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPolicyRequest.java index 8a77449c..58fe00b7 100644 --- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPolicyRequest.java +++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPolicyRequest.java @@ -33,6 +33,7 @@ import java.time.OffsetTime; import java.time.ZoneOffset; import java.util.Map; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; import org.onap.policy.models.decisions.concepts.DecisionRequest; @@ -41,6 +42,7 @@ import org.onap.policy.pdp.xacml.application.common.ToscaPolicyConversionExcepti @Getter @Setter @ToString +@NoArgsConstructor @XACMLRequest(ReturnPolicyIdList = true) public class GuardPolicyRequest { private static final String STR_GUARD = "guard"; @@ -109,10 +111,6 @@ public class GuardPolicyRequest { public static final String PREFIX_RESOURCE_ATTRIBUTE_ID = "urn:org:onap:guard:target:"; - public GuardPolicyRequest() { - super(); - } - /** * Parses the DecisionRequest into a StdMetadataPolicyRequest. * diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java index df5fe43e..3aae5fc4 100644 --- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java +++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java @@ -39,6 +39,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; import lombok.Getter; +import lombok.NoArgsConstructor; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.ApplyType; @@ -67,6 +68,7 @@ import org.onap.policy.pdp.xacml.application.common.operationshistory.CountRecen import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@NoArgsConstructor public class GuardTranslator implements ToscaPolicyTranslator { private static final Logger LOGGER = LoggerFactory.getLogger(GuardTranslator.class); @@ -118,9 +120,6 @@ public class GuardTranslator implements ToscaPolicyTranslator { // private static final String VARIABLE_TIMEINRANGE = "timeInRange"; - public GuardTranslator() { - super(); - } /** * Convert the policy. diff --git a/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTranslator.java b/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTranslator.java index 06e324d2..3caf28f2 100644 --- a/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTranslator.java +++ b/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTranslator.java @@ -31,6 +31,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Base64; import lombok.Getter; +import lombok.NoArgsConstructor; import org.onap.policy.common.parameters.annotations.NotBlank; import org.onap.policy.common.parameters.annotations.NotNull; import org.onap.policy.models.decisions.concepts.DecisionRequest; @@ -48,14 +49,11 @@ import org.slf4j.LoggerFactory; * @author Chenfei Gao (cgao@research.att.com) * */ +@NoArgsConstructor public class NativePdpApplicationTranslator implements ToscaPolicyTranslator { private static final Logger LOGGER = LoggerFactory.getLogger(NativePdpApplicationTranslator.class); - public NativePdpApplicationTranslator() { - super(); - } - @Override public Object convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException { // diff --git a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java index 5eda7678..6d86bdb4 100644 --- a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java +++ b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java @@ -46,7 +46,7 @@ import org.onap.policy.pdp.xacml.application.common.std.StdMatchablePolicyReques public class OptimizationSubscriberRequest extends StdMatchablePolicyRequest { @XACMLSubject(attributeId = "urn:org:onap:optimization:subscriber:name", includeInResults = true) - List<String> subscriberRoles; + private List<String> subscriberRoles; /** * Create an instance of xacml request. |