Cleanup eclipse warnings 81/104381/2
authorPamela Dragosh <pdragosh@research.att.com>
Wed, 25 Mar 2020 15:39:59 +0000 (11:39 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Wed, 25 Mar 2020 17:00:53 +0000 (13:00 -0400)
Issue-ID: POLICY-2271
Change-Id: Ib28a6f5321cc05b03994e180867461a631d40d75
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
main/src/test/java/org/onap/policy/pap/main/TestExceptions.java
main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java
main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java

index 9e3cda9..608e7ad 100644 (file)
@@ -1,7 +1,7 @@
-/*
+/*--
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,8 +23,6 @@ package org.onap.policy.pap.main;
 
 import org.junit.Test;
 import org.onap.policy.common.utils.test.ExceptionsTester;
-import org.onap.policy.pap.main.PolicyPapException;
-import org.onap.policy.pap.main.PolicyPapRuntimeException;
 
 /**
  * Class to perform unit test of {@link PolicyPapException PolicyPapRuntimeException}}.
index cf0da93..d898b5e 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Inc.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,8 +56,7 @@ public class TestPolicyComponentsHealthCheckControllerV1 extends CommonPapRestSe
     public static void setUpClass() {
         // To skip calling to the remote components
         PapParameterGroup papParameterGroup = ParameterService.get("PapGroup");
-        List<BusTopicParams> lo = Whitebox.getInternalState(papParameterGroup,
-            "healthCheckRestClientParameters");
+        List<BusTopicParams> lo = Whitebox.getInternalState(papParameterGroup, "healthCheckRestClientParameters");
         savedBusTopicParams = new ArrayList<>(lo);
         lo.clear();
     }
@@ -67,8 +67,7 @@ public class TestPolicyComponentsHealthCheckControllerV1 extends CommonPapRestSe
     @AfterClass
     public static void tearDownClass() {
         PapParameterGroup papParameterGroup = ParameterService.get("PapGroup");
-        List<BusTopicParams> lo = Whitebox.getInternalState(papParameterGroup,
-            "healthCheckRestClientParameters");
+        List<BusTopicParams> lo = Whitebox.getInternalState(papParameterGroup, "healthCheckRestClientParameters");
         lo.addAll(savedBusTopicParams);
     }
 
@@ -78,6 +77,7 @@ public class TestPolicyComponentsHealthCheckControllerV1 extends CommonPapRestSe
     }
 
     @Test
+    @SuppressWarnings("unchecked")
     public void testPolicyComponentsHealthCheck() throws Exception {
         Invocation.Builder invocationBuilder = sendRequest(ENDPOINT);
         Response response = invocationBuilder.get();
index 2fdb2e6..a1fc469 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Corp.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -121,18 +122,16 @@ public class TestPolicyComponentsHealthCheckProvider {
         when(client1.getName()).thenReturn(CLIENT_1);
         when(client1.getBaseUrl()).thenReturn("url1");
         when(response1.getStatus()).thenReturn(HttpURLConnection.HTTP_OK);
-        when(response1.readEntity(HealthCheckReport.class))
-            .thenReturn(createReport(HttpURLConnection.HTTP_OK, true));
+        when(response1.readEntity(HealthCheckReport.class)).thenReturn(createReport(HttpURLConnection.HTTP_OK, true));
         when(client1.get()).thenReturn(response1);
 
         when(client2.getName()).thenReturn("client2");
         when(client2.getBaseUrl()).thenReturn("url2");
         when(response2.getStatus()).thenReturn(HttpURLConnection.HTTP_OK);
-        when(response2.readEntity(HealthCheckReport.class))
-            .thenReturn(createReport(HttpURLConnection.HTTP_OK, true));
+        when(response2.readEntity(HealthCheckReport.class)).thenReturn(createReport(HttpURLConnection.HTTP_OK, true));
         when(client2.get()).thenReturn(response2);
 
-        PapParameterGroup papParameterGroup =  ParameterService.get(PAP_GROUP_PARAMS_NAME);
+        PapParameterGroup papParameterGroup = ParameterService.get(PAP_GROUP_PARAMS_NAME);
         List<BusTopicParams> params = papParameterGroup.getHealthCheckRestClientParameters();
         when(clientFactory.build(params.get(0))).thenReturn(client1);
         when(clientFactory.build(params.get(1))).thenReturn(client2);
@@ -162,26 +161,25 @@ public class TestPolicyComponentsHealthCheckProvider {
     public void testFetchPolicyComponentsHealthStatus_unhealthyClient() throws Exception {
         when(response1.getStatus()).thenReturn(HttpURLConnection.HTTP_INTERNAL_ERROR);
         when(response1.readEntity(HealthCheckReport.class))
-            .thenReturn(createReport(HttpURLConnection.HTTP_INTERNAL_ERROR, false));
+                .thenReturn(createReport(HttpURLConnection.HTTP_INTERNAL_ERROR, false));
         Map<String, Object> result = callFetchPolicyComponentsHealthStatus();
         assertFalse((Boolean) result.get("healthy"));
         HealthCheckReport report = (HealthCheckReport) result.get(CLIENT_1);
         assertFalse(report.isHealthy());
 
         when(response1.getStatus()).thenReturn(HttpURLConnection.HTTP_OK);
-        when(response1.readEntity(HealthCheckReport.class))
-            .thenReturn(createReport(HttpURLConnection.HTTP_OK, false));
+        when(response1.readEntity(HealthCheckReport.class)).thenReturn(createReport(HttpURLConnection.HTTP_OK, false));
         Map<String, Object> result2 = callFetchPolicyComponentsHealthStatus();
         assertFalse((Boolean) result2.get("healthy"));
         HealthCheckReport report2 = (HealthCheckReport) result.get(CLIENT_1);
-        assertFalse(report.isHealthy());
+        assertFalse(report2.isHealthy());
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testFetchPolicyComponentsHealthStatus_unhealthyPdps() throws Exception {
-        //Get a PDP and set it unhealthy
-        groups.get(0).getPdpSubgroups().get(0)
-            .getPdpInstances().get(0).setHealthy(PdpHealthStatus.NOT_HEALTHY);
+        // Get a PDP and set it unhealthy
+        groups.get(0).getPdpSubgroups().get(0).getPdpInstances().get(0).setHealthy(PdpHealthStatus.NOT_HEALTHY);
         Map<String, Object> result = callFetchPolicyComponentsHealthStatus();
         Map<String, List<Pdp>> pdpListWithType = (Map<String, List<Pdp>>) result.get(PapConstants.POLICY_PDPS);
         assertEquals(2, pdpListWithType.size());
@@ -221,4 +219,4 @@ public class TestPolicyComponentsHealthCheckProvider {
             throw new RuntimeException(e);
         }
     }
-}
\ No newline at end of file
+}