aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/reception-plugins/src
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@est.tech>2019-08-06 14:14:01 +0000
committerramverma <ram.krishna.verma@est.tech>2019-08-06 14:14:01 +0000
commitc04dd4a6984734869ef6888f95d304d3d53c1923 (patch)
treebb98d757a5890b1783959dcd9c2ff52a6341dc01 /plugins/reception-plugins/src
parent039cd619bc102865d664bbf6b003cd33b243eaf1 (diff)
Changing parameters to use ParameterGroupImpl
1. Changing all the decoders & handlers parameters to use ParameterGroupImpl. 2. Fixed all the test cases. Issue-ID: POLICY-1890 Change-Id: I4a124c0acc650020977ac8e2cee143c72003973a Signed-off-by: ramverma <ram.krishna.verma@est.tech>
Diffstat (limited to 'plugins/reception-plugins/src')
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterBuilder.java94
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterGroup.java85
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroup.java40
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java15
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandlerConfigurationParameterBuilder.java71
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandlerConfigurationParameterGroup.java35
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterBuilder.java357
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java168
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/CommonTestData.java53
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java25
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpxConfigurationParameterGroup.java31
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java32
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java21
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java22
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java77
-rw-r--r--plugins/reception-plugins/src/test/resources/parameters/EmptyParameters.json2
-rw-r--r--plugins/reception-plugins/src/test/resources/parameters/FileInCsarPolicyDecoderParameters.json4
-rw-r--r--plugins/reception-plugins/src/test/resources/parameters/FileInCsarPolicyDecoderParametersInvalid.json4
-rw-r--r--plugins/reception-plugins/src/test/resources/parameters/PdpxPolicyDecoderParameters.json8
-rw-r--r--plugins/reception-plugins/src/test/resources/parameters/PdpxPolicyDecoderParametersInvalid.json8
20 files changed, 201 insertions, 951 deletions
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterBuilder.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterBuilder.java
deleted file mode 100644
index 4c781030..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterBuilder.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. 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.
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.pdpx;
-
-/**
- * This class builds an instance of {@link PolicyDecodeCsarPdpxConfigurationParameterGroup} class.
- */
-public class PolicyDecoderCsarPdpxConfigurationParameterBuilder {
-
- private String policyNamePrefix;
- private String onapName;
- private String version;
- private String priority;
- private String riskType;
- private String riskLevel;
-
- public String getPolicyNamePrefix() {
- return policyNamePrefix;
- }
-
- public PolicyDecoderCsarPdpxConfigurationParameterBuilder setPolicyNamePrefix(final String policyNamePrefix) {
- this.policyNamePrefix = policyNamePrefix;
- return this;
- }
-
- public String getOnapName() {
- return onapName;
- }
-
- public PolicyDecoderCsarPdpxConfigurationParameterBuilder setOnapName(final String onapName) {
- this.onapName = onapName;
- return this;
- }
-
- public String getVersion() {
- return version;
- }
-
- public PolicyDecoderCsarPdpxConfigurationParameterBuilder setVersion(final String version) {
- this.version = version;
- return this;
- }
-
- public String getPriority() {
- return priority;
- }
-
- public PolicyDecoderCsarPdpxConfigurationParameterBuilder setPriority(final String priority) {
- this.priority = priority;
- return this;
- }
-
- public String getRiskType() {
- return riskType;
- }
-
- public PolicyDecoderCsarPdpxConfigurationParameterBuilder setRiskType(final String riskType) {
- this.riskType = riskType;
- return this;
- }
-
- public String getRiskLevel() {
- return riskLevel;
- }
-
- public PolicyDecoderCsarPdpxConfigurationParameterBuilder setRiskLevel(final String riskLevel) {
- this.riskLevel = riskLevel;
- return this;
- }
-
- public PolicyDecoderCsarPdpxConfigurationParameterGroup build() {
- return new PolicyDecoderCsarPdpxConfigurationParameterGroup(this);
- }
-}
-
-
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterGroup.java
index 26fd2a5a..f376c391 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpxConfigurationParameterGroup.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,16 +21,18 @@
package org.onap.policy.distribution.reception.decoding.pdpx;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ValidationStatus;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
-import org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandlerConfigurationParameterGroup;
+import lombok.Getter;
+
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
/**
- * This class handles reading, parsing and validating of the paramaters for the
- * {@link PolicyDecoderCsarPdpx}.
+ * This class handles reading, parsing and validating of the paramaters for the {@link PolicyDecoderCsarPdpx}.
*/
+@Getter
+@NotNull
+@NotBlank
public class PolicyDecoderCsarPdpxConfigurationParameterGroup extends PolicyDecoderConfigurationParameterGroup {
private String policyNamePrefix;
@@ -39,74 +42,8 @@ public class PolicyDecoderCsarPdpxConfigurationParameterGroup extends PolicyDeco
private String riskType;
private String riskLevel;
- /**
- * The constructor for instantiating {@link SdcReceptionHandlerConfigurationParameterGroup}
- * class.
- *
- * @param builder the SDC configuration builder
- */
- public PolicyDecoderCsarPdpxConfigurationParameterGroup(
- final PolicyDecoderCsarPdpxConfigurationParameterBuilder builder) {
- policyNamePrefix = builder.getPolicyNamePrefix();
- onapName = builder.getOnapName();
- version = builder.getVersion();
- priority = builder.getPriority();
- riskType = builder.getRiskType();
- riskLevel = builder.getRiskLevel();
- }
-
- public String getPolicyNamePrefix() {
- return policyNamePrefix;
- }
-
- public String getOnapName() {
- return onapName;
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getPriority() {
- return priority;
- }
-
- public String getRiskType() {
- return riskType;
- }
-
- public String getRiskLevel() {
- return riskLevel;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public GroupValidationResult validate() {
- final GroupValidationResult validationResult = new GroupValidationResult(this);
- validateStringElement(validationResult, policyNamePrefix, "policyNamePrefix");
- validateStringElement(validationResult, onapName, "onapName");
- validateStringElement(validationResult, version, "version");
- validateStringElement(validationResult, priority, "priority");
- validateStringElement(validationResult, riskType, "riskType");
- validateStringElement(validationResult, riskLevel, "riskLevel");
- return validationResult;
- }
-
- /**
- * Validate the string element.
- *
- * @param validationResult the result object
- * @param element the element to validate
- * @param elementName the element name for error message
- */
- private void validateStringElement(final GroupValidationResult validationResult, final String element,
- final String elementName) {
- if (!ParameterValidationUtils.validateStringParameter(element)) {
- validationResult.setResult(elementName, ValidationStatus.INVALID,
- elementName + " must be a non-blank string");
- }
+ public PolicyDecoderCsarPdpxConfigurationParameterGroup() {
+ super(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
}
}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroup.java
index 1df563c3..7aff5b4c 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroup.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroup.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +21,10 @@
package org.onap.policy.distribution.reception.decoding.policy.file;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ValidationStatus;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import lombok.Getter;
+
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
/**
@@ -30,37 +32,15 @@ import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurat
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
+@Getter
+@NotNull
+@NotBlank
public class PolicyDecoderFileInCsarToPolicyParameterGroup extends PolicyDecoderConfigurationParameterGroup {
private String policyFileName;
private String policyTypeFileName;
- /**
- * Constructor for instantiating {@link PolicyDecoderFileInCsarToPolicyParameterGroup} class.
- *
- * @param policyFileName the policy file name
- * @param policyTypeFileName the policy type file name
- */
- public PolicyDecoderFileInCsarToPolicyParameterGroup(final String policyFileName, final String policyTypeFileName) {
- this.policyFileName = policyFileName;
- this.policyTypeFileName = policyTypeFileName;
- }
-
- public String getPolicyFileName() {
- return policyFileName;
- }
-
- public String getPolicyTypeFileName() {
- return policyTypeFileName;
- }
-
- @Override
- public GroupValidationResult validate() {
- final GroupValidationResult validationResult = new GroupValidationResult(this);
- if (!ParameterValidationUtils.validateStringParameter(policyFileName)) {
- validationResult.setResult("policyFileName", ValidationStatus.INVALID,
- "must be a non-blank string containing the policy file name");
- }
- return validationResult;
+ public PolicyDecoderFileInCsarToPolicyParameterGroup() {
+ super(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
}
}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java
index 77269bb0..47312e62 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandler.java
@@ -62,9 +62,8 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler {
try {
final FileSystemReceptionHandlerConfigurationParameterGroup handlerParameters =
ParameterService.get(parameterGroupName);
- final FileClientHandler fileClientHandler = new FileClientHandler(this,
- handlerParameters.getWatchPath(),
- handlerParameters.getMaxThread());
+ final FileClientHandler fileClientHandler =
+ new FileClientHandler(this, handlerParameters.getWatchPath(), handlerParameters.getMaxThread());
final Thread fileWatcherThread = new Thread(fileClientHandler);
fileWatcherThread.start();
} catch (final Exception ex) {
@@ -114,10 +113,10 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler {
* @param maxThread the max thread number
* @throws InterruptedException if it occurs
*/
- protected void startWatchService(final WatchService watcher,
- final Path dir, int maxThread) throws InterruptedException {
+ protected void startWatchService(final WatchService watcher, final Path dir, final int maxThread)
+ throws InterruptedException {
WatchKey key;
- ExecutorService pool = Executors.newFixedThreadPool(maxThread);
+ final ExecutorService pool = Executors.newFixedThreadPool(maxThread);
try {
running = true;
@@ -135,7 +134,7 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler {
}
}
- private void processFileEvents(Path dir, WatchKey key, ExecutorService pool) {
+ private void processFileEvents(final Path dir, final WatchKey key, final ExecutorService pool) {
for (final WatchEvent<?> event : key.pollEvents()) {
@SuppressWarnings("unchecked")
final WatchEvent<Path> ev = (WatchEvent<Path>) event;
@@ -148,7 +147,7 @@ public class FileSystemReceptionHandler extends AbstractReceptionHandler {
waitForFileToBeReady(fullFilePath);
createPolicyInputAndCallHandler(fullFilePath);
LOGGER.debug("CSAR complete: {}", fileName);
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
LOGGER.error("waitForFileToBeReady interrupted", e);
Thread.currentThread().interrupt();
}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandlerConfigurationParameterBuilder.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandlerConfigurationParameterBuilder.java
deleted file mode 100644
index 415e0d94..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandlerConfigurationParameterBuilder.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel Corp. 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.
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.handling.file;
-
-/**
- * This class builds an instance of {@link FileSystemReceptionHandlerConfigurationParameterGroup} class.
- *
- */
-public class FileSystemReceptionHandlerConfigurationParameterBuilder {
-
- private String watchPath;
- private int maxThread = 1;
-
- /**
- * Set watchPath to this {@link FileSystemReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param watchPath the watchPath
- */
- public FileSystemReceptionHandlerConfigurationParameterBuilder setWatchPath(final String watchPath) {
- this.watchPath = watchPath;
- return this;
- }
-
- /**
- * Set maxThread to this {@link FileSystemReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param maxThread the max thread number in the thread pool
- */
- public FileSystemReceptionHandlerConfigurationParameterBuilder setMaxThread(final int maxThread) {
- this.maxThread = maxThread;
- return this;
- }
-
- /**
- * Returns the watchPath of this {@link FileSystemReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the watchPath
- */
- public String getWatchPath() {
- return watchPath;
- }
-
- /**
- * Returns the maxThread of this {@link FileSystemReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the maxThread
- */
- public int getMaxThread() {
- return maxThread;
- }
-}
-
-
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandlerConfigurationParameterGroup.java
index f9045816..a12130ea 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandlerConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/file/FileSystemReceptionHandlerConfigurationParameterGroup.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,37 +23,30 @@ package org.onap.policy.distribution.reception.handling.file;
import java.io.File;
+import lombok.Getter;
+import lombok.Setter;
+
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
/**
* This class handles reading, parsing and validating of the Policy SDC Service Distribution parameters from Json
* format, which strictly adheres to the interface:IConfiguration, defined by SDC SDK.
*/
+@Getter
+@Setter
+@NotNull
+@NotBlank
public class FileSystemReceptionHandlerConfigurationParameterGroup extends ReceptionHandlerConfigurationParameterGroup {
private String watchPath;
private int maxThread;
- /**
- * The constructor for instantiating {@link FileSystemReceptionHandlerConfigurationParameterGroup} class.
- *
- * @param builder the SDC configuration builder
- */
- public FileSystemReceptionHandlerConfigurationParameterGroup(
- final FileSystemReceptionHandlerConfigurationParameterBuilder builder) {
- watchPath = builder.getWatchPath();
- maxThread = builder.getMaxThread();
- }
-
- public String getWatchPath() {
- return watchPath;
- }
-
- public int getMaxThread() {
- return maxThread;
+ public FileSystemReceptionHandlerConfigurationParameterGroup() {
+ super(FileSystemReceptionHandlerConfigurationParameterGroup.class.getSimpleName());
}
/**
@@ -62,9 +56,6 @@ public class FileSystemReceptionHandlerConfigurationParameterGroup extends Recep
public GroupValidationResult validate() {
final GroupValidationResult validationResult = new GroupValidationResult(this);
validatePathElement(validationResult, watchPath, "watchPath");
- if (!ParameterValidationUtils.validateIntParameter(maxThread)) {
- validationResult.setResult("maxThread", ValidationStatus.INVALID, "must be a positive integer");
- }
return validationResult;
}
@@ -80,7 +71,7 @@ public class FileSystemReceptionHandlerConfigurationParameterGroup extends Recep
final String elementName) {
boolean valid = false;
if (element != null) {
- File file = new File(element);
+ final File file = new File(element);
if (file.exists() && file.isDirectory()) {
valid = true;
}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterBuilder.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterBuilder.java
deleted file mode 100644
index 65305c1c..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterBuilder.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. 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.
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.handling.sdc;
-
-import java.util.List;
-
-/**
- * This class builds an instance of {@link SdcReceptionHandlerConfigurationParameterGroup} class.
- *
- * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
- */
-public class SdcReceptionHandlerConfigurationParameterBuilder {
-
- private boolean activeserverTlsAuth;
- private boolean filterinEmptyResources;
- private boolean useHttpsWithDmaap;
- private int pollingTimeout;
- private int pollingInterval;
- private String user;
- private String password;
- private String consumerId;
- private String consumerGroup;
- private String asdcAddress;
- private String environmentName;
- private String keystorePath;
- private String keystorePassword;
- private List<String> messageBusAddress;
- private List<String> artifactTypes;
- private int retryDelay;
-
- /**
- * Set activeserverTlsAuth to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param activeserverTlsAuth the activeserverTlsAuth
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setActiveserverTlsAuth(final boolean activeserverTlsAuth) {
- this.activeserverTlsAuth = activeserverTlsAuth;
- return this;
- }
-
- /**
- * Set filterinEmptyResources to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param filterinEmptyResources the filterinEmptyResources
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setFilterinEmptyResources(
- final boolean filterinEmptyResources) {
- this.filterinEmptyResources = filterinEmptyResources;
- return this;
- }
-
- /**
- * Set useHttpsWithDmaap to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param useHttpsWithDmaap the useHttpsWithDmaap
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setUseHttpsWithDmaap(final Boolean useHttpsWithDmaap) {
- this.useHttpsWithDmaap = useHttpsWithDmaap;
- return this;
- }
-
- /**
- * Set pollingInterval to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param pollingInterval the pollingInterval
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setPollingInterval(final int pollingInterval) {
- this.pollingInterval = pollingInterval;
- return this;
- }
-
- /**
- * Set pollingTimeout to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param pollingTimeout the pollingTimeout
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setPollingTimeout(final int pollingTimeout) {
- this.pollingTimeout = pollingTimeout;
- return this;
- }
-
- /**
- * Set asdcAddress to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param asdcAddress the asdcAddress
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setAsdcAddress(final String asdcAddress) {
- this.asdcAddress = asdcAddress;
- return this;
- }
-
- /**
- * Set user to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param user the user
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setUser(final String user) {
- this.user = user;
- return this;
- }
-
- /**
- * Set password to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param password the password
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setPassword(final String password) {
- this.password = password;
- return this;
- }
-
- /**
- * Set consumerId to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param consumerId the consumerId
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setConsumerId(final String consumerId) {
- this.consumerId = consumerId;
- return this;
- }
-
- /**
- * Set consumerGroup to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param consumerGroup the consumerGroup
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setConsumerGroup(final String consumerGroup) {
- this.consumerGroup = consumerGroup;
- return this;
- }
-
- /**
- * Set environmentName to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param environmentName the environmentName
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setEnvironmentName(final String environmentName) {
- this.environmentName = environmentName;
- return this;
- }
-
- /**
- * Set keystorePath to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param keystorePath the keystorePath
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setKeystorePath(final String keystorePath) {
- this.keystorePath = keystorePath;
- return this;
- }
-
- /**
- * Set keystorePassword to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param keystorePassword the keystorePassword
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setKeystorePassword(final String keystorePassword) {
- this.keystorePassword = keystorePassword;
- return this;
- }
-
- /**
- * Set messageBusAddress to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param messageBusAddress the messageBusAddress
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setMessageBusAddress(final List<String> messageBusAddress) {
- this.messageBusAddress = messageBusAddress;
- return this;
- }
-
- /**
- * Set artifactTypes to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param artifactTypes the artifactTypes
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setArtifactTypes(final List<String> artifactTypes) {
- this.artifactTypes = artifactTypes;
- return this;
- }
-
- /**
- * Set retryDelay to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @param retryDelay the retryDelay
- */
- public SdcReceptionHandlerConfigurationParameterBuilder setRetryDelay(final int retryDelay) {
- this.retryDelay = retryDelay;
- return this;
- }
-
- /**
- * Returns the active server TlsAuth of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the activeserverTlsAuth
- */
- public boolean isActiveserverTlsAuth() {
- return activeserverTlsAuth;
- }
-
- /**
- * Returns the isFilterinEmptyResources flag of this {@link SdcReceptionHandlerConfigurationParameterBuilder}
- * instance.
- *
- * @return the isFilterinEmptyResources
- */
- public boolean isFilterinEmptyResources() {
- return filterinEmptyResources;
- }
-
- /**
- * Returns the isUseHttpsWithDmaap flag of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the isUseHttpsWithDmaap
- */
- public Boolean getIsUseHttpsWithDmaap() {
- return useHttpsWithDmaap;
- }
-
- /**
- * Returns the polling interval of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the pollingInterval
- */
- public int getPollingInterval() {
- return pollingInterval;
- }
-
- /**
- * Returns the polling timeout of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the pollingTimeout
- */
- public int getPollingTimeout() {
- return pollingTimeout;
- }
-
- /**
- * Returns the asdc address of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the asdcAddress
- */
- public String getAsdcAddress() {
- return asdcAddress;
- }
-
- /**
- * Returns the user of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the user
- */
- public String getUser() {
- return user;
- }
-
- /**
- * Returns the password of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the password
- */
- public String getPassword() {
- return password;
- }
-
- /**
- * Returns the consumer id of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the consumerId
- */
- public String getConsumerId() {
- return consumerId;
- }
-
- /**
- * Returns the consumer group of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the consumerGroup
- */
- public String getConsumerGroup() {
- return consumerGroup;
- }
-
- /**
- * Returns the environment name of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the environmentName
- */
- public String getEnvironmentName() {
- return environmentName;
- }
-
- /**
- * Returns the keystore path of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the keystorePath
- */
- public String getKeystorePath() {
- return keystorePath;
- }
-
- /**
- * Returns the keystore password of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the keystorePassword
- */
- public String getKeystorePassword() {
- return keystorePassword;
- }
-
- /**
- * Returns the message bus address of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the messageBusAddress
- */
- public List<String> getMessageBusAddress() {
- return messageBusAddress;
- }
-
- /**
- * Returns the artifact types of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the artifactTypes
- */
- public List<String> getArtifactTypes() {
- return artifactTypes;
- }
-
- /**
- * Returns the retryDelay of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
- *
- * @return the retryDelay
- */
- public int getRetryDelay() {
- return retryDelay;
- }
-
-}
-
-
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java
index 6746dc35..f9aed90b 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,15 +23,19 @@ package org.onap.policy.distribution.reception.handling.sdc;
import java.util.List;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ValidationStatus;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import lombok.Getter;
+
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
/**
* This class handles reading, parsing and validating of the Policy SDC Service Distribution parameters from Json
* format, which strictly adheres to the interface:IConfiguration, defined by SDC SDK.
*/
+@Getter
+@NotNull
+@NotBlank
public class SdcReceptionHandlerConfigurationParameterGroup extends ReceptionHandlerConfigurationParameterGroup {
private String asdcAddress;
@@ -50,161 +55,8 @@ public class SdcReceptionHandlerConfigurationParameterGroup extends ReceptionHan
private boolean isFilterInEmptyResources;
private boolean isUseHttpsWithDmaap;
- /**
- * The constructor for instantiating {@link SdcReceptionHandlerConfigurationParameterGroup} class.
- *
- * @param builder the SDC configuration builder
- */
- public SdcReceptionHandlerConfigurationParameterGroup(
- final SdcReceptionHandlerConfigurationParameterBuilder builder) {
- asdcAddress = builder.getAsdcAddress();
- messageBusAddress = builder.getMessageBusAddress();
- user = builder.getUser();
- password = builder.getPassword();
- pollingInterval = builder.getPollingInterval();
- pollingTimeout = builder.getPollingTimeout();
- retryDelay = builder.getRetryDelay();
- consumerId = builder.getConsumerId();
- artifactTypes = builder.getArtifactTypes();
- consumerGroup = builder.getConsumerGroup();
- environmentName = builder.getEnvironmentName();
- keyStorePath = builder.getKeystorePath();
- keyStorePassword = builder.getKeystorePassword();
- activeServerTlsAuth = builder.isActiveserverTlsAuth();
- isFilterInEmptyResources = builder.isFilterinEmptyResources();
- isUseHttpsWithDmaap = builder.getIsUseHttpsWithDmaap();
-
- }
-
- public String getAsdcAddress() {
- return asdcAddress;
- }
-
- public List<String> getMessageBusAddress() {
- return messageBusAddress;
- }
-
- public String getUser() {
- return user;
- }
-
- public String getPassword() {
- return password;
- }
-
- public int getPollingInterval() {
- return pollingInterval;
- }
-
- public int getPollingTimeout() {
- return pollingTimeout;
- }
-
- public int getRetryDelay() {
- return retryDelay;
- }
-
- public String getConsumerId() {
- return consumerId;
- }
-
- public List<String> getArtifactTypes() {
- return artifactTypes;
- }
-
- public String getConsumerGroup() {
- return consumerGroup;
- }
-
- public String getEnvironmentName() {
- return environmentName;
- }
-
- public String getKeyStorePassword() {
- return keyStorePassword;
- }
-
- public boolean isActiveServerTlsAuth() {
- return activeServerTlsAuth;
- }
-
- public String getKeyStorePath() {
- return keyStorePath;
- }
-
- public boolean isFilterInEmptyResources() {
- return isFilterInEmptyResources;
- }
-
- public boolean isUseHttpsWithDmaap() {
- return isUseHttpsWithDmaap;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public GroupValidationResult validate() {
- final GroupValidationResult validationResult = new GroupValidationResult(this);
- validateStringElement(validationResult, asdcAddress, "asdcAddress");
- validateStringElement(validationResult, user, "user");
- validateStringElement(validationResult, consumerId, "consumerId");
- validateStringElement(validationResult, consumerGroup, "consumerGroup");
- validateStringElement(validationResult, keyStorePath, "keyStorePath");
- validateStringElement(validationResult, keyStorePassword, "keyStorePassword");
- validateIntElement(validationResult, pollingInterval, "pollingInterval");
- validateIntElement(validationResult, pollingTimeout, "pollingTimeout");
- validateIntElement(validationResult, retryDelay, "retryDelay");
- validateStringListElement(validationResult, messageBusAddress, "messageBusAddress");
- validateStringListElement(validationResult, artifactTypes, "artifactTypes");
- return validationResult;
- }
-
- /**
- * Validate the integer Element.
- *
- * @param validationResult the result object
- * @param element the element to validate
- * @param elementName the element name for error message
- */
- private void validateIntElement(final GroupValidationResult validationResult, final int element,
- final String elementName) {
- if (!ParameterValidationUtils.validateIntParameter(element)) {
- validationResult.setResult(elementName, ValidationStatus.INVALID,
- elementName + " must be a positive integer");
- }
- }
-
- /**
- * Validate the String List Element.
- *
- * @param validationResult the result object
- * @param element the element to validate
- * @param elementName the element name for error message
- */
- private void validateStringListElement(final GroupValidationResult validationResult, final List<String> element,
- final String elementName) {
- for (final String temp : element) {
- if (!ParameterValidationUtils.validateStringParameter(temp)) {
- validationResult.setResult(elementName, ValidationStatus.INVALID,
- "the string of " + elementName + "must be a non-blank string");
- }
- }
- }
-
- /**
- * Validate the string element.
- *
- * @param validationResult the result object
- * @param element the element to validate
- * @param elementName the element name for error message
- */
- private void validateStringElement(final GroupValidationResult validationResult, final String element,
- final String elementName) {
- if (!ParameterValidationUtils.validateStringParameter(element)) {
- validationResult.setResult(elementName, ValidationStatus.INVALID,
- elementName + " must be a non-blank string");
- }
+ public SdcReceptionHandlerConfigurationParameterGroup() {
+ super(SdcReceptionHandlerConfigurationParameterGroup.class.getSimpleName());
}
}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/CommonTestData.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/CommonTestData.java
new file mode 100644
index 00000000..5006e078
--- /dev/null
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/CommonTestData.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.decoding.pdpx;
+
+import java.io.File;
+
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+
+/**
+ * Class to create parameters for test cases.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@est.tech)
+ */
+public class CommonTestData {
+
+ public static final Coder coder = new StandardCoder();
+
+ /**
+ * Returns PolicyDecoderParameters for test cases.
+ *
+ * @param fileName the file name to load the parameters
+ * @param clazz the parameter class to be returned
+ * @return the specific PolicyDecoderParameters object
+ */
+ public static <T> T getPolicyDecoderParameters(final String fileName, final Class<T> clazz) {
+ final StandardCoder coder = new StandardCoder();
+ try {
+ return coder.decode(new File(fileName), clazz);
+ } catch (final CoderException exp) {
+ throw new RuntimeException("cannot read/decode " + fileName, exp);
+ }
+ }
+}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java
index 0cd8b6f4..9cfbaf80 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,17 +42,15 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
*/
public class TestPolicyDecoderCsarPdpx {
- private static final String CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION = "csarToOptimizationPolicyConfiguration";
-
/**
* Set up for test cases.
*/
@BeforeClass
public static void setUp() {
- final ParameterGroup parameterGroup = new PolicyDecoderCsarPdpxConfigurationParameterBuilder()
- .setOnapName("onapName").setPolicyNamePrefix("OOF").setPriority("5").setRiskLevel("2")
- .setRiskType("Test").setVersion("1.0").build();
- parameterGroup.setName(CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION);
+ final ParameterGroup parameterGroup = CommonTestData.getPolicyDecoderParameters(
+ "src/test/resources/parameters/PdpxPolicyDecoderParameters.json",
+ PolicyDecoderCsarPdpxConfigurationParameterGroup.class);
+ parameterGroup.setName(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
ParameterService.register(parameterGroup);
}
@@ -60,14 +59,14 @@ public class TestPolicyDecoderCsarPdpx {
*/
@AfterClass
public static void tearDown() {
- ParameterService.deregister(CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION);
+ ParameterService.deregister(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
}
@Test
public void testHpaPolicy2Vnf() throws IOException, PolicyDecodingException {
final Csar csar = new Csar("src/test/resources/service-TestNs8-csar.csar");
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
- policyDecoderCsarPdpx.configure(CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION);
+ policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
final Collection<ToscaServiceTemplate> ret = policyDecoderCsarPdpx.decode(csar);
@@ -98,7 +97,7 @@ public class TestPolicyDecoderCsarPdpx {
public void testHpaPolicySriov() throws IOException, PolicyDecodingException {
final Csar csar = new Csar("src/test/resources/hpaPolicySriov.csar");
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
- policyDecoderCsarPdpx.configure(CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION);
+ policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
final ToscaServiceTemplate policy = (ToscaServiceTemplate) policies.toArray()[0];
@@ -138,7 +137,7 @@ public class TestPolicyDecoderCsarPdpx {
public void testHpaPolicyPciePassthrough() throws IOException, PolicyDecodingException {
final Csar csar = new Csar("src/test/resources/hpaPolicyPciePassthrough.csar");
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
- policyDecoderCsarPdpx.configure(CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION);
+ policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
assertEquals(2, policies.size());
@@ -181,7 +180,7 @@ public class TestPolicyDecoderCsarPdpx {
public void testHpaPolicyHugePage() throws IOException, PolicyDecodingException {
final Csar csar = new Csar("src/test/resources/hpaPolicyHugePage.csar");
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
- policyDecoderCsarPdpx.configure(CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION);
+ policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
assertEquals(2, policies.size());
@@ -214,7 +213,7 @@ public class TestPolicyDecoderCsarPdpx {
public void testS3p0PciVendorId() throws IOException, PolicyDecodingException {
final Csar csar = new Csar("src/test/resources/s3p_0_pciVendorId.csar");
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
- policyDecoderCsarPdpx.configure(CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION);
+ policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
assertEquals(1, policies.size());
@@ -248,7 +247,7 @@ public class TestPolicyDecoderCsarPdpx {
public void testserviceVcpeWithAll() throws IOException, PolicyDecodingException {
final Csar csar = new Csar("src/test/resources/service-VcpeWithAll-csar.csar");
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
- policyDecoderCsarPdpx.configure(CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION);
+ policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
assertEquals(5, policies.size());
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpxConfigurationParameterGroup.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpxConfigurationParameterGroup.java
index bebb8459..d0de432a 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpxConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpxConfigurationParameterGroup.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,17 +33,13 @@ import org.onap.policy.common.parameters.ValidationStatus;
*/
public class TestPolicyDecoderCsarPdpxConfigurationParameterGroup {
- private static final String OPTIMIZATION_POLICY_CONFIGURATION = "optimizationPolicyConfiguration";
-
@Test
- public void testBuilderAndGetters() {
- final PolicyDecoderCsarPdpxConfigurationParameterGroup parameterGroup =
- new PolicyDecoderCsarPdpxConfigurationParameterBuilder().setOnapName("onapName")
- .setPolicyNamePrefix("OOF").setPriority("5").setRiskLevel("2").setRiskType("Test")
- .setVersion("1.0").build();
- parameterGroup.setName(OPTIMIZATION_POLICY_CONFIGURATION);
+ public void testValidParameters() {
+ final PolicyDecoderCsarPdpxConfigurationParameterGroup parameterGroup = CommonTestData
+ .getPolicyDecoderParameters("src/test/resources/parameters/PdpxPolicyDecoderParameters.json",
+ PolicyDecoderCsarPdpxConfigurationParameterGroup.class);
- assertEquals(OPTIMIZATION_POLICY_CONFIGURATION, parameterGroup.getName());
+ assertEquals(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName(), parameterGroup.getName());
assertEquals("onapName", parameterGroup.getOnapName());
assertEquals("OOF", parameterGroup.getPolicyNamePrefix());
assertEquals("5", parameterGroup.getPriority());
@@ -54,11 +51,19 @@ public class TestPolicyDecoderCsarPdpxConfigurationParameterGroup {
@Test
public void testInvalidParameters() {
- final PolicyDecoderCsarPdpxConfigurationParameterGroup parameterGroup =
- new PolicyDecoderCsarPdpxConfigurationParameterBuilder().setOnapName("").setPolicyNamePrefix("")
- .setPriority("").setRiskLevel("").setRiskType("").setVersion("").build();
- parameterGroup.setName(OPTIMIZATION_POLICY_CONFIGURATION);
+ final PolicyDecoderCsarPdpxConfigurationParameterGroup parameterGroup = CommonTestData
+ .getPolicyDecoderParameters("src/test/resources/parameters/PdpxPolicyDecoderParametersInvalid.json",
+ PolicyDecoderCsarPdpxConfigurationParameterGroup.class);
assertEquals(ValidationStatus.INVALID, parameterGroup.validate().getStatus());
}
+
+ @Test
+ public void testEmptyParameters() {
+ final PolicyDecoderCsarPdpxConfigurationParameterGroup configurationParameters =
+ CommonTestData.getPolicyDecoderParameters("src/test/resources/parameters/EmptyParameters.json",
+ PolicyDecoderCsarPdpxConfigurationParameterGroup.class);
+
+ assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus());
+ }
}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java
index 2dd09985..56ddc406 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.distribution.reception.decoding.pdpx.CommonTestData;
/**
* Class to perform unit test of {@link PolicyDecoderFileInCsarToPolicyParameterGroup}.
@@ -33,32 +35,34 @@ import org.onap.policy.common.parameters.ValidationStatus;
public class PolicyDecoderFileInCsarToPolicyParameterGroupTest {
@Test
- public void testConstructorAndGetters() {
- final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters =
- new PolicyDecoderFileInCsarToPolicyParameterGroup("SamplePolicy", "SamplePolicyType");
- configurationParameters.setName("myConfiguration");
+ public void testValidParameters() {
+ final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters = CommonTestData
+ .getPolicyDecoderParameters("src/test/resources/parameters/FileInCsarPolicyDecoderParameters.json",
+ PolicyDecoderFileInCsarToPolicyParameterGroup.class);
- assertEquals("myConfiguration", configurationParameters.getName());
- assertEquals("SamplePolicy", configurationParameters.getPolicyFileName());
- assertEquals("SamplePolicyType", configurationParameters.getPolicyTypeFileName());
+ assertEquals(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName(),
+ configurationParameters.getName());
+ assertEquals("apex_ddf_policy", configurationParameters.getPolicyFileName());
+ assertEquals("apex_ddf_policy_type", configurationParameters.getPolicyTypeFileName());
assertEquals(ValidationStatus.CLEAN, configurationParameters.validate().getStatus());
}
@Test
- public void testInvalidPolicyFileName() {
+ public void testInvalidParameters() {
final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters =
- new PolicyDecoderFileInCsarToPolicyParameterGroup("", "SamplePolicyType");
- configurationParameters.setName("myConfiguration");
+ CommonTestData.getPolicyDecoderParameters(
+ "src/test/resources/parameters/FileInCsarPolicyDecoderParametersInvalid.json",
+ PolicyDecoderFileInCsarToPolicyParameterGroup.class);
assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus());
}
@Test
- public void testEmptyPolicyType() {
+ public void testEmptyParameters() {
final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters =
- new PolicyDecoderFileInCsarToPolicyParameterGroup("SamplePolicy", "");
- configurationParameters.setName("myConfiguration");
+ CommonTestData.getPolicyDecoderParameters("src/test/resources/parameters/EmptyParameters.json",
+ PolicyDecoderFileInCsarToPolicyParameterGroup.class);
- assertEquals(ValidationStatus.CLEAN, configurationParameters.validate().getStatus());
+ assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus());
}
}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java
index 2d0ba3ba..451e4f1b 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +37,7 @@ import org.mockito.runners.MockitoJUnitRunner;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.distribution.model.Csar;
+import org.onap.policy.distribution.reception.decoding.pdpx.CommonTestData;
import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
@@ -46,18 +48,15 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
@RunWith(MockitoJUnitRunner.class)
public class PolicyDecoderFileInCsarToPolicyTest {
- private static final String POLICY_FILE_NAME = "apex_ddf_policy";
- private static final String POLICY_TYPE_FILE_NAME = "apex_ddf_policy_type";
- private static final String GROUP_NAME = "apexPdpDecoderConfiguration";
-
/**
* Set up.
*/
@BeforeClass
public static void setUp() {
- final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters =
- new PolicyDecoderFileInCsarToPolicyParameterGroup(POLICY_FILE_NAME, POLICY_TYPE_FILE_NAME);
- configurationParameters.setName(GROUP_NAME);
+ final PolicyDecoderFileInCsarToPolicyParameterGroup configurationParameters = CommonTestData
+ .getPolicyDecoderParameters("src/test/resources/parameters/FileInCsarPolicyDecoderParameters.json",
+ PolicyDecoderFileInCsarToPolicyParameterGroup.class);
+ configurationParameters.setName(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
ParameterService.register(configurationParameters);
}
@@ -66,14 +65,14 @@ public class PolicyDecoderFileInCsarToPolicyTest {
*/
@AfterClass
public static void tearDown() {
- ParameterService.deregister(GROUP_NAME);
+ ParameterService.deregister(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
}
@Test
public void testDecodePolicy() {
final PolicyDecoderFileInCsarToPolicy decoder = new PolicyDecoderFileInCsarToPolicy();
- decoder.configure(GROUP_NAME);
+ decoder.configure(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
final File file = new File("src/test/resources/service-Sampleservice.csar");
final Csar csar = new Csar(file.getAbsolutePath());
@@ -91,7 +90,7 @@ public class PolicyDecoderFileInCsarToPolicyTest {
public void testDecodePolicyZipError() {
final PolicyDecoderFileInCsarToPolicy decoder = new PolicyDecoderFileInCsarToPolicy();
- decoder.configure(GROUP_NAME);
+ decoder.configure(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
final File file = new File("unknown.csar");
final Csar csar = new Csar(file.getAbsolutePath());
@@ -111,7 +110,7 @@ public class PolicyDecoderFileInCsarToPolicyTest {
public void testDecodePolicyCoderError() {
final PolicyDecoderFileInCsarToPolicy decoder = new PolicyDecoderFileInCsarToPolicy();
- decoder.configure(GROUP_NAME);
+ decoder.configure(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName());
final File file = new File("src/test/resources/service-Sampleservice-test.csar");
final Csar csar = new Csar(file.getAbsolutePath());
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java
index 1d32b191..dab97ec3 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java
@@ -52,9 +52,9 @@ public class TestFileSystemReceptionHandlerConfigurationParameterGroup {
try {
validPath = tempFolder.getRoot().getAbsolutePath();
- final FileSystemReceptionHandlerConfigurationParameterBuilder builder =
- new FileSystemReceptionHandlerConfigurationParameterBuilder().setWatchPath(validPath).setMaxThread(2);
- configParameters = new FileSystemReceptionHandlerConfigurationParameterGroup(builder);
+ configParameters = new FileSystemReceptionHandlerConfigurationParameterGroup();
+ configParameters.setWatchPath(validPath);
+ configParameters.setMaxThread(2);
} catch (final Exception e) {
fail("test should not thrown an exception here: " + e.getMessage());
}
@@ -79,24 +79,12 @@ public class TestFileSystemReceptionHandlerConfigurationParameterGroup {
}
@Test
- public void testFileSystemReceptionHandlerConfigurationParameterBuilder() {
-
- final FileSystemReceptionHandlerConfigurationParameterBuilder builder =
- new FileSystemReceptionHandlerConfigurationParameterBuilder().setWatchPath("/foo/bar");
- final FileSystemReceptionHandlerConfigurationParameterGroup configParameters =
- new FileSystemReceptionHandlerConfigurationParameterGroup(builder);
-
- assertEquals("/foo/bar", configParameters.getWatchPath());
- }
-
- @Test
public void testFileSystemReceptionHandlerConfigurationParameterBuilderWithInvalidPath() throws IOException {
final String invalidPath = tempFolder.newFile("foobar").getAbsolutePath();
- final FileSystemReceptionHandlerConfigurationParameterBuilder builder =
- new FileSystemReceptionHandlerConfigurationParameterBuilder().setWatchPath(invalidPath);
final FileSystemReceptionHandlerConfigurationParameterGroup configParameters =
- new FileSystemReceptionHandlerConfigurationParameterGroup(builder);
+ new FileSystemReceptionHandlerConfigurationParameterGroup();
+ configParameters.setWatchPath(invalidPath);
final GroupValidationResult validateResult = configParameters.validate();
assertFalse(validateResult.isValid());
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
index f9a65c54..30bcdf11 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +35,8 @@ import java.util.Arrays;
import org.junit.Test;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.distribution.reception.decoding.pdpx.CommonTestData;
/**
* Class to perform unit test of {@link SdcConfiguration}.
@@ -86,75 +89,11 @@ public class TestSdcReceptionHandlerConfigurationParameterGroup {
}
@Test
- public void testSdcConfigurationBuilder() {
+ public void testEmptyParameters() {
+ final SdcReceptionHandlerConfigurationParameterGroup configurationParameters =
+ CommonTestData.getPolicyDecoderParameters("src/test/resources/parameters/EmptyParameters.json",
+ SdcReceptionHandlerConfigurationParameterGroup.class);
- final SdcReceptionHandlerConfigurationParameterBuilder builder =
- new SdcReceptionHandlerConfigurationParameterBuilder().setAsdcAddress("localhost")
- .setConsumerGroup("policy-group").setConsumerId("policy-id").setEnvironmentName("TEST")
- .setKeystorePassword("password").setKeystorePath("dummyPath").setPassword("policy")
- .setPollingInterval(10).setPollingTimeout(20).setRetryDelay(30).setUser("policy")
- .setUseHttpsWithDmaap(false).setActiveserverTlsAuth(false).setFilterinEmptyResources(true)
- .setArtifactTypes(Arrays.asList("TOSCA_CSAR")).setMessageBusAddress(Arrays.asList("localhost"));
- final SdcReceptionHandlerConfigurationParameterGroup configParameters =
- new SdcReceptionHandlerConfigurationParameterGroup(builder);
- configParameters.setName("SDCConfiguration");
-
- assertEquals(Arrays.asList("localhost"), configParameters.getMessageBusAddress());
- assertEquals(Arrays.asList("TOSCA_CSAR"), configParameters.getArtifactTypes());
- assertEquals("localhost", configParameters.getAsdcAddress());
- assertEquals("policy", configParameters.getUser());
- assertEquals("policy", configParameters.getPassword());
- assertEquals(10, configParameters.getPollingInterval());
- assertEquals(20, configParameters.getPollingTimeout());
- assertEquals(30, configParameters.getRetryDelay());
- assertEquals("policy-id", configParameters.getConsumerId());
- assertEquals("policy-group", configParameters.getConsumerGroup());
- assertEquals("TEST", configParameters.getEnvironmentName());
- assertEquals("dummyPath", configParameters.getKeyStorePath());
- assertEquals("password", configParameters.getKeyStorePassword());
- assertEquals(false, configParameters.isActiveServerTlsAuth());
- assertEquals(true, configParameters.isFilterInEmptyResources());
- assertEquals(false, configParameters.isUseHttpsWithDmaap());
- }
-
- @Test
- public void testSdcConfigurationWithNullList() {
-
- final SdcReceptionHandlerConfigurationParameterBuilder builder =
- new SdcReceptionHandlerConfigurationParameterBuilder().setAsdcAddress("localhost")
- .setConsumerGroup("policy-group").setConsumerId("policy-id").setEnvironmentName("TEST")
- .setKeystorePassword("password").setKeystorePath("dummyPath").setPassword("policy")
- .setPollingInterval(10).setPollingTimeout(20).setUser("policy").setUseHttpsWithDmaap(false)
- .setActiveserverTlsAuth(false).setFilterinEmptyResources(true)
- .setArtifactTypes(Arrays.asList("TOSCA_CSAR")).setMessageBusAddress(null);
- final SdcReceptionHandlerConfigurationParameterGroup configParameters =
- new SdcReceptionHandlerConfigurationParameterGroup(builder);
- configParameters.setName("SDCConfiguration");
-
- try {
- configParameters.validate();
- fail("Test must throw an exception");
- } catch (final Exception exp) {
- assertTrue(exp.getMessage().contains("collection parameter \"messageBusAddress\" is null"));
- }
- }
-
- @Test
- public void testSdcConfigurationWithEmptyStringList() {
-
- final SdcReceptionHandlerConfigurationParameterBuilder builder =
- new SdcReceptionHandlerConfigurationParameterBuilder().setAsdcAddress("localhost")
- .setConsumerGroup("policy-group").setConsumerId("policy-id").setEnvironmentName("TEST")
- .setKeystorePassword("password").setKeystorePath("dummyPath").setPassword("policy")
- .setPollingInterval(10).setPollingTimeout(20).setUser("policy").setUseHttpsWithDmaap(false)
- .setActiveserverTlsAuth(false).setFilterinEmptyResources(true)
- .setArtifactTypes(Arrays.asList("")).setMessageBusAddress(Arrays.asList("localhost"));
- final SdcReceptionHandlerConfigurationParameterGroup configParameters =
- new SdcReceptionHandlerConfigurationParameterGroup(builder);
- configParameters.setName("SDCConfiguration");
-
- final GroupValidationResult validationResult = configParameters.validate();
- assertFalse(validationResult.isValid());
- assertTrue(validationResult.getResult().contains("must be a non-blank string"));
+ assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus());
}
}
diff --git a/plugins/reception-plugins/src/test/resources/parameters/EmptyParameters.json b/plugins/reception-plugins/src/test/resources/parameters/EmptyParameters.json
new file mode 100644
index 00000000..7a73a41b
--- /dev/null
+++ b/plugins/reception-plugins/src/test/resources/parameters/EmptyParameters.json
@@ -0,0 +1,2 @@
+{
+} \ No newline at end of file
diff --git a/plugins/reception-plugins/src/test/resources/parameters/FileInCsarPolicyDecoderParameters.json b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarPolicyDecoderParameters.json
new file mode 100644
index 00000000..ce67ef47
--- /dev/null
+++ b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarPolicyDecoderParameters.json
@@ -0,0 +1,4 @@
+{
+ "policyFileName": "apex_ddf_policy",
+ "policyTypeFileName": "apex_ddf_policy_type"
+} \ No newline at end of file
diff --git a/plugins/reception-plugins/src/test/resources/parameters/FileInCsarPolicyDecoderParametersInvalid.json b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarPolicyDecoderParametersInvalid.json
new file mode 100644
index 00000000..50719d16
--- /dev/null
+++ b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarPolicyDecoderParametersInvalid.json
@@ -0,0 +1,4 @@
+{
+ "policyFileName": "",
+ "policyTypeFileName": ""
+} \ No newline at end of file
diff --git a/plugins/reception-plugins/src/test/resources/parameters/PdpxPolicyDecoderParameters.json b/plugins/reception-plugins/src/test/resources/parameters/PdpxPolicyDecoderParameters.json
new file mode 100644
index 00000000..9f686632
--- /dev/null
+++ b/plugins/reception-plugins/src/test/resources/parameters/PdpxPolicyDecoderParameters.json
@@ -0,0 +1,8 @@
+{
+ "policyNamePrefix": "OOF",
+ "onapName": "onapName",
+ "version": "1.0",
+ "priority": "5",
+ "riskType": "Test",
+ "riskLevel": "2"
+} \ No newline at end of file
diff --git a/plugins/reception-plugins/src/test/resources/parameters/PdpxPolicyDecoderParametersInvalid.json b/plugins/reception-plugins/src/test/resources/parameters/PdpxPolicyDecoderParametersInvalid.json
new file mode 100644
index 00000000..a716452e
--- /dev/null
+++ b/plugins/reception-plugins/src/test/resources/parameters/PdpxPolicyDecoderParametersInvalid.json
@@ -0,0 +1,8 @@
+{
+ "policyNamePrefix": "",
+ "onapName": "",
+ "version": "",
+ "priority": "",
+ "riskType": "",
+ "riskLevel": ""
+} \ No newline at end of file