aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-01-10 10:32:17 -0500
committerJim Hahn <jrh3@att.com>2020-01-10 11:12:58 -0500
commite9c14cfca7af2ec822a6c88724c055fbd716152f (patch)
tree632ae39d2ebda838aa5f55747bcbf51c3cd2e2d9
parentf5cd84316856905a3206f715de958c875fef98d0 (diff)
Prepare drools-pdp for java 11
The Observer class has been deprecated. Changed the code to use StateChangeNotifier, instead, in anticipation of a corresponding change in policy/common. Also fixed new issue with missing getSupportedPolicyTypes() method. Issue-ID: POLICY-1406 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I2d3ee29f13bd12a2e16644a1746f066c91c05475
-rw-r--r--api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureApi.java6
-rw-r--r--feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java4
-rw-r--r--feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeature.java7
3 files changed, 6 insertions, 11 deletions
diff --git a/api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureApi.java b/api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureApi.java
index bdac688e..c267968c 100644
--- a/api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureApi.java
+++ b/api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureApi.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-core
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -20,10 +20,10 @@
package org.onap.policy.drools.statemanagement;
-import java.util.Observer;
import javax.validation.constraints.NotNull;
import org.onap.policy.common.capabilities.Lockable;
import org.onap.policy.common.im.AllSeemsWellException;
+import org.onap.policy.common.im.StateChangeNotifier;
import org.onap.policy.common.utils.services.OrderedService;
/**
@@ -61,7 +61,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
*
* @param stateChangeObserver observer
*/
- void addObserver(Observer stateChangeObserver);
+ void addObserver(StateChangeNotifier stateChangeObserver);
/**
* Returns the X.731 Administrative State for this resource.
diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java
index fe3566db..06fd08ca 100644
--- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java
+++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java
@@ -98,10 +98,6 @@ public abstract class LifecycleStateRunningTest {
String[] events = fsm.client.getSink().getRecentEvents();
PdpStatus status = new StandardCoder().decode(events[events.length - 1], PdpStatus.class);
- if (status.getSupportedPolicyTypes() != null) {
- return false;
- }
-
return status.getMessageName() == PdpMessageType.PDP_STATUS && state == status.getState();
};
}
diff --git a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeature.java b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeature.java
index 7d5ba512..f88eaead 100644
--- a/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeature.java
+++ b/feature-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeature.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* feature-state-management
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -21,10 +21,9 @@
package org.onap.policy.drools.statemanagement;
import java.io.IOException;
-import java.util.Observer;
import java.util.Properties;
-
import org.onap.policy.common.im.AllSeemsWellException;
+import org.onap.policy.common.im.StateChangeNotifier;
import org.onap.policy.common.im.StateManagement;
import org.onap.policy.drools.core.PolicySessionFeatureApi;
import org.onap.policy.drools.features.PolicyEngineFeatureApi;
@@ -94,7 +93,7 @@ public class StateManagementFeature implements StateManagementFeatureApi,
* {@inheritDoc}.
*/
@Override
- public void addObserver(Observer stateChangeObserver) {
+ public void addObserver(StateChangeNotifier stateChangeObserver) {
logger.debug("StateManagementFeature.addObserver() entry\n"
+ "StateManagementFeature.addObserver(): "
+ "stateManagement.getAdminState(): {}", stateManagement.getAdminState());