Update of StandbyStateManagementTest 57/47157/1
authorKevin McKiou <km097d@att.com>
Thu, 10 May 2018 23:19:44 +0000 (18:19 -0500)
committerKevin McKiou <km097d@att.com>
Thu, 10 May 2018 23:20:13 +0000 (18:20 -0500)
Patch 1:
This change modifies StandbyStateManagementTest
testPMStandbyStateChangeNotifer() to use a fresh instance of
StateManagement to avoid interaction with previous tests.

Issue-ID: POLICY-790
Change-Id: I5907ba6b50091bc4f7789f102f48a853d8498ed5
Signed-off-by: Kevin McKiou <km097d@att.com>
feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/StandbyStateManagementTest.java

index 0ad21f0..b79deeb 100644 (file)
@@ -219,27 +219,14 @@ public class StandbyStateManagementTest {
                Properties activeStandbyProperties = new Properties();
                activeStandbyProperties.load(new FileInputStream(new File(
                                configDir + "/feature-active-standby-management.properties")));
+               
+               String resourceName = "testPMS";
+               activeStandbyProperties.setProperty("resource.name", resourceName);
                ActiveStandbyProperties.initProperties(activeStandbyProperties);
-               String thisPdpId = ActiveStandbyProperties.getProperty(ActiveStandbyProperties.NODE_NAME);
                
-               logger.debug("testPMStandbyStateChangeNotifier: Getting StateManagementFeatureAPI");
-
-               StateManagementFeatureAPI sm = null;
-               for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList())
-               {
-                       ((PolicySessionFeatureAPI) feature).globalInit(null, configDir);
-                       sm = feature;
-                       logger.debug("testPMStandbyStateChangeNotifier stateManagementFeature.getResourceName(): {}", sm.getResourceName());
-                       break;
-               }
-               if(sm == null){
-                       logger.error("testPMStandbyStateChangeNotifier failed to initialize.  "
-                                       + "Unable to get instance of StateManagementFeatureAPI "
-                                       + "with resourceID: {}", thisPdpId);
-                       logger.debug("testPMStandbyStateChangeNotifier failed to initialize.  "
-                                       + "Unable to get instance of StateManagementFeatureAPI "
-                                       + "with resourceID: {}", thisPdpId);
-               }
+               logger.debug("testPMStandbyStateChangeNotifier: Getting StateManagement instance");
+               
+               StateManagement sm = new StateManagement(emfx, resourceName);
 
                //Create an instance of the Observer
                PMStandbyStateChangeNotifier pmNotifier = new PMStandbyStateChangeNotifier();