aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java/org/onap
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-03-25 11:39:59 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-03-25 13:00:53 -0400
commit7711dbb1473fc2e76c1f2af4a8ac1f9b712233fb (patch)
tree281218ec502d1a20d4b4c613912b713bd87c1695 /main/src/test/java/org/onap
parent9d5115946e4c65889bb56e438c975af629f0662d (diff)
Cleanup eclipse warnings
Issue-ID: POLICY-2271 Change-Id: Ib28a6f5321cc05b03994e180867461a631d40d75 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'main/src/test/java/org/onap')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/TestExceptions.java6
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java8
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java24
3 files changed, 17 insertions, 21 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/TestExceptions.java b/main/src/test/java/org/onap/policy/pap/main/TestExceptions.java
index 9e3cda9c..608e7ad8 100644
--- a/main/src/test/java/org/onap/policy/pap/main/TestExceptions.java
+++ b/main/src/test/java/org/onap/policy/pap/main/TestExceptions.java
@@ -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}}.
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java
index cf0da937..d898b5e5 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java
@@ -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();
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java
index 2fdb2e6e..a1fc4695 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java
@@ -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
+}