diff options
Diffstat (limited to 'plugins')
3 files changed, 17 insertions, 11 deletions
diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyForwarder.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyForwarder.java index 30d8f3ae..972e5abe 100644 --- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyForwarder.java +++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyForwarder.java @@ -107,7 +107,7 @@ public class XacmlPdpPolicyForwarder implements PolicyForwarder { + response.getStatus() + ", Response status info: " + response.getStatusInfo()); return false; } - } catch (KeyManagementException | NoSuchAlgorithmException exception) { + } catch (KeyManagementException | NoSuchAlgorithmException | ClassNotFoundException exception) { LOGGER.error("Invocation of method " + method + " failed for policy " + policyName + " due to error opening Http client", exception); return false; @@ -115,7 +115,8 @@ public class XacmlPdpPolicyForwarder implements PolicyForwarder { return true; } - private HttpClient getHttpClient() throws KeyManagementException, NoSuchAlgorithmException { + private HttpClient getHttpClient() + throws KeyManagementException, NoSuchAlgorithmException, ClassNotFoundException { boolean useHttps = configurationParameters.isUseHttps(); String hostname = configurationParameters.getHostname(); int port = configurationParameters.getPort(); diff --git a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/xacml/pdp/engine/XacmlPdpPolicyForwarderTest.java b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/xacml/pdp/engine/XacmlPdpPolicyForwarderTest.java index 9ef88b43..6982b33b 100644 --- a/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/xacml/pdp/engine/XacmlPdpPolicyForwarderTest.java +++ b/plugins/forwarding-plugins/src/test/java/org/onap/policy/distribution/forwarding/xacml/pdp/engine/XacmlPdpPolicyForwarderTest.java @@ -79,8 +79,9 @@ public class XacmlPdpPolicyForwarderTest { } @Test - public void testForwardPolicy() throws KeyManagementException, NoSuchAlgorithmException, NoSuchFieldException, - SecurityException, IllegalArgumentException, IllegalAccessException, PolicyDistributionException { + public void testForwardPolicy() + throws KeyManagementException, NoSuchAlgorithmException, NoSuchFieldException,SecurityException, + IllegalArgumentException, IllegalAccessException, PolicyDistributionException, ClassNotFoundException { HttpClient httpClientMock = mock(HttpClient.class); headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE); @@ -123,7 +124,7 @@ public class XacmlPdpPolicyForwarderTest { @Test public void testForwardPolicy_CreateFailsPushNotInvoked() throws KeyManagementException, NoSuchAlgorithmException, NoSuchFieldException, SecurityException, - IllegalArgumentException, IllegalAccessException, PolicyDistributionException { + IllegalArgumentException, IllegalAccessException, PolicyDistributionException, ClassNotFoundException { HttpClient httpClientMock = mock(HttpClient.class); headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE); @@ -151,7 +152,7 @@ public class XacmlPdpPolicyForwarderTest { @Test public void testForwardPolicy_PushFails() throws KeyManagementException, NoSuchAlgorithmException, NoSuchFieldException, SecurityException, - IllegalArgumentException, IllegalAccessException, PolicyDistributionException { + IllegalArgumentException, IllegalAccessException, PolicyDistributionException, ClassNotFoundException { HttpClient httpClientMock = mock(HttpClient.class); headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE); @@ -180,7 +181,7 @@ public class XacmlPdpPolicyForwarderTest { @Test public void testForwardPolicy_HttpClientInitFailureForPolicyCreate() throws KeyManagementException, NoSuchAlgorithmException, NoSuchFieldException, SecurityException, - IllegalArgumentException, IllegalAccessException, PolicyDistributionException { + IllegalArgumentException, IllegalAccessException, PolicyDistributionException, ClassNotFoundException { HttpClient httpClientMock = mock(HttpClient.class); headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE); @@ -208,7 +209,7 @@ public class XacmlPdpPolicyForwarderTest { @Test public void testForwardPolicy_HttpClientInitFailureForPolicyPush() throws KeyManagementException, NoSuchAlgorithmException, NoSuchFieldException, SecurityException, - IllegalArgumentException, IllegalAccessException, PolicyDistributionException { + IllegalArgumentException, IllegalAccessException, PolicyDistributionException, ClassNotFoundException { HttpClient httpClientMock = mock(HttpClient.class); headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE); diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java index 20922a1b..28408700 100644 --- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandler.java @@ -91,11 +91,15 @@ public class TestFileSystemReceptionHandler { } @Test - public final void testInit() throws IOException { + public final void testInit() throws IOException, InterruptedException { final FileSystemReceptionHandler sypHandler = Mockito.spy(fileSystemHandler); Mockito.doNothing().when(sypHandler).initFileWatcher(Mockito.isA(String.class)); - sypHandler.initializeReception(pssdConfigParameters.getName()); - Mockito.verify(sypHandler, Mockito.times(1)).initFileWatcher(Mockito.isA(String.class)); + try { + sypHandler.initializeReception(pssdConfigParameters.getName()); + } catch (final Exception exp) { + LOGGER.error(exp); + fail("Test should not throw any exception"); + } } @Test |