Changes to PAP infrastructure to support PDP
[policy/pap.git] / main / src / test / java / org / onap / policy / pap / main / rest / TestStatisticsRestControllerV1.java
index 9874389..1894fd7 100644 (file)
 package org.onap.policy.pap.main.rest;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Modifier;
 import javax.ws.rs.client.Invocation;
-import org.junit.Before;
 import org.junit.Test;
+import org.onap.policy.common.utils.services.Registry;
+import org.onap.policy.pap.main.PapConstants;
 
 /**
  * Class to perform unit test of {@link PapRestServer}.
@@ -39,18 +37,6 @@ public class TestStatisticsRestControllerV1 extends CommonPapRestServer {
 
     private static final String STATISTICS_ENDPOINT = "statistics";
 
-    /**
-     * Set up.
-     *
-     * @throws Exception if an error occurs
-     */
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-
-        PapStatisticsManager.getInstance().resetAllStatistics();
-    }
-
     @Test
     public void testSwagger() throws Exception {
         super.testSwagger(STATISTICS_ENDPOINT);
@@ -76,21 +62,15 @@ public class TestStatisticsRestControllerV1 extends CommonPapRestServer {
 
         markActivatorDead();
 
-        PapStatisticsManager.getInstance().resetAllStatistics();
+        Registry.get(PapConstants.REG_STATISTICS_MANAGER, PapStatisticsManager.class).resetAllStatistics();
 
         Invocation.Builder invocationBuilder = sendRequest(STATISTICS_ENDPOINT);
         StatisticsReport report = invocationBuilder.get(StatisticsReport.class);
         validateStatisticsReport(report, 0, 500);
     }
 
-    @Test
-    public void testPapStatisticsConstructorIsProtected() throws Exception {
-        final Constructor<PapStatisticsManager> constructor = PapStatisticsManager.class.getDeclaredConstructor();
-        assertTrue(Modifier.isProtected(constructor.getModifiers()));
-    }
-
     private void updateDistributionStatistics() {
-        PapStatisticsManager mgr = PapStatisticsManager.getInstance();
+        PapStatisticsManager mgr = Registry.get(PapConstants.REG_STATISTICS_MANAGER, PapStatisticsManager.class);
 
         mgr.updateTotalPdpCount();
         mgr.updateTotalPdpGroupCount();