Cleanup eclipse warnings in drools-pdp
[policy/drools-pdp.git] / policy-management / src / test / java / org / onap / policy / drools / system / PolicyEngineManagerTest.java
index 4b8357a..397e953 100644 (file)
@@ -27,12 +27,14 @@ 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.Matchers.any;
 import static org.mockito.Matchers.anyLong;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -41,6 +43,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
+import java.util.concurrent.ScheduledExecutorService;
 import java.util.function.BiConsumer;
 import java.util.function.Consumer;
 import org.junit.Before;
@@ -53,17 +56,21 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServer;
 import org.onap.policy.common.endpoints.http.server.HttpServletServerFactory;
 import org.onap.policy.common.utils.gson.GsonTestUtils;
 import org.onap.policy.drools.controller.DroolsController;
-import org.onap.policy.drools.features.PolicyControllerFeatureAPI;
-import org.onap.policy.drools.features.PolicyEngineFeatureAPI;
+import org.onap.policy.drools.core.lock.Lock;
+import org.onap.policy.drools.core.lock.LockCallback;
+import org.onap.policy.drools.core.lock.PolicyResourceLockManager;
+import org.onap.policy.drools.features.PolicyControllerFeatureApi;
+import org.onap.policy.drools.features.PolicyEngineFeatureApi;
 import org.onap.policy.drools.persistence.SystemPersistence;
-import org.onap.policy.drools.properties.DroolsProperties;
+import org.onap.policy.drools.properties.DroolsPropertyConstants;
 import org.onap.policy.drools.protocol.coders.EventProtocolCoder;
 import org.onap.policy.drools.protocol.configuration.ControllerConfiguration;
 import org.onap.policy.drools.protocol.configuration.DroolsConfiguration;
 import org.onap.policy.drools.protocol.configuration.PdpdConfiguration;
