summaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/controller-usecases/src/main/resources/usecases.drl4
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/controlloop/UsecasesBase.java4
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParams.java38
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java4
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParamsTest.java117
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java4
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java4
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java4
-rw-r--r--controlloop/common/feature-controlloop-management/src/test/resources/op.drl4
-rw-r--r--controlloop/packages/docker-controlloop/src/main/resources/docker-entrypoint.sh22
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopParamsCleanupTest.java4
11 files changed, 184 insertions, 25 deletions
diff --git a/controlloop/common/controller-usecases/src/main/resources/usecases.drl b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
index 692c74350..be009c55e 100644
--- a/controlloop/common/controller-usecases/src/main/resources/usecases.drl
+++ b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Bell Canada.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,7 @@
package org.onap.policy.controlloop;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
-import org.onap.policy.controlloop.params.ControlLoopParams;
+import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.controlloop.ControlLoopEventStatus;
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/controlloop/UsecasesBase.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/controlloop/UsecasesBase.java
index 4fe354dc6..1fe6ace44 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/controlloop/UsecasesBase.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/controlloop/UsecasesBase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -54,7 +54,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicListener;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.controlloop.params.ControlLoopParams;
+import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
import org.onap.policy.drools.persistence.SystemPersistence;
import org.onap.policy.drools.persistence.SystemPersistenceConstants;
import org.onap.policy.drools.protocol.coders.EventProtocolCoderConstants;
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParams.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParams.java
new file mode 100644
index 000000000..6e24e26bf
--- /dev/null
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParams.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * Copyright (C) 2020 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop.drl.legacy;
+
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class ControlLoopParams implements Serializable {
+
+ private static final long serialVersionUID = 970755684770982776L;
+
+ private String closedLoopControlName;
+ private String controlLoopYaml;
+ private String policyName;
+ private String policyScope;
+ private String policyVersion;
+}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java
index 8684a9198..cfa4b3d3b 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/utils/ControlLoopUtils.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -22,7 +22,7 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.controlloop.ControlLoopException;
-import org.onap.policy.controlloop.params.ControlLoopParams;
+import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
import org.onap.policy.controlloop.processor.ControlLoopProcessor;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.slf4j.Logger;
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParamsTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParamsTest.java
new file mode 100644
index 000000000..7bb2c5c96
--- /dev/null
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParamsTest.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * Copyright (C) 2020 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop.drl.legacy;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ControlLoopParamsTest {
+ private static final String CONTROL_LOOP_NAME = "c";
+ private static final String POLICY_NAME = "m";
+ private static final String POLICY_SCOPE = "s";
+ private static final String POLICY_VERSION = "v";
+ private static final String CONTROL_LOOP_YAML = "y";
+
+ private ControlLoopParams clp = new ControlLoopParams();
+
+ /**
+ * Prepare tests.
+ */
+ @Before
+ public void setUp() {
+ clp.setClosedLoopControlName(CONTROL_LOOP_NAME);
+ clp.setPolicyName(POLICY_NAME);
+ clp.setPolicyScope(POLICY_SCOPE);
+ clp.setPolicyVersion(POLICY_VERSION);
+ clp.setControlLoopYaml(CONTROL_LOOP_YAML);
+ }
+
+ @Test
+ public void getClosedLoopControlName() {
+ assertEquals(CONTROL_LOOP_NAME, clp.getClosedLoopControlName());
+ }
+
+ @Test
+ public void getControlLoopYaml() {
+ assertEquals(CONTROL_LOOP_YAML, clp.getControlLoopYaml());
+ }
+
+ @Test
+ public void getPolicyName() {
+ assertEquals(POLICY_NAME, clp.getPolicyName());
+ }
+
+ @Test
+ public void getPolicyScope() {
+ assertEquals(POLICY_SCOPE, clp.getPolicyScope());
+ }
+
+ @Test
+ public void getPolicyVersion() {
+ assertEquals(POLICY_VERSION, clp.getPolicyVersion());
+ }
+
+ @Test
+ public void setClosedLoopControlName() {
+ clp.setClosedLoopControlName(CONTROL_LOOP_NAME.toUpperCase());
+ assertEquals(CONTROL_LOOP_NAME.toUpperCase(), clp.getClosedLoopControlName());
+ }
+
+ @Test
+ public void setControlLoopYaml() {
+ clp.setControlLoopYaml(CONTROL_LOOP_YAML.toUpperCase());
+ assertEquals(CONTROL_LOOP_YAML.toUpperCase(), clp.getControlLoopYaml());
+ }
+
+ @Test
+ public void setPolicyName() {
+ clp.setPolicyName(POLICY_NAME.toUpperCase());
+ assertEquals(POLICY_NAME.toUpperCase(), clp.getPolicyName());
+ }
+
+ @Test
+ public void setPolicyScope() {
+ clp.setPolicyScope(POLICY_SCOPE.toUpperCase());
+ assertEquals(POLICY_SCOPE.toUpperCase(), clp.getPolicyScope());
+ }
+
+ @Test
+ public void setPolicyVersion() {
+ clp.setPolicyVersion(POLICY_VERSION.toUpperCase());
+ assertEquals(POLICY_VERSION.toUpperCase(), clp.getPolicyVersion());
+ }
+
+ @Test
+ public void testTwo() {
+ ControlLoopParams other = new ControlLoopParams();
+ other.setClosedLoopControlName(CONTROL_LOOP_NAME);
+ other.setPolicyName(POLICY_NAME);
+ other.setPolicyScope(POLICY_SCOPE);
+ other.setPolicyVersion(POLICY_VERSION);
+ other.setControlLoopYaml(CONTROL_LOOP_YAML);
+
+ assertEquals(clp, other);
+ assertEquals(clp.hashCode(), other.hashCode());
+ assertEquals(clp.toString(), other.toString());
+ }
+} \ No newline at end of file
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java
index 47907d9c3..ad83b7730 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -27,7 +27,7 @@ import java.nio.file.Paths;
import java.util.Map;
import org.junit.Test;
import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.controlloop.params.ControlLoopParams;
+import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
public class ControlLoopUtilsTest {
diff --git a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java
index ae19b914e..b814c6f4a 100644
--- a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java
+++ b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
package org.onap.policy.drools.apps.controlloop.feature.management;
import java.util.stream.Stream;
-import org.onap.policy.controlloop.params.ControlLoopParams;
+import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
import org.onap.policy.drools.features.PolicyEngineFeatureApi;
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyControllerConstants;
diff --git a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java
index 563cac049..ff53d5201 100644
--- a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java
+++ b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 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.
@@ -42,8 +42,8 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.onap.policy.aai.AaiManager;
import org.onap.policy.controlloop.ControlLoopException;
+import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager;
-import org.onap.policy.controlloop.params.ControlLoopParams;
import org.onap.policy.controlloop.processor.ControlLoopProcessor;
import org.onap.policy.drools.apps.controlloop.feature.management.ControlLoopManagementFeature;
import org.onap.policy.drools.controller.DroolsController;
diff --git a/controlloop/common/feature-controlloop-management/src/test/resources/op.drl b/controlloop/common/feature-controlloop-management/src/test/resources/op.drl
index 48ed09929..ca0b751c7 100644
--- a/controlloop/common/feature-controlloop-management/src/test/resources/op.drl
+++ b/controlloop/common/feature-controlloop-management/src/test/resources/op.drl
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
package org.onap.policy.drools.apps.controlloop.feature.management;
-import org.onap.policy.controlloop.params.ControlLoopParams;
+import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
rule "PARAMS"
when
diff --git a/controlloop/packages/docker-controlloop/src/main/resources/docker-entrypoint.sh b/controlloop/packages/docker-controlloop/src/main/resources/docker-entrypoint.sh
index c48cf6422..a1d689a07 100644
--- a/controlloop/packages/docker-controlloop/src/main/resources/docker-entrypoint.sh
+++ b/controlloop/packages/docker-controlloop/src/main/resources/docker-entrypoint.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ########################################################################
-# Copyright 2019 AT&T Intellectual Property. All rights reserved
+# Copyright 2019-2020 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.
@@ -38,7 +38,7 @@ function maven {
fi
}
-function configurations {
+function systemConfs {
if [[ ${DEBUG} == y ]]; then
echo "-- ${FUNCNAME[0]} --"
set -x
@@ -51,7 +51,7 @@ function configurations {
fi
for c in $(ls "${POLICY_INSTALL_INIT}"/*.conf 2> /dev/null); do
- echo "adding configuration file: ${c}"
+ echo "adding system conf file: ${c}"
cp -f "${c}" "${POLICY_HOME}"/etc/profile.d/
confName="$(basename "${c}")"
sed -i -e "s/ *= */=/" -e "s/=\([^\"\']*$\)/='\1'/" "${POLICY_HOME}/etc/profile.d/${confName}"
@@ -126,18 +126,20 @@ function security {
fi
}
-function properties {
+function serverConfig {
if [[ ${DEBUG} == y ]]; then
echo "-- ${FUNCNAME[0]} --"
set -x
fi
- if ! ls "${POLICY_INSTALL_INIT}"/*.properties > /dev/null 2>&1; then
+ local configExtSuffix=${1:-"properties"}
+
+ if ! ls "${POLICY_INSTALL_INIT}"/*."${configExtSuffix}" > /dev/null 2>&1; then
return 0
fi
- for p in $(ls "${POLICY_INSTALL_INIT}"/*.properties 2> /dev/null); do
- echo "configuration properties: ${p}"
+ for p in $(ls "${POLICY_INSTALL_INIT}"/*."${configExtSuffix}" 2> /dev/null); do
+ echo "configuration ${configExtSuffix}: ${p}"
cp -f "${p}" "${POLICY_HOME}"/config
done
}
@@ -225,11 +227,13 @@ function reload {
set -x
fi
- configurations
+ systemConfs
maven
features
security
- properties
+ serverConfig "properties"
+ serverConfig "xml"
+ serverConfig "json"
scripts "pre.sh"
}
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopParamsCleanupTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopParamsCleanupTest.java
index 947e50c00..ae12d0469 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopParamsCleanupTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopParamsCleanupTest.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * demo
+ * ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 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.