Make drools-apps event agnostic 97/111597/4
authorJim Hahn <jrh3@att.com>
Mon, 26 Oct 2020 20:48:47 +0000 (16:48 -0400)
committerJim Hahn <jrh3@att.com>
Mon, 16 Nov 2020 19:28:34 +0000 (14:28 -0500)
Removed tdjam and frankfurt controllers, which use event-specific
actors.

Issue-ID: POLICY-2804
Change-Id: Ica05f80bf72d039d9c4903591af7fb3793a81159
Signed-off-by: Jim Hahn <jrh3@att.com>
56 files changed:
controlloop/common/controller-frankfurt/pom.xml [deleted file]
controlloop/common/controller-frankfurt/src/main/resources/META-INF/kmodule.xml [deleted file]
controlloop/common/controller-frankfurt/src/main/resources/frankfurt.drl [deleted file]
controlloop/common/controller-frankfurt/src/test/java/org/onap/policy/controlloop/FrankfurtTest.java [deleted file]
controlloop/common/controller-frankfurt/src/test/resources/config/event-manager.properties [deleted file]
controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-controller.properties [deleted file]
controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-http-client.properties [deleted file]
controlloop/common/controller-frankfurt/src/test/resources/frankfurt.pom [deleted file]
controlloop/common/controller-tdjam/pom.xml [deleted file]
controlloop/common/controller-tdjam/src/main/java/org/onap/policy/controlloop/tdjam/SerialWorkQueue.java [deleted file]
controlloop/common/controller-tdjam/src/main/java/org/onap/policy/controlloop/tdjam/TdjamController.java [deleted file]
controlloop/common/controller-tdjam/src/main/java/org/onap/policy/extension/system/NonDroolsPolicyController.java [deleted file]
controlloop/common/controller-tdjam/src/main/resources/META-INF/services/org.onap.policy.drools.features.DroolsControllerFeatureApi [deleted file]
controlloop/common/controller-tdjam/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyControllerFeatureApi [deleted file]
controlloop/common/controller-tdjam/src/test/java/org/onap/policy/controlloop/TdjamTest.java [deleted file]
controlloop/common/controller-tdjam/src/test/java/org/onap/policy/controlloop/tdjam/TdjamControllerTest.java [deleted file]
controlloop/common/controller-tdjam/src/test/java/org/onap/policy/extension/system/NonDroolsPolicyControllerTest.java [deleted file]
controlloop/common/controller-tdjam/src/test/resources/META-INF/services/org.onap.policy.drools.features.DroolsControllerFeatureApi [deleted file]
controlloop/common/controller-tdjam/src/test/resources/META-INF/services/org.onap.policy.drools.features.PolicyControllerFeatureApi [deleted file]
controlloop/common/controller-tdjam/src/test/resources/config/event-manager.properties [deleted file]
controlloop/common/controller-tdjam/src/test/resources/config/tdjam-controller.properties [deleted file]
controlloop/common/controller-tdjam/src/test/resources/config/tdjam-http-client.properties [deleted file]
controlloop/common/controller-tdjam/src/test/resources/logback-test.xml [deleted file]
controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java
controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java
controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java [deleted file]
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Drools.java [deleted file]
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java [deleted file]
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/LockData.java
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ManagerContext.java [deleted file]
controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java [deleted file]
controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2Test.java [deleted file]
controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/LockDataTest.java
controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/StepTest.java
controlloop/common/feature-controlloop-frankfurt/pom.xml [deleted file]
controlloop/common/feature-controlloop-frankfurt/src/assembly/assemble_zip.xml [deleted file]
controlloop/common/feature-controlloop-frankfurt/src/main/feature/config/frankfurt-controller.properties [deleted file]
controlloop/common/feature-controlloop-frankfurt/src/main/feature/config/logback-include-frankfurt.xml [deleted file]
controlloop/common/feature-controlloop-frankfurt/src/main/java/org/onap/policy/drools/apps/controlloop/feature/frankfurt/FrankfurtFeature.java [deleted file]
controlloop/common/feature-controlloop-frankfurt/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi [deleted file]
controlloop/common/feature-controlloop-frankfurt/src/test/java/org/onap/policy/drools/apps/controlloop/feature/frankfurt/FrankfurtFeatureTest.java [deleted file]
controlloop/common/feature-controlloop-management/src/main/feature/config/controlloop.properties.environment
controlloop/common/feature-controlloop-tdjam/pom.xml [deleted file]
controlloop/common/feature-controlloop-tdjam/src/assembly/assemble_zip.xml [deleted file]
controlloop/common/feature-controlloop-tdjam/src/main/feature/config/logback-include-tdjam.xml [deleted file]
controlloop/common/feature-controlloop-tdjam/src/main/feature/config/tdjam-controller.properties [deleted file]
controlloop/common/feature-controlloop-tdjam/src/main/java/org/onap/policy/drools/apps/controlloop/feature/tdjam/TdjamFeature.java [deleted file]
controlloop/common/feature-controlloop-tdjam/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi [deleted file]
controlloop/common/feature-controlloop-tdjam/src/test/java/org/onap/policy/drools/apps/controlloop/feature/tdjam/TdjamFeatureTest.java [deleted file]
controlloop/common/pom.xml
controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Rules.java
controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/RulesTest.java
controlloop/packages/apps-controlloop/pom.xml
controlloop/packages/docker-controlloop/src/main/docker/Dockerfile

