diff options
Diffstat (limited to 'feature-lifecycle/src/test')
3 files changed, 13 insertions, 22 deletions
diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/ControllerSupport.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/ControllerSupport.java index 4c1830b8..4e0b4bf7 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/ControllerSupport.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/ControllerSupport.java @@ -135,14 +135,10 @@ public class ControllerSupport { * Change final marker in static field. */ public static <T> Field unsetFinalStaticAccess(Class<T> clazz, String fieldName) - throws NoSuchFieldException, IllegalAccessException { + throws NoSuchFieldException { Field field = clazz.getDeclaredField(fieldName); field.setAccessible(true); - Field modifiers = Field.class.getDeclaredField("modifiers"); - modifiers.setAccessible(true); - modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL); - return field; } diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java index 31fe3ebc..90c0d94c 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java @@ -163,7 +163,7 @@ public class LifecycleFsmUpdateTest { // checkstyle } - //ControllerSupport.setStaticField(LifecycleFeature.class, "fsm", savedFsm); + ControllerSupport.setStaticField(LifecycleFeature.class, "fsm", savedFsm); } /** @@ -177,7 +177,7 @@ public class LifecycleFsmUpdateTest { return new PseudoScheduledExecutorService(new TestTimeMulti()); } }; - //ControllerSupport.setStaticField(LifecycleFeature.class, "fsm", fsm); + ControllerSupport.setStaticField(LifecycleFeature.class, "fsm", fsm); fsm.setStatusTimerSeconds(15); assertTrue(fsm.start()); @@ -206,8 +206,7 @@ public class LifecycleFsmUpdateTest { unvalPolicy = getPolicyFromFile(EXAMPLE_OTHER_UNVAL_POLICY_JSON, EXAMPLE_OTHER_UNVAL_POLICY_NAME); } - - //TODO This test needs to be enabled in java-17 branch + @Test public void testUpdate() throws CoderException { verifyInitState(); @@ -365,7 +364,7 @@ public class LifecycleFsmUpdateTest { protected void deltaUpdate(List<ToscaPolicy> deploy, List<ToscaPolicy> undeploy, List<ToscaPolicy> active, long deployCount, long deploySuccess, long deployFail, long undeployCount, long undeploySuccess, long undeployFail) throws CoderException { - //assertTrue(fsm.update(getPdpUpdate(deploy, undeploy))); + assertTrue(fsm.update(getPdpUpdate(deploy, undeploy))); verifyDeploy(active, deployCount, deploySuccess, deployFail, undeployCount, undeploySuccess, undeployFail); } diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java index 9a756c74..29ef5a77 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java @@ -158,24 +158,20 @@ public class RestLifecycleManagerTest { */ @After public void tearDown() { - if (fsm != null) { - fsm.shutdown(); + fsm.shutdown(); - NoopTopicFactories.getSourceFactory().destroy(); - NoopTopicFactories.getSinkFactory().destroy(); + NoopTopicFactories.getSourceFactory().destroy(); + NoopTopicFactories.getSinkFactory().destroy(); - HttpClientFactoryInstance.getClientFactory().destroy(); - HttpServletServerFactoryInstance.getServerFactory().destroy(); + HttpClientFactoryInstance.getClientFactory().destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); - PolicyControllerConstants.getFactory().destroy(); - SystemPersistenceConstants.getManager().setConfigurationDir(null); - } + PolicyControllerConstants.getFactory().destroy(); + SystemPersistenceConstants.getManager().setConfigurationDir(null); } - - //TODO The below test needs to be enabled in java-17 branch - + @Test public void testMultiPolicyFlow() throws IOException, CoderException { /* group assignments */ |