+import org.onap.policy.drools.system.internal.SimpleLockManager;
+import org.onap.policy.drools.system.internal.SimpleLockProperties;
 
 public class PolicyEngineManagerTest {
-
     private static final String EXPECTED = "expected exception";
 
     private static final String NOOP_STR = CommInfrastructure.NOOP.name();
@@ -76,6 +83,8 @@ public class PolicyEngineManagerTest {
     private static final String FEATURE2 = "feature-b";
     private static final String MY_TOPIC = "my-topic";
     private static final String MESSAGE = "my-message";
+    private static final String MY_OWNER = "my-owner";
+    private static final String MY_RESOURCE = "my-resource";
 
     private static final Object MY_EVENT = new Object();
 
@@ -83,12 +92,12 @@ public class PolicyEngineManagerTest {
                     .addHttpServletServerMock().build();
 
     private Properties properties;
-    private PolicyEngineFeatureAPI prov1;
-    private PolicyEngineFeatureAPI prov2;
-    private List<PolicyEngineFeatureAPI> providers;
-    private PolicyControllerFeatureAPI contProv1;
-    private PolicyControllerFeatureAPI contProv2;
-    private List<PolicyControllerFeatureAPI> contProviders;
+    private PolicyEngineFeatureApi prov1;
+    private PolicyEngineFeatureApi prov2;
+    private List<PolicyEngineFeatureApi> providers;
+    private PolicyControllerFeatureApi contProv1;
+    private PolicyControllerFeatureApi contProv2;
+    private List<PolicyControllerFeatureApi> contProviders;
     private String[] globalInitArgs;
     private TopicSource source1;
     private TopicSource source2;
@@ -125,6 +134,8 @@ public class PolicyEngineManagerTest {
     private PdpdConfiguration pdpConfig;
     private String pdpConfigJson;
     private PolicyEngineManager mgr;
+    private ScheduledExecutorService exsvc;
+    private PolicyResourceLockManager lockmgr;
 
     /**
      * Initializes the object to be tested.
@@ -135,11 +146,11 @@ public class PolicyEngineManagerTest {
     public void setUp() throws Exception {
 
         properties = new Properties();
-        prov1 = mock(PolicyEngineFeatureAPI.class);
-        prov2 = mock(PolicyEngineFeatureAPI.class);
+        prov1 = mock(PolicyEngineFeatureApi.class);
+        prov2 = mock(PolicyEngineFeatureApi.class);
         providers = Arrays.asList(prov1, prov2);
-        contProv1 = mock(PolicyControllerFeatureAPI.class);
-        contProv2 = mock(PolicyControllerFeatureAPI.class);
+        contProv1 = mock(PolicyControllerFeatureApi.class);
+        contProv2 = mock(PolicyControllerFeatureApi.class);
         contProviders = Arrays.asList(contProv1, contProv2);
         globalInitArgs = null;
         source1 = mock(TopicSource.class);
@@ -176,6 +187,15 @@ public class PolicyEngineManagerTest {
         config3 = new ControllerConfiguration();
         config4 = new ControllerConfiguration();
         pdpConfig = new PdpdConfiguration();
+        exsvc = mock(ScheduledExecutorService.class);
+        lockmgr = mock(PolicyResourceLockManager.class);
+
+        when(lockmgr.start()).thenReturn(true);
+        when(lockmgr.stop()).thenReturn(true);
+        when(lockmgr.lock()).thenReturn(true);
+        when(lockmgr.unlock()).thenReturn(true);
+
+        when(prov2.beforeCreateLockManager(any(), any())).thenReturn(lockmgr);
 
         when(prov1.getName()).thenReturn(FEATURE1);
         when(prov2.getName()).thenReturn(FEATURE2);
@@ -238,8 +258,8 @@ public class PolicyEngineManagerTest {
         when(controller4.lock()).thenReturn(true);
         when(controller4.unlock()).thenReturn(true);
 
-        when(endpoint.addTopicSources(any())).thenReturn(sources);
-        when(endpoint.addTopicSinks(any())).thenReturn(sinks);
+        when(endpoint.addTopicSources(any(Properties.class))).thenReturn(sources);
+        when(endpoint.addTopicSinks(any(Properties.class))).thenReturn(sinks);
         when(endpoint.start()).thenReturn(true);
         when(endpoint.stop()).thenReturn(true);
         when(endpoint.lock()).thenReturn(true);
@@ -368,6 +388,16 @@ public class PolicyEngineManagerTest {
 
         assertNotNull(mgr.getEnvironmentProperty("PATH"));
         assertNull(mgr.getEnvironmentProperty("unknown-env-property"));
+
+        System.setProperty("propS-a", "valueS-a");
+        assertEquals("valueS-a", mgr.getEnvironmentProperty("propS-a"));
+
+        Properties props3 = new Properties();
+        props3.put("prop3-a", "${env:HOME}");
+        mgr.setEnvironment(props3);
+        assertEquals(System.getenv("HOME"), mgr.getEnvironmentProperty("prop3-a"));
+        assertEquals("valueS-a", mgr.getEnvironmentProperty("propS-a"));
+        assertEquals(newValue, mgr.getEnvironmentProperty(propKey));
     }
 
     @Test
@@ -377,6 +407,86 @@ public class PolicyEngineManagerTest {
         assertFalse(config.isEmpty());
     }
 
+    /**
+     * Tests that makeExecutorService() uses the value from the thread
+     * property.
+     */
+    @Test
+    public void testMakeExecutorServicePropertyProvided() {
+        PolicyEngineManager mgrspy = spy(mgr);
+
+        properties.setProperty(PolicyEngineManager.EXECUTOR_THREAD_PROP, "3");
+        mgrspy.configure(properties);
+        assertSame(exsvc, mgrspy.getExecutorService());
+        verify(mgrspy).makeScheduledExecutor(3);
+    }
+
+    /**
+     * Tests that makeExecutorService() uses the default thread count when no thread
+     * property is provided.
+     */
+    @Test
+    public void testMakeExecutorServiceNoProperty() {
+        PolicyEngineManager mgrspy = spy(mgr);
+
+        mgrspy.configure(properties);
+        assertSame(exsvc, mgrspy.getExecutorService());
+        verify(mgrspy).makeScheduledExecutor(PolicyEngineManager.DEFAULT_EXECUTOR_THREADS);
+    }
+
+    /**
+     * Tests that makeExecutorService() uses the default thread count when the thread
+     * property is invalid.
+     */
+    @Test
+    public void testMakeExecutorServiceInvalidProperty() {
+        PolicyEngineManager mgrspy = spy(mgr);
+
+        properties.setProperty(PolicyEngineManager.EXECUTOR_THREAD_PROP, "abc");
+        mgrspy.configure(properties);
+        assertSame(exsvc, mgrspy.getExecutorService());
+        verify(mgrspy).makeScheduledExecutor(PolicyEngineManager.DEFAULT_EXECUTOR_THREADS);
+    }
+
+    /**
+     * Tests createLockManager() when beforeCreateLock throws an exception and returns a
+     * manager.
+     */
+    @Test
+    public void testCreateLockManagerHaveProvider() {
+        // first provider throws an exception
+        when(prov1.beforeCreateLockManager(any(), any())).thenThrow(new RuntimeException(EXPECTED));
+
+        mgr.configure(properties);
+        assertSame(lockmgr, mgr.getLockManager());
+    }
+
+    /**
+     * Tests createLockManager() when SimpleLockManager throws an exception.
+     */
+    @Test
+    public void testCreateLockManagerSimpleEx() {
+        when(prov2.beforeCreateLockManager(any(), any())).thenReturn(null);
+
+        // invalid property for SimpleLockManager
+        properties.setProperty(SimpleLockProperties.EXPIRE_CHECK_SEC, "abc");
+        mgr.configure(properties);
+
+        // should create a manager using default properties
+        assertTrue(mgr.getLockManager() instanceof SimpleLockManager);
+    }
+
+    /**
+     * Tests createLockManager() when SimpleLockManager is returned.
+     */
+    @Test
+    public void testCreateLockManagerSimple() {
+        when(prov2.beforeCreateLockManager(any(), any())).thenReturn(null);
+
+        mgr.configure(properties);
+        assertTrue(mgr.getLockManager() instanceof SimpleLockManager);
+    }
+
     @Test
     public void testConfigureProperties() throws Exception {
         // arrange for first provider to throw exceptions
@@ -442,7 +552,7 @@ public class PolicyEngineManagerTest {
 
         // source list of size 1
         setUp();
-        when(endpoint.addTopicSources(any())).thenReturn(Arrays.asList(source1));
+        when(endpoint.addTopicSources(any(Properties.class))).thenReturn(Arrays.asList(source1));
         mgr.configure(properties);
         assertTrue(mgr.configure(pdpConfig));
 
@@ -482,19 +592,19 @@ public class PolicyEngineManagerTest {
 
         // empty name in properties - same result
         setUp();
-        properties.setProperty(DroolsProperties.PROPERTY_CONTROLLER_NAME, "");
+        properties.setProperty(DroolsPropertyConstants.PROPERTY_CONTROLLER_NAME, "");
         assertEquals(controller, mgr.createPolicyController(MY_NAME, properties));
         verify(contProv1).beforeCreate(MY_NAME, properties);
 
         // matching name in properties - same result
         setUp();
-        properties.setProperty(DroolsProperties.PROPERTY_CONTROLLER_NAME, MY_NAME);
+        properties.setProperty(DroolsPropertyConstants.PROPERTY_CONTROLLER_NAME, MY_NAME);
         assertEquals(controller, mgr.createPolicyController(MY_NAME, properties));
         verify(contProv1).beforeCreate(MY_NAME, properties);
 
         // mismatching name in properties - nothing should happen besides exception
         setUp();
-        properties.setProperty(DroolsProperties.PROPERTY_CONTROLLER_NAME, "mistmatched-name");
+        properties.setProperty(DroolsPropertyConstants.PROPERTY_CONTROLLER_NAME, "mistmatched-name");
         assertThatIllegalStateException().isThrownBy(() -> mgr.createPolicyController(MY_NAME, properties));
         verify(contProv1, never()).beforeCreate(MY_NAME, properties);
 
@@ -657,14 +767,20 @@ public class PolicyEngineManagerTest {
             when(sink1.start()).thenThrow(new RuntimeException(EXPECTED));
         });
 
+        // lock manager fails to start - still does everything
+        testStart(false, () -> when(lockmgr.start()).thenReturn(false));
+
+        //  lock manager throws an exception - still does everything
+        testStart(false, () -> when(lockmgr.start()).thenThrow(new RuntimeException(EXPECTED)));
+
         // servlet wait fails - still does everything
         testStart(false, () -> when(server1.waitedStart(anyLong())).thenReturn(false));
 
-        // topic source fails to start - still does everything
-        testStart(false, () -> when(source1.start()).thenReturn(false));
+        // topic source is not started with start
+        testStart(true, () -> when(source1.start()).thenReturn(false));
 
-        // topic sink fails to start - still does everything
-        testStart(false, () -> when(sink1.start()).thenReturn(false));
+        // topic sink is not started with start
+        testStart(true, () -> when(sink1.start()).thenReturn(false));
 
         // controller fails to start - still does everything
         testStart(false, () -> when(controller.start()).thenReturn(false));
@@ -725,11 +841,11 @@ public class PolicyEngineManagerTest {
         verify(server1).waitedStart(anyLong());
         verify(server2).waitedStart(anyLong());
 
-        verify(source1).start();
-        verify(source2).start();
+        verify(source1, never()).start();
+        verify(source2, never()).start();
 
-        verify(sink1).start();
-        verify(sink2).start();
+        verify(sink1, never()).start();
+        verify(sink2, never()).start();
 
         verify(controller).start();
         verify(controller2).start();
@@ -786,6 +902,12 @@ public class PolicyEngineManagerTest {
         // servlet fails to stop - still does everything
         testStop(false, () -> when(server1.stop()).thenReturn(false));
 
+        // lock manager fails to stop - still does everything
+        testStop(false, () -> when(lockmgr.stop()).thenReturn(false));
+
+        // lock manager throws an exception - still does everything
+        testStop(false, () -> when(lockmgr.stop()).thenThrow(new RuntimeException(EXPECTED)));
+
         // other tests
         checkBeforeAfter(
             (prov, flag) -> when(prov.beforeStop(mgr)).thenReturn(flag),
@@ -851,6 +973,10 @@ public class PolicyEngineManagerTest {
         assertTrue(threadStarted);
         assertTrue(threadInterrupted);
 
+
+        // lock manager throws an exception - still does everything
+        testShutdown(() -> doThrow(new RuntimeException(EXPECTED)).when(lockmgr).shutdown());
+
         // other tests
         checkBeforeAfter(
             (prov, flag) -> when(prov.beforeShutdown(mgr)).thenReturn(flag),
@@ -896,6 +1022,8 @@ public class PolicyEngineManagerTest {
 
         verify(prov1).afterShutdown(mgr);
         verify(prov2).afterShutdown(mgr);
+
+        verify(exsvc).shutdownNow();
     }
 
     @Test
@@ -975,6 +1103,12 @@ public class PolicyEngineManagerTest {
         // endpoint manager fails to lock - still does everything
         testLock(false, () -> when(endpoint.lock()).thenReturn(false));
 
+        // lock manager fails to lock - still does everything
+        testLock(false, () -> when(lockmgr.lock()).thenReturn(false));
+
+        // lock manager throws an exception - still does everything
+        testLock(false, () -> when(lockmgr.lock()).thenThrow(new RuntimeException(EXPECTED)));
+
         // other tests
         checkBeforeAfter(
             (prov, flag) -> when(prov.beforeLock(mgr)).thenReturn(flag),
@@ -1045,6 +1179,12 @@ public class PolicyEngineManagerTest {
         // endpoint manager fails to unlock - still does everything
         testUnlock(false, () -> when(endpoint.unlock()).thenReturn(false));
 
+        // lock manager fails to lock - still does everything
+        testUnlock(false, () -> when(lockmgr.unlock()).thenReturn(false));
+
+        // lock manager throws an exception - still does everything
+        testUnlock(false, () -> when(lockmgr.unlock()).thenThrow(new RuntimeException(EXPECTED)));
+
         // other tests
         checkBeforeAfter(
             (prov, flag) -> when(prov.beforeUnlock(mgr)).thenReturn(flag),
@@ -1473,6 +1613,87 @@ public class PolicyEngineManagerTest {
         verify(prov2).afterDeactivate(mgr);
     }
 
+    @Test
+    public void testCreateLock() {
+        Lock lock = mock(Lock.class);
+        LockCallback callback = mock(LockCallback.class);
+        when(lockmgr.createLock(MY_RESOURCE, MY_OWNER, 10, callback, false)).thenReturn(lock);
+
+        // not configured yet, thus no lock manager
+        assertThatIllegalStateException()
+                        .isThrownBy(() -> mgr.createLock(MY_RESOURCE, MY_OWNER, 10, callback, false));
+
+        // now configure it and try again
+        mgr.configure(properties);
+        assertSame(lock, mgr.createLock(MY_RESOURCE, MY_OWNER, 10, callback, false));
+
+        // test illegal args
+        assertThatThrownBy(() -> mgr.createLock(null, MY_OWNER, 10, callback, false))
+                        .hasMessageContaining("resourceId");
+        assertThatThrownBy(() -> mgr.createLock(MY_RESOURCE, null, 10, callback, false))
+                        .hasMessageContaining("ownerKey");
+        assertThatIllegalArgumentException()
+                        .isThrownBy(() -> mgr.createLock(MY_RESOURCE, MY_OWNER, -1, callback, false))
+                        .withMessageContaining("holdSec");
+        assertThatThrownBy(() -> mgr.createLock(MY_RESOURCE, MY_OWNER, 10, null, false))
+                        .hasMessageContaining("callback");
+    }
+
+    @Test
+    public void testOpen() throws Throwable {
+        when(prov1.beforeOpen(mgr)).thenThrow(new RuntimeException(EXPECTED));
+        when(prov1.afterOpen(mgr)).thenThrow(new RuntimeException(EXPECTED));
+
+        assertTrue(mgr.lock());
+        assertThatIllegalStateException().isThrownBy(() -> mgr.open());
+        unsuccessfulOpen();
+
+        assertTrue(mgr.unlock());
+        unsuccessfulOpen();
+
+        setUp();
+        mgr.configure(properties);
+        assertTrue(mgr.start());
+
+        verify(source1, never()).start();
+        verify(source2, never()).start();
+
+        assertTrue(mgr.open());
+
+        verify(prov1).beforeOpen(mgr);
+        verify(prov2).beforeOpen(mgr);
+
+        verify(source1).start();
+        verify(source2).start();
+
+        verify(prov1).afterOpen(mgr);
+        verify(prov2).afterOpen(mgr);
+
+        when(source1.start()).thenReturn(false);
+        assertFalse(mgr.open());
+        when(source1.start()).thenReturn(true);
+
+        when(sink1.start()).thenReturn(false);
+        assertFalse(mgr.open());
+        when(sink1.start()).thenReturn(true);
+
+        assertTrue(mgr.open());
+    }
+
+    private void unsuccessfulOpen() {
+        verify(prov1).beforeOpen(mgr);
+        verify(prov2).beforeOpen(mgr);
+
+        verify(prov1, never()).afterOpen(mgr);
+        verify(prov2, never()).afterOpen(mgr);
+
+        verify(source1, never()).start();
+        verify(source2, never()).start();
+
+        verify(sink1, never()).start();
+        verify(sink2, never()).start();
+    }
+
     @Test
     public void testControllerConfig() throws Exception {
         mgr.configure(properties);
@@ -1522,10 +1743,10 @@ public class PolicyEngineManagerTest {
      * @param verifyAfter verifies that a provider's afterXxx method was invoked
      * @throws Exception if an error occurs while calling {@link #setUp()}
      */
-    private void checkBeforeAfter(BiConsumer<PolicyEngineFeatureAPI, Boolean> setBefore,
-                    BiConsumer<PolicyEngineFeatureAPI, Boolean> setAfter, Runnable action,
-                    Consumer<PolicyEngineFeatureAPI> verifyBefore, Runnable verifyMiddle,
-                    Consumer<PolicyEngineFeatureAPI> verifyAfter) throws Exception {
+    private void checkBeforeAfter(BiConsumer<PolicyEngineFeatureApi, Boolean> setBefore,
+                    BiConsumer<PolicyEngineFeatureApi, Boolean> setAfter, Runnable action,
+                    Consumer<PolicyEngineFeatureApi> verifyBefore, Runnable verifyMiddle,
+                    Consumer<PolicyEngineFeatureApi> verifyAfter) throws Exception {
 
         checkBeforeAfter_FalseFalse(setBefore, setAfter, action, verifyBefore, verifyMiddle, verifyAfter);
         checkBeforeAfter_FalseTrue(setBefore, setAfter, action, verifyBefore, verifyMiddle, verifyAfter);
@@ -1547,10 +1768,10 @@ public class PolicyEngineManagerTest {
      * @param verifyAfter verifies that a provider's afterXxx method was invoked
      * @throws Exception if an error occurs while calling {@link #setUp()}
      */
-    private void checkBeforeAfter_FalseFalse(BiConsumer<PolicyEngineFeatureAPI, Boolean> setBefore,
-                    BiConsumer<PolicyEngineFeatureAPI, Boolean> setAfter, Runnable action,
-                    Consumer<PolicyEngineFeatureAPI> verifyBefore, Runnable verifyMiddle,
-                    Consumer<PolicyEngineFeatureAPI> verifyAfter) throws Exception {
+    private void checkBeforeAfter_FalseFalse(BiConsumer<PolicyEngineFeatureApi, Boolean> setBefore,
+                    BiConsumer<PolicyEngineFeatureApi, Boolean> setAfter, Runnable action,
+                    Consumer<PolicyEngineFeatureApi> verifyBefore, Runnable verifyMiddle,
+                    Consumer<PolicyEngineFeatureApi> verifyAfter) throws Exception {
 
         setUp();
 
@@ -1588,10 +1809,10 @@ public class PolicyEngineManagerTest {
      * @param verifyAfter verifies that a provider's afterXxx method was invoked
      * @throws Exception if an error occurs while calling {@link #setUp()}
      */
-    private void checkBeforeAfter_FalseTrue(BiConsumer<PolicyEngineFeatureAPI, Boolean> setBefore,
-                    BiConsumer<PolicyEngineFeatureAPI, Boolean> setAfter, Runnable action,
-                    Consumer<PolicyEngineFeatureAPI> verifyBefore, Runnable verifyMiddle,
-                    Consumer<PolicyEngineFeatureAPI> verifyAfter) throws Exception {
+    private void checkBeforeAfter_FalseTrue(BiConsumer<PolicyEngineFeatureApi, Boolean> setBefore,
+                    BiConsumer<PolicyEngineFeatureApi, Boolean> setAfter, Runnable action,
+                    Consumer<PolicyEngineFeatureApi> verifyBefore, Runnable verifyMiddle,
+                    Consumer<PolicyEngineFeatureApi> verifyAfter) throws Exception {
 
         setUp();
 
@@ -1629,10 +1850,10 @@ public class PolicyEngineManagerTest {
      * @param verifyAfter verifies that a provider's afterXxx method was invoked
      * @throws Exception if an error occurs while calling {@link #setUp()}
      */
-    private void checkBeforeAfter_TrueFalse(BiConsumer<PolicyEngineFeatureAPI, Boolean> setBefore,
-                    BiConsumer<PolicyEngineFeatureAPI, Boolean> setAfter, Runnable action,
-                    Consumer<PolicyEngineFeatureAPI> verifyBefore, Runnable verifyMiddle,
-                    Consumer<PolicyEngineFeatureAPI> verifyAfter) throws Exception {
+    private void checkBeforeAfter_TrueFalse(BiConsumer<PolicyEngineFeatureApi, Boolean> setBefore,
+                    BiConsumer<PolicyEngineFeatureApi, Boolean> setAfter, Runnable action,
+                    Consumer<PolicyEngineFeatureApi> verifyBefore, Runnable verifyMiddle,
+                    Consumer<PolicyEngineFeatureApi> verifyAfter) throws Exception {
 
         setUp();
 
@@ -1664,12 +1885,12 @@ public class PolicyEngineManagerTest {
     private class PolicyEngineManagerImpl extends PolicyEngineManager {
 
         @Override
-        protected List<PolicyEngineFeatureAPI> getEngineProviders() {
+        protected List<PolicyEngineFeatureApi> getEngineProviders() {
             return providers;
         }
 
         @Override
-        protected List<PolicyControllerFeatureAPI> getControllerProviders() {
+        protected List<PolicyControllerFeatureApi> getControllerProviders() {
             return contProviders;
         }
 
@@ -1724,6 +1945,11 @@ public class PolicyEngineManagerTest {
             return engine;
         }
 
+        @Override
+        protected ScheduledExecutorService makeScheduledExecutor(int nthreads) {
+            return exsvc;
+        }
+
         /**
          * Shutdown thread with overrides.
          */