diff --git a/controlloop/common/controller-frankfurt/pom.xml b/controlloop/common/controller-frankfurt/pom.xml
deleted file mode 100644 (file)
index e9ef3e8..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ============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=========================================================
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-        <artifactId>drools-applications-common</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>controller-frankfurt</artifactId>
-    <packaging>kjar</packaging>
-
-    <name>${project.artifactId}</name>
-    <description>Frankfurt Controller</description>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.kie</groupId>
-                <artifactId>kie-maven-plugin</artifactId>
-                <extensions>true</extensions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>events</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>aai</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>appc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>appclcm</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>cds</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>sdnc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>sdnr</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>so</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>vfc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-            <artifactId>eventmanager</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actorServiceProvider</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.aai</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.appc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.appclcm</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.cds</artifactId>
-            <version>${policy.models.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.guard</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.sdnc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.sdnr</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.so</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.vfc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.drools-pdp</groupId>
-            <artifactId>policy-management</artifactId>
-            <version>${version.policy.drools-pdp}</version>
-            <scope>provided</scope>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-            <artifactId>rules-test</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <profiles>
-        <profile>
-            <!--This profile is used to store Eclipse m2e settings only. It has no
-                influence on the Maven build itself. -->
-            <id>only-eclipse</id>
-            <activation>
-                <property>
-                    <name>m2e.version</name>
-                </property>
-            </activation>
-            <build>
-                <pluginManagement>
-                    <plugins>
-                        <plugin>
-                            <groupId>org.eclipse.m2e</groupId>
-                            <artifactId>lifecycle-mapping</artifactId>
-                            <version>1.0.0</version>
-                            <configuration>
-                                <lifecycleMappingMetadata>
-                                    <pluginExecutions>
-                                        <pluginExecution>
-                                            <pluginExecutionFilter>
-                                                <groupId>org.kie</groupId>
-                                                <artifactId>kie-maven-plugin</artifactId>
-                                                <goals>
-                                                    <goal>build</goal>
-                                                </goals>
-                                            </pluginExecutionFilter>
-                                            <action>
-                                                <ignore />
-                                            </action>
-                                        </pluginExecution>
-                                    </pluginExecutions>
-                                </lifecycleMappingMetadata>
-                            </configuration>
-                        </plugin>
-                    </plugins>
-                </pluginManagement>
-            </build>
-        </profile>
-    </profiles>
-</project>
diff --git a/controlloop/common/controller-frankfurt/src/main/resources/META-INF/kmodule.xml b/controlloop/common/controller-frankfurt/src/main/resources/META-INF/kmodule.xml
deleted file mode 100644 (file)
index cc39944..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ============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=========================================================
-  -->
-<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
-    <kbase name="onap.policies.controlloop.operational.common.Drools" equalsBehavior="equality"
-           packages="org.onap.policy.controlloop">
-        <ksession name="frankfurt"/>
-    </kbase>
-</kmodule>
diff --git a/controlloop/common/controller-frankfurt/src/main/resources/frankfurt.drl b/controlloop/common/controller-frankfurt/src/main/resources/frankfurt.drl
deleted file mode 100644 (file)
index 8169e1c..0000000
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * ============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;
-
-import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
-import org.onap.policy.controlloop.CanonicalOnset;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.VirtualControlLoopNotification;
-import org.onap.policy.controlloop.ControlLoopNotificationType;
-import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2Drools;
-import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2.NewEventStatus;
-import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager2;
-import org.onap.policy.controlloop.utils.ControlLoopUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
-
-import org.onap.policy.drools.system.PolicyEngineConstants;
-
-/*
-*
-* Called when the ControlLoopParams object has been inserted into working memory from the BRMSGW.
-*
-*/
-rule "INSERT.PARAMS"
-    when
-        $params : ControlLoopParams()
-    then
-
-    Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
-    logger.info("{}: {} : TOSCA-POLICY=[{}]", $params.getClosedLoopControlName(), $params.getPolicyName() + "."
-        + drools.getRule().getName(), $params.getToscaPolicy());
-end
-
-/*
-*
-* Called when a Tosca Policy is present.
-*
-*/
-rule "NEW.TOSCA.POLICY"
-    when
-        $policy : ToscaPolicy()
-    then
-
-    Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
-    logger.info("{}: [{}|{}|{}|{}]: CONTENT: {}", drools.getRule().getName(),
-                $policy.getType(), $policy.getTypeVersion(), $policy.getName(),
-                $policy.getVersion(), $policy);
-
-    ControlLoopParams params = ControlLoopUtils.toControlLoopParams($policy);
-    if (params != null) {
-        insert(params);
-    }
-end
-
-/*
- * Remove Control Loop Parameters.
- */
-rule "REMOVE.PARAMS"
-    when
-        $params : ControlLoopParams( $policyName :  getPolicyName(), $policyVersion : getPolicyVersion() )
-        not ( ToscaPolicy( getName() == $policyName, getVersion() == $policyVersion ) )
-    then
-
-    Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
-    logger.info("{}: [{}|{}|{}]", drools.getRule().getName(),
-                $params.getPolicyScope(), $params.getPolicyName(), $params.getPolicyVersion());
-
-    retract($params);
-end
-
-/*
-*
-* This rule responds to DCAE Events where there is no manager yet. Either it is
-* the first ONSET, or a subsequent badly formed Event (i.e. Syntax error, or is-closed-loop-disabled)
-*
-*/
-rule "EVENT"
-    when
-        $params : ControlLoopParams( $clName : getClosedLoopControlName() )
-        $event : CanonicalOnset( closedLoopControlName == $clName )
-        not ( ControlLoopEventManager2Drools( closedLoopControlName == $event.getClosedLoopControlName(),
-            getContext().getEvent() == $event ) )
-    then
-
-    Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
-    logger.info("{}: {}.{}: event={}",
-                $clName, $params.getPolicyName(), drools.getRule().getName(),
-                $event);
-    //
-    // Retract the event from memory; it will be managed by the manager for now on
-    //
-    retract($event);
-
-    VirtualControlLoopNotification notification;
-
-    try {
-        //
-        // Check the event, because we need it to not be null when
-        // we create the ControlLoopEventManager2Drools. The ControlLoopEventManager2Drools
-        // will do extra syntax checking as well as check if the closed loop is disabled.
-        //
-        if ($event.getRequestId() == null) {
-            notification = new VirtualControlLoopNotification($event);
-            notification.setNotification(ControlLoopNotificationType.REJECTED);
-            notification.setFrom("policy");
-            notification.setMessage("Missing requestId");
-            notification.setPolicyName($params.getPolicyName() + "." + drools.getRule().getName());
-            notification.setPolicyScope($params.getPolicyScope());
-            notification.setPolicyVersion($params.getPolicyVersion());
-
-        } else {
-            ControlLoopEventManager2Drools manager = new ControlLoopEventManager2Drools($params, $event, drools.getWorkingMemory());
-            insert(manager);
-            try {
-                manager.start();
-            } catch(Exception e) {
-                retract(manager);
-                throw e;
-            }
-            notification = manager.makeNotification();
-            notification.setNotification(ControlLoopNotificationType.ACTIVE);
-            notification.setPolicyName($params.getPolicyName() + "." + drools.getRule().getName());
-        }
-    } catch (Exception e) {
-        logger.warn("{}: {}.{}", $clName, $params.getPolicyName(), drools.getRule().getName(), e);
-        notification = new VirtualControlLoopNotification($event);
-        notification.setNotification(ControlLoopNotificationType.REJECTED);
-        notification.setMessage("Exception occurred: " + e.getMessage());
-        notification.setPolicyName($params.getPolicyName() + "." + drools.getRule().getName());
-        notification.setPolicyScope($params.getPolicyScope());
-        notification.setPolicyVersion($params.getPolicyVersion());
-    }
-    //
-    // Generate notification
-    //
-    try {
-        PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification);
-
-    } catch(RuntimeException e) {
-        logger.warn("{}: {}.{}: event={} exception generating notification",
-                $clName, $params.getPolicyName(), drools.getRule().getName(),
-                $event, e);
-    }
-end
-
-/*
-*
-* This rule happens when we get a subsequent event.
-*
-*/
-rule "EVENT.MANAGER.NEW.EVENT"
-    when
-        $event : VirtualControlLoopEvent( )
-        $manager : ControlLoopEventManager2Drools( closedLoopControlName == $event.getClosedLoopControlName(),
-            getContext().getEvent() == $event )
-    then
-
-    Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
-    logger.info("{}: {}.{}: event={} manager={}",
-            $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName(),
-            $event, $manager);
-    //
-    // Remove the event from memory
-    //
-    retract($event);
-
-    //
-    // Check what kind of event this is
-    //
-    switch($manager.onNewEvent($event)) {
-        case SYNTAX_ERROR:
-            //
-            // Ignore any bad syntax events
-            //
-            logger.warn("{}: {}.{}: syntax error",
-                $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName());
-            break;
-
-        case FIRST_ABATEMENT:
-        case SUBSEQUENT_ABATEMENT:
-            //
-            // TODO: handle the abatement.  Currently, it's just discarded.
-            //
-            logger.info("{}: {}.{}: abatement",
-                $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName());
-            break;
-
-        case FIRST_ONSET:
-        case SUBSEQUENT_ONSET:
-        default:
-            //
-            // We don't care about subsequent onsets
-            //
-            logger.warn("{}: {}.{}: subsequent onset",
-                $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName());
-            break;
-    }
-end
-
-/*
-*
-* Step completed
-*
-*/
-rule "EVENT.MANAGER.PROCESSING"
-    when
-        $manager : ControlLoopEventManager2Drools( isUpdated(), isActive(), $notification : getNotification() )
-    then
-
-    Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
-    logger.info("{}: {}.{}: manager={}",
-            $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName(),
-            $manager);
-    //
-    // Generate notification
-    //
-    try {
-        $notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
-        PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", $notification);
-
-    } catch(RuntimeException e) {
-        logger.warn("{}: {}.{}: manager={} exception generating notification",
-                $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName(),
-                $manager, e);
-    }
-    //
-    // Generate Response notification
-    //
-    try {
-        ControlLoopResponse clResponse = $manager.getControlLoopResponse();
-        if (clResponse != null) {
-            PolicyEngineConstants.getManager().deliver("DCAE_CL_RSP", clResponse);
-        }
-
-    } catch(RuntimeException e) {
-        logger.warn("{}: {}.{}: manager={} exception generating Response notification",
-                $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName(),
-                $manager, e);
-    }
-    //
-    // Discard this message and wait for the next response.
-    //
-    $manager.nextStep();
-    update($manager);
-end
-
-/*
-*
-* Final step completed
-*
-*/
-rule "EVENT.MANAGER.FINAL"
-    when
-        $manager : ControlLoopEventManager2Drools( !isActive(), $notification : getNotification() )
-    then
-
-    Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
-    logger.info("{}: {}.{}: manager={}",
-            $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName(),
-            $manager);
-    //
-    // Generate notification
-    //
-    try {
-        $notification.setPolicyName($manager.getPolicyName() + "." + drools.getRule().getName());
-        PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", $notification);
-
-    } catch(RuntimeException e) {
-        logger.warn("{}: {}.{}: manager={} exception generating notification",
-                $manager.getClosedLoopControlName(), $manager.getPolicyName(), drools.getRule().getName(),
-                $manager, e);
-    }
-    //
-    // Retract and destroy the manager
-    //
-    retract($manager);
-    $manager.destroy();
-end
-
-/*
-*
-* This rule will clean up any rogue events where there is no
-* ControlLoopParams object corresponding to the onset event.
-*
-*/
-rule "EVENT.CLEANUP"
-    salience -1
-    when
-        $event : VirtualControlLoopEvent( $clName: closedLoopControlName )
-    then
-
-    Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
-    logger.info("{}: {}", $clName, drools.getRule().getName());
-    logger.debug("{}: {}: orphan event={}",
-                $clName, drools.getRule().getName(), $event);
-    //
-    // Retract the event
-    //
-    retract($event);
-end
-
-/*
-*
-* At this point, it appears that if we prevent the rules from getting messages from
-* topics, then that will also prevent the actors from getting them.  So the following
-* rules are here just to discard those messages.
-*
-* These have a higher salience so the objects are removed before the "FINAL" message
-* is processed, so that the junit test can assume things are done once they see the
-* "FINAL" message.  Otherwise, tests might fail sporadically.
-*
-*/
-rule "APPC.Response.CLEANUP"
-    salience 1
-    when
-        $msg : org.onap.policy.appc.Response( )
-    then
-        retract($msg);
-end
-
-rule "APPC.Request.CLEANUP"
-    salience 1
-    when
-        $msg : org.onap.policy.appc.Request( )
-    then
-        retract($msg);
-end
-
-rule "APPC-LCM.Response.CLEANUP"
-    salience 1
-    when
-        $msg : org.onap.policy.appclcm.AppcLcmDmaapWrapper( )
-    then
-        retract($msg);
-end
-
-rule "SDNR.Response.CLEANUP"
-    salience 1
-    when
-        $msg : org.onap.policy.sdnr.PciResponseWrapper( )
-    then
-        retract($msg);
-end
diff --git a/controlloop/common/controller-frankfurt/src/test/java/org/onap/policy/controlloop/FrankfurtTest.java b/controlloop/common/controller-frankfurt/src/test/java/org/onap/policy/controlloop/FrankfurtTest.java
deleted file mode 100644 (file)
index fd9847b..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * ============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;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.onap.policy.controlloop.common.rules.test.DroolsRuleTest;
-import org.onap.policy.controlloop.common.rules.test.Listener;
-import org.onap.policy.controlloop.common.rules.test.NamedRunner;
-import org.onap.policy.controlloop.common.rules.test.TestNames;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.simulators.Util;
-
-/**
- * Tests use cases using Frankfurt rules.
- *
- * <p/>
- * Note: this runs ALL tests (i.e., any whose names start with "test").
- */
-@RunWith(NamedRunner.class)
-@TestNames(prefixes = {"test"})
-
-public class FrankfurtTest extends DroolsRuleTest {
-    protected static final String CONTROLLER_NAME = "frankfurt";
-
-
-    /**
-     * Sets up statics.
-     */
-    @BeforeClass
-    public static void setUpBeforeClass() {
-        initStatics(CONTROLLER_NAME);
-
-        rules.configure("src/main/resources");
-        rules.start();
-        httpClients.addClients("frankfurt");
-        simulators.start(Util::buildAaiSim, Util::buildSoSim, Util::buildVfcSim, Util::buildGuardSim,
-                        Util::buildSdncSim);
-    }
-
-    /**
-     * Cleans up statics.
-     */
-    @AfterClass
-    public static void tearDownAfterClass() {
-        finishStatics();
-    }
-
-    /**
-     * Sets up.
-     */
-    @Before
-    public void setUp() {
-        init();
-    }
-
-    /**
-     * Tears down.
-     */
-    @After
-    public void tearDown() {
-        finish();
-    }
-
-    @Override
-    protected void waitForLockAndPermit(ToscaPolicy policy, Listener<VirtualControlLoopNotification> policyClMgt) {
-        String policyName = policy.getIdentifier().getName();
-
-        policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.ACTIVE
-                        && (policyName + ".EVENT").equals(notif.getPolicyName()));
-
-        policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.OPERATION
-                        && (policyName + ".EVENT.MANAGER.PROCESSING").equals(notif.getPolicyName())
-                        && notif.getMessage().startsWith("Sending guard query"));
-
-        policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.OPERATION
-                        && (policyName + ".EVENT.MANAGER.PROCESSING").equals(notif.getPolicyName())
-                        && notif.getMessage().startsWith("Guard result") && notif.getMessage().endsWith("Permit"));
-
-        policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.OPERATION
-                        && (policyName + ".EVENT.MANAGER.PROCESSING").equals(notif.getPolicyName())
-                        && notif.getMessage().startsWith("actor="));
-    }
-
-    @Override
-    protected VirtualControlLoopNotification waitForFinal(ToscaPolicy policy,
-                    Listener<VirtualControlLoopNotification> policyClMgt, ControlLoopNotificationType finalType) {
-
-        return policyClMgt.await(notif -> notif.getNotification() == finalType
-                        && (policy.getIdentifier().getName() + ".EVENT.MANAGER.FINAL").equals(notif.getPolicyName()));
-    }
-}
diff --git a/controlloop/common/controller-frankfurt/src/test/resources/config/event-manager.properties b/controlloop/common/controller-frankfurt/src/test/resources/config/event-manager.properties
deleted file mode 100644 (file)
index 7dd1e73..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# ============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========================================================
-#
-
-# DB parameters
-operation.history.url=jdbc:h2:mem:Frankfurt
-operation.history.userName=sa
-operation.history.password=
-
-# Actor parameters
-#
-# Note: every operation must have at least one entry, otherwise it will not be
-# configured and started.  Thus some of them have a "placeholder" property.
-#
-
-#actor.service.GUARD.disabled=true
-actor.service.GUARD.clientName=GUARD
-actor.service.GUARD.onapName=my-onap-name
-actor.service.GUARD.onapComponent=my-onap-component
-actor.service.GUARD.onapInstance=my-onap-instance
-actor.service.GUARD.operations.Decision.path=decision
-
-actor.service.AAI.clientName=AAI
-actor.service.AAI.operations.CustomQuery.path=aai/v16/query
-actor.service.AAI.operations.Pnf.path=aai/v16/network/pnfs/pnf
-actor.service.AAI.operations.Tenant.path=aai/v16/search/nodes-query
-
-actor.service.APPC.sinkTopic=APPC-LCM-READ
-actor.service.APPC.sourceTopic=APPC-LCM-WRITE
-actor.service.APPC.operations.ConfigModify.placeholder=
-actor.service.APPC.operations.Migrate.placeholder=
-actor.service.APPC.operations.Restart.placeholder=
-actor.service.APPC.operations.Rebuild.placeholder=
-
-# legacy APPC - must specify sink and source for each operation
-actor.service.APPC.operations.ModifyConfig.sinkTopic=APPC-CL
-actor.service.APPC.operations.ModifyConfig.sourceTopic=APPC-CL
-
-actor.service.CDS.operations.any.host=localhost
-actor.service.CDS.operations.any.port=7878
-actor.service.CDS.operations.any.username=grpc-username
-actor.service.CDS.operations.any.password=grpc-password
-actor.service.CDS.operations.any.timeout=10
-
-actor.service.SDNC.clientName=SDNC
-actor.service.SDNC.operations.BandwidthOnDemand.path=\
-        GENERIC-RESOURCE-API:vf-module-topology-operation
-actor.service.SDNC.operations.Reroute.path=\
-        GENERIC-RESOURCE-API:network-topology-operation
-
-actor.service.SDNR.sinkTopic=SDNR-CL
-actor.service.SDNR.sourceTopic=SDNR-CL-RSP
-actor.service.SDNR.operations.any.placeholder=
-
-actor.service.SO.clientName=SO
-actor.service.SO.pollPath=orchestrationRequests/v5/
-actor.service.SO.maxPolls=20
-actor.service.SO.pollWaitSec=20
-actor.service.SO.operations.VF\ Module\ Create.path=serviceInstantiation/v7/serviceInstances
-actor.service.SO.operations.VF\ Module\ Delete.path=serviceInstances/v7
-
-actor.service.VFC.clientName=VFC
-actor.service.VFC.pollPath=jobs
-actor.service.VFC.maxPolls=20
-actor.service.VFC.pollWaitSec=20
-actor.service.VFC.operations.Restart.path=ns
-actor.service.VFC.operations.Restart.timeoutSec=60
diff --git a/controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-controller.properties b/controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-controller.properties
deleted file mode 100644 (file)
index af3d0eb..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# ============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=========================================================
-#
-
-controller.name=frankfurt
-
-rules.groupId=org.onap.policy.controlloop
-rules.artifactId=frankfurt
-rules.version=1.0.0
-
-noop.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP,POLICY-CL-MGT,APPC-LCM-READ
-
-noop.source.topics.DCAE_TOPIC.events=\
-    org.onap.policy.controlloop.CanonicalOnset,org.onap.policy.controlloop.CanonicalAbated
-noop.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalOnset.\
-    filter=[?($.closedLoopEventStatus == 'ONSET')]
-noop.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalAbated.\
-    filter=[?($.closedLoopEventStatus == 'ABATED')]
-noop.source.topics.DCAE_TOPIC.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson
-
-noop.source.topics.APPC-CL.events=org.onap.policy.appc.Response,org.onap.policy.appc.Request
-noop.source.topics.APPC-CL.events.org.onap.policy.appc.Response.filter=[?($.CommonHeader && $.Status)]
-noop.source.topics.APPC-CL.events.org.onap.policy.appc.Request.filter=[?($.CommonHeader && $.Action)]
-noop.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-
-noop.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-noop.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')]
-noop.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-
-noop.source.topics.SDNR-CL-RSP.events=org.onap.policy.sdnr.PciResponseWrapper
-noop.source.topics.SDNR-CL-RSP.events.org.onap.policy.sdnr.PciResponseWrapper.filter=[?($.type == 'response')]
-noop.source.topics.SDNR-CL-RSP.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
-
-noop.source.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
-noop.source.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
-noop.source.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-noop.source.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-
-noop.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL,DCAE_CL_RSP
-
-noop.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
-noop.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
-noop.sink.topics.DCAE_CL_RSP.events=org.onap.policy.controlloop.ControlLoopResponse
-noop.sink.topics.DCAE_CL_RSP.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
diff --git a/controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-http-client.properties b/controlloop/common/controller-frankfurt/src/test/resources/config/frankfurt-http-client.properties
deleted file mode 100644 (file)
index 1e3e88c..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# ============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=========================================================
-#
-
-http.client.services=GUARD,AAI,SDNC,SO,VFC
-
-http.client.services.GUARD.managed=true
-http.client.services.GUARD.host=localhost
-http.client.services.GUARD.port=6669
-http.client.services.GUARD.userName=pdpx
-http.client.services.GUARD.password=pdpx
-http.client.services.GUARD.contextUriPath=policy/pdpx/v1/
-
-http.client.services.AAI.managed=true
-http.client.services.AAI.host=localhost
-http.client.services.AAI.port=6666
-http.client.services.AAI.contextUriPath=
-
-http.client.services.SDNC.managed=true
-http.client.services.SDNC.host=localhost
-http.client.services.SDNC.port=6665
-http.client.services.SDNC.userName=sdnc
-http.client.services.SDNC.password=sdnc
-http.client.services.SDNC.contextUriPath=
-
-http.client.services.SO.managed=true
-http.client.services.SO.host=localhost
-http.client.services.SO.port=6667
-http.client.services.SO.contextUriPath=
-
-http.client.services.VFC.managed=true
-http.client.services.VFC.host=localhost
-http.client.services.VFC.port=6668
-http.client.services.VFC.userName=VFC
-http.client.services.VFC.password=VFC
-http.client.services.VFC.contextUriPath=api/nslcm/v1
diff --git a/controlloop/common/controller-frankfurt/src/test/resources/frankfurt.pom b/controlloop/common/controller-frankfurt/src/test/resources/frankfurt.pom
deleted file mode 100644 (file)
index 707e59c..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ============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=========================================================
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>org.onap.policy.controlloop</groupId>
-    <artifactId>frankfurt</artifactId>
-    <version>1.0.0</version>
-</project>
diff --git a/controlloop/common/controller-tdjam/pom.xml b/controlloop/common/controller-tdjam/pom.xml
deleted file mode 100644 (file)
index 16f16e3..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ============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=========================================================
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-        <artifactId>drools-applications-common</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>controller-tdjam</artifactId>
-    <packaging>kjar</packaging>
-
-    <name>${project.artifactId}</name>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.kie</groupId>
-                <artifactId>kie-maven-plugin</artifactId>
-                <extensions>true</extensions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>events</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>aai</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>appc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>appclcm</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>cds</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>sdnc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>sdnr</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>so</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
-            <artifactId>vfc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-            <artifactId>eventmanager</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actorServiceProvider</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.aai</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.appc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.appclcm</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.cds</artifactId>
-            <version>${policy.models.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.guard</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.sdnc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.sdnr</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.so</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
-            <artifactId>actor.vfc</artifactId>
-            <version>${policy.models.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.drools-pdp</groupId>
-            <artifactId>policy-management</artifactId>
-            <version>${version.policy.drools-pdp}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-            <artifactId>rules-test</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <profiles>
-        <profile>
-            <!--This profile is used to store Eclipse m2e settings only. It has no
-                influence on the Maven build itself. -->
-            <id>only-eclipse</id>
-            <activation>
-                <property>
-                    <name>m2e.version</name>
-                </property>
-            </activation>
-            <build>
-                <pluginManagement>
-                    <plugins>
-                        <plugin>
-                            <groupId>org.eclipse.m2e</groupId>
-                            <artifactId>lifecycle-mapping</artifactId>
-                            <version>1.0.0</version>
-                            <configuration>
-                                <lifecycleMappingMetadata>
-                                    <pluginExecutions>
-                                        <pluginExecution>
-                                            <pluginExecutionFilter>
-                                                <groupId>org.kie</groupId>
-                                                <artifactId>kie-maven-plugin</artifactId>
-                                                <goals>
-                                                    <goal>build</goal>
-                                                </goals>
-                                            </pluginExecutionFilter>
-                                            <action>
-                                                <ignore />
-                                            </action>
-                                        </pluginExecution>
-                                    </pluginExecutions>
-                                </lifecycleMappingMetadata>
-                            </configuration>
-                        </plugin>
-                    </plugins>
-                </pluginManagement>
-            </build>
-        </profile>
-    </profiles>
-</project>
diff --git a/controlloop/common/controller-tdjam/src/main/java/org/onap/policy/controlloop/tdjam/SerialWorkQueue.java b/controlloop/common/controller-tdjam/src/main/java/org/onap/policy/controlloop/tdjam/SerialWorkQueue.java
deleted file mode 100644 (file)
index 7d83765..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*-
- * ============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.tdjam;
-
-import java.util.LinkedList;
-import lombok.Getter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class provides a way to handle synchronization, with minimal blocking. Requests
- * are queued until {@link #start()} is invoked.
- */
-public class SerialWorkQueue {
-    private static Logger logger = LoggerFactory.getLogger(SerialWorkQueue.class);
-
-    // current work list
-    private LinkedList<Runnable> workQueue;
-
-    @Getter
-    private boolean running = false;
-
-    /**
-     * Constructor - no initial Runnable.
-     */
-    public SerialWorkQueue() {
-        workQueue = new LinkedList<>();
-    }
-
-    /**
-     * Constructor - initial 'Runnable' is specified.
-     *
-     * @param runnable an initial 'Runnnable' to run
-     */
-    public SerialWorkQueue(Runnable runnable) {
-        workQueue = new LinkedList<>();
-        workQueue.add(runnable);
-    }
-
-    /**
-     * Starts the queue. If the current thread is the first to start it, then the current
-     * thread will process any requests in the queue before returning.
-     */
-    public void start() {
-        Runnable item;
-
-        synchronized (this) {
-            if (running) {
-                // already running
-                return;
-            }
-
-            running = true;
-            item = workQueue.peekFirst();
-        }
-
-        if (item != null) {
-            processQueue(item);
-        }
-    }
-
-    /**
-     * Called to add a 'Runnable' to the work queue. If the queue was empty, the current
-     * thread is used to process the queue.
-     *
-     * @param work the Runnable to be queued, and eventually run
-     */
-    public void queueAndRun(Runnable work) {
-        synchronized (this) {
-            workQueue.add(work);
-            if (!running || workQueue.size() > 1) {
-                // there was already work in the queue, so presumably there is
-                // already an associated thread running
-                return;
-            }
-            // if we reach this point, the queue was empty when this method was
-            // called, so this thread will process the queue
-        }
-
-        processQueue(work);
-    }
-
-    /**
-     * Internal method to process the work queue until it is empty. Note that entries
-     * could be added by this thread or another one while we are working.
-     *
-     * @param firstItem the first item in the queue
-     */
-    private void processQueue(Runnable firstItem) {
-        Runnable next = firstItem;
-        while (next != null) {
-            try {
-                next.run();
-            } catch (Exception e) {
-                logger.error("SerialWorkQueue.processQueue exception", e);
-            }
-
-            synchronized (this) {
-                // remove the job we just ran
-                workQueue.removeFirst();
-                next = workQueue.peekFirst();
-            }
-        }
-    }
-}
diff --git a/controlloop/common/controller-tdjam/src/main/java/org/onap/policy/controlloop/tdjam/TdjamController.java b/controlloop/common/controller-tdjam/src/main/java/org/onap/policy/controlloop/tdjam/TdjamController.java
deleted file mode 100644 (file)
index 3b36551..0000000
+++ /dev/null
@@ -1,835 +0,0 @@
-/*-
- * ============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.tdjam;
-
-import static org.onap.policy.drools.properties.DroolsPropertyConstants.PROPERTY_CONTROLLER_TYPE;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import org.onap.policy.common.endpoints.event.comm.Topic;
-import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
-import org.onap.policy.common.endpoints.event.comm.TopicListener;
-import org.onap.policy.common.endpoints.event.comm.TopicSource;
-import org.onap.policy.controlloop.CanonicalOnset;
-import org.onap.policy.controlloop.ControlLoopEvent;
-import org.onap.policy.controlloop.ControlLoopException;
-import org.onap.policy.controlloop.ControlLoopNotificationType;
-import org.onap.policy.controlloop.ControlLoopResponse;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.VirtualControlLoopNotification;
-import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
-import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2;
-import org.onap.policy.controlloop.utils.ControlLoopUtils;
-import org.onap.policy.drools.controller.DroolsController;
-import org.onap.policy.drools.features.DroolsControllerFeatureApi;
-import org.onap.policy.drools.features.PolicyControllerFeatureApi;
-import org.onap.policy.drools.protocol.coders.EventProtocolCoder.CoderFilters;
-import org.onap.policy.drools.protocol.coders.EventProtocolCoderConstants;
-import org.onap.policy.drools.protocol.coders.ProtocolCoderToolset;
-import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration;
-import org.onap.policy.drools.system.PolicyController;
-import org.onap.policy.drools.system.PolicyEngineConstants;
-import org.onap.policy.extension.system.NonDroolsPolicyController;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This replaces a Drools session with Java code. Although Drools memory
- * is simulated when running the Junit tests, there is no actual use of
- * Drools here.
- */
-public class TdjamController extends NonDroolsPolicyController {
-    private static Logger logger = LoggerFactory.getLogger(TdjamController.class);
-
-    // the 'controller.type' property is set to this value
-    private static final String TDJAM_CONTROLLER_BUILDER_TAG = "tdjam";
-
-    // topic on which to publish event notifications
-    private static final String POLICY_CL_MGT = "POLICY-CL-MGT";
-
-    // additional data associated with session
-    private final String groupId;
-    private final String artifactId;
-
-    // top-level tosca policy table (first key = name, second key = version)
-    private final Map<String, Map<String, ToscaPolicy>> toscaPolicies = new HashMap<>();
-
-    // maps 'controlLoopControlName' to 'ControlLoopParams'
-    private final Map<String, ControlLoopParams> controlLoopParams = new HashMap<>();
-
-    // maps 'requestId' to 'ControlLoopEventManager'
-    private final Map<UUID, ControlLoopEventManager> eventManagers = new ConcurrentHashMap<>();
-
-    // maps onset to 'ControlLoopEventManager'
-    private final Map<VirtualControlLoopEvent, ControlLoopEventManager> onsetToEventManager = new ConcurrentHashMap<>();
-
-    // maps 'topic' to 'TopicData'
-    private final Map<String, TopicData> topicDataTable = new ConcurrentHashMap<>();
-
-    /* ============================================================ */
-
-    /**
-     * Initialize a new 'TdjamController'.
-     *
-     * @param name the controller name
-     * @param properties properties defining the controller
-     */
-    public TdjamController(String name, Properties properties) {
-        super(name, properties);
-
-        this.groupId = getGroupId();
-        this.artifactId = getArtifactId();
-
-        init();
-    }
-
-    private void init() {
-        // go through all of the incoming message decoders associated
-        // with this controller
-        for (ProtocolCoderToolset pct :
-                EventProtocolCoderConstants.getManager()
-                .getDecoders(groupId, artifactId)) {
-            // go through the 'CoderFilters' instances, and see if there are
-            // any that we are interested in
-            for (CoderFilters cf : pct.getCoders()) {
-                try {
-                    Class<?> clazz = Class.forName(cf.getCodedClass());
-                    if (ControlLoopEvent.class.isAssignableFrom(clazz)) {
-                        // this one is of interest
-                        logger.debug("TdjamController using CoderFilters: {}", cf);
-                        getTopicData(pct.getTopic());
-                    }
-                } catch (ClassNotFoundException e) {
-                    logger.error("CoderFilter refers to unknown class: {}",
-                                 cf.getCodedClass(), e);
-                }
-            }
-        }
-
-        // start all 'TopicData' instances
-        for (TopicData topicData : topicDataTable.values()) {
-            topicData.start();
-        }
-    }
-
-    @Override
-    public <T> boolean offer(T object) {
-        if (object instanceof ToscaPolicy) {
-            addToscaPolicy((ToscaPolicy) object);
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Add or replace a ToscaPolicy instance. The policy is keyed by name and
-     * version.
-     *
-     * @param toscaPolicy the ToscaPolicy being added
-     * @return if a ToscaPolicy with this name/version previously existed within
-     *     this TdjamController, it is returned; otherwise, 'null' is returned.
-     */
-    public synchronized ToscaPolicy addToscaPolicy(ToscaPolicy toscaPolicy) {
-        Map<String, ToscaPolicy> level2 =
-            toscaPolicies.computeIfAbsent(toscaPolicy.getName(),
-                key -> new HashMap<String, ToscaPolicy>());
-        ToscaPolicy prev = level2.put(toscaPolicy.getVersion(), toscaPolicy);
-        if (prev != null) {
-            // update 'ControlLoopParams' entries
-            for (ControlLoopParams clp : controlLoopParams.values()) {
-                if (clp.getToscaPolicy() == prev) {
-                    clp.setToscaPolicy(toscaPolicy);
-                }
-            }
-        }
-        logger.debug("ToscaPolicy name={}, version={}, count={}, prev={}",
-            toscaPolicy.getName(), toscaPolicy.getVersion(), toscaPolicies.size(), (prev != null));
-        dumpTables();
-
-        // attempt to create a 'ControlLoopParams' instance from this object
-        ControlLoopParams params =
-            ControlLoopUtils.toControlLoopParams(toscaPolicy);
-        if (params != null) {
-            addControlLoopParams(params);
-        }
-        return prev;
-    }
-
-    /**
-     * Remove a ToscaPolicy instance associated with the specified name and
-     * version.
-     *
-     * @param name the name of the ToscaPolicy to remove
-     * @param version the version of the ToscaPolicy to remove
-     * @return the ToscaPolicy that was removed, or 'null' if not found
-     */
-    public synchronized ToscaPolicy removeToscaPolicy(String name, String version) {
-        ToscaPolicy prev = null;
-        Map<String, ToscaPolicy> level2 = toscaPolicies.get(name);
-
-        if (level2 != null && (prev = level2.remove(version)) != null) {
-            // remove all 'ControlLoopParams' entries referencing this policy
-            for (ControlLoopParams clp :
-                    new ArrayList<>(controlLoopParams.values())) {
-                if (clp.getToscaPolicy() == prev) {
-                    controlLoopParams.remove(clp.getClosedLoopControlName());
-                }
-            }
-        }
-        return prev;
-    }
-
-    /**
-     * Fetch a ToscaPolicy instance associated with the specified name and
-     * version.
-     *
-     * @param name the name of the ToscaPolicy
-     * @param version the version of the ToscaPolicy
-     * @return the ToscaPolicy, or 'null' if not found
-     */
-    public synchronized ToscaPolicy getToscaPolicy(String name, String version) {
-        Map<String, ToscaPolicy> level2 = toscaPolicies.get(name);
-        return (level2 == null ? null : level2.get(version));
-    }
-
-    /**
-     * Return a collection of all ToscaPolicy instances.
-     *
-     * @return all ToscaPolicy instances
-     */
-    public synchronized Collection<ToscaPolicy> getAllToscaPolicies() {
-        HashSet<ToscaPolicy> rval = new HashSet<>();
-        for (Map<String, ToscaPolicy> map : toscaPolicies.values()) {
-            rval.addAll(map.values());
-        }
-        return rval;
-    }
-
-    /**
-     * Add a new 'ControlLoopParams' instance -- they are keyed by
-     * 'closedLoopControlName'.
-     *
-     * @param clp the 'ControlLoopParams' instance to add
-     * @return the 'ControlLoopParams' instance previously associated with the
-     *     'closedLoopControlName' ('null' if it didn't exist)
-     */
-    public synchronized ControlLoopParams addControlLoopParams(ControlLoopParams clp) {
-        ToscaPolicy toscaPolicy =
-            getToscaPolicy(clp.getPolicyName(), clp.getPolicyVersion());
-        if (toscaPolicy == null) {
-            // there needs to be a 'ToscaPolicy' instance with a matching
-            // name/version
-            logger.debug("Missing ToscaPolicy, name={}, version={}",
-                         clp.getPolicyName(), clp.getPolicyVersion());
-            return clp;
-        }
-
-        clp.setToscaPolicy(toscaPolicy);
-        ControlLoopParams prev =
-            controlLoopParams.put(clp.getClosedLoopControlName(), clp);
-
-        logger.debug("ControlLoopParams name={}, version={}, closedLoopControlName={}, count={}, prev={}",
-                     clp.getPolicyName(), clp.getPolicyVersion(),
-                     clp.getClosedLoopControlName(), controlLoopParams.size(), (prev != null));
-        dumpTables();
-        return prev;
-    }
-
-    /**
-     * Return a collection of all ControlLoopParams instances.
-     *
-     * @return all ControlLoopParams instances
-     */
-    public synchronized Collection<ControlLoopParams> getAllControlLoopParams() {
-        return new ArrayList<>(controlLoopParams.values());
-    }
-
-    /**
-     * Return a collection of all EventManager  instances.
-     *
-     * @return all EventManager instances
-     *
-     */
-    public synchronized Collection<ControlLoopEventManager> getAllEventManagers() {
-        return new ArrayList<>(eventManagers.values());
-    }
-
-    /**
-     * Return a collection of all onsetToEventManager  instances.
-     *
-     * @return all onsetToEventManager instances
-     *
-     */
-    public synchronized Collection<ControlLoopEventManager> getAllOnsetToEventManager() {
-        return new ArrayList<>(onsetToEventManager.values());
-    }
-
-    /**
-     *  Reset the controller.
-     *
-     */
-    public synchronized void reset() {
-        toscaPolicies.clear();
-        controlLoopParams.clear();
-        eventManagers.clear();
-        onsetToEventManager.clear();
-    }
-
-    @Override
-    public boolean stop() {
-        super.stop();
-
-        // stop all 'TopicData' instances
-        for (TopicData topicData : topicDataTable.values()) {
-            topicData.stop();
-        }
-        return true;
-    }
-
-    /**
-     * Remove a ControlLoopParams instance associated with the specified
-     * 'closedLoopControlName'.
-     *
-     * @param closedLoopControlName the closedLoopControlName identifying the
-     *     ControlLoopParams instance
-     * @return the 'ControlLoopParams' instance, 'null' if not found
-     */
-    public synchronized ControlLoopParams removeControlLoopParams(String closedLoopControlName) {
-        return controlLoopParams.remove(closedLoopControlName);
-    }
-
-    /**
-     * Dump out the ToscaPolicy and ControlLoopParams tables in
-     * human-readable form.
-     */
-    private void dumpTables() {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        PrintStream out = new PrintStream(bos, true);
-
-        // name(25) version(10) closedLoopControlName(...)
-
-        String format = "%-25s %-10s %s\n";
-        out.println("ToscaPolicy Table");
-        out.format(format, "Name", "Version", "");
-        out.format(format, "----", "-------", "");
-
-        for (Map<String, ToscaPolicy> level2 : toscaPolicies.values()) {
-            for (ToscaPolicy tp : level2.values()) {
-                out.format(format, tp.getName(), tp.getVersion(), "");
-            }
-        }
-
-        out.println("\nControlLoopParams Table");
-        out.format(format, "Name", "Version", "ClosedLoopControlName");
-        out.format(format, "----", "-------", "---------------------");
-        for (ControlLoopParams cp : controlLoopParams.values()) {
-            out.format(format, cp.getPolicyName(), cp.getPolicyVersion(),
-                       cp.getClosedLoopControlName());
-        }
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(new String(bos.toByteArray(), StandardCharsets.UTF_8));
-        }
-    }
-
-    /**
-     * Find or create a 'TopicData' instance associated with the specified
-     * topic name.
-     *
-     * @param name the topic name
-     * @return the new or existing 'TopicData' instance associated with 'name'
-     */
-    private TopicData getTopicData(String name) {
-        return topicDataTable.computeIfAbsent(name, key -> new TopicData(name));
-    }
-
-    /* ============================================================ */
-
-    /**
-     * Process an incoming 'ControlLoopEvent'.
-     *
-     * @param event the incoming 'ControlLoopEvent'
-     */
-    private void processEvent(ControlLoopEvent event) {
-        String clName = event.getClosedLoopControlName();
-        ControlLoopParams params = controlLoopParams.get(clName);
-        if (params == null) {
-            logger.debug("No ControlLoopParams for event: {}", event);
-            return;
-        }
-
-        UUID requestId = event.getRequestId();
-        if (event instanceof CanonicalOnset) {
-            CanonicalOnset coEvent = (CanonicalOnset) event;
-
-            if (requestId == null) {
-                // the requestId should not be 'null'
-                handleNullRequestId(coEvent, params);
-                return;
-            }
-
-            ControlLoopEventManager manager = onsetToEventManager.computeIfAbsent(coEvent, key -> {
-                // a ControlLoopEventManager does not yet exist for this
-                // 'event' -- create one, with the initial event
-                try {
-                    ControlLoopEventManager mgr = new ControlLoopEventManager(params, coEvent);
-                    eventManagers.put(requestId, mgr);
-                    return mgr;
-                } catch (ControlLoopException e) {
-                    logger.error("Exception creating ControlLoopEventManager", e);
-                    return null;
-                }
-            });
-
-            if (manager != null && !manager.getSerialWorkQueue().isRunning()) {
-                // new manager - start it by processing the initial event
-                manager.getSerialWorkQueue().start();
-                return;
-            }
-        }
-
-        if (event instanceof VirtualControlLoopEvent) {
-            ControlLoopEventManager manager = eventManagers.get(requestId);
-            if (manager != null) {
-                manager.getSerialWorkQueue()
-                                .queueAndRun(() -> manager.subsequentEvent((VirtualControlLoopEvent) event));
-                return;
-            }
-        }
-
-        // this block of code originally appeared in the 'EVENT.CLEANUP'
-        // Drools rule
-        String ruleName = "EVENT.CLEANUP";
-
-        logger.info("{}: {}", clName, ruleName);
-        logger.debug("{}: {}: orphan event={}", clName, ruleName, event);
-    }
-
-    /**
-     * Generate and send a notification message in response to a 'CanonicalOnset'
-     * with a null 'requestId'.
-     *
-     * @param event the CanonicalOnset event
-     * @param params the associated ControlLoopParams
-     */
-    private void handleNullRequestId(CanonicalOnset event,
-                                     ControlLoopParams params) {
-        // this block of code originally appeared in the 'EVENT' Drools rule
-        String ruleName = "EVENT";
-        String clName = event.getClosedLoopControlName();
-
-        VirtualControlLoopNotification notification =
-            new VirtualControlLoopNotification(event);
-        notification.setNotification(ControlLoopNotificationType.REJECTED);
-        notification.setFrom("policy");
-        notification.setMessage("Missing requestId");
-        notification.setPolicyName(params.getPolicyName() + "." + ruleName);
-        notification.setPolicyScope(params.getPolicyScope());
-        notification.setPolicyVersion(params.getPolicyVersion());
-
-        //
-        // Generate notification
-        //
-        try {
-            PolicyEngineConstants.getManager().deliver(POLICY_CL_MGT, notification);
-
-        } catch (RuntimeException e) {
-            logger.warn("{}: {}.{}: event={} exception generating notification",
-                        clName, params.getPolicyName(), ruleName,
-                        event, e);
-        }
-    }
-
-    /* ============================================================ */
-
-    /**
-     * This nested class corresponds to a single topic name. At present, the
-     * only topics that are directly handled by this class are
-     * 'ControlLoopEvent', and subclasses (hence, the call to 'processEvent').
-     * If other event types later need to be directly handled, this may need to
-     * become an abstract class, with subclasses for the various event types.
-     */
-    private class TopicData implements TopicListener {
-        // topic name
-        private String name;
-
-        // set of 'TopicSource' instances associated with this topic
-        // (probably only one, but the underlying APIs support a list)
-        private List<TopicSource> topicSources = null;
-
-        /**
-         * Constructor -- initialize the 'TopicData' instance.
-         *
-         * @param name the topic name
-         */
-        private TopicData(String name) {
-            this.name = name;
-        }
-
-        /**
-         * Register all of the 'TopicSource' instances associated with this
-         * topic, and start the listeners.
-         */
-        private void start() {
-            if (topicSources == null) {
-                // locate topic sources
-                ArrayList<String> topics = new ArrayList<>();
-                topics.add(name);
-                topicSources = TopicEndpointManager.getManager().getTopicSources(topics);
-            }
-
-            for (TopicSource consumer : topicSources) {
-                consumer.register(this);
-                consumer.start();
-            }
-        }
-
-        /**
-         * Unregister all of the 'TopicSource' instances associated with this
-         * topic, and stop the listeners.
-         */
-        private void stop() {
-            if (topicSources != null) {
-                for (TopicSource consumer : topicSources) {
-                    consumer.unregister(this);
-                    consumer.stop();
-                }
-            }
-        }
-
-        /*===========================*/
-        /* 'TopicListener' interface */
-        /*===========================*/
-
-        @Override
-        public void onTopicEvent(Topic.CommInfrastructure commType, String topic, String event) {
-            logger.debug("TopicData.onTopicEvent: {}", event);
-            Object decodedObject =
-                EventProtocolCoderConstants.getManager().decode(groupId, artifactId, topic, event);
-            if (decodedObject != null) {
-                logger.debug("Decoded to object of {}", decodedObject.getClass());
-                if (decodedObject instanceof ControlLoopEvent) {
-                    PolicyEngineConstants.getManager().getExecutorService().execute(() ->
-                        processEvent((ControlLoopEvent) decodedObject));
-                }
-            }
-        }
-    }
-
-    /* ============================================================ */
-
-    /**
-     * This is a 'ControlLoopEventManager2' variant designed to run under
-     * 'TdjamController'.
-     */
-    private class ControlLoopEventManager extends ControlLoopEventManager2 {
-        private static final long serialVersionUID = 1L;
-
-        // used to serialize method calls from multiple threads, which avoids the
-        // need for additional synchronization
-        private final SerialWorkQueue serialWorkQueue;
-
-        private final ControlLoopParams params;
-
-        // onset event
-        private final CanonicalOnset event;
-
-        /**
-         * Constructor - initialize a ControlLoopEventManager.
-         *
-         * @param params the 'ControlLoopParam's instance associated with the
-         *     'closedLoopControlName'
-         * @param event the initial ControlLoopEvent
-         */
-        private ControlLoopEventManager(ControlLoopParams params, CanonicalOnset event)
-            throws ControlLoopException {
-
-            super(params, event);
-            this.params = params;
-            this.event = event;
-            this.serialWorkQueue = new SerialWorkQueue(this::initialEvent);
-        }
-
-        /**
-         * Return the SerialWorkQueue.
-         *
-         * @return the SerialWorkQueue
-         */
-        private SerialWorkQueue getSerialWorkQueue() {
-            return serialWorkQueue;
-        }
-
-        /**
-         * This is a notification from the base class that a state transition
-         * has occurred.
-         */
-        @Override
-        protected void notifyUpdate() {
-            update();
-        }
-
-        /**
-         * Process the initial event from DCAE that caused the
-         * 'ControlLoopEventManager' to be created.
-         */
-        private void initialEvent() {
-            // this block of code originally appeared in the 'EVENT' Drools rule
-            String ruleName = "EVENT";
-            UUID requestId = event.getRequestId();
-            String clName = event.getClosedLoopControlName();
-
-            VirtualControlLoopNotification notification;
-
-            try {
-                //
-                // Check the event, because we need it to not be null when
-                // we create the ControlLoopEventManager. The ControlLoopEventManager
-                // will do extra syntax checking as well as check if the closed loop is disabled.
-                //
-                start();
-                notification = makeNotification();
-                notification.setNotification(ControlLoopNotificationType.ACTIVE);
-                notification.setPolicyName(params.getPolicyName() + "." + ruleName);
-            } catch (Exception e) {
-                logger.warn("{}: {}.{}", clName, params.getPolicyName(), ruleName, e);
-                eventManagers.remove(requestId, this);
-                onsetToEventManager.remove(event, this);
-                notification = new VirtualControlLoopNotification(event);
-                notification.setNotification(ControlLoopNotificationType.REJECTED);
-                notification.setMessage("Exception occurred: " + e.getMessage());
-                notification.setPolicyName(params.getPolicyName() + "." + ruleName);
-                notification.setPolicyScope(params.getPolicyScope());
-                notification.setPolicyVersion(params.getPolicyVersion());
-            }
-            //
-            // Generate notification
-            //
-            try {
-                PolicyEngineConstants.getManager().deliver(POLICY_CL_MGT, notification);
-
-            } catch (RuntimeException e) {
-                logger.warn("{}: {}.{}: event={} exception generating notification",
-                            clName, params.getPolicyName(), ruleName,
-                            event, e);
-            }
-        }
-
-        /**
-         * Process a subsequent event from DCAE.
-         *
-         * @param event the VirtualControlLoopEvent event
-         */
-        private void subsequentEvent(VirtualControlLoopEvent event) {
-            // this block of code originally appeared in the
-            // 'EVENT.MANAGER>NEW.EVENT' Drools rule
-            String ruleName = "EVENT.MANAGER.NEW.EVENT";
-
-            //
-            // Check what kind of event this is
-            //
-            switch (onNewEvent(event)) {
-                case SYNTAX_ERROR:
-                    //
-                    // Ignore any bad syntax events
-                    //
-                    logger.warn("{}: {}.{}: syntax error",
-                                getClosedLoopControlName(), getPolicyName(), ruleName);
-                    break;
-
-                case FIRST_ABATEMENT:
-                case SUBSEQUENT_ABATEMENT:
-                    //
-                    // TODO: handle the abatement.  Currently, it's just discarded.
-                    //
-                    break;
-
-                case FIRST_ONSET:
-                case SUBSEQUENT_ONSET:
-                default:
-                    //
-                    // We don't care about subsequent onsets
-                    //
-                    logger.warn("{}: {}.{}: subsequent onset",
-                                getClosedLoopControlName(), getPolicyName(), ruleName);
-                    break;
-            }
-        }
-
-        /**
-         * Called when a state transition occurs.
-         */
-        private void update() {
-            // handle synchronization by running it under the SerialWorkQueue
-            getSerialWorkQueue().queueAndRun(() -> {
-                if (isActive()) {
-                    updateActive();
-                } else {
-                    updateInactive();
-                }
-            });
-        }
-
-        /**
-         * Called when a state transition occurs, and we are in the active state.
-         */
-        private void updateActive() {
-            if (!isUpdated()) {
-                // no notification needed
-                return;
-            }
-
-            // this block of code originally appeared in the
-            // 'EVENT.MANAGER.PROCESSING' Drools rule
-            String ruleName = "EVENT.MANAGER.PROCESSING";
-            VirtualControlLoopNotification notification =
-                getNotification();
-
-            logger.info("{}: {}.{}: manager={}",
-                        getClosedLoopControlName(), getPolicyName(), ruleName,
-                        this);
-            //
-            // Generate notification
-            //
-            try {
-                notification.setPolicyName(getPolicyName() + "." + ruleName);
-                PolicyEngineConstants.getManager().deliver(POLICY_CL_MGT, notification);
-
-            } catch (RuntimeException e) {
-                logger.warn("{}: {}.{}: manager={} exception generating notification",
-                            getClosedLoopControlName(), getPolicyName(), ruleName,
-                            this, e);
-            }
-            //
-            // Generate Response notification
-            //
-            try {
-                ControlLoopResponse clResponse = getControlLoopResponse();
-                if (clResponse != null) {
-                    PolicyEngineConstants.getManager().deliver("DCAE_CL_RSP", clResponse);
-                }
-
-            } catch (RuntimeException e) {
-                logger.warn("{}: {}.{}: manager={} exception generating Response notification",
-                            getClosedLoopControlName(), getPolicyName(), ruleName,
-                            this, e);
-            }
-            //
-            // Discard this message and wait for the next response.
-            //
-            nextStep();
-            update();
-        }
-
-        /**
-         * Called when a state transition has occurred, and we are not in the
-         * active state.
-         */
-        private void updateInactive() {
-            // this block of code originally appeared in the 'EVENT.MANAGER.FINAL'
-            // Drools rule
-            String ruleName = "EVENT.MANAGER.FINAL";
-            VirtualControlLoopNotification notification =
-                getNotification();
-
-            logger.info("{}: {}.{}: manager={}",
-                        getClosedLoopControlName(), getPolicyName(), ruleName,
-                        this);
-            //
-            // Generate notification
-            //
-            try {
-                notification.setPolicyName(getPolicyName() + "." + ruleName);
-                PolicyEngineConstants.getManager().deliver(POLICY_CL_MGT, notification);
-            } catch (RuntimeException e) {
-                logger.warn("{}: {}.{}: manager={} exception generating notification",
-                            getClosedLoopControlName(), getPolicyName(), ruleName,
-                            this, e);
-            }
-            //
-            // Destroy the manager
-            //
-            destroy();
-
-            // Remove the entry from the table
-            eventManagers.remove(getRequestId(), this);
-            onsetToEventManager.remove(event, this);
-        }
-    }
-
-    /* ============================================================ */
-
-    /**
-     * An instance of this class is called by 'IndexedPolicyControllerFactory'.
-     * It does the build operation when the value of the 'controller.type'
-     * property matches the value of TDJAM_CONTROLLER_BUILDER_TAG.
-     */
-    public static class PolicyBuilder implements PolicyControllerFeatureApi {
-        @Override
-        public int getSequenceNumber() {
-            return 1;
-        }
-
-        @Override
-        public PolicyController beforeInstance(String name, Properties properties) {
-            if (TDJAM_CONTROLLER_BUILDER_TAG.equals(properties.getProperty(PROPERTY_CONTROLLER_TYPE))) {
-                return new TdjamController(name, properties);
-            }
-            return null;
-        }
-    }
-
-    /* ============================================================ */
-
-    /**
-     * An instance of this class is called by 'IndexedDroolsControllerFactory'.
-     * It does the build operation when the value of the 'controller.type'
-     * property matches the value of TDJAM_CONTROLLER_BUILDER_TAG.
-     */
-    public static class DroolsBuilder implements DroolsControllerFeatureApi {
-        @Override
-        public int getSequenceNumber() {
-            return 1;
-        }
-
-        @Override
-        public DroolsController beforeInstance(Properties properties,
-                                      String groupId, String artifactId, String version,
-                                      List<TopicCoderFilterConfiguration> decoderConfigurations,
-                                      List<TopicCoderFilterConfiguration> encoderConfigurations) throws LinkageError {
-
-            if (TDJAM_CONTROLLER_BUILDER_TAG.equals(properties.getProperty(PROPERTY_CONTROLLER_TYPE))) {
-                return NonDroolsPolicyController.getBuildInProgress();
-            }
-            return null;
-        }
-    }
-}
diff --git a/controlloop/common/controller-tdjam/src/main/java/org/onap/policy/extension/system/NonDroolsPolicyController.java b/controlloop/common/controller-tdjam/src/main/java/org/onap/policy/extension/system/NonDroolsPolicyController.java
deleted file mode 100644 (file)
index 97eb6a0..0000000
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
- * ============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.extension.system;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import org.apache.commons.collections4.queue.CircularFifoQueue;
-import org.checkerframework.checker.nullness.qual.NonNull;
-import org.onap.policy.common.endpoints.event.comm.Topic;
-import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
-import org.onap.policy.common.endpoints.event.comm.TopicSink;
-import org.onap.policy.common.endpoints.event.comm.TopicSource;
-import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
-import org.onap.policy.common.utils.services.OrderedServiceImpl;
-import org.onap.policy.drools.controller.DroolsController;
-import org.onap.policy.drools.core.PolicyContainer;
-import org.onap.policy.drools.features.DroolsControllerFeatureApi;
-import org.onap.policy.drools.features.DroolsControllerFeatureApiConstants;
-import org.onap.policy.drools.protocol.coders.EventProtocolCoder;
-import org.onap.policy.drools.protocol.coders.EventProtocolCoderConstants;
-import org.onap.policy.drools.protocol.coders.EventProtocolParams;
-import org.onap.policy.drools.protocol.coders.JsonProtocolFilter;
-import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration;
-import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration.CustomGsonCoder;
-import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration.PotentialCoderFilter;
-import org.onap.policy.drools.system.internal.AggregatedPolicyController;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class combines the 'PolicyController' and 'DroolsController'
- * interfaces, and provides a controller that does not have Drools running
- * underneath. It also contains some code copied from 'MavenDroolsController'
- * and 'NullDroolsController'. The goal is to have it look like other
- * controllers, use the same style property file, and provide access to
- * UEB/DMAAP message streams associated with the controller.
- */
-public class NonDroolsPolicyController extends AggregatedPolicyController implements DroolsController {
-    /**
-     * Logger.
-     */
-    private static final Logger logger = LoggerFactory.getLogger(NonDroolsPolicyController.class);
-
-    /**
-     * The PolicyController and DroolsController factories assume that the
-     * controllers are separate objects, but in this case, the same object
-     * is used for both. We want the DroolsController 'build' method to
-     * return the same object; however, at the point the DroolsController
-     * build is taking place, the PolicyController hasn't yet been placed
-     * in any tables. The following variable is used to pass this information
-     * from one stack frame to another within the same thread.
-     */
-    private static ThreadLocal<NonDroolsPolicyController> buildInProgress = new ThreadLocal<>();
-
-    /**
-     * alive status of this drools controller,
-     * reflects invocation of start()/stop() only.
-     */
-    protected volatile boolean alive = false;
-
-    /**
-     * locked status of this drools controller,
-     * reflects if i/o drools related operations are permitted,
-     * more specifically: offer() and deliver().
-     * It does not affect the ability to start and stop
-     * underlying drools infrastructure
-     */
-    protected volatile boolean locked = false;
-
-    /**
-     * list of topics, each with associated decoder classes, each
-     * with a list of associated filters.
-     */
-    protected List<TopicCoderFilterConfiguration> decoderConfigurations;
-
-    /**
-     * list of topics, each with associated encoder classes, each
-     * with a list of associated filters.
-     */
-    protected List<TopicCoderFilterConfiguration> encoderConfigurations;
-
-    /**
-     * recent sink events processed.
-     */
-    protected final CircularFifoQueue<String> recentSinkEvents = new CircularFifoQueue<>(10);
-
-    // this is used to avoid infinite recursion in a shutdown or halt operation
-    private boolean shutdownInProgress = false;
-
-    private static Properties convert(String name, Properties properties) {
-
-        Properties newProperties = new Properties();
-        for (String pname : properties.stringPropertyNames()) {
-            newProperties.setProperty(pname, properties.getProperty(pname));
-        }
-
-        newProperties.setProperty("rules.groupId", "NonDroolsPolicyController");
-        newProperties.setProperty("rules.artifactId", name);
-        newProperties.setProperty("rules.version", "1.0");
-        return newProperties;
-    }
-
-    /**
-     * constructor -- pass parameters to superclass.
-     * @param name controller name
-     * @param properties contents of controller properties file
-     */
-    public NonDroolsPolicyController(String name, Properties properties) {
-        super(name, convert(name, properties));
-    }
-
-    /**
-     * This is used to pass the 'NonDroolsPolicyController' object to the
-     * 'DroolsPolicyBuilder' object, as the same object is used for both
-     * 'PolicyController' and 'DroolsController'.
-     *
-     * @return the NonDroolsPolicyController object ('null' if not available)
-     */
-    public static NonDroolsPolicyController getBuildInProgress() {
-        return buildInProgress.get();
-    }
-
-    @Override
-    protected void initDrools(Properties properties) {
-        try {
-            // Register with drools factory
-            buildInProgress.set(this);
-            this.droolsController.set(getDroolsFactory().build(properties, sources, sinks));
-            buildInProgress.remove();
-        } catch (Exception | LinkageError e) {
-            logger.error("{}: cannot init-drools", this);
-            throw new IllegalArgumentException(e);
-        }
-
-        decoderConfigurations = codersAndFilters(properties, sources);
-        encoderConfigurations = codersAndFilters(properties, sinks);
-
-        // add to 'EventProtocolCoderConstants.getManager()' table
-        for (TopicCoderFilterConfiguration tcfc : decoderConfigurations) {
-            for (PotentialCoderFilter pcf : tcfc.getCoderFilters()) {
-                getCoderManager().addDecoder(
-                    EventProtocolParams.builder()
-                    .groupId(getGroupId())
-                    .artifactId(getArtifactId())
-                    .topic(tcfc.getTopic())
-                    .eventClass(pcf.getCodedClass())
-                    .protocolFilter(pcf.getFilter())
-                    .customGsonCoder(tcfc.getCustomGsonCoder())
-                    .modelClassLoaderHash(NonDroolsPolicyController.class.getClassLoader().hashCode()));
-            }
-        }
-        for (TopicCoderFilterConfiguration tcfc : encoderConfigurations) {
-            for (PotentialCoderFilter pcf : tcfc.getCoderFilters()) {
-                getCoderManager().addEncoder(
-                    EventProtocolParams.builder()
-                    .groupId(getGroupId())
-                    .artifactId(getArtifactId())
-                    .topic(tcfc.getTopic())
-                    .eventClass(pcf.getCodedClass())
-                    .protocolFilter(pcf.getFilter())
-                    .customGsonCoder(tcfc.getCustomGsonCoder())
-                    .modelClassLoaderHash(NonDroolsPolicyController.class.getClassLoader().hashCode()));
-            }
-        }
-    }
-
-    /*==============================*/
-    /* 'DroolsController' interface */
-    /*==============================*/
-
-    // methods copied from 'MavenDroolsController' and 'NullDroolsController'
-
-    @Override
-    public boolean start() {
-
-        logger.info("START: {}", this);
-
-        synchronized (this) {
-            this.alive = true;
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean stop() {
-
-        logger.info("STOP: {}", this);
-
-        synchronized (this) {
-            this.alive = false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public void shutdown() {
-        if (shutdownInProgress) {
-            // avoid infinite recursion
-            return;
-        }
-        logger.info("{}: SHUTDOWN", this);
-
-        try {
-            this.stop();
-            this.removeCoders();
-            shutdownInProgress = true;
-
-            // the following method calls 'this.shutdown' recursively
-            getDroolsFactory().shutdown(this);
-        } catch (Exception e) {
-            logger.error("{} SHUTDOWN FAILED because of {}", this, e.getMessage(), e);
-        } finally {
-            shutdownInProgress = false;
-        }
-    }
-
-    @Override
-    public void halt() {
-        if (shutdownInProgress) {
-            // avoid infinite recursion
-            return;
-        }
-        logger.info("{}: HALT", this);
-
-        try {
-            this.stop();
-            this.removeCoders();
-            shutdownInProgress = true;
-
-            // the following method calls 'this.halt' recursively
-            getDroolsFactory().destroy(this);
-        } catch (Exception e) {
-            logger.error("{} HALT FAILED because of {}", this, e.getMessage(), e);
-        } finally {
-            shutdownInProgress = false;
-        }
-    }
-
-    @Override
-    public boolean isAlive() {
-        return this.alive;
-    }
-
-    @Override
-    public boolean lock() {
-        logger.info("LOCK: {}",  this);
-
-        this.locked = true;
-        return true;
-    }
-
-    @Override
-    public boolean unlock() {
-        logger.info("UNLOCK: {}",  this);
-
-        this.locked = false;
-        return true;
-    }
-
-    @Override
-    public boolean isLocked() {
-        return this.locked;
-    }
-
-    @Override
-    public String getGroupId() {
-        return "NonDroolsPolicyController";
-    }
-
-    @Override
-    public String getArtifactId() {
-        return getName();
-    }
-
-    @Override
-    public String getVersion() {
-        return "1.0";
-    }
-
-    @Override
-    public List<String> getSessionNames() {
-        return new ArrayList<>();
-    }
-
-    @Override
-    public List<String> getCanonicalSessionNames() {
-        return new ArrayList<>();
-    }
-
-    @Override
-    public List<String> getBaseDomainNames() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public boolean offer(String topic, String event) {
-        return false;
-    }
-
-    @Override
-    public <T> boolean offer(T event) {
-        return false;
-    }
-
-    @Override
-    public boolean deliver(TopicSink sink, Object event) {
-
-        // this one is from 'MavenDroolsController'
-
-        logger.info("{} DELIVER: {} FROM {} TO {}", this, event, this, sink);
-
-        for (DroolsControllerFeatureApi feature : getDroolsProviders().getList()) {
-            try {
-                if (feature.beforeDeliver(this, sink, event)) {
-                    return true;
-                }
-            } catch (Exception e) {
-                logger.error("{}: feature {} before-deliver failure because of {}", this, feature.getClass().getName(),
-                        e.getMessage(), e);
-            }
-        }
-
-        if (sink == null) {
-            throw new IllegalArgumentException(this +  " invalid sink");
-        }
-
-        if (event == null) {
-            throw new IllegalArgumentException(this +  " invalid event");
-        }
-
-        if (this.locked) {
-            throw new IllegalStateException(this +  " is locked");
-        }
-
-        if (!this.alive) {
-            throw new IllegalStateException(this +  " is stopped");
-        }
-
-        String json =
-                getCoderManager().encode(sink.getTopic(), event, this);
-
-        synchronized (this.recentSinkEvents) {
-            this.recentSinkEvents.add(json);
-        }
-
-        boolean success = sink.send(json);
-
-        for (DroolsControllerFeatureApi feature : getDroolsProviders().getList()) {
-            try {
-                if (feature.afterDeliver(this, sink, event, json, success)) {
-                    return true;
-                }
-            } catch (Exception e) {
-                logger.error("{}: feature {} after-deliver failure because of {}", this, feature.getClass().getName(),
-                        e.getMessage(), e);
-            }
-        }
-
-        return success;
-
-    }
-
-    @Override
-    public Object[] getRecentSourceEvents() {
-        return new String[0];
-    }
-
-    @Override
-    public PolicyContainer getContainer() {
-        return null;
-    }
-
-    @Override
-    public String[] getRecentSinkEvents() {
-        synchronized (this.recentSinkEvents) {
-            String[] events = new String[recentSinkEvents.size()];
-            return recentSinkEvents.toArray(events);
-        }
-    }
-
-    @Override
-    public boolean ownsCoder(Class<?> coderClass, int modelHash) {
-        //throw new IllegalStateException(makeInvokeMsg());
-        return true;
-    }
-
-    @Override
-    public Class<?> fetchModelClass(String className) {
-        try {
-            return Class.forName(className);
-        } catch (ClassNotFoundException e) {
-            throw new IllegalArgumentException(makeInvokeMsg());
-        }
-    }
-
-    @Override
-    public boolean isBrained() {
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("NonDroolsPolicyController []");
-        return builder.toString();
-    }
-
-    @Override
-    public void updateToVersion(String newGroupId, String newArtifactId, String newVersion,
-            List<TopicCoderFilterConfiguration> decoderConfigurations,
-            List<TopicCoderFilterConfiguration> encoderConfigurations)
-                    throws LinkageError {
-        throw new IllegalStateException(makeInvokeMsg());
-    }
-
-    @Override
-    public Map<String, Integer> factClassNames(String sessionName) {
-        return new HashMap<>();
-    }
-
-    @Override
-    public long factCount(String sessionName) {
-        return 0;
-    }
-
-    @Override
-    public List<Object> facts(String sessionName, String className, boolean delete) {
-        return new ArrayList<>();
-    }
-
-    @Override
-    public <T> List<T> facts(@NonNull String sessionName, @NonNull Class<T> clazz) {
-        return new ArrayList<>();
-    }
-
-    @Override
-    public List<Object> factQuery(String sessionName, String queryName,
-            String queriedEntity,
-            boolean delete, Object... queryParams) {
-        return new ArrayList<>();
-    }
-
-    @Override
-    public <T> boolean delete(@NonNull String sessionName, @NonNull T fact) {
-        return false;
-    }
-
-    @Override
-    public <T> boolean delete(@NonNull T fact) {
-        return false;
-    }
-
-    @Override
-    public <T> boolean delete(@NonNull String sessionName, @NonNull Class<T> fact) {
-        return false;
-    }
-
-    @Override
-    public <T> boolean delete(@NonNull Class<T> fact) {
-        return false;
-    }
-
-    private String makeInvokeMsg() {
-        return this.getClass().getName() + " invoked";
-    }
-
-    /**
-     * remove decoders.
-     */
-    protected void removeDecoders() {
-        logger.info("REMOVE-DECODERS: {}", this);
-
-        if (this.decoderConfigurations == null) {
-            return;
-        }
-
-
-        for (TopicCoderFilterConfiguration coderConfig: decoderConfigurations) {
-            String topic = coderConfig.getTopic();
-            getCoderManager().removeDecoders(this.getGroupId(), this.getArtifactId(), topic);
-        }
-    }
-
-    /**
-     * remove decoders.
-     */
-    protected void removeEncoders() {
-
-        logger.info("REMOVE-ENCODERS: {}", this);
-
-        if (this.encoderConfigurations == null) {
-            return;
-        }
-
-        for (TopicCoderFilterConfiguration coderConfig: encoderConfigurations) {
-            String topic = coderConfig.getTopic();
-            getCoderManager().removeEncoders(this.getGroupId(), this.getArtifactId(), topic);
-        }
-    }
-
-    /**
-     * removes this drools controllers and encoders and decoders from operation.
-     */
-    protected void removeCoders() {
-        logger.info("{}: REMOVE-CODERS", this);
-
-        try {
-            this.removeDecoders();
-        } catch (IllegalArgumentException e) {
-            logger.error("{} REMOVE-DECODERS FAILED because of {}", this, e.getMessage(), e);
-        }
-
-        try {
-            this.removeEncoders();
-        } catch (IllegalArgumentException e) {
-            logger.error("{} REMOVE-ENCODERS FAILED because of {}", this, e.getMessage(), e);
-        }
-    }
-
-    protected List<TopicCoderFilterConfiguration> codersAndFilters(Properties properties,
-            List<? extends Topic> topicEntities) {
-
-        List<TopicCoderFilterConfiguration> topics2DecodedClasses2Filters = new ArrayList<>();
-
-        if (topicEntities == null || topicEntities.isEmpty()) {
-            return topics2DecodedClasses2Filters;
-        }
-
-        for (Topic topic : topicEntities) {
-
-            // 1. first the topic
-
-            String firstTopic = topic.getTopic();
-
-            String propertyTopicEntityPrefix = getPropertyTopicPrefix(topic) + firstTopic;
-
-            // 2. check if there is a custom decoder for this topic that the user prefers to use
-            // instead of the ones provided in the platform
-
-            CustomGsonCoder customGsonCoder = getCustomCoder(properties, propertyTopicEntityPrefix);
-
-            // 3. second the list of classes associated with each topic
-
-            String eventClasses = properties
-                    .getProperty(propertyTopicEntityPrefix + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_SUFFIX);
-
-            if (eventClasses == null || eventClasses.isEmpty()) {
-                logger.warn("There are no event classes for topic {}", firstTopic);
-                continue;
-            }
-
-            List<PotentialCoderFilter> classes2Filters =
-                            getFilterExpressions(properties, propertyTopicEntityPrefix, eventClasses);
-
-            TopicCoderFilterConfiguration topic2Classes2Filters =
-                    new TopicCoderFilterConfiguration(firstTopic, classes2Filters, customGsonCoder);
-            topics2DecodedClasses2Filters.add(topic2Classes2Filters);
-        }
-
-        return topics2DecodedClasses2Filters;
-    }
-
-    private String getPropertyTopicPrefix(Topic topic) {
-        boolean isSource = topic instanceof TopicSource;
-        CommInfrastructure commInfra = topic.getTopicCommInfrastructure();
-        if (commInfra == CommInfrastructure.UEB) {
-            if (isSource) {
-                return PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + ".";
-            } else {
-                return PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + ".";
-            }
-        } else if (commInfra == CommInfrastructure.DMAAP) {
-            if (isSource) {
-                return PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + ".";
-            } else {
-                return PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + ".";
-            }
-        } else if (commInfra == CommInfrastructure.NOOP) {
-            if (isSource) {
-                return PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS + ".";
-            } else {
-                return PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS + ".";
-            }
-        } else {
-            throw new IllegalArgumentException("Invalid Communication Infrastructure: " + commInfra);
-        }
-    }
-
-    private CustomGsonCoder getCustomCoder(Properties properties, String propertyPrefix) {
-        String customGson = properties.getProperty(propertyPrefix
-                + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_CUSTOM_MODEL_CODER_GSON_SUFFIX);
-
-        CustomGsonCoder customGsonCoder = null;
-        if (customGson != null && !customGson.isEmpty()) {
-            try {
-                customGsonCoder = new CustomGsonCoder(customGson);
-            } catch (IllegalArgumentException e) {
-                logger.warn("{}: cannot create custom-gson-coder {} because of {}", this, customGson,
-                        e.getMessage(), e);
-            }
-        }
-        return customGsonCoder;
-    }
-
-    private List<PotentialCoderFilter> getFilterExpressions(Properties properties, String propertyPrefix,
-                    String eventClasses) {
-
-        List<PotentialCoderFilter> classes2Filters = new ArrayList<>();
-
-        List<String> topicClasses = new ArrayList<>(Arrays.asList(eventClasses.split("\\s*,\\s*")));
-
-        for (String theClass : topicClasses) {
-
-            // 4. for each coder class, get the filter expression
-
-            String filter = properties
-                    .getProperty(propertyPrefix
-                            + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_SUFFIX
-                            + "." + theClass + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_FILTER_SUFFIX);
-
-            JsonProtocolFilter protocolFilter = new JsonProtocolFilter(filter);
-            PotentialCoderFilter class2Filters = new PotentialCoderFilter(theClass, protocolFilter);
-            classes2Filters.add(class2Filters);
-        }
-
-        return classes2Filters;
-    }
-
-    // these may be overridden by junit tests
-
-    protected EventProtocolCoder getCoderManager() {
-        return EventProtocolCoderConstants.getManager();
-    }
-
-    protected OrderedServiceImpl<DroolsControllerFeatureApi> getDroolsProviders() {
-        return DroolsControllerFeatureApiConstants.getProviders();
-    }
-}
diff --git a/controlloop/common/controller-tdjam/src/main/resources/META-INF/services/org.onap.policy.drools.features.DroolsControllerFeatureApi b/controlloop/common/controller-tdjam/src/main/resources/META-INF/services/org.onap.policy.drools.features.DroolsControllerFeatureApi
deleted file mode 100644 (file)
index 09a087e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.tdjam.TdjamController$DroolsBuilder
diff --git a/controlloop/common/controller-tdjam/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyControllerFeatureApi b/controlloop/common/controller-tdjam/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyControllerFeatureApi
deleted file mode 100644 (file)
index dad4678..0000000
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.controlloop.tdjam.TdjamController$PolicyBuilder
diff --git a/controlloop/common/controller-tdjam/src/test/java/org/onap/policy/controlloop/TdjamTest.java b/controlloop/common/controller-tdjam/src/test/java/org/onap/policy/controlloop/TdjamTest.java
deleted file mode 100644 (file)
index 917e9ad..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * ============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;
-
-import java.util.Properties;
-import lombok.Getter;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.controlloop.common.rules.test.BaseTest;
-import org.onap.policy.controlloop.common.rules.test.Listener;
-import org.onap.policy.controlloop.common.rules.test.NamedRunner;
-import org.onap.policy.controlloop.common.rules.test.Rules;
-import org.onap.policy.controlloop.common.rules.test.TestNames;
-import org.onap.policy.drools.persistence.SystemPersistence;
-import org.onap.policy.drools.persistence.SystemPersistenceConstants;
-import org.onap.policy.drools.system.PolicyController;
-import org.onap.policy.drools.system.PolicyControllerConstants;
-import org.onap.policy.drools.system.PolicyEngine;
-import org.onap.policy.drools.system.PolicyEngineConstants;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.simulators.Util;
-
-
-
-/**
- * Tests use cases using BaseTest Set.
- *
- * <p/>
- * Note: this runs ALL tests (i.e., any whose names start with "test").
- */
-@RunWith(NamedRunner.class)
-@TestNames(prefixes = {"test"})
-
-public class TdjamTest extends BaseTest {
-    protected static final String CONTROLLER_NAME = "tdjam";
-    protected static PolicyController controller;
-
-    @Getter
-    private static final PolicyEngine pdpd = makeEngine();
-
-    @Getter
-    private static final SystemPersistence pdpdRepo = makePdpdRepo();
-
-    /**
-     * Sets up statics.
-     */
-    @BeforeClass
-    public static void setUpBeforeClass() {
-        initStatics();
-        pdpdRepo.setConfigurationDir("src/test/resources/config");
-        pdpd.configure(new Properties());
-        controller = pdpd.createPolicyController(CONTROLLER_NAME, pdpdRepo.getControllerProperties(CONTROLLER_NAME));
-        pdpd.start();
-        httpClients.addClients("tdjam");
-        simulators.start(Util::buildAaiSim, Util::buildSoSim, Util::buildVfcSim, Util::buildGuardSim,
-                        Util::buildSdncSim);
-    }
-
-    /**
-     * Cleans up statics.
-     */
-    @AfterClass
-    public static void tearDownAfterClass() {
-        finishStatics();
-        PolicyControllerConstants.getFactory().shutdown(controller);
-        pdpd.stop();
-    }
-
-    /**
-     * Sets up.
-     */
-    @Before
-    public void setUp() {
-        init();
-    }
-
-    /**
-     * Tears down.
-     */
-    @After
-    public void tearDown() {
-        finish();
-    }
-
-    protected static PolicyEngine makeEngine() {
-        return PolicyEngineConstants.getManager();
-    }
-
-    protected static SystemPersistence makePdpdRepo() {
-        return SystemPersistenceConstants.getManager();
-    }
-
-    @Override
-    protected void waitForLockAndPermit(ToscaPolicy policy, Listener<VirtualControlLoopNotification> policyClMgt) {
-        String policyName = policy.getIdentifier().getName();
-
-        policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.ACTIVE
-                        && (policyName + ".EVENT").equals(notif.getPolicyName()));
-
-        policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.OPERATION
-                        && (policyName + ".EVENT.MANAGER.PROCESSING").equals(notif.getPolicyName())
-                        && notif.getMessage().startsWith("Sending guard query"));
-
-        policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.OPERATION
-                        && (policyName + ".EVENT.MANAGER.PROCESSING").equals(notif.getPolicyName())
-                        && notif.getMessage().startsWith("Guard result") && notif.getMessage().endsWith("Permit"));
-
-        policyClMgt.await(notif -> notif.getNotification() == ControlLoopNotificationType.OPERATION
-                        && (policyName + ".EVENT.MANAGER.PROCESSING").equals(notif.getPolicyName())
-                        && notif.getMessage().startsWith("actor="));
-    }
-
-    @Override
-    protected VirtualControlLoopNotification waitForFinal(ToscaPolicy policy,
-                    Listener<VirtualControlLoopNotification> policyClMgt, ControlLoopNotificationType finalType) {
-
-        return policyClMgt.await(notif -> notif.getNotification() == finalType
-                        && (policy.getIdentifier().getName() + ".EVENT.MANAGER.FINAL").equals(notif.getPolicyName()));
-    }
-
-    @Override
-    protected ToscaPolicy checkPolicy(String fileName)  {
-        try {
-            policy = Rules.getPolicyFromFile(fileName);
-        } catch (CoderException e) {
-            throw new IllegalArgumentException(fileName, e);
-        }
-        controller.getDrools().offer(policy);
-        return policy;
-    }
-
-    @Override
-    protected Listener<VirtualControlLoopNotification> createNoficationTopicListener() {
-        return topics.createListener(POLICY_CL_MGT_TOPIC,
-            VirtualControlLoopNotification.class, controller);
-    }
-}
diff --git a/controlloop/common/controller-tdjam/src/test/java/org/onap/policy/controlloop/tdjam/TdjamControllerTest.java b/controlloop/common/controller-tdjam/src/test/java/org/onap/policy/controlloop/tdjam/TdjamControllerTest.java
deleted file mode 100644 (file)
index 990e473..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*-
- * ============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.tdjam;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.onap.policy.drools.properties.DroolsPropertyConstants.PROPERTY_CONTROLLER_TYPE;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.read.ListAppender;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.UUID;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.controlloop.CanonicalOnset;
-import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
-import org.onap.policy.drools.controller.DroolsControllerConstants;
-import org.onap.policy.drools.system.PolicyControllerConstants;
-import org.onap.policy.drools.system.PolicyEngineConstants;
-import org.onap.policy.drools.utils.PropertyUtil;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.powermock.reflect.Whitebox;
-import org.slf4j.LoggerFactory;
-
-public class TdjamControllerTest {
-    private static Properties prop;
-    private static Logger logger = (Logger) LoggerFactory.getLogger(TdjamController.class);
-    private static ListAppender<ILoggingEvent> appender = new ListAppender<ILoggingEvent>();
-
-    /**
-     * Setup appender, and initialize properties.
-     */
-    @BeforeClass
-    public static void setupClass() throws Exception {
-        logger.setLevel(Level.DEBUG);
-        logger.addAppender(appender);
-
-        prop = PropertyUtil.getProperties("src/test/resources/config/tdjam-controller.properties");
-        prop.setProperty(PROPERTY_CONTROLLER_TYPE, "tdjam");
-
-        PolicyEngineConstants.getManager().configure(new Properties());
-        PolicyEngineConstants.getManager().start();
-
-    }
-
-    /**
-     * Remove appender.
-     */
-    @AfterClass
-    public static void cleanupClass() {
-
-        PolicyEngineConstants.getManager().stop();
-        PolicyEngineConstants.getManager().getExecutorService().shutdown();
-
-        appender.stop();
-        System.out.println("APPENDER:");
-        for (ILoggingEvent event : appender.list) {
-            System.out.println("    " + event);
-        }
-        logger.detachAppender(appender);
-    }
-
-    @Test
-    public void toscaPolicyTests() {
-        TdjamController tc = (TdjamController) PolicyControllerConstants.getFactory().build("tc", prop);
-        assertTrue(PolicyControllerConstants.getFactory().inventory().contains(tc));
-        assertTrue(DroolsControllerConstants.getFactory().inventory().contains(tc));
-
-        final HashSet<ToscaPolicy> toscaPolicies = new HashSet<>();
-        final HashSet<ControlLoopParams> controlLoopParams = new HashSet<>();
-
-        ToscaPolicy a1 = buildToscaPolicy("a", "1", tc);
-        ToscaPolicy a2 = buildToscaPolicy("a", "2", tc);
-        ToscaPolicy b1 = buildToscaPolicy("b", "1", tc);
-
-        toscaPolicies.add(a1);
-        toscaPolicies.add(a2);
-        toscaPolicies.add(b1);
-
-        assertSame(a1, tc.getToscaPolicy("a", "1"));
-        assertSame(a2, tc.getToscaPolicy("a", "2"));
-        assertSame(b1, tc.getToscaPolicy("b", "1"));
-        assertEquals(toscaPolicies, tc.getAllToscaPolicies());
-
-        // create associated ControlLoopParams
-        final ControlLoopParams clpa1 = buildControlLoopParams("a", "1", "clpa1", tc);
-        final ControlLoopParams clpa2 = buildControlLoopParams("a", "2", "clpa2", tc);
-        final ControlLoopParams clpb1 = buildControlLoopParams("b", "1", "clpb1", tc);
-        final ControlLoopParams clpb3 = buildControlLoopParams("b", "3", "clpb3", null);
-
-        // the add for 'clpb3' should fail, because there is no ToscaPolicy
-        startLog();
-        assertSame(clpb3, tc.addControlLoopParams(clpb3));
-        stopLog();
-        assertLog(".*Missing ToscaPolicy, name=b, version=3.*");
-        assertNull(tc.removeControlLoopParams("clpb3"));
-
-        controlLoopParams.add(clpa1);
-        controlLoopParams.add(clpa2);
-        controlLoopParams.add(clpb1);
-        assertEquals(controlLoopParams, new HashSet<>(tc.getAllControlLoopParams()));
-
-        // manually remove a ControlLoopParams
-        assertSame(clpa1, tc.removeControlLoopParams("clpa1"));
-        assertTrue(controlLoopParams.remove(clpa1));
-        assertEquals(controlLoopParams, new HashSet<>(tc.getAllControlLoopParams()));
-
-        // tests of nonexistent policies
-        assertNull(tc.getToscaPolicy("c", "1")); // non-existent name
-        assertNull(tc.removeToscaPolicy("c", "1"));
-        assertNull(tc.getToscaPolicy("b", "3")); // non-existent version
-        assertNull(tc.removeToscaPolicy("b", "3"));
-
-        assertSame(a1, tc.removeToscaPolicy("a", "1"));
-        assertTrue(toscaPolicies.remove(a1));
-        assertEquals(toscaPolicies, tc.getAllToscaPolicies());
-        assertSame(a2, tc.removeToscaPolicy("a", "2"));
-        assertTrue(toscaPolicies.remove(a2));
-        assertEquals(toscaPolicies, tc.getAllToscaPolicies());
-
-        // ControlLoopParams removal should be automatic
-        assertTrue(controlLoopParams.remove(clpa2));
-        assertEquals(controlLoopParams, new HashSet<>(tc.getAllControlLoopParams()));
-
-        // test reset method
-        tc.reset();
-        assertTrue(tc.getAllToscaPolicies().isEmpty());
-        assertTrue(tc.getAllControlLoopParams().isEmpty());
-        assertTrue(tc.getAllEventManagers().isEmpty());
-        assertTrue(tc.getAllOnsetToEventManager().isEmpty());
-
-        PolicyControllerConstants.getFactory().shutdown(tc);
-        assertFalse(PolicyControllerConstants.getFactory().inventory().contains(tc));
-        assertFalse(DroolsControllerConstants.getFactory().inventory().contains(tc));
-    }
-
-    @Test
-    public void onsetErrors() throws Exception {
-        TdjamController tc = (TdjamController) PolicyControllerConstants.getFactory().build("tc", prop);
-        assertTrue(PolicyControllerConstants.getFactory().inventory().contains(tc));
-        assertTrue(DroolsControllerConstants.getFactory().inventory().contains(tc));
-        tc.start();
-
-        buildToscaPolicy("a", "1", tc);
-        final ControlLoopParams clpa1 = buildControlLoopParams("a", "1", "clpa1", tc);
-        assertTrue(tc.getAllControlLoopParams().contains(clpa1));
-
-        CanonicalOnset canonicalOnset = new CanonicalOnset();
-        startLog();
-        Whitebox.invokeMethod(tc, "processEvent", canonicalOnset);
-        stopLog();
-        assertLog(".*No ControlLoopParams for event: CanonicalOnset.*");
-
-        // set Name with new canonicalOnset
-        CanonicalOnset canonicalOnset2 = new CanonicalOnset();
-        canonicalOnset2.setClosedLoopControlName("clpa1");
-        // try with a non-null requestID, but missing target
-        canonicalOnset2.setRequestId(UUID.randomUUID());
-        startLog();
-        Whitebox.invokeMethod(tc, "processEvent", canonicalOnset2);
-        stopLog();
-        assertLog(".*Exception creating ControlLoopEventManager.*");
-
-        PolicyControllerConstants.getFactory().shutdown(tc);
-        assertFalse(PolicyControllerConstants.getFactory().inventory().contains(tc));
-    }
-
-    private ToscaPolicy buildToscaPolicy(String name, String version, TdjamController tc) {
-        ToscaPolicy tp = new ToscaPolicy();
-        tp.setName(name);
-        tp.setVersion(version);
-
-        if (tc != null) {
-            tc.addToscaPolicy(tp);
-        }
-        return tp;
-    }
-
-    private ControlLoopParams buildControlLoopParams(String name, String version,
-        String closedLoopControlName, TdjamController tc) {
-
-        ControlLoopParams clp = new ControlLoopParams();
-        clp.setPolicyName(name);
-        clp.setPolicyVersion(version);
-        clp.setClosedLoopControlName(closedLoopControlName);
-
-        if (tc != null) {
-            assertNotSame(clp, tc.addControlLoopParams(clp));
-        }
-
-        return clp;
-    }
-
-    private void startLog() {
-        appender.list.clear();
-        appender.start();
-    }
-
-    private void stopLog() {
-        appender.stop();
-    }
-
-    private void assertLog(String regexp) {
-        for (ILoggingEvent event : appender.list) {
-            if (event.toString().matches(regexp)) {
-                return;
-            }
-        }
-        fail("Missing log entry: " + regexp);
-    }
-}
diff --git a/controlloop/common/controller-tdjam/src/test/java/org/onap/policy/extension/system/NonDroolsPolicyControllerTest.java b/controlloop/common/controller-tdjam/src/test/java/org/onap/policy/extension/system/NonDroolsPolicyControllerTest.java
deleted file mode 100644 (file)
index 57f98bd..0000000
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * ============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.extension.system;
-
-import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
-import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.onap.policy.drools.properties.DroolsPropertyConstants.PROPERTY_CONTROLLER_TYPE;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.function.Function;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.common.endpoints.event.comm.TopicSink;
-import org.onap.policy.controlloop.VirtualControlLoopNotification;
-import org.onap.policy.drools.controller.DroolsController;
-import org.onap.policy.drools.features.DroolsControllerFeatureApi;
-import org.onap.policy.drools.features.PolicyControllerFeatureApi;
-import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration;
-import org.onap.policy.drools.system.PolicyController;
-import org.onap.policy.drools.system.PolicyControllerConstants;
-import org.onap.policy.drools.utils.PropertyUtil;
-
-public class NonDroolsPolicyControllerTest {
-    //public static boolean loop = true;
-    private static Properties prop;
-
-    private NonDroolsPolicyController controller;
-
-    @BeforeClass
-    public static void setupClass() throws Exception {
-        prop = PropertyUtil.getProperties("src/test/resources/config/tdjam-controller.properties");
-    }
-
-    /**
-     * Resets the stats and creates the controller.
-     */
-    @Before
-    public void setUp() {
-        DroolsControllerFeatureHandler.resetStats();
-
-        controller = buildController("tdjam");
-    }
-
-    /**
-     * Destroys the controller.
-     */
-    @After
-    public void tearDown() {
-        String name = controller.getName();
-        assertSame(controller, PolicyControllerConstants.getFactory().get(name));
-        PolicyControllerConstants.getFactory().destroy(controller);
-        assertThatIllegalArgumentException().isThrownBy(
-            () -> PolicyControllerConstants.getFactory().get(name));
-    }
-
-    @Test
-    public void testState() {
-        assertEquals("nondrools", controller.getName());
-        assertEquals("NonDroolsPolicyController", controller.getGroupId());
-        assertEquals("nondrools", controller.getArtifactId());
-        assertEquals("1.0", controller.getVersion());
-        assertTrue(controller.isBrained());
-
-        assertFalse(controller.isAlive());
-        assertFalse(controller.isLocked());
-
-        // first 'start()'
-        controller.start();
-        assertTrue(controller.isAlive());
-        assertFalse(controller.isLocked());
-
-        // second 'start()'
-        controller.start();
-        assertTrue(controller.isAlive());
-        assertFalse(controller.isLocked());
-
-        // test a few stubbed-off methods
-        assertNull(controller.getContainer());
-        assertThatIllegalStateException().isThrownBy(() -> controller.updateToVersion(null, null, null, null, null));
-
-        controller.lock();
-        assertTrue(controller.isAlive());
-        assertTrue(controller.isLocked());
-
-        controller.stop();
-        assertFalse(controller.isAlive());
-        assertTrue(controller.isLocked());
-
-        controller.unlock();
-        assertFalse(controller.isAlive());
-        assertFalse(controller.isLocked());
-    }
-
-    @Test
-    public void testNames() {
-        assertTrue(controller.getSessionNames().isEmpty());
-        assertTrue(controller.getCanonicalSessionNames().isEmpty());
-        assertTrue(controller.getBaseDomainNames().isEmpty());
-    }
-
-    @Test
-    public void testOffer() {
-        controller.start();
-
-        assertFalse(controller.offer("topic", "event"));
-        assertFalse(controller.offer("event"));
-        assertEquals(0, controller.getRecentSourceEvents().length);
-        assertEquals(0, controller.getRecentSinkEvents().length);
-    }
-
-    @Test
-    public void testFacts() {
-        assertThatIllegalArgumentException().isThrownBy(
-            () -> controller.fetchModelClass("NoSuchClass"));
-        assertTrue(controller.factClassNames(null).isEmpty());
-        assertEquals(0, controller.factCount(null));
-        assertTrue(controller.facts(null, null, false).isEmpty());
-        assertTrue(controller.facts("sessionName", String.class).isEmpty());
-        assertTrue(controller.factQuery(null, null, null, false).isEmpty());
-    }
-
-    @Test
-    public void testDelete() {
-        assertFalse(controller.delete("sessionName", "fact"));
-        assertFalse(controller.delete("fact"));
-        assertFalse(controller.delete("sessionName", String.class));
-        assertFalse(controller.delete(String.class));
-    }
-
-    @Test
-    public void testDeliver() {
-        final TopicSink topicSink = mock(TopicSink.class);
-        when(topicSink.getTopic()).thenReturn("POLICY-CL-MGT");
-        when(topicSink.send(any())).thenReturn(false);
-
-        final VirtualControlLoopNotification msg = new VirtualControlLoopNotification(null);
-
-        controller.lock();
-
-        // invalid sink
-        try {
-            controller.deliver(null, null);
-            fail("Expected IllegalArgumentException did not occur");
-        } catch (IllegalArgumentException ex) {
-            assertTrue(ex.getMessage(),
-                       ex.getMessage().endsWith(" invalid sink"));
-        }
-
-        // invalid event
-        try {
-            controller.deliver(topicSink, null);
-            fail("Expected IllegalArgumentException did not occur");
-        } catch (IllegalArgumentException ex) {
-            assertTrue(ex.getMessage(),
-                       ex.getMessage().endsWith(" invalid event"));
-        }
-
-        // is locked
-        try {
-            controller.deliver(topicSink, "event");
-            fail("Expected IllegalStateException did not occur");
-        } catch (IllegalStateException ex) {
-            assertTrue(ex.getMessage(),
-                       ex.getMessage().endsWith(" is locked"));
-        }
-        controller.unlock();
-
-        // is stopped
-        try {
-            controller.deliver(topicSink, "event");
-            fail("Expected IllegalStateException did not occur");
-        } catch (IllegalStateException ex) {
-            assertTrue(ex.getMessage(),
-                       ex.getMessage().endsWith(" is stopped"));
-        }
-
-        // there should have been 4 'beforeDeliver' calls up to this point
-        assertEquals(4, DroolsControllerFeatureHandler.beforeDeliverFalse);
-
-        Function<String, Boolean> signal = (sig) -> {
-            msg.getAai().put("signal", sig);
-            return controller.deliver(topicSink, msg);
-        };
-
-        controller.start();
-
-        // 'beforeDeliver' intercepts
-        DroolsControllerFeatureHandler.resetStats();
-
-        assertTrue(signal.apply("beforeDeliverTrue"));
-        assertEquals(1, DroolsControllerFeatureHandler.beforeDeliverTrue);
-        assertEquals(0, DroolsControllerFeatureHandler.afterDeliverFalse);
-
-        assertFalse(signal.apply("beforeDeliverException"));
-        assertEquals(1, DroolsControllerFeatureHandler.beforeDeliverException);
-        assertEquals(1, DroolsControllerFeatureHandler.afterDeliverFalse);
-        // it would be nice to check the log message at this point
-
-        // 'afterDeliver' intercepts
-        DroolsControllerFeatureHandler.resetStats();
-
-        assertTrue(signal.apply("afterDeliverTrue"));
-        assertEquals(1, DroolsControllerFeatureHandler.afterDeliverTrue);
-
-        assertFalse(signal.apply("afterDeliverException"));
-        assertEquals(1, DroolsControllerFeatureHandler.afterDeliverException);
-
-        assertFalse(signal.apply("nothing in particular"));
-        assertEquals(1, DroolsControllerFeatureHandler.afterDeliverFalse);
-    }
-
-    private NonDroolsPolicyController buildController(String type) {
-        prop.setProperty(PROPERTY_CONTROLLER_TYPE, type);
-        PolicyController controller =
-            PolicyControllerConstants.getFactory().build("nondrools", prop);
-        assertTrue(controller instanceof NonDroolsPolicyController);
-        return (NonDroolsPolicyController) controller;
-    }
-
-    /* ============================================================ */
-
-    /**
-     * An instance of this class is called by 'IndexedPolicyControllerFactory'.
-     * It does the build operation when the value of the 'controller.type'
-     * property matches the value of TDJAM_CONTROLLER_BUILDER_TAG.
-     */
-    public static class PolicyBuilder implements PolicyControllerFeatureApi {
-        @Override
-        public int getSequenceNumber() {
-            return 1;
-        }
-
-        @Override
-        public PolicyController beforeInstance(String name, Properties properties) {
-            if ("nondrools".equals(properties.getProperty(PROPERTY_CONTROLLER_TYPE))) {
-                return new NonDroolsPolicyController(name, properties);
-            }
-            return null;
-        }
-    }
-
-    /* ============================================================ */
-
-    /**
-     * An instance of this class is called by 'IndexedDroolsControllerFactory'.
-     * It does the build operation when the value of the 'controller.type'
-     * property matches the value of TDJAM_CONTROLLER_BUILDER_TAG.
-     */
-    public static class DroolsBuilder implements DroolsControllerFeatureApi {
-        @Override
-        public int getSequenceNumber() {
-            return 1;
-        }
-
-        @Override
-        public DroolsController beforeInstance(Properties properties,
-                                      String groupId, String artifactId, String version,
-                                      List<TopicCoderFilterConfiguration> decoderConfigurations,
-                                      List<TopicCoderFilterConfiguration> encoderConfigurations) throws LinkageError {
-
-            if ("nondrools".equals(properties.getProperty(PROPERTY_CONTROLLER_TYPE))) {
-                return NonDroolsPolicyController.getBuildInProgress();
-            }
-            return null;
-        }
-    }
-
-    /* ============================================================ */
-
-    public static class DroolsControllerFeatureHandler implements DroolsControllerFeatureApi {
-        static int beforeDeliverFalse = 0;
-        static int beforeDeliverTrue = 0;
-        static int beforeDeliverException = 0;
-        static int afterDeliverFalse = 0;
-        static int afterDeliverTrue = 0;
-        static int afterDeliverException = 0;
-
-        private static void resetStats() {
-            beforeDeliverFalse = 0;
-            beforeDeliverTrue = 0;
-            beforeDeliverException = 0;
-            afterDeliverFalse = 0;
-            afterDeliverTrue = 0;
-            afterDeliverException = 0;
-        }
-
-        @Override
-        public int getSequenceNumber() {
-            return 1;
-        }
-
-        @Override
-        public boolean beforeDeliver(DroolsController controller, TopicSink sink, Object fact) {
-            if (fact instanceof VirtualControlLoopNotification) {
-                String factString = ((VirtualControlLoopNotification) fact).getAai().get("signal");
-                if (factString == null) {
-                    // this hook is run during 'FrankfurtTest' as well
-                    return false;
-                }
-                if (factString.contains("beforeDeliverTrue")) {
-                    beforeDeliverTrue += 1;
-                    return true;
-                }
-                if (factString.contains("beforeDeliverException")) {
-                    beforeDeliverException += 1;
-                    RuntimeException ex = new RuntimeException("beforeDeliver");
-                    ex.printStackTrace();
-                    throw ex;
-                }
-            }
-            beforeDeliverFalse += 1;
-            return false;
-        }
-
-
-        @Override
-            public boolean afterDeliver(DroolsController controller, TopicSink sink, Object fact,
-                                        String json, boolean success) {
-
-            if (fact instanceof VirtualControlLoopNotification) {
-                String factString = ((VirtualControlLoopNotification) fact).getAai().get("signal");
-                if (factString == null) {
-                    // this hook is run during 'FrankfurtTest' as well
-                    return false;
-                }
-                if (factString.contains("afterDeliverTrue")) {
-                    afterDeliverTrue += 1;
-                    return true;
-                }
-                if (factString.contains("afterDeliverException")) {
-                    afterDeliverException += 1;
-                    throw new RuntimeException("afterDeliver");
-                }
-            }
-            afterDeliverFalse += 1;
-            return false;
-        }
-    }
-}
diff --git a/controlloop/common/controller-tdjam/src/test/resources/META-INF/services/org.onap.policy.drools.features.DroolsControllerFeatureApi b/controlloop/common/controller-tdjam/src/test/resources/META-INF/services/org.onap.policy.drools.features.DroolsControllerFeatureApi
deleted file mode 100644 (file)
index bb7cf8e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-org.onap.policy.extension.system.NonDroolsPolicyControllerTest$DroolsControllerFeatureHandler
-org.onap.policy.extension.system.NonDroolsPolicyControllerTest$DroolsBuilder
-org.onap.policy.controlloop.tdjam.TdjamController$DroolsBuilder
diff --git a/controlloop/common/controller-tdjam/src/test/resources/META-INF/services/org.onap.policy.drools.features.PolicyControllerFeatureApi b/controlloop/common/controller-tdjam/src/test/resources/META-INF/services/org.onap.policy.drools.features.PolicyControllerFeatureApi
deleted file mode 100644 (file)
index 4f27643..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-org.onap.policy.controlloop.tdjam.TdjamController$PolicyBuilder
-org.onap.policy.extension.system.NonDroolsPolicyControllerTest$PolicyBuilder
diff --git a/controlloop/common/controller-tdjam/src/test/resources/config/event-manager.properties b/controlloop/common/controller-tdjam/src/test/resources/config/event-manager.properties
deleted file mode 100644 (file)
index f5be41c..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# ============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========================================================
-#
-
-# DB parameters
-operation.history.url=jdbc:h2:mem:Tdjam
-operation.history.userName=sa
-operation.history.password=
-
-# Actor parameters
-#
-# Note: every operation must have at least one entry, otherwise it will not be
-# configured and started.  Thus some of them have a "placeholder" property.
-#
-
-#actor.service.GUARD.disabled=true
-actor.service.GUARD.clientName=GUARD
-actor.service.GUARD.onapName=my-onap-name
-actor.service.GUARD.onapComponent=my-onap-component
-actor.service.GUARD.onapInstance=my-onap-instance
-actor.service.GUARD.operations.Decision.path=decision
-
-actor.service.AAI.clientName=AAI
-actor.service.AAI.operations.CustomQuery.path=aai/v16/query
-actor.service.AAI.operations.Pnf.path=aai/v16/network/pnfs/pnf
-actor.service.AAI.operations.Tenant.path=aai/v16/search/nodes-query
-
-actor.service.APPC.sinkTopic=APPC-LCM-READ
-actor.service.APPC.sourceTopic=APPC-LCM-WRITE
-actor.service.APPC.operations.ConfigModify.placeholder=
-actor.service.APPC.operations.Migrate.placeholder=
-actor.service.APPC.operations.Restart.placeholder=
-actor.service.APPC.operations.Rebuild.placeholder=
-
-# legacy APPC - must specify sink and source for each operation
-actor.service.APPC.operations.ModifyConfig.sinkTopic=APPC-CL
-actor.service.APPC.operations.ModifyConfig.sourceTopic=APPC-CL
-
-actor.service.CDS.operations.any.host=localhost
-actor.service.CDS.operations.any.port=7878
-actor.service.CDS.operations.any.username=grpc-username
-actor.service.CDS.operations.any.password=grpc-password
-actor.service.CDS.operations.any.timeout=10
-
-actor.service.SDNC.clientName=SDNC
-actor.service.SDNC.operations.BandwidthOnDemand.path=\
-        GENERIC-RESOURCE-API:vf-module-topology-operation
-actor.service.SDNC.operations.Reroute.path=\
-        GENERIC-RESOURCE-API:network-topology-operation
-
-actor.service.SDNR.sinkTopic=SDNR-CL
-actor.service.SDNR.sourceTopic=SDNR-CL-RSP
-actor.service.SDNR.operations.any.placeholder=
-
-actor.service.SO.clientName=SO
-actor.service.SO.pollPath=orchestrationRequests/v5/
-actor.service.SO.maxPolls=20
-actor.service.SO.pollWaitSec=20
-actor.service.SO.operations.VF\ Module\ Create.path=serviceInstantiation/v7/serviceInstances
-actor.service.SO.operations.VF\ Module\ Delete.path=serviceInstances/v7
-
-actor.service.VFC.clientName=VFC
-actor.service.VFC.pollPath=jobs
-actor.service.VFC.maxPolls=20
-actor.service.VFC.pollWaitSec=20
-actor.service.VFC.operations.Restart.path=ns
-actor.service.VFC.operations.Restart.timeoutSec=60
diff --git a/controlloop/common/controller-tdjam/src/test/resources/config/tdjam-controller.properties b/controlloop/common/controller-tdjam/src/test/resources/config/tdjam-controller.properties
deleted file mode 100644 (file)
index 135fa05..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# ============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=========================================================
-#
-
-controller.name=tdjam
-controller.type=tdjam
-
-rules.groupId=NonDroolsPolicyController
-rules.artifactId=tdjam
-rules.version=1.0
-
-noop.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP,POLICY-CL-MGT,APPC-LCM-READ
-
-noop.source.topics.DCAE_TOPIC.events=\
-    org.onap.policy.controlloop.CanonicalOnset,org.onap.policy.controlloop.CanonicalAbated
-noop.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalOnset.\
-    filter=[?($.closedLoopEventStatus == 'ONSET')]
-noop.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalAbated.\
-    filter=[?($.closedLoopEventStatus == 'ABATED')]
-noop.source.topics.DCAE_TOPIC.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson
-
-noop.source.topics.APPC-CL.events=org.onap.policy.appc.Response,org.onap.policy.appc.Request
-noop.source.topics.APPC-CL.events.org.onap.policy.appc.Response.filter=[?($.CommonHeader && $.Status)]
-noop.source.topics.APPC-CL.events.org.onap.policy.appc.Request.filter=[?($.CommonHeader && $.Action)]
-noop.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-
-noop.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-noop.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')]
-noop.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-
-noop.source.topics.SDNR-CL-RSP.events=org.onap.policy.sdnr.PciResponseWrapper
-noop.source.topics.SDNR-CL-RSP.events.org.onap.policy.sdnr.PciResponseWrapper.filter=[?($.type == 'response')]
-noop.source.topics.SDNR-CL-RSP.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
-
-noop.source.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
-noop.source.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
-noop.source.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-noop.source.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-
-noop.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL,DCAE_CL_RSP
-
-noop.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
-noop.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
-noop.sink.topics.DCAE_CL_RSP.events=org.onap.policy.controlloop.ControlLoopResponse
-noop.sink.topics.DCAE_CL_RSP.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
diff --git a/controlloop/common/controller-tdjam/src/test/resources/config/tdjam-http-client.properties b/controlloop/common/controller-tdjam/src/test/resources/config/tdjam-http-client.properties
deleted file mode 100644 (file)
index 1e3e88c..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# ============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=========================================================
-#
-
-http.client.services=GUARD,AAI,SDNC,SO,VFC
-
-http.client.services.GUARD.managed=true
-http.client.services.GUARD.host=localhost
-http.client.services.GUARD.port=6669
-http.client.services.GUARD.userName=pdpx
-http.client.services.GUARD.password=pdpx
-http.client.services.GUARD.contextUriPath=policy/pdpx/v1/
-
-http.client.services.AAI.managed=true
-http.client.services.AAI.host=localhost
-http.client.services.AAI.port=6666
-http.client.services.AAI.contextUriPath=
-
-http.client.services.SDNC.managed=true
-http.client.services.SDNC.host=localhost
-http.client.services.SDNC.port=6665
-http.client.services.SDNC.userName=sdnc
-http.client.services.SDNC.password=sdnc
-http.client.services.SDNC.contextUriPath=
-
-http.client.services.SO.managed=true
-http.client.services.SO.host=localhost
-http.client.services.SO.port=6667
-http.client.services.SO.contextUriPath=
-
-http.client.services.VFC.managed=true
-http.client.services.VFC.host=localhost
-http.client.services.VFC.port=6668
-http.client.services.VFC.userName=VFC
-http.client.services.VFC.password=VFC
-http.client.services.VFC.contextUriPath=api/nslcm/v1
diff --git a/controlloop/common/controller-tdjam/src/test/resources/logback-test.xml b/controlloop/common/controller-tdjam/src/test/resources/logback-test.xml
deleted file mode 100644 (file)
index 84b02f2..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-  controller-tdjam
-  ================================================================================
-  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=========================================================
-  -->
-
-<configuration>
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <!-- encoders are assigned the type
-             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
-        <encoder>
-            <pattern>%d %level  %msg%n</pattern>
-        </encoder>
-    </appender>
-
-    <!-- the following line doesn't seem necessary, but it is needed for some reason  -->
-    <logger name="org.onap.policy.controlloop.tdjam" level="info" additivity="false">
-        <appender-ref ref="STDOUT" />
-    </logger>
-
-    <root level="info">
-        <appender-ref ref="STDOUT" />
-    </root>
-</configuration>
index d4979fb..cce7209 100644 (file)
@@ -76,8 +76,6 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
 import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
 import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
 import org.onap.policy.controlloop.eventmanager.ActorConstants;
-import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2;
-import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2Drools;
 import org.onap.policy.controlloop.ophistory.OperationHistoryDataManager;
 import org.onap.policy.drools.apps.controller.usecases.UsecasesEventManager.NewEventStatus;
 import org.onap.policy.drools.apps.controller.usecases.step.AaiCqStep2;
@@ -888,7 +886,7 @@ public class UsecasesEventManagerTest {
 
         // VM case
         event.setTargetType(ControlLoopTargetType.VM);
-        event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
+        event.setAai(Map.of(UsecasesConstants.GENERIC_VNF_VNF_ID, MY_TARGET));
         assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
 
         event.setAai(Map.of());
@@ -896,7 +894,7 @@ public class UsecasesEventManagerTest {
 
         // VNF case
         event.setTargetType(ControlLoopTargetType.VNF);
-        event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
+        event.setAai(Map.of(UsecasesConstants.GENERIC_VNF_VNF_ID, MY_TARGET));
         assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
 
         event.setAai(Map.of());
@@ -904,7 +902,7 @@ public class UsecasesEventManagerTest {
 
         // PNF case
         event.setTargetType(ControlLoopTargetType.PNF);
-        event.setAai(Map.of(ControlLoopEventManager2.PNF_NAME, MY_TARGET));
+        event.setAai(Map.of(UsecasesConstants.PNF_NAME, MY_TARGET));
         assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
 
         event.setAai(Map.of());
@@ -914,13 +912,13 @@ public class UsecasesEventManagerTest {
     @Test
     public void testValidateAaiVmVnfData() {
         event.setTargetType(ControlLoopTargetType.VM);
-        event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
+        event.setAai(Map.of(UsecasesConstants.GENERIC_VNF_VNF_ID, MY_TARGET));
         assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
 
-        event.setAai(Map.of(ControlLoopEventManager2.VSERVER_VSERVER_NAME, MY_TARGET));
+        event.setAai(Map.of(UsecasesConstants.VSERVER_VSERVER_NAME, MY_TARGET));
         assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
 
-        event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_NAME, MY_TARGET));
+        event.setAai(Map.of(UsecasesConstants.GENERIC_VNF_VNF_NAME, MY_TARGET));
         assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
 
         event.setAai(Map.of());
@@ -931,7 +929,7 @@ public class UsecasesEventManagerTest {
     @Test
     public void testValidateAaiPnfData() {
         event.setTargetType(ControlLoopTargetType.PNF);
-        event.setAai(Map.of(ControlLoopEventManager2.PNF_NAME, MY_TARGET));
+        event.setAai(Map.of(UsecasesConstants.PNF_NAME, MY_TARGET));
         assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
 
         event.setAai(Map.of());
@@ -943,16 +941,16 @@ public class UsecasesEventManagerTest {
     public void testIsClosedLoopDisabled() {
         Map<String, String> orig = event.getAai();
 
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "true"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+        event.setAai(addAai(orig, UsecasesConstants.VSERVER_IS_CLOSED_LOOP_DISABLED, "true"));
+        assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
                         .isInstanceOf(IllegalStateException.class);
 
-        event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_IS_CLOSED_LOOP_DISABLED, "true"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+        event.setAai(addAai(orig, UsecasesConstants.GENERIC_VNF_IS_CLOSED_LOOP_DISABLED, "true"));
+        assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
                         .isInstanceOf(IllegalStateException.class);
 
-        event.setAai(addAai(orig, ControlLoopEventManager2.PNF_IS_IN_MAINT, "true"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+        event.setAai(addAai(orig, UsecasesConstants.PNF_IS_IN_MAINT, "true"));
+        assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
                         .isInstanceOf(IllegalStateException.class);
     }
 
@@ -960,18 +958,18 @@ public class UsecasesEventManagerTest {
     public void testIsProvStatusInactive() {
         Map<String, String> orig = event.getAai();
 
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "ACTIVE"));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+        event.setAai(addAai(orig, UsecasesConstants.VSERVER_PROV_STATUS, "ACTIVE"));
+        assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
 
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "inactive"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+        event.setAai(addAai(orig, UsecasesConstants.VSERVER_PROV_STATUS, "inactive"));
+        assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
                         .isInstanceOf(IllegalStateException.class);
 
-        event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "ACTIVE"));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+        event.setAai(addAai(orig, UsecasesConstants.GENERIC_VNF_PROV_STATUS, "ACTIVE"));
+        assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
 
-        event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "inactive"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+        event.setAai(addAai(orig, UsecasesConstants.GENERIC_VNF_PROV_STATUS, "inactive"));
+        assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
                         .isInstanceOf(IllegalStateException.class);
     }
 
@@ -980,16 +978,16 @@ public class UsecasesEventManagerTest {
         Map<String, String> orig = event.getAai();
 
         for (String value : Arrays.asList("yes", "y", "true", "t", "yEs", "trUe")) {
-            event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, value));
-            assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+            event.setAai(addAai(orig, UsecasesConstants.VSERVER_IS_CLOSED_LOOP_DISABLED, value));
+            assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
                             .isInstanceOf(IllegalStateException.class);
         }
 
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "false"));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+        event.setAai(addAai(orig, UsecasesConstants.VSERVER_IS_CLOSED_LOOP_DISABLED, "false"));
+        assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
 
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "no"));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+        event.setAai(addAai(orig, UsecasesConstants.VSERVER_IS_CLOSED_LOOP_DISABLED, "no"));
+        assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
     }
 
 
index 131e5d3..ab95072 100644 (file)
@@ -50,7 +50,6 @@ import org.onap.policy.controlloop.actor.so.VfModuleCreate;
 import org.onap.policy.controlloop.actorserviceprovider.Operation;
 import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
 import org.onap.policy.controlloop.actorserviceprovider.TargetType;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
 import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
 import org.onap.policy.controlloop.eventmanager.StepContext;
 import org.onap.policy.drools.apps.controller.usecases.UsecasesConstants;
@@ -72,8 +71,6 @@ public class GuardStep2Test {
     private static final UUID REQ_ID = UUID.randomUUID();
     private static final int VF_COUNT = 10;
 
-    @Mock
-    private ControlLoopEventContext context;
     @Mock
     private StepContext stepContext;
     @Mock
@@ -106,8 +103,6 @@ public class GuardStep2Test {
         when(event.getRequestId()).thenReturn(REQ_ID);
         when(event.getAai()).thenReturn(aai);
 
-        when(context.getEvent()).thenReturn(event);
-
         when(genericVnf.getVnfId()).thenReturn(MY_TARGET);
         when(genericVnf.getVnfName()).thenReturn(MY_NAME);
         when(genericVnf.getVnfType()).thenReturn(MY_TYPE);
@@ -174,7 +169,7 @@ public class GuardStep2Test {
                     .actor(MASTER_ACTOR)
                     .operation(MASTER_OPERATION)
                     .targetEntity(MY_TARGET)
-                    .context(context)
+                    .requestId(REQ_ID)
                     .targetType(target)
                     .build();
         // @formatter:on
index d01e2b5..7695d5b 100644 (file)
@@ -64,10 +64,8 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
 import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
 import org.onap.policy.controlloop.actorserviceprovider.Operator;
 import org.onap.policy.controlloop.actorserviceprovider.TargetType;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
 import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
 import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager2;
 import org.onap.policy.controlloop.eventmanager.StepContext;
 import org.onap.policy.drools.apps.controller.usecases.UsecasesConstants;
 
@@ -97,7 +95,6 @@ public class Step2Test {
     private CompletableFuture<OperationOutcome> future;
     private Map<String, String> payload;
     private VirtualControlLoopEvent event;
-    private ControlLoopEventContext context;
     private BlockingQueue<OperationOutcome> starts;
     private BlockingQueue<OperationOutcome> completions;
     private ControlLoopOperationParams params;
@@ -126,10 +123,6 @@ public class Step2Test {
 
         event = new VirtualControlLoopEvent();
         event.setRequestId(REQ_ID);
-        event.setTarget(ControlLoopOperationManager2.VSERVER_VSERVER_NAME);
-        event.setAai(new TreeMap<>(Map.of(ControlLoopOperationManager2.VSERVER_VSERVER_NAME, MY_TARGET)));
-
-        context = new ControlLoopEventContext(event);
 
         starts = new LinkedBlockingQueue<>();
         completions = new LinkedBlockingQueue<>();
@@ -137,10 +130,10 @@ public class Step2Test {
         Map<String, String> entityIds = new HashMap<>();
 
         params = ControlLoopOperationParams.builder().actor(POLICY_ACTOR).actorService(actors)
-                        .completeCallback(completions::add).context(context).executor(ForkJoinPool.commonPool())
+                        .completeCallback(completions::add).executor(ForkJoinPool.commonPool())
                         .operation(POLICY_OPERATION).payload(new TreeMap<>(payload)).startCallback(starts::add)
                         .targetType(TargetType.VM).targetEntityIds(entityIds).targetEntity(MY_TARGET)
-                        .build();
+                        .requestId(REQ_ID).build();
 
         step = new Step2(stepContext, params, event);
         step.init();
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java
deleted file mode 100644 (file)
index 1b3ae92..0000000
+++ /dev/null
@@ -1,648 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2017-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.eventmanager;
-
-import static org.onap.policy.controlloop.ControlLoopTargetType.PNF;
-import static org.onap.policy.controlloop.ControlLoopTargetType.VM;
-import static org.onap.policy.controlloop.ControlLoopTargetType.VNF;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import lombok.Getter;
-import lombok.ToString;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.policy.controlloop.ControlLoopEventStatus;
-import org.onap.policy.controlloop.ControlLoopException;
-import org.onap.policy.controlloop.ControlLoopNotificationType;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopResponse;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.VirtualControlLoopNotification;
-import org.onap.policy.controlloop.actorserviceprovider.ActorService;
-import org.onap.policy.controlloop.actorserviceprovider.OperationFinalResult;
-import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
-import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
-import org.onap.policy.controlloop.ophistory.OperationHistoryDataManager;
-import org.onap.policy.controlloop.processor.ControlLoopProcessor;
-import org.onap.policy.drools.core.lock.LockCallback;
-import org.onap.policy.drools.domain.models.operational.Operation;
-import org.onap.policy.drools.system.PolicyEngineConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Manager for a single control loop event. Once this has been created, the event can be
- * retracted from working memory. Once this has been created, {@link #start()} should be
- * invoked, and then {@link #nextStep()} should be invoked continually until
- * {@link #isActive()} returns {@code false}, indicating that all steps have completed.
- */
-@ToString(onlyExplicitlyIncluded = true)
-public abstract class ControlLoopEventManager2 implements ManagerContext, Serializable {
-    private static final Logger logger = LoggerFactory.getLogger(ControlLoopEventManager2.class);
-    private static final long serialVersionUID = -1216568161322872641L;
-
-    private static final String EVENT_MANAGER_SERVICE_CONFIG = "event-manager";
-    public static final String PROV_STATUS_ACTIVE = "ACTIVE";
-    private static final String VM_NAME = "VM_NAME";
-    private static final String VNF_NAME = "VNF_NAME";
-    public static final String GENERIC_VNF_VNF_ID = "generic-vnf.vnf-id";
-    public static final String GENERIC_VNF_VNF_NAME = "generic-vnf.vnf-name";
-    public static final String VSERVER_VSERVER_NAME = "vserver.vserver-name";
-    public static final String GENERIC_VNF_IS_CLOSED_LOOP_DISABLED = "generic-vnf.is-closed-loop-disabled";
-    public static final String VSERVER_IS_CLOSED_LOOP_DISABLED = "vserver.is-closed-loop-disabled";
-    public static final String PNF_IS_IN_MAINT = "pnf.in-maint";
-    public static final String GENERIC_VNF_PROV_STATUS = "generic-vnf.prov-status";
-    public static final String VSERVER_PROV_STATUS = "vserver.prov-status";
-    public static final String PNF_ID = "pnf.pnf-id";
-    public static final String PNF_NAME = "pnf.pnf-name";
-
-    private static final Set<String> VALID_TARGETS = Stream
-                    .of(VM_NAME, VNF_NAME, VSERVER_VSERVER_NAME, GENERIC_VNF_VNF_ID, GENERIC_VNF_VNF_NAME, PNF_NAME)
-                    .map(String::toLowerCase).collect(Collectors.toSet());
-
-    private static final Set<String> TRUE_VALUES = Set.of("true", "t", "yes", "y");
-
-    /**
-     * Counts the number of these objects that have been created.  This is used by junit
-     * tests.
-     */
-    private static final AtomicLong createCount = new AtomicLong(0);
-
-    public enum NewEventStatus {
-        FIRST_ONSET, SUBSEQUENT_ONSET, FIRST_ABATEMENT, SUBSEQUENT_ABATEMENT, SYNTAX_ERROR
-    }
-
-    /**
-     * {@code True} if this object was created by this JVM instance, {@code false}
-     * otherwise. This will be {@code false} if this object is reconstituted from a
-     * persistent store or by transfer from another server.
-     */
-    private transient boolean createdByThisJvmInstance;
-
-    @Getter
-    @ToString.Include
-    public final String closedLoopControlName;
-    @Getter
-    @ToString.Include
-    private final UUID requestId;
-    @Getter
-    private final ControlLoopEventContext context;
-    @ToString.Include
-    private int numOnsets = 1;
-    @ToString.Include
-    private int numAbatements = 0;
-    private VirtualControlLoopEvent abatement = null;
-
-    /**
-     * Time, in milliseconds, when the control loop will time out.
-     */
-    @Getter
-    private final long endTimeMs;
-
-    // fields extracted from the ControlLoopParams
-    @Getter
-    private final String policyName;
-    private final String policyScope;
-    private final String policyVersion;
-
-    private final LinkedList<ControlLoopOperation> controlLoopHistory = new LinkedList<>();
-
-    /**
-     * Maps a target entity to its lock.
-     */
-    private final transient Map<String, LockData> target2lock = new HashMap<>();
-
-    private final ControlLoopProcessor processor;
-    private final AtomicReference<ControlLoopOperationManager2> currentOperation = new AtomicReference<>();
-
-    private OperationFinalResult finalResult = null;
-
-    @Getter
-    private VirtualControlLoopNotification notification;
-    @Getter
-    private ControlLoopResponse controlLoopResponse;
-
-    @Getter
-    private boolean updated = false;
-
-
-    /**
-     * Constructs the object.
-     *
-     * @param params control loop parameters
-     * @param event event to be managed by this object
-     * @throws ControlLoopException if the event is invalid or if a YAML processor cannot
-     *         be created
-     */
-    public ControlLoopEventManager2(ControlLoopParams params, VirtualControlLoopEvent event)
-                    throws ControlLoopException {
-
-        createCount.incrementAndGet();
-
-        checkEventSyntax(event);
-
-        if (isClosedLoopDisabled(event)) {
-            throw new IllegalStateException("is-closed-loop-disabled is set to true on VServer or VNF");
-        }
-
-        if (isProvStatusInactive(event)) {
-            throw new IllegalStateException("prov-status is not ACTIVE on VServer or VNF");
-        }
-
-        this.createdByThisJvmInstance = true;
-        this.closedLoopControlName = params.getClosedLoopControlName();
-        this.requestId = event.getRequestId();
-        this.context = new ControlLoopEventContext(event);
-        this.policyName = params.getPolicyName();
-        this.policyScope = params.getPolicyScope();
-        this.policyVersion = params.getPolicyVersion();
-        this.processor = new ControlLoopProcessor(params.getToscaPolicy());
-        this.endTimeMs = System.currentTimeMillis() + detmControlLoopTimeoutMs();
-    }
-
-    /**
-     * Gets the number of managers objects that have been created.
-     * @return the number of managers objects that have been created
-     */
-    public static long getCreateCount() {
-        return createCount.get();
-    }
-
-    /**
-     * Starts the manager.
-     *
-     * @throws ControlLoopException if the processor cannot get a policy
-     */
-    public void start() throws ControlLoopException {
-        if (!isActive()) {
-            throw new IllegalStateException("manager is no longer active");
-        }
-
-        startHook();
-
-        if (currentOperation.get() != null) {
-            throw new IllegalStateException("manager already started");
-        }
-
-        startOperation();
-    }
-
-    /**
-     * Starts an operation for the current processor policy.
-     *
-     * @throws ControlLoopException if the processor cannot get a policy
-     */
-    private synchronized void startOperation() throws ControlLoopException {
-
-        if ((finalResult = processor.checkIsCurrentPolicyFinal()) == null) {
-            // not final - start the next operation
-            currentOperation.set(makeOperationManager(context, processor.getCurrentPolicy()));
-            currentOperation.get().start(endTimeMs - System.currentTimeMillis());
-            return;
-        }
-
-        logger.info("final={} oper state={} for {}", finalResult, currentOperation.get().getState(), requestId);
-
-        controlLoopResponse = null;
-        notification = makeNotification();
-        notification.setHistory(controlLoopHistory);
-
-        switch (finalResult) {
-            case FINAL_FAILURE_EXCEPTION:
-                notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
-                notification.setMessage("Exception in processing closed loop");
-                break;
-            case FINAL_SUCCESS:
-                notification.setNotification(ControlLoopNotificationType.FINAL_SUCCESS);
-                break;
-            case FINAL_OPENLOOP:
-                notification.setNotification(ControlLoopNotificationType.FINAL_OPENLOOP);
-                break;
-            case FINAL_FAILURE:
-            default:
-                notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
-                break;
-        }
-    }
-
-    /**
-     * Starts the next step, whatever that may be.
-     */
-    public synchronized void nextStep() {
-        if (!isActive()) {
-            return;
-        }
-
-        updated = false;
-
-        try {
-            if (!currentOperation.get().nextStep()) {
-                // current operation is done - try the next
-                controlLoopHistory.addAll(currentOperation.get().getHistory());
-                processor.nextPolicyForResult(currentOperation.get().getOperationResult());
-                startOperation();
-            }
-
-        } catch (ControlLoopException | RuntimeException e) {
-            // processor problem - this is fatal
-            logger.warn("{}: cannot start next step for {}", closedLoopControlName, requestId, e);
-            finalResult = OperationFinalResult.FINAL_FAILURE_EXCEPTION;
-            controlLoopResponse = null;
-            notification = makeNotification();
-            notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
-            notification.setMessage("Policy processing aborted due to policy error");
-            notification.setHistory(controlLoopHistory);
-        }
-    }
-
-    /**
-     * Determines if the manager is still active.
-     *
-     * @return {@code true} if the manager is still active, {@code false} otherwise
-     */
-    public synchronized boolean isActive() {
-        return (createdByThisJvmInstance && finalResult == null);
-    }
-
-    /**
-     * Updates working memory if this changes.
-     *
-     * @param operation operation manager that was updated
-     */
-    @Override
-    public synchronized void updated(ControlLoopOperationManager2 operation) {
-        if (!isActive() || operation != currentOperation.get()) {
-            // no longer working on the given operation
-            return;
-        }
-
-        controlLoopResponse = operation.getControlLoopResponse();
-        notification = makeNotification();
-
-        VirtualControlLoopEvent event = context.getEvent();
-
-        switch (operation.getState()) {
-            case LOCK_DENIED:
-                notification.setNotification(ControlLoopNotificationType.REJECTED);
-                notification.setMessage("The target " + event.getAai().get(event.getTarget()) + " is already locked");
-                break;
-            case LOCK_LOST:
-                notification.setNotification(ControlLoopNotificationType.OPERATION_FAILURE);
-                notification.setMessage("The target " + event.getAai().get(event.getTarget()) + " is no longer locked");
-                break;
-            case GUARD_STARTED:
-                notification.setNotification(ControlLoopNotificationType.OPERATION);
-                notification.setMessage(
-                                "Sending guard query for " + operation.getActor() + " " + operation.getOperation());
-                break;
-            case GUARD_PERMITTED:
-                notification.setNotification(ControlLoopNotificationType.OPERATION);
-                notification.setMessage("Guard result for " + operation.getActor() + " " + operation.getOperation()
-                                + " is Permit");
-                break;
-            case GUARD_DENIED:
-                notification.setNotification(ControlLoopNotificationType.OPERATION);
-                notification.setMessage("Guard result for " + operation.getActor() + " " + operation.getOperation()
-                                + " is Deny");
-                break;
-            case OPERATION_STARTED:
-                notification.setNotification(ControlLoopNotificationType.OPERATION);
-                notification.setMessage(operation.getOperationMessage());
-                notification.setHistory(Collections.emptyList());
-                break;
-            case OPERATION_SUCCESS:
-                notification.setNotification(ControlLoopNotificationType.OPERATION_SUCCESS);
-                break;
-
-            case CONTROL_LOOP_TIMEOUT:
-                logger.warn("{}: control loop timed out for {}", closedLoopControlName, requestId);
-                controlLoopHistory.addAll(currentOperation.get().getHistory());
-                notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
-                notification.setMessage("Control Loop timed out");
-                notification.setHistory(controlLoopHistory);
-                finalResult = OperationFinalResult.FINAL_FAILURE;
-                break;
-
-            case OPERATION_FAILURE:
-            default:
-                notification.setNotification(ControlLoopNotificationType.OPERATION_FAILURE);
-                break;
-        }
-
-        updated = true;
-        notifyUpdate();
-    }
-
-    /**
-     * Cancels the current operation and frees all locks.
-     */
-    public synchronized void destroy() {
-        ControlLoopOperationManager2 oper = currentOperation.get();
-        if (oper != null) {
-            oper.cancel();
-        }
-
-        getBlockingExecutor().execute(this::freeAllLocks);
-    }
-
-    /**
-     * Frees all locks.
-     */
-    private void freeAllLocks() {
-        target2lock.values().forEach(LockData::free);
-    }
-
-    /**
-     * Makes a notification message for the current operation.
-     *
-     * @return a new notification
-     */
-    public synchronized VirtualControlLoopNotification makeNotification() {
-        VirtualControlLoopNotification notif = new VirtualControlLoopNotification(context.getEvent());
-        notif.setNotification(ControlLoopNotificationType.OPERATION);
-        notif.setFrom("policy");
-        notif.setPolicyScope(policyScope);
-        notif.setPolicyVersion(policyVersion);
-
-        if (finalResult == null) {
-            ControlLoopOperationManager2 oper = currentOperation.get();
-            if (oper != null) {
-                notif.setMessage(oper.getOperationHistory());
-                notif.setHistory(oper.getHistory());
-            }
-        }
-
-        return notif;
-    }
-
-    /**
-     * An event onset/abatement.
-     *
-     * @param event the event
-     * @return the status
-     */
-    public synchronized NewEventStatus onNewEvent(VirtualControlLoopEvent event) {
-        try {
-            checkEventSyntax(event);
-
-            if (event.getClosedLoopEventStatus() == ControlLoopEventStatus.ONSET) {
-                if (event.equals(context.getEvent())) {
-                    return NewEventStatus.FIRST_ONSET;
-                }
-
-                numOnsets++;
-                return NewEventStatus.SUBSEQUENT_ONSET;
-
-            } else {
-                if (abatement == null) {
-                    abatement = event;
-                    numAbatements++;
-                    return NewEventStatus.FIRST_ABATEMENT;
-                } else {
-                    numAbatements++;
-                    return NewEventStatus.SUBSEQUENT_ABATEMENT;
-                }
-            }
-        } catch (ControlLoopException e) {
-            logger.error("{}: onNewEvent threw an exception", this, e);
-            return NewEventStatus.SYNTAX_ERROR;
-        }
-    }
-
-    /**
-     * Determines the overall control loop timeout.
-     *
-     * @return the policy timeout, in milliseconds, if specified, a default timeout
-     *         otherwise
-     */
-    private long detmControlLoopTimeoutMs() {
-        // validation checks preclude null or 0 timeout values in the policy
-        Integer timeout = processor.getPolicy().getProperties().getTimeout();
-        return TimeUnit.MILLISECONDS.convert(timeout, TimeUnit.SECONDS);
-    }
-
-    /**
-     * Check an event syntax.
-     *
-     * @param event the event syntax
-     * @throws ControlLoopException if an error occurs
-     */
-    protected void checkEventSyntax(VirtualControlLoopEvent event) throws ControlLoopException {
-        validateStatus(event);
-        if (StringUtils.isBlank(event.getClosedLoopControlName())) {
-            throw new ControlLoopException("No control loop name");
-        }
-        if (event.getRequestId() == null) {
-            throw new ControlLoopException("No request ID");
-        }
-        if (event.getClosedLoopEventStatus() == ControlLoopEventStatus.ABATED) {
-            return;
-        }
-        if (StringUtils.isBlank(event.getTarget())) {
-            throw new ControlLoopException("No target field");
-        } else if (!VALID_TARGETS.contains(event.getTarget().toLowerCase())) {
-            throw new ControlLoopException("target field invalid");
-        }
-        validateAaiData(event);
-    }
-
-    private void validateStatus(VirtualControlLoopEvent event) throws ControlLoopException {
-        if (event.getClosedLoopEventStatus() != ControlLoopEventStatus.ONSET
-                        && event.getClosedLoopEventStatus() != ControlLoopEventStatus.ABATED) {
-            throw new ControlLoopException("Invalid value in closedLoopEventStatus");
-        }
-    }
-
-    private void validateAaiData(VirtualControlLoopEvent event) throws ControlLoopException {
-        Map<String, String> eventAai = event.getAai();
-        if (eventAai == null) {
-            throw new ControlLoopException("AAI is null");
-        }
-        if (event.getTargetType() == null) {
-            throw new ControlLoopException("The Target type is null");
-        }
-        switch (event.getTargetType()) {
-            case VM:
-            case VNF:
-                validateAaiVmVnfData(eventAai);
-                return;
-            case PNF:
-                validateAaiPnfData(eventAai);
-                return;
-            default:
-                throw new ControlLoopException("The target type is not supported");
-        }
-    }
-
-    private void validateAaiVmVnfData(Map<String, String> eventAai) throws ControlLoopException {
-        if (eventAai.get(GENERIC_VNF_VNF_ID) == null && eventAai.get(VSERVER_VSERVER_NAME) == null
-                        && eventAai.get(GENERIC_VNF_VNF_NAME) == null) {
-            throw new ControlLoopException(
-                            "generic-vnf.vnf-id or generic-vnf.vnf-name or vserver.vserver-name information missing");
-        }
-    }
-
-    private void validateAaiPnfData(Map<String, String> eventAai) throws ControlLoopException {
-        if (eventAai.get(PNF_NAME) == null) {
-            throw new ControlLoopException("AAI PNF object key pnf-name is missing");
-        }
-    }
-
-    /**
-     * Is closed loop disabled for an event.
-     *
-     * @param event the event
-     * @return <code>true</code> if the control loop is disabled, <code>false</code>
-     *         otherwise
-     */
-    private static boolean isClosedLoopDisabled(VirtualControlLoopEvent event) {
-        Map<String, String> aai = event.getAai();
-        return (isAaiTrue(aai.get(VSERVER_IS_CLOSED_LOOP_DISABLED))
-                        || isAaiTrue(aai.get(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED))
-                        || isAaiTrue(aai.get(PNF_IS_IN_MAINT)));
-    }
-
-    /**
-     * Does provisioning status, for an event, have a value other than ACTIVE.
-     *
-     * @param event the event
-     * @return {@code true} if the provisioning status is neither ACTIVE nor {@code null},
-     *         {@code false} otherwise
-     */
-    private static boolean isProvStatusInactive(VirtualControlLoopEvent event) {
-        Map<String, String> aai = event.getAai();
-        return !(PROV_STATUS_ACTIVE.equalsIgnoreCase(aai.getOrDefault(VSERVER_PROV_STATUS, PROV_STATUS_ACTIVE))
-                        && PROV_STATUS_ACTIVE.equalsIgnoreCase(
-                                        aai.getOrDefault(GENERIC_VNF_PROV_STATUS, PROV_STATUS_ACTIVE)));
-    }
-
-    /**
-     * Determines the boolean value represented by the given AAI field value.
-     *
-     * @param aaiValue value to be examined
-     * @return the boolean value represented by the field value, or {@code false} if the
-     *         value is {@code null}
-     */
-    private static boolean isAaiTrue(String aaiValue) {
-        return (aaiValue != null && TRUE_VALUES.contains(aaiValue.toLowerCase()));
-    }
-
-    /**
-     * Requests a lock. This requests the lock for the time that remains before the
-     * timeout expires. This avoids having to extend the lock.
-     *
-     * @param targetEntity entity to be locked
-     * @param lockUnavailableCallback function to be invoked if the lock is
-     *        unavailable/lost
-     * @return a future that can be used to await the lock
-     */
-    @Override
-    public synchronized CompletableFuture<OperationOutcome> requestLock(String targetEntity,
-                    Consumer<OperationOutcome> lockUnavailableCallback) {
-
-        long remainingMs = endTimeMs - System.currentTimeMillis();
-        int remainingSec = 15 + Math.max(0, (int) TimeUnit.SECONDS.convert(remainingMs, TimeUnit.MILLISECONDS));
-
-        LockData data = target2lock.computeIfAbsent(targetEntity, key -> {
-            LockData data2 = new LockData(key, requestId);
-            makeLock(targetEntity, requestId.toString(), remainingSec, data2);
-            return data2;
-        });
-
-        data.addUnavailableCallback(lockUnavailableCallback);
-
-        return data.getFuture();
-    }
-
-    /**
-     * Initializes various components, on demand.
-     */
-    private static class LazyInitData {
-        private static final OperationHistoryDataManager DATA_MANAGER;
-        private static final ActorService ACTOR_SERVICE;
-
-        static {
-            EventManagerServices services = new EventManagerServices(EVENT_MANAGER_SERVICE_CONFIG);
-            ACTOR_SERVICE = services.getActorService();
-            DATA_MANAGER = services.getDataManager();
-        }
-    }
-
-    // the following methods may be overridden by junit tests
-
-    protected ControlLoopOperationManager2 makeOperationManager(ControlLoopEventContext ctx, Operation operation) {
-        return new ControlLoopOperationManager2(this, ctx, operation, getExecutor());
-    }
-
-    protected Executor getExecutor() {
-        return ForkJoinPool.commonPool();
-    }
-
-    protected ExecutorService getBlockingExecutor() {
-        return PolicyEngineConstants.getManager().getExecutorService();
-    }
-
-    protected void makeLock(String targetEntity, String requestId, int holdSec, LockCallback callback) {
-        PolicyEngineConstants.getManager().createLock(targetEntity, requestId, holdSec, callback, false);
-    }
-
-    @Override
-    public ActorService getActorService() {
-        return LazyInitData.ACTOR_SERVICE;
-    }
-
-    @Override
-    public OperationHistoryDataManager getDataManager() {
-        return LazyInitData.DATA_MANAGER;
-    }
-
-    /* ============================================================ */
-
-    /**
-     * This is a method, invoked from the 'start' method -- it gives subclasses
-     * the ability to add operations. The default implementation does nothing.
-     */
-    protected void startHook() {
-    }
-
-    /**
-     * This is an abstract method that is called after a notable update has
-     * occurred to the 'ControlLoopEventManager2' object. It gives subclasses
-     * the ability to add a callback method to process state changes.
-     */
-    protected abstract void notifyUpdate();
-}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Drools.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Drools.java
deleted file mode 100644 (file)
index 9e8af9a..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============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.eventmanager;
-
-import org.drools.core.WorkingMemory;
-import org.kie.api.runtime.rule.FactHandle;
-import org.onap.policy.controlloop.ControlLoopException;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
-
-/**
- * Manager for a single control loop event. Once this has been created, the event can be
- * retracted from working memory. Once this has been created, {@link #start()} should be
- * invoked, and then {@link #nextStep()} should be invoked continually until
- * {@link #isActive()} returns {@code false}, indicating that all steps have completed.
- */
-public class ControlLoopEventManager2Drools extends ControlLoopEventManager2 {
-    private static final long serialVersionUID = 1L;
-
-    private final transient WorkingMemory workMem;
-    private transient FactHandle factHandle;
-
-    /**
-     * Constructs the object.
-     *
-     * @param params control loop parameters
-     * @param event event to be managed by this object
-     * @param workMem working memory to update if this changes
-     * @throws ControlLoopException if the event is invalid or if a YAML processor cannot
-     *         be created
-     */
-    public ControlLoopEventManager2Drools(ControlLoopParams params, VirtualControlLoopEvent event,
-        WorkingMemory workMem) throws ControlLoopException {
-
-        super(params, event);
-        this.workMem = workMem;
-    }
-
-    /**
-     * This is a hook added to 'ControlLoopEventManager2.start()' --
-     * here, we add an additional check.
-     */
-    @Override
-    protected void startHook() {
-        if ((factHandle = workMem.getFactHandle(this)) == null) {
-            throw new IllegalStateException("manager is not in working memory");
-        }
-    }
-
-    /**
-     * This is a hook added to 'ControlLoopEventManager2.updated(...)' --
-     * here, we mark it as updated in Drools memory.
-     */
-    @Override
-    protected void notifyUpdate() {
-        workMem.update(factHandle, this);
-    }
-}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
deleted file mode 100644 (file)
index ea269fe..0000000
+++ /dev/null
@@ -1,820 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * Modifications Copyright (C) 2019 Tech Mahindra
- * Modifications Copyright (C) 2019 Bell Canada.
- * ================================================================================
- * 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.eventmanager;
-
-import java.io.Serializable;
-import java.time.Instant;
-import java.util.Deque;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CancellationException;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentLinkedDeque;
-import java.util.concurrent.Executor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Collectors;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.ToString;
-import org.onap.policy.aai.AaiConstants;
-import org.onap.policy.aai.AaiCqResponse;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopResponse;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actor.guard.GuardActor;
-import org.onap.policy.controlloop.actor.sdnr.SdnrActor;
-import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
-import org.onap.policy.controlloop.actorserviceprovider.TargetType;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
-import org.onap.policy.controlloop.actorserviceprovider.pipeline.PipelineUtil;
-import org.onap.policy.drools.domain.models.operational.OperationalTarget;
-import org.onap.policy.sdnr.PciMessage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Manages a single Operation for a single event. Once this has been created,
- * {@link #start()} should be invoked, and then {@link #nextStep()} should be invoked
- * continually until it returns {@code false}, indicating that all steps have completed.
- */
-@ToString(onlyExplicitlyIncluded = true)
-public class ControlLoopOperationManager2 implements Serializable {
-    private static final long serialVersionUID = -3773199283624595410L;
-    private static final Logger logger = LoggerFactory.getLogger(ControlLoopOperationManager2.class);
-    private static final String CL_TIMEOUT_ACTOR = "-CL-TIMEOUT-";
-    public static final String LOCK_ACTOR = "LOCK";
-    public static final String LOCK_OPERATION = "Lock";
-    private static final String GUARD_ACTOR = GuardActor.NAME;
-    public static final String VSERVER_VSERVER_NAME = "vserver.vserver-name";
-    public static final String GENERIC_VNF_VNF_NAME = "generic-vnf.vnf-name";
-    public static final String GENERIC_VNF_VNF_ID = "generic-vnf.vnf-id";
-    public static final String PNF_NAME = "pnf.pnf-name";
-
-    // @formatter:off
-    public enum State {
-        ACTIVE,
-        LOCK_DENIED,
-        LOCK_LOST,
-        GUARD_STARTED,
-        GUARD_PERMITTED,
-        GUARD_DENIED,
-        OPERATION_STARTED,
-        OPERATION_SUCCESS,
-        OPERATION_FAILURE,
-        CONTROL_LOOP_TIMEOUT
-    }
-    // @formatter:on
-
-    private final transient ManagerContext operContext;
-    private final transient ControlLoopEventContext eventContext;
-    private final org.onap.policy.drools.domain.models.operational.Operation policy;
-
-    @Getter
-    @ToString.Include
-    private State state = State.ACTIVE;
-
-    @ToString.Include
-    private final String requestId;
-
-    @ToString.Include
-    private final String policyId;
-
-    /**
-     * Bumped each time the "complete" callback is invoked by the Actor, provided it's for
-     * this operation.
-     */
-    @ToString.Include
-    private int attempts = 0;
-
-    private final Deque<Operation> operationHistory = new ConcurrentLinkedDeque<>();
-
-    /**
-     * Set to {@code true} to prevent the last item in {@link #operationHistory} from
-     * being included in the outcome of {@link #getHistory()}. Used when the operation
-     * aborts prematurely due to lock-denied, guard-denied, etc.
-     */
-    private boolean holdLast = false;
-
-    /**
-     * Queue of outcomes yet to be processed. Outcomes are added to this each time the
-     * "start" or "complete" callback is invoked.
-     */
-    @Getter(AccessLevel.PROTECTED)
-    private final transient Deque<OperationOutcome> outcomes = new ConcurrentLinkedDeque<>();
-
-    /**
-     * Used to cancel the running operation.
-     */
-    @Getter(AccessLevel.PROTECTED)
-    private transient CompletableFuture<OperationOutcome> future = null;
-
-    /**
-     * Target entity. Determined after the lock is granted, though it may require the
-     * custom query to be performed first.
-     */
-    @Getter
-    private String targetEntity;
-
-    @Getter(AccessLevel.PROTECTED)
-    private final transient ControlLoopOperationParams params;
-    private final transient PipelineUtil taskUtil;
-
-    @Getter
-    private ControlLoopResponse controlLoopResponse;
-
-    /**
-     * Time when the lock was first requested.
-     */
-    private transient AtomicReference<Instant> lockStart = new AtomicReference<>();
-
-    // values extracted from the policy
-    @Getter
-    private final String actor;
-    @Getter
-    private final String operation;
-
-    private final String targetStr;
-    private final OperationalTarget target;
-
-
-    /**
-     * Construct an instance.
-     *
-     * @param operContext this operation's context
-     * @param context event context
-     * @param operation2 operation's policy
-     * @param executor executor for the Operation
-     */
-    public ControlLoopOperationManager2(ManagerContext operContext, ControlLoopEventContext context,
-                    org.onap.policy.drools.domain.models.operational.Operation operation2, Executor executor) {
-
-        this.operContext = operContext;
-        this.eventContext = context;
-        this.policy = operation2;
-        this.requestId = context.getEvent().getRequestId().toString();
-        this.policyId = "" + operation2.getId();
-        this.actor = operation2.getActorOperation().getActor();
-        this.operation = operation2.getActorOperation().getOperation();
-        this.target = operation2.getActorOperation().getTarget();
-
-        String targetType = (target != null ? target.getTargetType() : null);
-        Map<String, String> entityIds = (target != null ? target.getEntityIds() : null);
-
-        // TODO encode()?
-        this.targetStr = (target != null ? target.toString() : null);
-
-        // @formatter:off
-        params = ControlLoopOperationParams.builder()
-                        .actorService(operContext.getActorService())
-                        .actor(actor)
-                        .operation(operation)
-                        .context(context)
-                        .executor(executor)
-                        .targetType(TargetType.toTargetType(targetType))
-                        .targetEntityIds(entityIds)
-                        .startCallback(this::onStart)
-                        .completeCallback(this::onComplete)
-                        .build();
-        // @formatter:on
-
-        taskUtil = new PipelineUtil(params);
-    }
-
-    //
-    // Internal class used for tracking
-    //
-    @Getter
-    @ToString
-    private class Operation implements Serializable {
-        private static final long serialVersionUID = 1L;
-
-        private int attempt;
-        private OperationResult policyResult;
-        private ControlLoopOperation clOperation;
-        private ControlLoopResponse clResponse;
-
-        /**
-         * Constructs the object.
-         *
-         * @param outcome outcome of the operation
-         */
-        public Operation(OperationOutcome outcome) {
-            attempt = ControlLoopOperationManager2.this.attempts;
-            policyResult = outcome.getResult();
-            clOperation = outcome.toControlLoopOperation();
-            clOperation.setTarget(targetStr);
-            clResponse = makeControlLoopResponse(outcome);
-
-            if (outcome.getEnd() == null) {
-                clOperation.setOutcome("Started");
-            } else if (clOperation.getOutcome() == null) {
-                clOperation.setOutcome("");
-            }
-        }
-    }
-
-    /**
-     * Start the operation, first acquiring any locks that are needed. This should not
-     * throw any exceptions, but will, instead, invoke the callbacks with exceptions.
-     *
-     * @param remainingMs time remaining, in milliseconds, for the control loop
-     */
-    @SuppressWarnings("unchecked")
-    public synchronized void start(long remainingMs) {
-        // this is synchronized while we update "future"
-
-        try {
-            // provide a default, in case something fails before requestLock() is called
-            lockStart.set(Instant.now());
-
-            // @formatter:off
-            future = taskUtil.sequence(
-                this::detmTarget,
-                this::requestLock,
-                this::startOperation);
-            // @formatter:on
-
-            // handle any exceptions that may be thrown, set timeout, and handle timeout
-
-            // @formatter:off
-            future.exceptionally(this::handleException)
-                    .orTimeout(remainingMs, TimeUnit.MILLISECONDS)
-                    .exceptionally(this::handleTimeout);
-            // @formatter:on
-
-        } catch (RuntimeException e) {
-            handleException(e);
-        }
-    }
-
-    /**
-     * Start the operation, after the lock has been acquired.
-     *
-     * @return CompletableFuture for the operation being started
-     */
-    private CompletableFuture<OperationOutcome> startOperation() {
-        // @formatter:off
-        ControlLoopOperationParams params2 = params.toBuilder()
-                    .payload(new LinkedHashMap<>())
-                    .retry(policy.getRetries())
-                    .timeoutSec(policy.getTimeout())
-                    .targetEntity(targetEntity)
-                    .build();
-        // @formatter:on
-
-        if (policy.getActorOperation().getPayload() != null) {
-            params2.getPayload().putAll(policy.getActorOperation().getPayload());
-        }
-
-        return params2.start();
-    }
-
-    /**
-     * Handles exceptions that may be generated.
-     *
-     * @param thrown exception that was generated
-     * @return {@code null}
-     */
-    private OperationOutcome handleException(Throwable thrown) { // NOSONAR
-        /*
-         * disabling sonar about returning the same value because we prefer the code to be
-         * structured this way
-         */
-
-        if (thrown instanceof CancellationException || thrown.getCause() instanceof CancellationException) {
-            return null;
-        }
-
-        logger.warn("{}.{}: exception starting operation for {}", actor, operation, requestId, thrown);
-        OperationOutcome outcome = taskUtil.setOutcome(params.makeOutcome(), thrown);
-        outcome.setStart(lockStart.get());
-        outcome.setEnd(Instant.now());
-        outcome.setFinalOutcome(true);
-        onComplete(outcome);
-
-        // this outcome is not used so just return "null"
-        return null;
-    }
-
-    /**
-     * Handles control loop timeout exception.
-     *
-     * @param thrown exception that was generated
-     * @return {@code null}
-     */
-    private OperationOutcome handleTimeout(Throwable thrown) {
-        logger.warn("{}.{}: control loop timeout for {}", actor, operation, requestId, thrown);
-
-        OperationOutcome outcome = taskUtil.setOutcome(params.makeOutcome(), thrown);
-        outcome.setActor(CL_TIMEOUT_ACTOR);
-        outcome.setOperation(null);
-        outcome.setStart(lockStart.get());
-        outcome.setEnd(Instant.now());
-        outcome.setFinalOutcome(true);
-        onComplete(outcome);
-
-        // cancel the operation, if it's still running
-        future.cancel(false);
-
-        // this outcome is not used so just return "null"
-        return null;
-    }
-
-    /**
-     * Cancels the operation.
-     */
-    public void cancel() {
-        synchronized (this) {
-            if (future == null) {
-                return;
-            }
-        }
-
-        future.cancel(false);
-    }
-
-    /**
-     * Requests a lock on the {@link #targetEntity}.
-     *
-     * @return a future to await the lock
-     */
-    private CompletableFuture<OperationOutcome> requestLock() {
-        /*
-         * Failures are handled via the callback, and successes are discarded by
-         * sequence(), without passing them to onComplete().
-         *
-         * Return a COPY of the future so that if we try to cancel it, we'll only cancel
-         * the copy, not the original. This is done by tacking thenApply() onto the end.
-         */
-        lockStart.set(Instant.now());
-        return operContext.requestLock(targetEntity, this::lockUnavailable).thenApply(outcome -> outcome);
-    }
-
-    /**
-     * Indicates that the lock on the target entity is unavailable.
-     *
-     * @param outcome lock outcome
-     */
-    private void lockUnavailable(OperationOutcome outcome) {
-
-        // Note: NEVER invoke onStart() for locks; only invoke onComplete()
-        onComplete(outcome);
-
-        /*
-         * Now that we've added the lock outcome to the queue, ensure the future is
-         * canceled, which may, itself, generate an operation outcome.
-         */
-        cancel();
-    }
-
-    /**
-     * Handles responses provided via the "start" callback. Note: this is never be invoked
-     * for locks; only {@link #onComplete(OperationOutcome)} is invoked for locks.
-     *
-     * @param outcome outcome provided to the callback
-     */
-    private void onStart(OperationOutcome outcome) {
-        if (outcome.isFor(actor, operation) || GUARD_ACTOR.equals(outcome.getActor())) {
-            addOutcome(outcome);
-        }
-    }
-
-    /**
-     * Handles responses provided via the "complete" callback. Note: this is never invoked
-     * for "successful" locks.
-     *
-     * @param outcome outcome provided to the callback
-     */
-    private void onComplete(OperationOutcome outcome) {
-
-        switch (outcome.getActor()) {
-            case LOCK_ACTOR:
-            case GUARD_ACTOR:
-            case CL_TIMEOUT_ACTOR:
-                addOutcome(outcome);
-                break;
-
-            default:
-                if (outcome.isFor(actor, operation)) {
-                    addOutcome(outcome);
-                }
-                break;
-        }
-    }
-
-    /**
-     * Adds an outcome to {@link #outcomes}.
-     *
-     * @param outcome outcome to be added
-     */
-    private synchronized void addOutcome(OperationOutcome outcome) {
-        /*
-         * This is synchronized to prevent nextStep() from invoking processOutcome() at
-         * the same time.
-         */
-
-        logger.debug("added outcome={} for {}", outcome, requestId);
-        outcomes.add(outcome);
-
-        if (outcomes.peekFirst() == outcomes.peekLast()) {
-            // this is the first outcome in the queue - process it
-            processOutcome();
-        }
-    }
-
-    /**
-     * Looks for the next step in the queue.
-     *
-     * @return {@code true} if more responses are expected, {@code false} otherwise
-     */
-    public synchronized boolean nextStep() {
-        switch (state) {
-            case LOCK_DENIED:
-            case LOCK_LOST:
-            case GUARD_DENIED:
-            case CONTROL_LOOP_TIMEOUT:
-                holdLast = false;
-                return false;
-            default:
-                break;
-        }
-
-        OperationOutcome outcome = outcomes.peek();
-        if (outcome == null) {
-            // empty queue
-            return true;
-        }
-
-        if (outcome.isFinalOutcome() && outcome.isFor(actor, operation)) {
-            controlLoopResponse = null;
-            return false;
-        }
-
-        // first item has been processed, remove it
-        outcomes.remove();
-        if (!outcomes.isEmpty()) {
-            // have a new "first" item - process it
-            processOutcome();
-        }
-
-        return true;
-    }
-
-    /**
-     * Processes the first item in {@link #outcomes}. Sets the state, increments
-     * {@link #attempts}, if appropriate, and stores the operation history in the DB.
-     */
-    private synchronized void processOutcome() {
-        OperationOutcome outcome = outcomes.peek();
-        logger.debug("process outcome={} for {}", outcome, requestId);
-
-        controlLoopResponse = null;
-
-        switch (outcome.getActor()) {
-
-            case CL_TIMEOUT_ACTOR:
-                state = State.CONTROL_LOOP_TIMEOUT;
-                processAbort(outcome, OperationResult.FAILURE, "Control loop timed out");
-                break;
-
-            case LOCK_ACTOR:
-                // lock is no longer available
-                if (state == State.ACTIVE) {
-                    state = State.LOCK_DENIED;
-                    storeFailureInDataBase(outcome, OperationResult.FAILURE_GUARD, "Operation denied by Lock");
-                } else {
-                    state = State.LOCK_LOST;
-                    processAbort(outcome, OperationResult.FAILURE, "Operation aborted by Lock");
-                }
-                break;
-
-            case GUARD_ACTOR:
-                if (outcome.getEnd() == null) {
-                    state = State.GUARD_STARTED;
-                } else if (outcome.getResult() == OperationResult.SUCCESS) {
-                    state = State.GUARD_PERMITTED;
-                } else {
-                    state = State.GUARD_DENIED;
-                    storeFailureInDataBase(outcome, OperationResult.FAILURE_GUARD, "Operation denied by Guard");
-                }
-                break;
-
-            default:
-                if (outcome.getEnd() == null) {
-                    // operation started
-                    ++attempts;
-                    state = State.OPERATION_STARTED;
-
-                } else {
-                    /*
-                     * Operation completed. If the last entry was a "start" (i.e., "end" field
-                     * is null), then replace it. Otherwise, just add the completion.
-                     */
-                    state = (outcome.getResult() == OperationResult.SUCCESS ? State.OPERATION_SUCCESS
-                                    : State.OPERATION_FAILURE);
-                    controlLoopResponse = makeControlLoopResponse(outcome);
-                    if (!operationHistory.isEmpty() && operationHistory.peekLast().getClOperation().getEnd() == null) {
-                        operationHistory.removeLast();
-                    }
-                }
-
-                operationHistory.add(new Operation(outcome));
-                storeOperationInDataBase();
-                break;
-        }
-
-        // indicate that this has changed
-        operContext.updated(this);
-    }
-
-    /**
-     * Processes an operation abort, updating the DB record, if an operation has been
-     * started.
-     *
-     * @param outcome operation outcome
-     * @param result result to put into the DB
-     * @param message message to put into the DB
-     */
-    private void processAbort(OperationOutcome outcome, OperationResult result, String message) {
-        if (operationHistory.isEmpty() || operationHistory.peekLast().getClOperation().getEnd() != null) {
-            // last item was not a "start" operation
-
-            // NOTE: do NOT generate control loop response since operation was not started
-
-            storeFailureInDataBase(outcome, result, message);
-            return;
-        }
-
-        // last item was a "start" operation - replace it with a failure
-        final Operation operOrig = operationHistory.removeLast();
-
-        // use start time from the operation, itself
-        if (operOrig != null && operOrig.getClOperation() != null) {
-            outcome.setStart(operOrig.getClOperation().getStart());
-        }
-
-        controlLoopResponse = makeControlLoopResponse(outcome);
-
-        storeFailureInDataBase(outcome, result, message);
-    }
-
-    /**
-     * Makes a control loop response.
-     *
-     * @param outcome operation outcome
-     * @return a new control loop response, or {@code null} if none is required
-     */
-    protected ControlLoopResponse makeControlLoopResponse(OperationOutcome outcome) {
-
-        // only generate response for certain actors.
-        if (outcome == null || !actor.equals(SdnrActor.NAME)) {
-            return null;
-        }
-
-        VirtualControlLoopEvent event = eventContext.getEvent();
-
-        ControlLoopResponse clRsp = new ControlLoopResponse();
-        clRsp.setFrom(actor);
-        clRsp.setTarget("DCAE");
-        clRsp.setClosedLoopControlName(event.getClosedLoopControlName());
-        clRsp.setPolicyName(event.getPolicyName());
-        clRsp.setPolicyVersion(event.getPolicyVersion());
-        clRsp.setRequestId(event.getRequestId());
-        clRsp.setVersion(event.getVersion());
-
-        PciMessage msg = outcome.getResponse();
-        if (msg != null && msg.getBody() != null && msg.getBody().getOutput() != null) {
-            clRsp.setPayload(msg.getBody().getOutput().getPayload());
-        }
-
-        return clRsp;
-    }
-
-    /**
-     * Get the operation, as a message.
-     *
-     * @return the operation, as a message
-     */
-    public String getOperationMessage() {
-        Operation last = operationHistory.peekLast();
-        return (last == null ? null : last.getClOperation().toMessage());
-    }
-
-    /**
-     * Gets the operation result.
-     *
-     * @return the operation result
-     */
-    public OperationResult getOperationResult() {
-        Operation last = operationHistory.peekLast();
-        return (last == null ? OperationResult.FAILURE_EXCEPTION : last.getPolicyResult());
-    }
-
-    /**
-     * Get the latest operation history.
-     *
-     * @return the latest operation history
-     */
-    public String getOperationHistory() {
-        Operation last = operationHistory.peekLast();
-        return (last == null ? null : last.clOperation.toHistory());
-    }
-
-    /**
-     * Get the history.
-     *
-     * @return the list of control loop operations
-     */
-    public List<ControlLoopOperation> getHistory() {
-        Operation last = (holdLast ? operationHistory.removeLast() : null);
-
-        List<ControlLoopOperation> result = operationHistory.stream().map(Operation::getClOperation)
-                        .map(ControlLoopOperation::new).collect(Collectors.toList());
-
-        if (last != null) {
-            operationHistory.add(last);
-        }
-
-        return result;
-    }
-
-    /**
-     * Stores a failure in the DB.
-     *
-     * @param outcome operation outcome
-     * @param result result to put into the DB
-     * @param message message to put into the DB
-     */
-    private void storeFailureInDataBase(OperationOutcome outcome, OperationResult result, String message) {
-        // don't include this in history yet
-        holdLast = true;
-
-        outcome.setActor(actor);
-        outcome.setOperation(operation);
-        outcome.setMessage(message);
-        outcome.setResult(result);
-
-        operationHistory.add(new Operation(outcome));
-        storeOperationInDataBase();
-    }
-
-    /**
-     * Stores the latest operation in the DB.
-     */
-    private void storeOperationInDataBase() {
-        operContext.getDataManager().store(requestId, eventContext.getEvent(), targetEntity,
-                        operationHistory.peekLast().getClOperation());
-    }
-
-    /**
-     * Determines the target entity.
-     *
-     * @return a future to determine the target entity, or {@code null} if the entity has
-     *         already been determined
-     */
-    protected CompletableFuture<OperationOutcome> detmTarget() {
-        if (target == null) {
-            throw new IllegalArgumentException("The target is null");
-        }
-
-        if (target.getTargetType() == null) {
-            throw new IllegalArgumentException("The target type is null");
-        }
-
-        switch (TargetType.toTargetType(target.getTargetType())) {
-            case PNF:
-                return detmPnfTarget();
-            case VM:
-            case VNF:
-            case VFMODULE:
-                return detmVfModuleTarget();
-            default:
-                throw new IllegalArgumentException("The target type is not supported");
-        }
-    }
-
-    /**
-     * Determines the PNF target entity.
-     *
-     * @return a future to determine the target entity, or {@code null} if the entity has
-     *         already been determined
-     */
-    private CompletableFuture<OperationOutcome> detmPnfTarget() {
-        if (!PNF_NAME.equalsIgnoreCase(eventContext.getEvent().getTarget())) {
-            throw new IllegalArgumentException("Target does not match target type");
-        }
-
-        targetEntity = eventContext.getEnrichment().get(PNF_NAME);
-        if (targetEntity == null) {
-            throw new IllegalArgumentException("AAI section is missing " + PNF_NAME);
-        }
-
-        return null;
-    }
-
-    /**
-     * Determines the VF Module target entity.
-     *
-     * @return a future to determine the target entity, or {@code null} if the entity has
-     *         already been determined
-     */
-    private CompletableFuture<OperationOutcome> detmVfModuleTarget() {
-        String targetFieldName = eventContext.getEvent().getTarget();
-        if (targetFieldName == null) {
-            throw new IllegalArgumentException("Target is null");
-        }
-
-        switch (targetFieldName.toLowerCase()) {
-            case VSERVER_VSERVER_NAME:
-                targetEntity = eventContext.getEnrichment().get(VSERVER_VSERVER_NAME);
-                break;
-            case GENERIC_VNF_VNF_ID:
-                targetEntity = eventContext.getEnrichment().get(GENERIC_VNF_VNF_ID);
-                break;
-            case GENERIC_VNF_VNF_NAME:
-                return detmVnfName();
-            default:
-                throw new IllegalArgumentException("Target does not match target type");
-        }
-
-        if (targetEntity == null) {
-            throw new IllegalArgumentException("Enrichment data is missing " + targetFieldName);
-        }
-
-        return null;
-    }
-
-    /**
-     * Determines the VNF Name target entity.
-     *
-     * @return a future to determine the target entity, or {@code null} if the entity has
-     *         already been determined
-     */
-    @SuppressWarnings("unchecked")
-    private CompletableFuture<OperationOutcome> detmVnfName() {
-        // if the onset is enriched with the vnf-id, we don't need an A&AI response
-        targetEntity = eventContext.getEnrichment().get(GENERIC_VNF_VNF_ID);
-        if (targetEntity != null) {
-            return null;
-        }
-
-        // vnf-id was not in the onset - obtain it via the custom query
-
-        // @formatter:off
-        ControlLoopOperationParams cqparams = params.toBuilder()
-                        .actor(AaiConstants.ACTOR_NAME)
-                        .operation(AaiCqResponse.OPERATION)
-                        .targetEntity("")
-                        .build();
-        // @formatter:on
-
-        // perform custom query and then extract the VNF ID from it
-        return taskUtil.sequence(() -> eventContext.obtain(AaiCqResponse.CONTEXT_KEY, cqparams),
-                        this::extractVnfFromCq);
-    }
-
-    /**
-     * Extracts the VNF Name target entity from the custom query data.
-     *
-     * @return {@code null}
-     */
-    private CompletableFuture<OperationOutcome> extractVnfFromCq() {
-        // already have the CQ data
-        AaiCqResponse cq = eventContext.getProperty(AaiCqResponse.CONTEXT_KEY);
-        if (cq.getDefaultGenericVnf() == null) {
-            throw new IllegalArgumentException("No vnf-id found");
-        }
-
-        targetEntity = cq.getDefaultGenericVnf().getVnfId();
-        if (targetEntity == null) {
-            throw new IllegalArgumentException("No vnf-id found");
-        }
-
-        return null;
-    }
-}
index 119d146..67eddba 100644 (file)
@@ -169,8 +169,8 @@ public class LockData implements LockCallback {
      */
     private OperationOutcome makeOutcome() {
         OperationOutcome outcome = new OperationOutcome();
-        outcome.setActor(ControlLoopOperationManager2.LOCK_ACTOR);
-        outcome.setOperation(ControlLoopOperationManager2.LOCK_OPERATION);
+        outcome.setActor(ActorConstants.LOCK_ACTOR);
+        outcome.setOperation(ActorConstants.LOCK_OPERATION);
         outcome.setTarget(targetEntity);
         outcome.setFinalOutcome(true);
         outcome.setStart(createTime);
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ManagerContext.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ManagerContext.java
deleted file mode 100644 (file)
index 0dcd302..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============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.eventmanager;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.function.Consumer;
-import org.onap.policy.controlloop.actorserviceprovider.ActorService;
-import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-import org.onap.policy.controlloop.ophistory.OperationHistoryDataManager;
-
-/**
- * Context for the Operation Manager.
- */
-public interface ManagerContext {
-
-    /**
-     * Gets the actor service.
-     *
-     * @return the actor service
-     */
-    ActorService getActorService();
-
-    /**
-     * Gets the operation history data manager.
-     *
-     * @return the operation history data manager
-     */
-    OperationHistoryDataManager getDataManager();
-
-    /**
-     * Requests a lock on the specified target.
-     *
-     * @param target target to be locked
-     * @param lockUnavailableCallback callback to be invoked if the lock is
-     *        unavailable/lost
-     * @return a future to await the lock
-     */
-    CompletableFuture<OperationOutcome> requestLock(String target, Consumer<OperationOutcome> lockUnavailableCallback);
-
-    /**
-     * Indicates that the given operation manager has been updated.
-     *
-     * @param operationMgr operation manager that has been updated
-     */
-    void updated(ControlLoopOperationManager2 operationMgr);
-}
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java
deleted file mode 100644 (file)
index d3c217c..0000000
+++ /dev/null
@@ -1,848 +0,0 @@
-/*-
- * ============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.eventmanager;
-
-import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyLong;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.UUID;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutorService;
-import java.util.function.Consumer;
-import org.drools.core.WorkingMemory;
-import org.junit.Before;
-import org.junit.Test;
-import org.kie.api.runtime.rule.FactHandle;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardYamlCoder;
-import org.onap.policy.common.utils.io.Serializer;
-import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.controlloop.ControlLoopEventStatus;
-import org.onap.policy.controlloop.ControlLoopException;
-import org.onap.policy.controlloop.ControlLoopNotificationType;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopTargetType;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.VirtualControlLoopNotification;
-import org.onap.policy.controlloop.actorserviceprovider.ActorService;
-import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
-import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
-import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2.NewEventStatus;
-import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager2.State;
-import org.onap.policy.controlloop.ophistory.OperationHistoryDataManager;
-import org.onap.policy.drools.core.lock.LockCallback;
-import org.onap.policy.drools.core.lock.LockImpl;
-import org.onap.policy.drools.core.lock.LockState;
-import org.onap.policy.drools.domain.models.operational.Operation;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-
-public class ControlLoopEventManager2Test {
-    private static final UUID REQ_ID = UUID.randomUUID();
-    private static final String CL_NAME = "my-closed-loop-name";
-    private static final String POLICY_NAME = "my-policy-name";
-    private static final String POLICY_SCOPE = "my-scope";
-    private static final String POLICY_VERSION = "1.2.3";
-    private static final String MY_TARGET = "my-target";
-    private static final String LOCK1 = "my-lock-A";
-    private static final String LOCK2 = "my-lock-B";
-    private static final Coder yamlCoder = new StandardYamlCoder();
-
-    @Mock
-    private WorkingMemory workMem;
-    @Mock
-    private Consumer<OperationOutcome> callback1;
-    @Mock
-    private Consumer<OperationOutcome> callback2;
-    @Mock
-    private Consumer<OperationOutcome> callback3;
-    @Mock
-    private FactHandle factHandle;
-    @Mock
-    private ActorService actors;
-    @Mock
-    private OperationHistoryDataManager dataMgr;
-    @Mock
-    private ControlLoopOperationManager2 oper1;
-    @Mock
-    private ControlLoopOperationManager2 oper2;
-    @Mock
-    private ControlLoopOperationManager2 oper3;
-    @Mock
-    private ExecutorService executor;
-
-    private long preCreateTimeMs;
-    private List<LockImpl> locks;
-    private ToscaPolicy tosca;
-    private ControlLoopParams params;
-    private VirtualControlLoopEvent event;
-    private int updateCount;
-    private ControlLoopEventManager2Drools mgr;
-
-    /**
-     * Sets up.
-     */
-    @Before
-    public void setUp() throws ControlLoopException, CoderException {
-        MockitoAnnotations.initMocks(this);
-
-        when(oper1.getHistory()).thenReturn(makeHistory("A"));
-        when(oper2.getHistory()).thenReturn(makeHistory("B"));
-        when(oper3.getHistory()).thenReturn(makeHistory("C"));
-
-        when(oper1.getActor()).thenReturn("First");
-        when(oper1.getOperation()).thenReturn("OperationA");
-        when(oper1.getOperationMessage()).thenReturn("message-A");
-        when(oper1.getOperationHistory()).thenReturn("history-A");
-
-        when(oper2.getActor()).thenReturn("Second");
-        when(oper2.getOperation()).thenReturn("OperationB");
-        when(oper2.getOperationMessage()).thenReturn("message-B");
-        when(oper2.getOperationHistory()).thenReturn("history-B");
-
-        when(oper3.getActor()).thenReturn("Third");
-        when(oper3.getOperation()).thenReturn("OperationC");
-        when(oper3.getOperationMessage()).thenReturn("message-C");
-        when(oper3.getOperationHistory()).thenReturn("history-C");
-
-        when(workMem.getFactHandle(any())).thenReturn(factHandle);
-
-        event = new VirtualControlLoopEvent();
-        event.setRequestId(REQ_ID);
-        event.setTarget(ControlLoopOperationManager2.VSERVER_VSERVER_NAME);
-        event.setAai(new TreeMap<>(Map.of(ControlLoopOperationManager2.VSERVER_VSERVER_NAME, MY_TARGET)));
-        event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
-        event.setClosedLoopControlName(CL_NAME);
-        event.setTargetType(ControlLoopTargetType.VNF);
-
-        params = new ControlLoopParams();
-        params.setClosedLoopControlName(CL_NAME);
-        params.setPolicyName(POLICY_NAME);
-        params.setPolicyScope(POLICY_SCOPE);
-        params.setPolicyVersion(POLICY_VERSION);
-
-        loadPolicy("eventManager/event-mgr-simple.yaml");
-
-        locks = new ArrayList<>();
-
-        updateCount = 0;
-
-        preCreateTimeMs = System.currentTimeMillis();
-
-        mgr = new MyManagerWithOper(params, event, workMem);
-    }
-
-    @Test
-    public void testConstructor() {
-        assertEquals(POLICY_NAME, mgr.getPolicyName());
-
-        Map<String, String> orig = event.getAai();
-
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "true"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                        .hasMessage("is-closed-loop-disabled is set to true on VServer or VNF");
-
-        // vserver ACTIVE
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS,
-                        ControlLoopEventManager2.PROV_STATUS_ACTIVE.toUpperCase()));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
-
-        // vserver active
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS,
-                        ControlLoopEventManager2.PROV_STATUS_ACTIVE.toLowerCase()));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
-
-        // vserver inactive
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "inactive"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                        .hasMessage("prov-status is not ACTIVE on VServer or VNF");
-
-        // vnf ACTIVE
-        event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS,
-                        ControlLoopEventManager2.PROV_STATUS_ACTIVE.toUpperCase()));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
-
-        // vnf active
-        event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS,
-                        ControlLoopEventManager2.PROV_STATUS_ACTIVE.toLowerCase()));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
-
-        // vnf inactive
-        event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "inactive"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                        .hasMessage("prov-status is not ACTIVE on VServer or VNF");
-
-        // valid
-        event.setAai(orig);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        // invalid
-        event.setTarget("unknown-target");
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                        .isInstanceOf(ControlLoopException.class);
-    }
-
-    /**
-     * Runs through a policy that has several operations.
-     */
-    @Test
-    public void testMultiOperation() throws Exception {
-
-        loadPolicy("eventManager/event-mgr-multi.yaml");
-
-        mgr = new MyManagerWithOper(params, event, workMem);
-        mgr.start();
-
-        for (ControlLoopOperationManager2 oper : Arrays.asList(oper1, oper2, oper3)) {
-            assertTrue(mgr.isActive());
-            nextStep(oper, true, OperationResult.SUCCESS);
-            runRule();
-
-            assertTrue(mgr.isActive());
-            nextStep(oper, false, OperationResult.SUCCESS);
-            runRule();
-        }
-
-        assertFalse(mgr.isActive());
-    }
-
-    @Test
-    public void testStart() throws Exception {
-        // start it
-        mgr.start();
-
-        // cannot re-start
-        assertThatCode(() -> mgr.start()).isInstanceOf(IllegalStateException.class)
-                        .hasMessage("manager already started");
-    }
-
-    /**
-     * Tests start() error cases.
-     */
-    @Test
-    public void testStartErrors() throws Exception {
-        // wrong jvm
-        ControlLoopEventManager2Drools mgr2 = new ControlLoopEventManager2Drools(params, event, workMem);
-        ControlLoopEventManager2Drools mgr3 = Serializer.roundTrip(mgr2);
-        assertThatCode(() -> mgr3.start()).isInstanceOf(IllegalStateException.class)
-                        .hasMessage("manager is no longer active");
-
-        // no fact handle
-        when(workMem.getFactHandle(any())).thenReturn(null);
-        assertThatCode(() -> mgr.start()).isInstanceOf(IllegalStateException.class)
-                        .hasMessage("manager is not in working memory");
-    }
-
-    @Test
-    public void testNextStep_testStartOperationSuccess() throws ControlLoopException {
-        runOperation(OperationResult.SUCCESS);
-
-        VirtualControlLoopNotification notif = mgr.getNotification();
-        assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, notif.getNotification());
-        assertNull(notif.getMessage());
-
-        assertThatCode(() -> mgr.nextStep()).doesNotThrowAnyException();
-    }
-
-    /**
-     * Tests nextStep() when the next step is invalid, which should cause an exception to
-     * be thrown by the processor.
-     */
-    @Test
-    public void testNextStepMissing() throws Exception {
-        mgr.start();
-
-        when(oper1.nextStep()).thenThrow(new IllegalArgumentException("expected exception"));
-
-        mgr.nextStep();
-
-        assertFalse(mgr.isActive());
-
-        VirtualControlLoopNotification notif = mgr.getNotification();
-        assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notif.getNotification());
-        assertEquals("Policy processing aborted due to policy error", notif.getMessage());
-        assertTrue(notif.getHistory().isEmpty());
-    }
-
-    /**
-     * Tests startOperation() with FINAL_FAILURE_EXCEPTION.
-     */
-    @Test
-    public void testStartOperationException() throws ControlLoopException {
-        runOperation(OperationResult.FAILURE_EXCEPTION);
-
-        VirtualControlLoopNotification notif = mgr.getNotification();
-        assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notif.getNotification());
-        assertEquals("Exception in processing closed loop", notif.getMessage());
-    }
-
-    /**
-     * Tests startOperation() with FINAL_FAILURE.
-     */
-    @Test
-    public void testStartOperationFailure() throws ControlLoopException {
-        runOperation(OperationResult.FAILURE);
-
-        VirtualControlLoopNotification notif = mgr.getNotification();
-        assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notif.getNotification());
-        assertNull(notif.getMessage());
-    }
-
-    /**
-     * Tests startOperation() with FINAL_OPENLOOP.
-     */
-    @Test
-    public void testStartOperationOpenLoop() throws ControlLoopException {
-        runOperation(OperationResult.FAILURE_GUARD);
-
-        VirtualControlLoopNotification notif = mgr.getNotification();
-        assertEquals(ControlLoopNotificationType.FINAL_OPENLOOP, notif.getNotification());
-        assertNull(notif.getMessage());
-    }
-
-    @Test
-    public void testIsActive() throws Exception {
-        mgr = new ControlLoopEventManager2Drools(params, event, workMem);
-        assertTrue(mgr.isActive());
-
-        ControlLoopEventManager2Drools mgr2 = Serializer.roundTrip(mgr);
-        assertFalse(mgr2.isActive());
-    }
-
-    @Test
-    public void testUpdated() throws ControlLoopException {
-        mgr.start();
-
-        // not the active operation - should be ignored
-        mgr.updated(oper3);
-        verify(workMem, never()).update(any(), any());
-
-        VirtualControlLoopNotification notif;
-
-        // check notification data
-        when(oper1.getState()).thenReturn(State.LOCK_DENIED);
-        mgr.updated(oper1);
-        notif = mgr.getNotification();
-        assertNotNull(notif.getHistory());
-
-        /*
-         * try the various cases
-         */
-        when(oper1.getState()).thenReturn(State.LOCK_DENIED);
-        mgr.updated(oper1);
-        verifyNotification(ControlLoopNotificationType.REJECTED, "The target my-target is already locked");
-
-        when(oper1.getState()).thenReturn(State.LOCK_LOST);
-        mgr.updated(oper1);
-        verifyNotification(ControlLoopNotificationType.OPERATION_FAILURE, "The target my-target is no longer locked");
-
-        when(oper1.getState()).thenReturn(State.GUARD_STARTED);
-        mgr.updated(oper1);
-        verifyNotification(ControlLoopNotificationType.OPERATION, "Sending guard query for First OperationA");
-
-        when(oper1.getState()).thenReturn(State.GUARD_PERMITTED);
-        mgr.updated(oper1);
-        verifyNotification(ControlLoopNotificationType.OPERATION, "Guard result for First OperationA is Permit");
-
-        when(oper1.getState()).thenReturn(State.GUARD_DENIED);
-        mgr.updated(oper1);
-        verifyNotification(ControlLoopNotificationType.OPERATION, "Guard result for First OperationA is Deny");
-
-        when(oper1.getState()).thenReturn(State.OPERATION_STARTED);
-        mgr.updated(oper1);
-        verifyNotification(ControlLoopNotificationType.OPERATION, "message-A");
-
-        when(oper1.getState()).thenReturn(State.OPERATION_SUCCESS);
-        mgr.updated(oper1);
-        verifyNotification(ControlLoopNotificationType.OPERATION_SUCCESS, "history-A");
-
-        when(oper1.getState()).thenReturn(State.OPERATION_FAILURE);
-        mgr.updated(oper1);
-        verifyNotification(ControlLoopNotificationType.OPERATION_FAILURE, "history-A");
-
-        // should still be active
-        assertTrue(mgr.isActive());
-
-        /*
-         * control loop time
-         */
-        when(oper1.getState()).thenReturn(State.CONTROL_LOOP_TIMEOUT);
-        mgr.updated(oper1);
-        verifyNotification(ControlLoopNotificationType.FINAL_FAILURE, "Control Loop timed out");
-
-        // should now be done
-        assertFalse(mgr.isActive());
-    }
-
-    @Test
-    public void testDestroy() {
-        mgr.requestLock(LOCK1, callback1);
-        mgr.requestLock(LOCK2, callback2);
-        mgr.requestLock(LOCK1, callback3);
-
-        mgr.destroy();
-
-        freeLocks();
-
-        for (LockImpl lock : locks) {
-            assertTrue(lock.isUnavailable());
-        }
-    }
-
-    /**
-     * Tests destroy() once it has been started.
-     */
-    @Test
-    public void testDestroyStarted() throws ControlLoopException {
-        mgr.start();
-
-        mgr.requestLock(LOCK1, callback1);
-        mgr.requestLock(LOCK2, callback2);
-        mgr.requestLock(LOCK1, callback3);
-
-        mgr.destroy();
-
-        freeLocks();
-
-        // should have canceled the operation
-        verify(oper1).cancel();
-
-        for (LockImpl lock : locks) {
-            assertTrue(lock.isUnavailable());
-        }
-    }
-
-    @Test
-    public void testMakeNotification() throws ControlLoopException {
-        // before started
-        assertNotNull(mgr.makeNotification());
-
-        mgr.start();
-
-        nextStep(oper1, true, OperationResult.SUCCESS);
-        runRule();
-
-        // check notification while running
-        VirtualControlLoopNotification notif = mgr.getNotification();
-        assertEquals("history-A", notif.getMessage());
-
-        List<ControlLoopOperation> history = notif.getHistory();
-        assertNotNull(history);
-
-        nextStep(oper1, false, OperationResult.SUCCESS);
-        runRule();
-
-        assertFalse(mgr.isActive());
-
-        // check notification when complete
-        notif = mgr.getNotification();
-        assertNull(notif.getMessage());
-        assertEquals(history, notif.getHistory());
-    }
-
-    @Test
-    public void testOnNewEvent() {
-        VirtualControlLoopEvent event2 = new VirtualControlLoopEvent(event);
-        assertEquals(NewEventStatus.FIRST_ONSET, mgr.onNewEvent(event2));
-
-        event2.setPayload("other payload");
-        assertEquals(NewEventStatus.SUBSEQUENT_ONSET, mgr.onNewEvent(event2));
-        assertEquals(NewEventStatus.SUBSEQUENT_ONSET, mgr.onNewEvent(event2));
-        assertEquals(NewEventStatus.FIRST_ONSET, mgr.onNewEvent(event));
-
-        event2.setClosedLoopEventStatus(ControlLoopEventStatus.ABATED);
-        assertEquals(NewEventStatus.FIRST_ABATEMENT, mgr.onNewEvent(event2));
-
-        assertEquals(NewEventStatus.SUBSEQUENT_ABATEMENT, mgr.onNewEvent(event2));
-        assertEquals(NewEventStatus.SUBSEQUENT_ABATEMENT, mgr.onNewEvent(event2));
-
-        event2.setClosedLoopEventStatus(null);
-        assertEquals(NewEventStatus.SYNTAX_ERROR, mgr.onNewEvent(event2));
-    }
-
-    @Test
-    public void testDetmControlLoopTimeoutMs() throws Exception {
-        verifyTimeout(1200 * 1000L);
-    }
-
-    private void verifyTimeout(long timeMs) {
-        long end = mgr.getEndTimeMs();
-        assertTrue(end >= preCreateTimeMs + timeMs);
-        assertTrue(end < preCreateTimeMs + timeMs + 5000);
-    }
-
-    @Test
-    public void testCheckEventSyntax() {
-        // initially, it's valid
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setTarget("unknown-target");
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class)
-                        .hasMessage("target field invalid");
-
-        event.setTarget(null);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class)
-                        .hasMessage("No target field");
-
-        // abated supersedes previous errors - so it shouldn't throw an exception
-        event.setClosedLoopEventStatus(ControlLoopEventStatus.ABATED);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setRequestId(null);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class)
-                        .hasMessage("No request ID");
-
-        event.setClosedLoopControlName(null);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class)
-                        .hasMessage("No control loop name");
-    }
-
-    @Test
-    public void testValidateStatus() {
-        event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setClosedLoopEventStatus(ControlLoopEventStatus.ABATED);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setClosedLoopEventStatus(null);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class)
-                        .hasMessage("Invalid value in closedLoopEventStatus");
-    }
-
-    @Test
-    public void testValidateAaiData() {
-        event.setTargetType("unknown-target-type");
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class)
-                        .hasMessage("The target type is not supported");
-
-        event.setTargetType(null);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class)
-                        .hasMessage("The Target type is null");
-
-        event.setAai(null);
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class)
-                        .hasMessage("AAI is null");
-
-        // VM case
-        event.setTargetType(ControlLoopTargetType.VM);
-        event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setAai(Map.of());
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class);
-
-        // VNF case
-        event.setTargetType(ControlLoopTargetType.VNF);
-        event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setAai(Map.of());
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class);
-
-        // PNF case
-        event.setTargetType(ControlLoopTargetType.PNF);
-        event.setAai(Map.of(ControlLoopEventManager2.PNF_NAME, MY_TARGET));
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setAai(Map.of());
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class);
-    }
-
-    @Test
-    public void testValidateAaiVmVnfData() {
-        event.setTargetType(ControlLoopTargetType.VM);
-        event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setAai(Map.of(ControlLoopEventManager2.VSERVER_VSERVER_NAME, MY_TARGET));
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_NAME, MY_TARGET));
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setAai(Map.of());
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class).hasMessage(
-                        "generic-vnf.vnf-id or generic-vnf.vnf-name or vserver.vserver-name information missing");
-    }
-
-    @Test
-    public void testValidateAaiPnfData() {
-        event.setTargetType(ControlLoopTargetType.PNF);
-        event.setAai(Map.of(ControlLoopEventManager2.PNF_NAME, MY_TARGET));
-        assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
-
-        event.setAai(Map.of());
-        assertThatCode(() -> mgr.checkEventSyntax(event)).isInstanceOf(ControlLoopException.class)
-                        .hasMessage("AAI PNF object key pnf-name is missing");
-    }
-
-    @Test
-    public void testIsClosedLoopDisabled() {
-        Map<String, String> orig = event.getAai();
-
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "true"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                        .isInstanceOf(IllegalStateException.class);
-
-        event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_IS_CLOSED_LOOP_DISABLED, "true"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                        .isInstanceOf(IllegalStateException.class);
-
-        event.setAai(addAai(orig, ControlLoopEventManager2.PNF_IS_IN_MAINT, "true"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                        .isInstanceOf(IllegalStateException.class);
-    }
-
-    private Map<String, String> addAai(Map<String, String> original, String key, String value) {
-        Map<String, String> map = new TreeMap<>(original);
-        map.put(key, value);
-        return map;
-    }
-
-    @Test
-    public void testIsProvStatusInactive() {
-        Map<String, String> orig = event.getAai();
-
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "ACTIVE"));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
-
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "inactive"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                        .isInstanceOf(IllegalStateException.class);
-
-        event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "ACTIVE"));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
-        event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "inactive"));
-        assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                        .isInstanceOf(IllegalStateException.class);
-    }
-
-    @Test
-    public void testIsAaiTrue() {
-        Map<String, String> orig = event.getAai();
-
-        for (String value : Arrays.asList("yes", "y", "true", "t", "yEs", "trUe")) {
-            event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, value));
-            assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
-                            .isInstanceOf(IllegalStateException.class);
-        }
-
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "false"));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
-
-        event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "no"));
-        assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
-    }
-
-    @Test
-    public void testRequestLock() {
-        final CompletableFuture<OperationOutcome> future1 = mgr.requestLock(LOCK1, callback1);
-        final CompletableFuture<OperationOutcome> future2 = mgr.requestLock(LOCK2, callback2);
-        assertSame(future1, mgr.requestLock(LOCK1, callback3));
-
-        assertEquals(2, locks.size());
-
-        assertTrue(future1.isDone());
-        assertTrue(future2.isDone());
-
-        verify(callback1, never()).accept(any());
-        verify(callback2, never()).accept(any());
-        verify(callback3, never()).accept(any());
-
-        // indicate that the first lock failed
-        locks.get(0).notifyUnavailable();
-
-        verify(callback1).accept(any());
-        verify(callback2, never()).accept(any());
-        verify(callback3).accept(any());
-    }
-
-    @Test
-    public void testMakeOperationManager() throws ControlLoopException {
-        // use a manager that creates real operation managers
-        mgr = new MyManager(params, event, workMem);
-
-        assertThatCode(() -> mgr.start()).doesNotThrowAnyException();
-    }
-
-    @Test
-    public void testGetBlockingExecutor() throws Exception {
-        mgr = new ControlLoopEventManager2Drools(params, event, workMem);
-        assertThatCode(() -> mgr.getBlockingExecutor()).doesNotThrowAnyException();
-    }
-
-    @Test
-    public void testToString() {
-        assertNotNull(mgr.toString());
-    }
-
-
-    private void nextStep(ControlLoopOperationManager2 oper, boolean moreSteps, OperationResult result) {
-        when(oper.nextStep()).thenReturn(moreSteps);
-        when(oper.getOperationResult()).thenReturn(result);
-
-        if (result == OperationResult.SUCCESS) {
-            when(oper.getState()).thenReturn(State.OPERATION_SUCCESS);
-        } else {
-            when(oper.getState()).thenReturn(State.OPERATION_FAILURE);
-        }
-
-        mgr.updated(oper);
-
-        updateCount++;
-
-        verify(workMem, times(updateCount)).update(factHandle, mgr);
-    }
-
-    private void runRule() {
-        assertTrue(mgr.isActive());
-        mgr.nextStep();
-    }
-
-    private void runOperation(OperationResult finalResult) throws ControlLoopException {
-        mgr.start();
-        verify(oper1).start(anyLong());
-
-        assertTrue(mgr.isActive());
-
-        nextStep(oper1, true, OperationResult.SUCCESS);
-        runRule();
-
-        nextStep(oper1, false, finalResult);
-        runRule();
-
-        assertFalse(mgr.isActive());
-
-        // should have no effect, because it's done
-        mgr.updated(oper1);
-        verify(workMem, times(updateCount)).update(any(), any());
-    }
-
-    private void verifyNotification(ControlLoopNotificationType expectedType, String expectedMsg) {
-        VirtualControlLoopNotification notif = mgr.getNotification();
-        assertEquals(expectedType, notif.getNotification());
-        assertEquals(expectedMsg, notif.getMessage());
-    }
-
-    private List<ControlLoopOperation> makeHistory(String message) {
-        ControlLoopOperation clo = new ControlLoopOperation();
-        clo.setMessage("history-" + message);
-
-        return List.of(clo);
-    }
-
-    private void loadPolicy(String fileName) throws CoderException {
-        ToscaServiceTemplate template =
-                        yamlCoder.decode(ResourceUtils.getResourceAsString(fileName), ToscaServiceTemplate.class);
-        tosca = template.getToscaTopologyTemplate().getPolicies().get(0).values().iterator().next();
-
-        params.setToscaPolicy(tosca);
-    }
-
-    private void freeLocks() {
-        ArgumentCaptor<Runnable> runCaptor = ArgumentCaptor.forClass(Runnable.class);
-        verify(executor).execute(runCaptor.capture());
-
-        runCaptor.getValue().run();
-    }
-
-
-    private class MyManager extends ControlLoopEventManager2Drools {
-        private static final long serialVersionUID = 1L;
-
-        public MyManager(ControlLoopParams params, VirtualControlLoopEvent event, WorkingMemory workMem)
-                        throws ControlLoopException {
-
-            super(params, event, workMem);
-        }
-
-        @Override
-        protected ExecutorService getBlockingExecutor() {
-            return executor;
-        }
-
-        @Override
-        protected void makeLock(String targetEntity, String requestId, int holdSec, LockCallback callback) {
-            LockImpl lock = new LockImpl(LockState.ACTIVE, targetEntity, requestId, holdSec, callback);
-            locks.add(lock);
-            callback.lockAvailable(lock);
-        }
-
-        @Override
-        public ActorService getActorService() {
-            return actors;
-        }
-
-        @Override
-        public OperationHistoryDataManager getDataManager() {
-            return dataMgr;
-        }
-    }
-
-
-    private class MyManagerWithOper extends MyManager {
-        private static final long serialVersionUID = 1L;
-
-        public MyManagerWithOper(ControlLoopParams params, VirtualControlLoopEvent event, WorkingMemory workMem)
-                        throws ControlLoopException {
-
-            super(params, event, workMem);
-        }
-
-        @Override
-        protected ControlLoopOperationManager2 makeOperationManager(ControlLoopEventContext ctx, Operation policy) {
-            switch (policy.getActorOperation().getActor()) {
-                case "First":
-                    return oper1;
-                case "Second":
-                    return oper2;
-                case "Third":
-                    return oper3;
-                default:
-                    throw new IllegalArgumentException("unknown policy actor " + policy.getActorOperation().getActor());
-            }
-        }
-    }
-}
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2Test.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2Test.java
deleted file mode 100644 (file)
index 0b06665..0000000
+++ /dev/null
@@ -1,1037 +0,0 @@
-/*-
- * ============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.eventmanager;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.time.Instant;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.UUID;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Consumer;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.policy.aai.AaiCqResponse;
-import org.onap.policy.common.utils.time.PseudoExecutor;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopResponse;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actor.guard.DecisionOperation;
-import org.onap.policy.controlloop.actor.guard.GuardActor;
-import org.onap.policy.controlloop.actorserviceprovider.ActorService;
-import org.onap.policy.controlloop.actorserviceprovider.Operation;
-import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
-import org.onap.policy.controlloop.actorserviceprovider.Operator;
-import org.onap.policy.controlloop.actorserviceprovider.TargetType;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
-import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.onap.policy.controlloop.ophistory.OperationHistoryDataManager;
-import org.onap.policy.drools.domain.models.operational.ActorOperation;
-import org.onap.policy.drools.domain.models.operational.OperationalTarget;
-import org.onap.policy.sdnr.PciBody;
-import org.onap.policy.sdnr.PciMessage;
-import org.onap.policy.sdnr.PciResponse;
-
-public class ControlLoopOperationManager2Test {
-    private static final UUID REQ_ID = UUID.randomUUID();
-    private static final String MISMATCH = "mismatch";
-    private static final String POLICY_ID = "my-policy";
-    private static final String POLICY_ACTOR = "my-actor";
-    private static final String POLICY_OPERATION = "my-operation";
-    private static final String OTHER_ACTOR = "another-actor";
-    private static final String MY_TARGET = "my-target";
-    private static final String MY_VNF_ID = "my-vnf-id";
-    private static final String PAYLOAD_KEY = "payload-key";
-    private static final String PAYLOAD_VALUE = "payload-value";
-    private static final long REMAINING_MS = 5000;
-    private static final int MAX_RUN = 100;
-    private static final Integer POLICY_RETRY = 3;
-    private static final Integer POLICY_TIMEOUT = 20;
-    private static final IllegalArgumentException EXPECTED_EXCEPTION =
-                    new IllegalArgumentException("expected exception");
-
-    @Captor
-    private ArgumentCaptor<Consumer<OperationOutcome>> lockCallback;
-
-    @Mock
-    private OperationHistoryDataManager dataMgr;
-    @Mock
-    private ManagerContext mgrctx;
-    @Mock
-    private Operator policyOperator;
-    @Mock
-    private Operation policyOperation;
-    @Mock
-    private Actor policyActor;
-    @Mock
-    private ActorService actors;
-    @Mock
-    private AaiCqResponse cqdata;
-    @Mock
-    private GenericVnf vnf;
-
-    private CompletableFuture<OperationOutcome> lockFuture;
-    private CompletableFuture<OperationOutcome> policyFuture;
-    private ActorOperation operation;
-    private OperationalTarget target;
-    private Map<String, String> entityIds;
-    private Map<String, String> payload;
-    private org.onap.policy.drools.domain.models.operational.Operation policy;
-    private VirtualControlLoopEvent event;
-    private ControlLoopEventContext context;
-    private PseudoExecutor executor;
-    private ControlLoopOperationManager2 mgr;
-
-    /**
-     * Sets up.
-     */
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-
-        lockFuture = new CompletableFuture<>();
-        policyFuture = new CompletableFuture<>();
-
-        when(mgrctx.getActorService()).thenReturn(actors);
-        when(mgrctx.getDataManager()).thenReturn(dataMgr);
-        when(mgrctx.requestLock(any(), any())).thenReturn(lockFuture);
-
-        // configure policy operation
-        when(actors.getActor(POLICY_ACTOR)).thenReturn(policyActor);
-        when(policyActor.getOperator(POLICY_OPERATION)).thenReturn(policyOperator);
-        when(policyOperator.buildOperation(any())).thenReturn(policyOperation);
-        when(policyOperation.start()).thenReturn(policyFuture);
-
-        when(vnf.getVnfId()).thenReturn(MY_VNF_ID);
-        when(cqdata.getDefaultGenericVnf()).thenReturn(vnf);
-
-        entityIds = Map.of("entity-name-A", "entity-value-A");
-
-        target = OperationalTarget.builder()
-                        .targetType(TargetType.VM.toString())
-                        .entityIds(entityIds)
-                        .build();
-
-        payload = Map.of(PAYLOAD_KEY, PAYLOAD_VALUE);
-
-        operation = ActorOperation.builder()
-                        .actor(POLICY_ACTOR)
-                        .operation(POLICY_OPERATION)
-                        .payload(payload)
-                        .target(target)
-                        .build();
-
-        policy = org.onap.policy.drools.domain.models.operational.Operation.builder()
-                        .id(POLICY_ID)
-                        .actorOperation(operation)
-                        .retries(POLICY_RETRY)
-                        .timeout(POLICY_TIMEOUT)
-                        .build();
-
-        event = new VirtualControlLoopEvent();
-        event.setRequestId(REQ_ID);
-        event.setTarget(ControlLoopOperationManager2.VSERVER_VSERVER_NAME);
-        event.setAai(new TreeMap<>(Map.of(ControlLoopOperationManager2.VSERVER_VSERVER_NAME, MY_TARGET)));
-
-        context = new ControlLoopEventContext(event);
-        context.setProperty(AaiCqResponse.CONTEXT_KEY, cqdata);
-
-        executor = new PseudoExecutor();
-
-        mgr = new ControlLoopOperationManager2(mgrctx, context, policy, executor);
-    }
-
-    @Test
-    public void testStart() {
-        mgr.start(REMAINING_MS);
-
-        // should have determined the target entity by now
-        assertEquals(MY_TARGET, mgr.getTargetEntity());
-
-        verify(mgrctx).requestLock(eq(MY_TARGET), any());
-
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome();
-        policyFuture.complete(genOpOutcome());
-        runToCompletion();
-
-        assertEquals(ControlLoopOperationManager2.State.GUARD_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.GUARD_PERMITTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_SUCCESS, mgr.getState());
-
-        assertFalse(mgr.nextStep());
-
-        OperationOutcome outcome = mgr.getOutcomes().peek();
-        assertEquals(OperationResult.SUCCESS, outcome.getResult());
-        assertTrue(outcome.isFinalOutcome());
-
-        verify(mgrctx, times(4)).updated(mgr);
-    }
-
-    /**
-     * Tests start() when detmTarget() (i.e., the first task) throws an exception.
-     */
-    @Test
-    public void testStartDetmTargetException() {
-        operation.setTarget(OperationalTarget.builder().build());
-        mgr = new ControlLoopOperationManager2(mgrctx, context, policy, executor);
-        mgr.start(REMAINING_MS);
-
-        runToCompletion();
-
-        assertFalse(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_FAILURE, mgr.getState());
-
-        // should have called update() for operation-start, but not for any nextStep()
-        verify(mgrctx).updated(mgr);
-    }
-
-    /**
-     * Tests start() when a subsequent task throws an exception.
-     */
-    @Test
-    public void testStartException() {
-        when(policyOperation.start()).thenThrow(EXPECTED_EXCEPTION);
-
-        mgr.start(REMAINING_MS);
-
-        lockFuture.complete(new OperationOutcome());
-        runToCompletion();
-
-        assertFalse(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_FAILURE, mgr.getState());
-
-        // should have called update() for operation-start, but not for any nextStep()
-        verify(mgrctx).updated(mgr);
-    }
-
-    /**
-     * Tests start() when the control loop times out before the operation starts.
-     */
-    @Test
-    public void testStartClTimeout_testHandleTimeout() throws InterruptedException {
-        // catch the callback when it times out
-        CountDownLatch updatedLatch = new CountDownLatch(1);
-        doAnswer(args -> {
-            updatedLatch.countDown();
-            return null;
-        }).when(mgrctx).updated(any());
-
-        long tstart = System.currentTimeMillis();
-
-        // give it a short timeout
-        mgr.start(100);
-
-        assertTrue(updatedLatch.await(5, TimeUnit.SECONDS));
-        assertTrue(System.currentTimeMillis() - tstart >= 100);
-
-        // don't generate any responses
-        runToCompletion();
-
-        // wait for the future to be canceled, via a background thread
-        CountDownLatch futureLatch = new CountDownLatch(1);
-        mgr.getFuture().whenComplete((unused, thrown) -> futureLatch.countDown());
-        assertTrue(futureLatch.await(5, TimeUnit.SECONDS));
-
-        // lock should have been canceled
-        assertTrue(mgr.getFuture().isCancelled());
-
-        assertFalse(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.CONTROL_LOOP_TIMEOUT, mgr.getState());
-
-        // should have called update() for operation-start, but not for any nextStep()
-        verify(mgrctx).updated(mgr);
-
-        // should have added a record to the DB
-        verify(dataMgr).store(any(), any(), any(), any());
-    }
-
-    @Test
-    public void testStartOperation() {
-        mgr.start(REMAINING_MS);
-
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome();
-        runToCompletion();
-
-        verify(policyOperation).start();
-
-        ArgumentCaptor<ControlLoopOperationParams> captor = ArgumentCaptor.forClass(ControlLoopOperationParams.class);
-        verify(policyOperator).buildOperation(captor.capture());
-
-        ControlLoopOperationParams params = captor.getValue();
-
-        assertNotNull(params);
-        assertEquals(POLICY_ACTOR, params.getActor());
-        assertSame(actors, params.getActorService());
-        assertNotNull(params.getCompleteCallback());
-        assertSame(context, params.getContext());
-        assertSame(executor, params.getExecutor());
-        assertEquals(POLICY_OPERATION, params.getOperation());
-        assertEquals(payload, params.getPayload());
-        assertSame(REQ_ID, params.getRequestId());
-        assertSame(POLICY_RETRY, params.getRetry());
-        assertNotNull(params.getStartCallback());
-        assertEquals(target.getTargetType().toString(), params.getTargetType().toString());
-        assertSame(entityIds, params.getTargetEntityIds());
-        assertEquals(MY_TARGET, params.getTargetEntity());
-        assertSame(POLICY_TIMEOUT, params.getTimeoutSec());
-    }
-
-    @Test
-    public void testStartOperationNullPayload() {
-        operation.setPayload(null);
-        mgr.start(REMAINING_MS);
-
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome();
-        runToCompletion();
-
-        verify(policyOperation).start();
-
-        ArgumentCaptor<ControlLoopOperationParams> captor = ArgumentCaptor.forClass(ControlLoopOperationParams.class);
-        verify(policyOperator).buildOperation(captor.capture());
-
-        ControlLoopOperationParams params = captor.getValue();
-
-        assertNotNull(params);
-        assertEquals(POLICY_ACTOR, params.getActor());
-        assertSame(actors, params.getActorService());
-        assertNotNull(params.getCompleteCallback());
-        assertSame(context, params.getContext());
-        assertSame(executor, params.getExecutor());
-        assertEquals(POLICY_OPERATION, params.getOperation());
-        assertTrue(params.getPayload().isEmpty());
-        assertSame(REQ_ID, params.getRequestId());
-        assertSame(POLICY_RETRY, params.getRetry());
-        assertNotNull(params.getStartCallback());
-        assertEquals(target.getTargetType().toString(), params.getTargetType().toString());
-        assertSame(entityIds, params.getTargetEntityIds());
-        assertEquals(MY_TARGET, params.getTargetEntity());
-        assertSame(POLICY_TIMEOUT, params.getTimeoutSec());
-    }
-
-    @Test
-    public void testMakeControlLoopResponse() {
-        final OperationOutcome outcome = new OperationOutcome();
-        PciMessage msg = new PciMessage();
-        outcome.setResponse(msg);
-
-        PciBody body = new PciBody();
-        msg.setBody(body);
-
-        PciResponse output = new PciResponse();
-        body.setOutput(output);
-
-        output.setPayload("my-payload");
-
-
-        // not an SDNR action - should return null
-        assertNull(mgr.makeControlLoopResponse(outcome));
-
-        /*
-         * now work with SDNR actor
-         */
-        operation.setActor("SDNR");
-        mgr = new ControlLoopOperationManager2(mgrctx, context, policy, executor);
-
-        // should return null for a null input
-        assertNull(mgr.makeControlLoopResponse(null));
-
-        // should generate a response, with a payload
-        checkResp(outcome, "my-payload");
-
-        /*
-         * these should generate a response, with null payload
-         */
-        output.setPayload(null);
-        checkResp(outcome, null);
-
-        body.setOutput(null);
-        checkResp(outcome, null);
-
-        msg.setBody(null);
-        checkResp(outcome, null);
-
-        outcome.setResponse(null);
-        checkResp(outcome, null);
-    }
-
-    @Test
-    public void testGetOperationMessage() {
-        // no history yet
-        assertNull(mgr.getOperationMessage());
-
-        runCyle();
-        assertThat(mgr.getOperationMessage()).contains("actor=my-actor").contains("operation=my-operation");
-    }
-
-    @Test
-    public void testGetOperationResult() {
-        // no history yet
-        assertNotNull(mgr.getOperationResult());
-
-        runCyle();
-        assertEquals(OperationResult.SUCCESS, mgr.getOperationResult());
-    }
-
-    /**
-     * Tests getOperationResult() when it ends in a failure.
-     */
-    @Test
-    public void testGetOperationResultFailure() {
-        mgr.start(REMAINING_MS);
-
-        genLockFailure();
-        runToCompletion();
-
-        assertEquals(OperationResult.FAILURE_GUARD, mgr.getOperationResult());
-    }
-
-    /**
-     * Tests handleException() when the exception is a "cancel".
-     */
-    @Test
-    public void testHandleExceptionCanceled() {
-        lockFuture.cancel(false);
-
-        mgr.start(REMAINING_MS);
-
-        runToCompletion();
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.ACTIVE, mgr.getState());
-    }
-
-    @Test
-    public void testCancel() {
-        mgr.start(REMAINING_MS);
-
-        mgr.cancel();
-        assertTrue(mgr.getFuture().isCancelled());
-    }
-
-    /**
-     * Tests cancel() when the operation hasn't been started.
-     */
-    @Test
-    public void testCancelNotStarted() {
-        assertNull(mgr.getFuture());
-
-        mgr.cancel();
-        assertNull(mgr.getFuture());
-    }
-
-    @Test
-    public void testLockUnavailable() {
-        mgr.start(REMAINING_MS);
-
-        runToCompletion();
-
-        // lock failure outcome
-        final OperationOutcome outcome = genLockFailure();
-
-        runToCompletion();
-
-        assertFalse(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.LOCK_DENIED, mgr.getState());
-
-        assertEquals(outcome, mgr.getOutcomes().peek());
-
-        // should have called update() for operation-start, but not for any nextStep()
-        verify(mgrctx).updated(mgr);
-    }
-
-    /**
-     * Tests onStart() and onComplete() with other actors.
-     */
-    @Test
-    public void testOnStart_testOnComplete() {
-        mgr.start(REMAINING_MS);
-
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome();
-
-        // generate failure outcome for ANOTHER actor - should be ignored
-        OperationOutcome outcome = mgr.getParams().makeOutcome();
-        outcome.setActor(OTHER_ACTOR);
-        outcome.setResult(OperationResult.FAILURE);
-        outcome.setStart(Instant.now());
-        mgr.getParams().callbackStarted(new OperationOutcome(outcome));
-
-        outcome.setEnd(Instant.now());
-        mgr.getParams().callbackCompleted(outcome);
-
-        policyFuture.complete(genOpOutcome());
-        runToCompletion();
-
-        // should not include the other actor's outcome
-        assertEquals(ControlLoopOperationManager2.State.GUARD_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.GUARD_PERMITTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_SUCCESS, mgr.getState());
-
-        assertFalse(mgr.nextStep());
-
-        assertEquals(OperationResult.SUCCESS, mgr.getOutcomes().peek().getResult());
-
-        verify(mgrctx, times(4)).updated(mgr);
-    }
-
-    @Test
-    public void testNextStep() {
-        mgr.start(REMAINING_MS);
-
-        // only do the lock and the guard
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome();
-        runToCompletion();
-
-        assertEquals(ControlLoopOperationManager2.State.GUARD_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.GUARD_PERMITTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertTrue(mgr.nextStep());
-
-        verify(mgrctx, times(2)).updated(mgr);
-    }
-
-    /**
-     * Tests processOutcome() when the lock is denied.
-     */
-    @Test
-    public void testProcessOutcomeLockDenied() {
-        mgr.start(REMAINING_MS);
-
-        // unavailable from the start => "denied"
-        genLockFailure();
-
-        runToCompletion();
-
-        assertEquals(ControlLoopOperationManager2.State.LOCK_DENIED, mgr.getState());
-
-        assertFalse(mgr.nextStep());
-        verify(mgrctx).updated(mgr);
-
-        verifyDb(1, OperationResult.FAILURE_GUARD, "Operation denied by Lock");
-    }
-
-    /**
-     * Tests processOutcome() when the lock is lost.
-     */
-    @Test
-    public void testProcessOutcomeLockLost() {
-        mgr.start(REMAINING_MS);
-
-        // indicate lock success initially
-        lockFuture.complete(new OperationOutcome());
-
-        // do the guard
-        genGuardOutcome();
-
-        // now generate a lock failure => "lost"
-        genLockFailure();
-
-        runToCompletion();
-
-        assertEquals(ControlLoopOperationManager2.State.GUARD_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.GUARD_PERMITTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.LOCK_LOST, mgr.getState());
-
-        assertFalse(mgr.nextStep());
-        verify(mgrctx, times(3)).updated(mgr);
-
-        verifyDb(1, OperationResult.FAILURE, "Operation aborted by Lock");
-    }
-
-    /**
-     * Tests processOutcome() when the guard is permitted.
-     */
-    @Test
-    public void testProcessOutcomeGuardPermit() {
-        mgr.start(REMAINING_MS);
-
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome();
-
-        runToCompletion();
-
-        assertEquals(ControlLoopOperationManager2.State.GUARD_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.GUARD_PERMITTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        verify(mgrctx, times(2)).updated(mgr);
-
-        verify(dataMgr, never()).store(any(), any(), any(), any());
-    }
-
-    /**
-     * Tests processOutcome() when the guard is permitted.
-     */
-    @Test
-    public void testProcessOutcomeGuardDenied() {
-        mgr.start(REMAINING_MS);
-
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome(false);
-
-        runToCompletion();
-
-        assertEquals(ControlLoopOperationManager2.State.GUARD_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.GUARD_DENIED, mgr.getState());
-
-        assertFalse(mgr.nextStep());
-        verify(mgrctx, times(2)).updated(mgr);
-
-        verifyDb(1, OperationResult.FAILURE_GUARD, "Operation denied by Guard");
-    }
-
-    /**
-     * Tests processOutcome() when the operation is a success.
-     */
-    @Test
-    public void testProcessOutcomeOperSuccess() {
-        mgr.start(REMAINING_MS);
-
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome();
-        genOpOutcome();
-
-        runToCompletion();
-
-        assertEquals(ControlLoopOperationManager2.State.GUARD_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.GUARD_PERMITTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_SUCCESS, mgr.getState());
-
-        assertFalse(mgr.nextStep());
-        verify(mgrctx, times(4)).updated(mgr);
-
-        verifyDb(2, OperationResult.SUCCESS, null);
-    }
-
-    /**
-     * Tests processOutcome() when the operation is a failure.
-     */
-    @Test
-    public void testProcessOutcomeOperFailure() {
-        mgr.start(REMAINING_MS);
-
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome();
-        genOpOutcome(false);
-
-        runToCompletion();
-
-        assertEquals(ControlLoopOperationManager2.State.GUARD_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.GUARD_PERMITTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_FAILURE, mgr.getState());
-        verifyDb(2, OperationResult.FAILURE, null);
-
-        assertThat(mgr.toString()).contains("attempts=1");
-
-        // next failure
-        genOpOutcome(false);
-        runToCompletion();
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_FAILURE, mgr.getState());
-        verifyDb(4, OperationResult.FAILURE, null);
-
-        assertThat(mgr.toString()).contains("attempts=2");
-
-        // and finally a success
-        genOpOutcome();
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_STARTED, mgr.getState());
-
-        assertTrue(mgr.nextStep());
-        assertEquals(ControlLoopOperationManager2.State.OPERATION_SUCCESS, mgr.getState());
-        verifyDb(6, OperationResult.SUCCESS, null);
-
-        assertThat(mgr.toString()).contains("attempts=3");
-
-        assertFalse(mgr.nextStep());
-        verify(mgrctx, times(8)).updated(mgr);
-    }
-
-    @Test
-    public void testGetOperationHistory() {
-        // no history yet
-        assertNull(mgr.getOperationHistory());
-
-        runCyle();
-        assertThat(mgr.getOperationHistory()).contains("actor=my-actor").contains("operation=my-operation")
-                        .contains("outcome=Success");
-    }
-
-    @Test
-    public void testGetHistory() {
-        // no history yet
-        assertEquals(0, mgr.getHistory().size());
-
-        runCyle();
-        assertEquals(1, mgr.getHistory().size());
-    }
-
-    @Test
-    public void testDetmTargetVm() {
-        target.setTargetType(TargetType.VM.toString());
-        assertNull(mgr.detmTarget());
-        assertEquals(MY_TARGET, mgr.getTargetEntity());
-
-        target.setTargetType(TargetType.VNF.toString());
-        assertNull(mgr.detmTarget());
-        assertEquals(MY_TARGET, mgr.getTargetEntity());
-
-        target.setTargetType(TargetType.VFMODULE.toString());
-        assertNull(mgr.detmTarget());
-        assertEquals(MY_TARGET, mgr.getTargetEntity());
-
-        // unsupported type
-        target.setTargetType(TargetType.VFC.toString());
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget())
-                        .withMessage("The target type is not supported");
-
-        // null type
-        target.setTargetType(null);
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget()).withMessage("The target type is null");
-
-        // null target
-        operation.setTarget(null);
-        mgr = new ControlLoopOperationManager2(mgrctx, context, policy, executor);
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget()).withMessage("The target is null");
-    }
-
-    @Test
-    public void testDetmPnfTarget() {
-        setTargetPnf();
-        assertNull(mgr.detmTarget());
-        assertEquals(MY_TARGET, mgr.getTargetEntity());
-
-        // missing enrichment data
-        event.getAai().clear();
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget())
-                        .withMessage("AAI section is missing " + ControlLoopOperationManager2.PNF_NAME);
-
-        // wrong target
-        event.setTarget(MISMATCH);
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget())
-                        .withMessage("Target does not match target type");
-    }
-
-    @Test
-    public void testDetmVfModuleTarget() {
-        // vserver
-        event.setTarget(ControlLoopOperationManager2.VSERVER_VSERVER_NAME);
-        event.getAai().clear();
-        event.getAai().putAll(Map.of(ControlLoopOperationManager2.VSERVER_VSERVER_NAME, MY_TARGET));
-        assertNull(mgr.detmTarget());
-        assertEquals(MY_TARGET, mgr.getTargetEntity());
-
-        // vnf-id
-        event.setTarget(ControlLoopOperationManager2.GENERIC_VNF_VNF_ID);
-        event.getAai().clear();
-        event.getAai().putAll(Map.of(ControlLoopOperationManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
-        assertNull(mgr.detmTarget());
-        assertEquals(MY_TARGET, mgr.getTargetEntity());
-
-        // wrong type
-        event.setTarget(MISMATCH);
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget())
-                        .withMessage("Target does not match target type");
-
-        // missing enrichment data
-        event.setTarget(ControlLoopOperationManager2.VSERVER_VSERVER_NAME);
-        event.getAai().clear();
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget())
-                        .withMessage("Enrichment data is missing " + ControlLoopOperationManager2.VSERVER_VSERVER_NAME);
-
-        // null target
-        event.setTarget(null);
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget()).withMessage("Target is null");
-    }
-
-    @Test
-    public void testDetmVnfName() {
-        setTargetVnfName();
-        assertNull(mgr.detmTarget());
-        assertEquals(MY_TARGET, mgr.getTargetEntity());
-
-        // force it to be gotten from the CQ data
-        event.getAai().clear();
-        assertNull(mgr.detmTarget());
-        assertEquals(MY_VNF_ID, mgr.getTargetEntity());
-    }
-
-    @Test
-    public void testExtractVnfFromCq() {
-        // force it to be gotten from the CQ data
-        setTargetVnfName();
-        event.getAai().clear();
-
-        // missing vnf id in CQ data
-        when(vnf.getVnfId()).thenReturn(null);
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget()).withMessage("No vnf-id found");
-
-        // missing default vnf in CQ data
-        when(cqdata.getDefaultGenericVnf()).thenReturn(null);
-        assertThatIllegalArgumentException().isThrownBy(() -> mgr.detmTarget()).withMessage("No vnf-id found");
-    }
-
-    @Test
-    public void testGetState_testGetActor_testGetOperation() {
-        assertEquals(ControlLoopOperationManager2.State.ACTIVE, mgr.getState());
-        assertEquals(POLICY_ACTOR, mgr.getActor());
-        assertEquals(POLICY_OPERATION, mgr.getOperation());
-    }
-
-    @Test
-    public void testToString() {
-        assertThat(mgr.toString()).contains("state").contains("requestId").contains("policyId").contains("attempts");
-    }
-
-    /**
-     * Runs a cycle, from start to completion.
-     */
-    private void runCyle() {
-        mgr.start(REMAINING_MS);
-
-        lockFuture.complete(new OperationOutcome());
-        genGuardOutcome();
-        genOpOutcome();
-
-        runToCompletion();
-
-        // guard start
-        assertTrue(mgr.nextStep());
-
-        // guard permit
-        assertTrue(mgr.nextStep());
-
-        // operation start
-        assertTrue(mgr.nextStep());
-
-        // operation success
-        assertFalse(mgr.nextStep());
-    }
-
-    /**
-     * Runs everything until the executor queue is empty.
-     */
-    private void runToCompletion() {
-        assertTrue(executor.runAll(MAX_RUN));
-    }
-
-    /**
-     * Generates a failure outcome for the lock, and invokes the callbacks.
-     *
-     * @return the generated outcome
-     */
-    private OperationOutcome genLockFailure() {
-        OperationOutcome outcome = new OperationOutcome();
-        outcome.setActor(ControlLoopOperationManager2.LOCK_ACTOR);
-        outcome.setOperation(ControlLoopOperationManager2.LOCK_OPERATION);
-        outcome.setResult(OperationResult.FAILURE);
-        outcome.setStart(Instant.now());
-        outcome.setEnd(Instant.now());
-        outcome.setFinalOutcome(true);
-
-        verify(mgrctx).requestLock(eq(MY_TARGET), lockCallback.capture());
-        lockCallback.getValue().accept(outcome);
-
-        lockFuture.complete(outcome);
-
-        return outcome;
-    }
-
-    /**
-     * Generates an outcome for the guard, and invokes the callbacks.
-     *
-     * @return the generated outcome
-     */
-    private OperationOutcome genGuardOutcome() {
-        return genGuardOutcome(true);
-    }
-
-    /**
-     * Generates an outcome for the guard, and invokes the callbacks.
-     *
-     * @param permit {@code true} if the guard should be permitted, {@code false} if
-     *        denied
-     * @return the generated outcome
-     */
-    private OperationOutcome genGuardOutcome(boolean permit) {
-        OperationOutcome outcome = mgr.getParams().makeOutcome();
-        outcome.setActor(GuardActor.NAME);
-        outcome.setOperation(DecisionOperation.NAME);
-        outcome.setStart(Instant.now());
-        mgr.getParams().callbackStarted(new OperationOutcome(outcome));
-
-        if (!permit) {
-            outcome.setResult(OperationResult.FAILURE);
-        }
-
-        outcome.setEnd(Instant.now());
-        mgr.getParams().callbackCompleted(outcome);
-
-        return outcome;
-    }
-
-    /**
-     * Generates an outcome for the operation, itself, and invokes the callbacks.
-     *
-     * @return the generated outcome
-     */
-    private OperationOutcome genOpOutcome() {
-        return genOpOutcome(true);
-    }
-
-    /**
-     * Generates an outcome for the operation, itself, and invokes the callbacks.
-     *
-     * @param success {@code true} if the outcome should be a success, {@code false} if a
-     *        failure
-     * @return the generated outcome
-     */
-    private OperationOutcome genOpOutcome(boolean success) {
-        OperationOutcome outcome = mgr.getParams().makeOutcome();
-        outcome.setStart(Instant.now());
-        mgr.getParams().callbackStarted(new OperationOutcome(outcome));
-
-        if (success) {
-            outcome.setFinalOutcome(true);
-        } else {
-            outcome.setResult(OperationResult.FAILURE);
-        }
-
-        outcome.setEnd(Instant.now());
-        mgr.getParams().callbackCompleted(outcome);
-
-        return outcome;
-    }
-
-    /**
-     * Configures the data for a PNF target.
-     */
-    private void setTargetPnf() {
-        event.setTarget(ControlLoopOperationManager2.PNF_NAME);
-        event.getAai().clear();
-        event.getAai().putAll(Map.of(ControlLoopOperationManager2.PNF_NAME, MY_TARGET));
-
-        target.setTargetType(TargetType.PNF.toString());
-    }
-
-    /**
-     * Configures the data for a VNF-NAME target.
-     */
-    private void setTargetVnfName() {
-        event.setTarget(ControlLoopOperationManager2.GENERIC_VNF_VNF_NAME);
-        event.getAai().clear();
-        event.getAai().putAll(Map.of(ControlLoopOperationManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
-
-        target.setTargetType(TargetType.VNF.toString());
-    }
-
-    private void checkResp(OperationOutcome outcome, String expectedPayload) {
-        ControlLoopResponse resp = mgr.makeControlLoopResponse(outcome);
-        assertNotNull(resp);
-        assertEquals(REQ_ID, resp.getRequestId());
-        assertEquals(expectedPayload, resp.getPayload());
-    }
-
-    private void verifyDb(int nrecords, OperationResult expectedResult, String expectedMsg) {
-        ArgumentCaptor<String> entityCaptor = ArgumentCaptor.forClass(String.class);
-        ArgumentCaptor<ControlLoopOperation> opCaptor = ArgumentCaptor.forClass(ControlLoopOperation.class);
-        verify(dataMgr, times(nrecords)).store(any(), any(), entityCaptor.capture(), opCaptor.capture());
-
-        assertEquals(MY_TARGET, entityCaptor.getValue());
-
-        ControlLoopOperation oper = opCaptor.getValue();
-
-        assertEquals(expectedResult.toString(), oper.getOutcome());
-        assertEquals(expectedMsg, oper.getMessage());
-    }
-}
index 98ff04d..164dfb4 100644 (file)
@@ -132,8 +132,8 @@ public class LockDataTest {
 
         assertTrue(future.isDone());
         OperationOutcome outcome = future.get();
-        assertEquals(ControlLoopOperationManager2.LOCK_ACTOR, outcome.getActor());
-        assertEquals(ControlLoopOperationManager2.LOCK_OPERATION, outcome.getOperation());
+        assertEquals(ActorConstants.LOCK_ACTOR, outcome.getActor());
+        assertEquals(ActorConstants.LOCK_OPERATION, outcome.getOperation());
         assertEquals(ENTITY, outcome.getTarget());
         assertEquals(OperationResult.SUCCESS, outcome.getResult());
         assertEquals(ControlLoopOperation.SUCCESS_MSG, outcome.getMessage());
@@ -173,8 +173,8 @@ public class LockDataTest {
         assertTrue(future2.isDone());
         assertSame(outcome, future2.get());
 
-        assertEquals(ControlLoopOperationManager2.LOCK_ACTOR, outcome.getActor());
-        assertEquals(ControlLoopOperationManager2.LOCK_OPERATION, outcome.getOperation());
+        assertEquals(ActorConstants.LOCK_ACTOR, outcome.getActor());
+        assertEquals(ActorConstants.LOCK_OPERATION, outcome.getOperation());
         assertEquals(ENTITY, outcome.getTarget());
         assertEquals(OperationResult.FAILURE, outcome.getResult());
         assertEquals(ControlLoopOperation.FAILED_MSG, outcome.getMessage());
index efcc610..aec4693 100644 (file)
@@ -55,7 +55,6 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
 import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
 import org.onap.policy.controlloop.actorserviceprovider.Operator;
 import org.onap.policy.controlloop.actorserviceprovider.TargetType;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
 import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
 import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
 import org.onap.policy.drools.domain.models.operational.OperationalTarget;
@@ -84,7 +83,6 @@ public class StepTest {
     private Map<String, String> entityIds;
     private Map<String, String> payload;
     private VirtualControlLoopEvent event;
-    private ControlLoopEventContext context;
     private BlockingQueue<OperationOutcome> starts;
     private BlockingQueue<OperationOutcome> completions;
     private ControlLoopOperationParams params;
@@ -117,19 +115,15 @@ public class StepTest {
 
         event = new VirtualControlLoopEvent();
         event.setRequestId(REQ_ID);
-        event.setTarget(ControlLoopOperationManager2.VSERVER_VSERVER_NAME);
-        event.setAai(new TreeMap<>(Map.of(ControlLoopOperationManager2.VSERVER_VSERVER_NAME, MY_TARGET)));
-
-        context = new ControlLoopEventContext(event);
 
         starts = new LinkedBlockingQueue<>();
         completions = new LinkedBlockingQueue<>();
 
         params = ControlLoopOperationParams.builder().actor(POLICY_ACTOR).actorService(actors)
-                        .completeCallback(completions::add).context(context).executor(ForkJoinPool.commonPool())
+                        .completeCallback(completions::add).executor(ForkJoinPool.commonPool())
                         .operation(POLICY_OPERATION).payload(new TreeMap<>(payload)).startCallback(starts::add)
                         .targetType(TargetType.valueOf(target.getTargetType())).targetEntityIds(target.getEntityIds())
-                        .targetEntity(MY_TARGET).build();
+                        .requestId(REQ_ID).targetEntity(MY_TARGET).build();
 
         startTime = new AtomicReference<>();
 
diff --git a/controlloop/common/feature-controlloop-frankfurt/pom.xml b/controlloop/common/feature-controlloop-frankfurt/pom.xml
deleted file mode 100644 (file)
index cdcec1d..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-<!--
-  ============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=========================================================
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-        <artifactId>drools-applications-common</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>feature-controlloop-frankfurt</artifactId>
-
-    <description>
-        Load Experimental Frankfurt Control Loop Controller as a feature.
-    </description>
-
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/feature</directory>
-                <filtering>true</filtering>
-            </resource>
-            <resource>
-                <directory>src/main/resources</directory>
-            </resource>
-        </resources>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>zipfile</id>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <phase>package</phase>
-                        <configuration>
-                            <attach>true</attach>
-                            <finalName>${project.artifactId}-${project.version}</finalName>
-                            <descriptors>
-                                <descriptor>src/assembly/assemble_zip.xml</descriptor>
-                            </descriptors>
-                            <appendAssemblyId>false</appendAssemblyId>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-dependencies</id>
-                        <goals>
-                            <goal>copy-dependencies</goal>
-                        </goals>
-                        <phase>prepare-package</phase>
-                        <configuration>
-                            <outputDirectory>${project.build.directory}/assembly/lib</outputDirectory>
-                            <overWriteReleases>false</overWriteReleases>
-                            <overWriteSnapshots>true</overWriteSnapshots>
-                            <overWriteIfNewer>true</overWriteIfNewer>
-                            <useRepositoryLayout>false</useRepositoryLayout>
-                            <addParentPoms>false</addParentPoms>
-                            <copyPom>false</copyPom>
-                            <includeScope>runtime</includeScope>
-                            <excludeTransitive>true</excludeTransitive>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-            <artifactId>controller-frankfurt</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.drools-pdp</groupId>
-            <artifactId>policy-management</artifactId>
-            <version>${version.policy.drools-pdp}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/controlloop/common/feature-controlloop-frankfurt/src/assembly/assemble_zip.xml b/controlloop/common/feature-controlloop-frankfurt/src/assembly/assemble_zip.xml
deleted file mode 100644 (file)
index bee309b..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<!--
-  ============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=========================================================
-  -->
-
-<!-- Defines how we build the .zip file which is our distribution. -->
-
-<assembly
-    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-    <id>feature-controlloop-frankfurt-package</id>
-    <formats>
-        <format>zip</format>
-    </formats>
-
-    <includeBaseDirectory>false</includeBaseDirectory>
-
-    <fileSets>
-        <fileSet>
-            <directory>target</directory>
-            <outputDirectory>lib/feature</outputDirectory>
-            <includes>
-                <include>feature-controlloop-frankfurt-${project.version}.jar</include>
-            </includes>
-        </fileSet>
-        <fileSet>
-            <directory>target/assembly/lib</directory>
-            <outputDirectory>artifacts</outputDirectory>
-            <includes>
-                <include>controller-frankfurt-${project.version}.jar</include>
-            </includes>
-        </fileSet>
-        <fileSet>
-            <directory>target/assembly/lib</directory>
-            <outputDirectory>lib/dependencies</outputDirectory>
-            <includes>
-                <include>*.jar</include>
-            </includes>
-            <excludes>
-                <exclude>controller-frankfurt-${project.version}.jar</exclude>
-            </excludes>
-        </fileSet>
-        <fileSet>
-            <directory>target/classes/config</directory>
-            <outputDirectory>config</outputDirectory>
-            <fileMode>0644</fileMode>
-            <excludes />
-        </fileSet>
-        <fileSet>
-            <directory>src/main/feature/bin</directory>
-            <outputDirectory>bin</outputDirectory>
-            <fileMode>0755</fileMode>
-            <excludes />
-        </fileSet>
-        <fileSet>
-            <directory>src/main/feature/db</directory>
-            <outputDirectory>db</outputDirectory>
-            <fileMode>0744</fileMode>
-            <excludes />
-        </fileSet>
-        <fileSet>
-            <directory>src/main/feature/install</directory>
-            <outputDirectory>install</outputDirectory>
-            <fileMode>0755</fileMode>
-            <excludes />
-        </fileSet>
-    </fileSets>
-</assembly>
diff --git a/controlloop/common/feature-controlloop-frankfurt/src/main/feature/config/frankfurt-controller.properties b/controlloop/common/feature-controlloop-frankfurt/src/main/feature/config/frankfurt-controller.properties
deleted file mode 100644 (file)
index 76ce48b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-###
-# ============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=========================================================
-###
-
-controller.name=frankfurt
-
-rules.groupId=${project.groupId}
-rules.artifactId=controller-frankfurt
-rules.version=${project.version}
-
-dmaap.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP
-dmaap.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL,DCAE_CL_RSP
-
-dmaap.source.topics.DCAE_TOPIC.events=\
-    org.onap.policy.controlloop.CanonicalOnset,org.onap.policy.controlloop.CanonicalAbated
-dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalOnset.filter=\
-    [?($.closedLoopEventStatus == 'ONSET')]
-dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalAbated.filter=\
-    [?($.closedLoopEventStatus == 'ABATED')]
-dmaap.source.topics.DCAE_TOPIC.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson
-
-dmaap.source.topics.APPC-CL.events=org.onap.policy.appc.Response
-dmaap.source.topics.APPC-CL.events.org.onap.policy.appc.Response.filter=[?($.CommonHeader && $.Status)]
-dmaap.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-
-dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')]
-dmaap.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-
-dmaap.sink.topics.APPC-CL.events=org.onap.policy.appc.Request
-dmaap.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-
-dmaap.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-dmaap.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-
-dmaap.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
-dmaap.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
-dmaap.sink.topics.DCAE_CL_RSP.events=org.onap.policy.controlloop.ControlLoopResponse
-dmaap.sink.topics.DCAE_CL_RSP.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
-dmaap.source.topics.SDNR-CL-RSP.events=org.onap.policy.sdnr.PciResponseWrapper
-dmaap.source.topics.SDNR-CL-RSP.events.org.onap.policy.sdnr.PciResponseWrapper.filter=[?($.type == 'response')]
-dmaap.source.topics.SDNR-CL-RSP.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
diff --git a/controlloop/common/feature-controlloop-frankfurt/src/main/feature/config/logback-include-frankfurt.xml b/controlloop/common/feature-controlloop-frankfurt/src/main/feature/config/logback-include-frankfurt.xml
deleted file mode 100644 (file)
index 080fb99..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-  feature-controlloop-frankfurt
-  ================================================================================
-  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=========================================================
-  -->
-
-<!--
-  The logger configurations in this file are for each individual controller
-  to have their own network logger for topic traffic. This is an extension of
-  logback.xml or logback-eelf.xml.
-
-  NOTE: Each logger MUST contain the same name as the control loop's controller.
--->
-<included>
-
-    <property name="logDir" value="${POLICY_LOGS}" />
-    <property name="frankfurtLog" value="frankfurt-network" />
-    <property name="networkPattern" value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%t]%m%n" />
-
-    <!-- Frankfurt Network Logging Properties -->
-    <appender name="FrankfurtOut" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${logDir}/${frankfurtLog}.log</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${logDir}/${frankfurtLog}.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
-            <maxFileSize>50MB</maxFileSize>
-            <maxHistory>30</maxHistory>
-            <totalSizeCap>10GB</totalSizeCap>
-        </rollingPolicy>
-        <encoder>
-            <pattern>${networkPattern}</pattern>
-        </encoder>
-    </appender>
-
-    <appender name="AsyncFrankfurtOut" class="ch.qos.logback.classic.AsyncAppender">
-        <appender-ref ref="FrankfurtOut" />
-    </appender>
-
-    <logger name="frankfurt" level="INFO" additivity="false">
-        <appender-ref ref="AsyncFrankfurtOut" />
-    </logger>
-
-</included>
diff --git a/controlloop/common/feature-controlloop-frankfurt/src/main/java/org/onap/policy/drools/apps/controlloop/feature/frankfurt/FrankfurtFeature.java b/controlloop/common/feature-controlloop-frankfurt/src/main/java/org/onap/policy/drools/apps/controlloop/feature/frankfurt/FrankfurtFeature.java
deleted file mode 100644 (file)
index 95d8b13..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * ============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.drools.apps.controlloop.feature.frankfurt;
-
-import org.onap.policy.drools.features.PolicyEngineFeatureApi;
-
-/**
- * Frankfurt Use Cases installation as a feature saves time loading the controller at
- * runtime over the usual installation from nexus. It also reduces potential for errors in
- * the pom.xml generated in the brmsgw side.
- *
- * <p/>
- * There is no impact on other components as the brmsgw etc .. they will continue
- * operating as usual.
- *
- * <p/>
- * This class will be expanded in the future for additional functionality
- *
- */
-public class FrankfurtFeature implements PolicyEngineFeatureApi {
-
-    public static final int SEQNO = 1000;
-
-    @Override
-    public int getSequenceNumber() {
-        return SEQNO;
-    }
-}
diff --git a/controlloop/common/feature-controlloop-frankfurt/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi b/controlloop/common/feature-controlloop-frankfurt/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi
deleted file mode 100644 (file)
index dfea34b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.drools.apps.controlloop.feature.frankfurt.FrankfurtFeature
diff --git a/controlloop/common/feature-controlloop-frankfurt/src/test/java/org/onap/policy/drools/apps/controlloop/feature/frankfurt/FrankfurtFeatureTest.java b/controlloop/common/feature-controlloop-frankfurt/src/test/java/org/onap/policy/drools/apps/controlloop/feature/frankfurt/FrankfurtFeatureTest.java
deleted file mode 100644 (file)
index 2cb60d7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * ============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.drools.apps.controlloop.feature.frankfurt;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.onap.policy.drools.apps.controlloop.feature.frankfurt.FrankfurtFeature;
-
-public class FrankfurtFeatureTest {
-
-    @Test
-    public void testGetSequenceNumber() {
-        assertEquals(FrankfurtFeature.SEQNO, new FrankfurtFeature().getSequenceNumber());
-    }
-}
index 9993e63..36979a7 100644 (file)
@@ -2,7 +2,7 @@
 # ============LICENSE_START=======================================================
 # ONAP
 # ================================================================================
-# Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
 # Modifications Copyright (C) 2019-2020 Bell Canada.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # directory, it will be automatically loaded by PDP-D, after being expanded
 # by installation scripts.
 
-sql.db.host=${envd:SQL_HOST}
-sql.db.username=${envd:SQL_USER}
-sql.db.password=${envd:SQL_PASSWORD}
-
+# these can be removed once RestControlLoopManager is modified to use the Actor
+# model instead of using AaiManager
 aai.url=https://${envd:AAI_HOST}:${envd:AAI_PORT:443}/${envd:AAI_CONTEXT_URI}
 aai.username=${envd:AAI_USERNAME}
 aai.password=${envd:AAI_PASSWORD}
 
-so.url=${envd:SO_URL}
-so.username=${envd:SO_USERNAME}
-so.password=${envd:SO_PASSWORD}
-
-vfc.url=https://${envd:VFC_HOST}:${envd:VFC_PORT:443}/${envd:VFC_CONTEXT_URI}
-vfc.username=${envd:VFC_USERNAME}
-vfc.password=${envd:VFC_PASSWORD}
-
-pdpx.host=${envd:PDP_HOST}
-pdpx.username=${envd:PDP_USERNAME}
-pdpx.password=${envd:PDP_PASSWORD}
-
-guard.url=https://${envd:PDP_HOST}:${envd:PDP_PORT:443}/${envd:PDP_CONTEXT_URI}decision
-guard.jdbc.url=jdbc:mariadb://${envd:SQL_HOST}:3306/operationshistory
 guard.disabled=false
-
-sdnc.url=https://${envd:SDNC_HOST}:${envd:SDNC_PORT:443}/${envd:SDNC_CONTEXT_URI}
-sdnc.username=${envd:SDNC_USERNAME}
-sdnc.password=${envd:SDNC_PASSWORD}
-
-cds.grpcHost=${envd:CDS_GRPC_HOST}
-cds.grpcPort=${envd:CDS_GRPC_PORT}
-cds.grpcUsername=${envd:CDS_GRPC_USERNAME}
-cds.grpcPassword=${envd:CDS_GRPC_PASSWORD}
-# The timeout defined in policy will take preference over the one below always.
-# This timeout will be removed in Honolulu along with related code.
-cds.grpcTimeout=10
diff --git a/controlloop/common/feature-controlloop-tdjam/pom.xml b/controlloop/common/feature-controlloop-tdjam/pom.xml
deleted file mode 100644 (file)
index 0331e2a..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-<!--
-  ============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=========================================================
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-        <artifactId>drools-applications-common</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>feature-controlloop-tdjam</artifactId>
-
-    <description>
-        Load Experimental TDJAM Control Loop Controller as a feature.
-    </description>
-
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/feature</directory>
-                <filtering>true</filtering>
-            </resource>
-            <resource>
-                <directory>src/main/resources</directory>
-            </resource>
-        </resources>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>zipfile</id>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <phase>package</phase>
-                        <configuration>
-                            <attach>true</attach>
-                            <finalName>${project.artifactId}-${project.version}</finalName>
-                            <descriptors>
-                                <descriptor>src/assembly/assemble_zip.xml</descriptor>
-                            </descriptors>
-                            <appendAssemblyId>false</appendAssemblyId>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-dependencies</id>
-                        <goals>
-                            <goal>copy-dependencies</goal>
-                        </goals>
-                        <phase>prepare-package</phase>
-                        <configuration>
-                            <outputDirectory>${project.build.directory}/assembly/lib</outputDirectory>
-                            <overWriteReleases>false</overWriteReleases>
-                            <overWriteSnapshots>true</overWriteSnapshots>
-                            <overWriteIfNewer>true</overWriteIfNewer>
-                            <useRepositoryLayout>false</useRepositoryLayout>
-                            <addParentPoms>false</addParentPoms>
-                            <copyPom>false</copyPom>
-                            <includeScope>runtime</includeScope>
-                            <excludeTransitive>true</excludeTransitive>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-            <artifactId>controller-tdjam</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.drools-pdp</groupId>
-            <artifactId>policy-management</artifactId>
-            <version>${version.policy.drools-pdp}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/controlloop/common/feature-controlloop-tdjam/src/assembly/assemble_zip.xml b/controlloop/common/feature-controlloop-tdjam/src/assembly/assemble_zip.xml
deleted file mode 100644 (file)
index 7467549..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<!--
-  ============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=========================================================
-  -->
-
-<!-- Defines how we build the .zip file which is our distribution. -->
-
-<assembly
-    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-    <id>feature-controlloop-tdjam-package</id>
-    <formats>
-        <format>zip</format>
-    </formats>
-
-    <includeBaseDirectory>false</includeBaseDirectory>
-
-    <fileSets>
-        <fileSet>
-            <directory>target</directory>
-            <outputDirectory>lib/feature</outputDirectory>
-            <includes>
-                <include>feature-controlloop-tdjam-${project.version}.jar</include>
-            </includes>
-        </fileSet>
-        <fileSet>
-            <directory>target/assembly/lib</directory>
-            <outputDirectory>artifacts</outputDirectory>
-            <includes>
-                <include>controller-tdjam-${project.version}.jar</include>
-            </includes>
-        </fileSet>
-        <fileSet>
-            <directory>target/assembly/lib</directory>
-            <outputDirectory>lib/dependencies</outputDirectory>
-            <includes>
-                <include>*.jar</include>
-            </includes>
-            <excludes>
-                <exclude>controller-tdjam-${project.version}.jar</exclude>
-            </excludes>
-        </fileSet>
-        <fileSet>
-            <directory>target/classes/config</directory>
-            <outputDirectory>config</outputDirectory>
-            <fileMode>0644</fileMode>
-            <excludes />
-        </fileSet>
-        <fileSet>
-            <directory>src/main/feature/bin</directory>
-            <outputDirectory>bin</outputDirectory>
-            <fileMode>0755</fileMode>
-            <excludes />
-        </fileSet>
-        <fileSet>
-            <directory>src/main/feature/db</directory>
-            <outputDirectory>db</outputDirectory>
-            <fileMode>0744</fileMode>
-            <excludes />
-        </fileSet>
-        <fileSet>
-            <directory>src/main/feature/install</directory>
-            <outputDirectory>install</outputDirectory>
-            <fileMode>0755</fileMode>
-            <excludes />
-        </fileSet>
-    </fileSets>
-</assembly>
diff --git a/controlloop/common/feature-controlloop-tdjam/src/main/feature/config/logback-include-tdjam.xml b/controlloop/common/feature-controlloop-tdjam/src/main/feature/config/logback-include-tdjam.xml
deleted file mode 100644 (file)
index ae0384c..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-  feature-controlloop-tdjam
-  ================================================================================
-  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=========================================================
-  -->
-
-<!--
-  The logger configurations in this file are for each individual controller
-  to have their own network logger for topic traffic. This is an extension of
-  logback.xml or logback-eelf.xml.
-
-  NOTE: Each logger MUST contain the same name as the control loop's controller.
--->
-<included>
-
-    <property name="logDir" value="${POLICY_LOGS}" />
-    <property name="tdjamLog" value="tdjam-network" />
-    <property name="networkPattern" value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%t]%m%n" />
-
-    <!-- Tdjam Network Logging Properties -->
-    <appender name="TdjamOut" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${logDir}/${tdjamLog}.log</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${logDir}/${tdjamLog}.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
-            <maxFileSize>50MB</maxFileSize>
-            <maxHistory>30</maxHistory>
-            <totalSizeCap>10GB</totalSizeCap>
-        </rollingPolicy>
-        <encoder>
-            <pattern>${networkPattern}</pattern>
-        </encoder>
-    </appender>
-
-    <appender name="AsyncTdjamOut" class="ch.qos.logback.classic.AsyncAppender">
-        <appender-ref ref="TdjamOut" />
-    </appender>
-
-    <logger name="tdjam" level="INFO" additivity="false">
-        <appender-ref ref="AsyncTdjamOut" />
-    </logger>
-
-</included>
diff --git a/controlloop/common/feature-controlloop-tdjam/src/main/feature/config/tdjam-controller.properties b/controlloop/common/feature-controlloop-tdjam/src/main/feature/config/tdjam-controller.properties
deleted file mode 100644 (file)
index d507998..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-###
-# ============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=========================================================
-###
-
-controller.name=tdjam
-controller.type=tdjam
-
-rules.groupId=${project.groupId}
-rules.artifactId=controller-tdjam
-rules.version=${project.version}
-
-dmaap.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP
-dmaap.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL,DCAE_CL_RSP
-
-dmaap.source.topics.DCAE_TOPIC.events=\
-    org.onap.policy.controlloop.CanonicalOnset,org.onap.policy.controlloop.CanonicalAbated
-dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalOnset.filter=\
-    [?($.closedLoopEventStatus == 'ONSET')]
-dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalAbated.filter=\
-    [?($.closedLoopEventStatus == 'ABATED')]
-dmaap.source.topics.DCAE_TOPIC.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson
-
-dmaap.source.topics.APPC-CL.events=org.onap.policy.appc.Response
-dmaap.source.topics.APPC-CL.events.org.onap.policy.appc.Response.filter=[?($.CommonHeader && $.Status)]
-dmaap.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-
-dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')]
-dmaap.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-
-dmaap.sink.topics.APPC-CL.events=org.onap.policy.appc.Request
-dmaap.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-
-dmaap.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
-dmaap.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
-
-dmaap.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification
-dmaap.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
-dmaap.sink.topics.DCAE_CL_RSP.events=org.onap.policy.controlloop.ControlLoopResponse
-dmaap.sink.topics.DCAE_CL_RSP.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty
-
-dmaap.source.topics.SDNR-CL-RSP.events=org.onap.policy.sdnr.PciResponseWrapper
-dmaap.source.topics.SDNR-CL-RSP.events.org.onap.policy.sdnr.PciResponseWrapper.filter=[?($.type == 'response')]
-dmaap.source.topics.SDNR-CL-RSP.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson
diff --git a/controlloop/common/feature-controlloop-tdjam/src/main/java/org/onap/policy/drools/apps/controlloop/feature/tdjam/TdjamFeature.java b/controlloop/common/feature-controlloop-tdjam/src/main/java/org/onap/policy/drools/apps/controlloop/feature/tdjam/TdjamFeature.java
deleted file mode 100644 (file)
index 615dba4..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * ============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.drools.apps.controlloop.feature.tdjam;
-
-import org.onap.policy.drools.features.PolicyEngineFeatureApi;
-
-/**
- * TDJAM Use Cases installation as a feature saves time loading the controller at
- * runtime over the usual installation from nexus. It also reduces potential for errors in
- * the pom.xml generated in the brmsgw side.
- *
- * <p/>
- * There is no impact on other components as the brmsgw etc .. they will continue
- * operating as usual.
- *
- * <p/>
- * This class will be expanded in the future for additional functionality
- *
- */
-public class TdjamFeature implements PolicyEngineFeatureApi {
-
-    public static final int SEQNO = 1000;
-
-    @Override
-    public int getSequenceNumber() {
-        return SEQNO;
-    }
-}
diff --git a/controlloop/common/feature-controlloop-tdjam/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi b/controlloop/common/feature-controlloop-tdjam/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi
deleted file mode 100644 (file)
index 8ce2ea7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.drools.apps.controlloop.feature.tdjam.TdjamFeature
diff --git a/controlloop/common/feature-controlloop-tdjam/src/test/java/org/onap/policy/drools/apps/controlloop/feature/tdjam/TdjamFeatureTest.java b/controlloop/common/feature-controlloop-tdjam/src/test/java/org/onap/policy/drools/apps/controlloop/feature/tdjam/TdjamFeatureTest.java
deleted file mode 100644 (file)
index 0d64c04..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * ============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.drools.apps.controlloop.feature.tdjam;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.onap.policy.drools.apps.controlloop.feature.tdjam.TdjamFeature;
-
-public class TdjamFeatureTest {
-
-    @Test
-    public void testGetSequenceNumber() {
-        assertEquals(TdjamFeature.SEQNO, new TdjamFeature().getSequenceNumber());
-    }
-}
index 6f986f4..25c573c 100644 (file)
     <module>coordination</module>
     <module>eventmanager</module>
     <module>rules-test</module>
-    <module>controller-frankfurt</module>
     <module>controller-usecases</module>
-    <module>controller-tdjam</module>
     <module>feature-controlloop-utils</module>
     <module>feature-controlloop-trans</module>
     <module>feature-controlloop-management</module>
-    <module>feature-controlloop-frankfurt</module>
     <module>feature-controlloop-usecases</module>
-    <module>feature-controlloop-tdjam</module>
   </modules>
 
 
index 83825bc..9a82389 100644 (file)
@@ -41,7 +41,7 @@ import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.common.utils.coder.StandardCoderInstantAsMillis;
 import org.onap.policy.controlloop.ControlLoopNotificationType;
 import org.onap.policy.controlloop.VirtualControlLoopNotification;
-import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2;
+import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager;
 import org.onap.policy.drools.system.PolicyEngineConstants;
 import org.onap.policy.drools.system.internal.SimpleLockManager;
 import org.onap.policy.drools.system.internal.SimpleLockManager.SimpleLock;
@@ -632,7 +632,7 @@ public abstract class BaseTest {
     }
 
     protected long getCreateCount() {
-        return ControlLoopEventManager2.getCreateCount();
+        return ControlLoopEventManager.getCreateCount();
     }
 
     /**
index 64f0880..1b8f94c 100644 (file)
@@ -51,7 +51,7 @@ import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.common.utils.resources.ResourceUtils;
 import org.onap.policy.controlloop.ControlLoopEvent;
 import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
-import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2;
+import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager;
 import org.onap.policy.drools.controller.DroolsController;
 import org.onap.policy.drools.persistence.SystemPersistence;
 import org.onap.policy.drools.persistence.SystemPersistenceConstants;
@@ -152,7 +152,7 @@ public class Rules {
      * as any event managers and events.
      */
     public void resetFacts() {
-        List<Class<?>> classes = List.of(ToscaPolicy.class, ControlLoopParams.class, ControlLoopEventManager2.class,
+        List<Class<?>> classes = List.of(ToscaPolicy.class, ControlLoopParams.class, ControlLoopEventManager.class,
                         ControlLoopEvent.class);
 
         // delete all objects of the listed classes
index 3f1cc25..11f7d41 100644 (file)
@@ -63,7 +63,7 @@ import org.mockito.MockitoAnnotations;
 import org.onap.policy.common.utils.test.log.logback.ExtractAppender;
 import org.onap.policy.controlloop.ControlLoopEvent;
 import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
-import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2;
+import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager;
 import org.onap.policy.drools.controller.DroolsController;
 import org.onap.policy.drools.persistence.SystemPersistence;
 import org.onap.policy.drools.system.PolicyController;
@@ -239,7 +239,7 @@ public class RulesTest {
 
         verify(drools).delete(ToscaPolicy.class);
         verify(drools).delete(ControlLoopParams.class);
-        verify(drools).delete(ControlLoopEventManager2.class);
+        verify(drools).delete(ControlLoopEventManager.class);
         verify(drools).delete(ControlLoopEvent.class);
     }
 
index fadf057..db04e38 100644 (file)
       <version>${project.version}</version>
       <type>zip</type>
     </dependency>
-    <dependency>
-      <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-      <artifactId>feature-controlloop-frankfurt</artifactId>
-      <version>${project.version}</version>
-      <type>zip</type>
-    </dependency>
     <dependency>
       <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
       <artifactId>feature-controlloop-usecases</artifactId>
       <version>${project.version}</version>
       <type>zip</type>
     </dependency>
-    <dependency>
-      <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
-      <artifactId>feature-controlloop-tdjam</artifactId>
-      <version>${project.version}</version>
-      <type>zip</type>
-    </dependency>
   </dependencies>
 
 </project>
index 63b7b26..e236f8b 100644 (file)
@@ -33,16 +33,12 @@ RUN unzip apps-controlloop.zip && \
     chmod 600 $POLICY_HOME/config/* && \
     . $POLICY_HOME/etc/profile.d/env.sh && \
     $POLICY_HOME/bin/features install controlloop-utils controlloop-trans controlloop-management && \
-    $POLICY_HOME/bin/features install controlloop-frankfurt && \
     $POLICY_HOME/bin/features install controlloop-usecases && \
-    $POLICY_HOME/bin/features install controlloop-tdjam && \
     $POLICY_HOME/bin/features enable healthcheck distributed-locking lifecycle && \
     $POLICY_HOME/bin/features enable controlloop-trans controlloop-management && \
     $POLICY_HOME/bin/features enable controlloop-usecases && \
     $POLICY_HOME/bin/deploy-artifact -l -d -s $POLICY_HOME/etc/m2/standalone-settings.xml \
         -a $POLICY_HOME/features/controlloop-management/lib/feature/feature-controlloop-management-$BUILD_VERSION_APP_CL.jar && \
-    $POLICY_HOME/bin/deploy-artifact -l -d -s $POLICY_HOME/etc/m2/standalone-settings.xml \
-        -a $POLICY_HOME/features/controlloop-frankfurt/artifacts/controller-frankfurt-$BUILD_VERSION_APP_CL.jar && \
     $POLICY_HOME/bin/deploy-artifact -l -d -s $POLICY_HOME/etc/m2/standalone-settings.xml \
         -a $POLICY_HOME/features/controlloop-usecases/artifacts/controller-usecases-$BUILD_VERSION_APP_CL.jar && \
     find $HOME/.m2/ -name _maven.repositories -exec rm -v {} \; && \