\r
public class KeystoreBuilderTest {\r
\r
- @Rule\r
- public TemporaryFolder folder = new TemporaryFolder();\r
+ @Rule\r
+ public TemporaryFolder folder = new TemporaryFolder();\r
\r
- KeystoreBuilder ksb;\r
- org.onap.aai.sparky.util.test.KeystoreBuilder ksb1;\r
+ KeystoreBuilder ksb;\r
+ org.onap.aai.sparky.util.test.KeystoreBuilder ksb1;\r
\r
- @Before\r
- public void setUp() throws IOException, NoSuchAlgorithmException {\r
- System.setProperty("AJSC_HOME", new File(".").getCanonicalPath().replace('\\', '/'));\r
+ @Before\r
+ public void setUp() throws IOException, NoSuchAlgorithmException {\r
+ System.setProperty("AJSC_HOME", new File(".").getCanonicalPath().replace('\\', '/'));\r
\r
- folder.newFile("file1.xml");\r
- folder.newFile("file2.xml");\r
+ folder.newFile("file1.xml");\r
+ folder.newFile("file2.xml");\r
\r
- String endPointList = "https://localhost:9517;https://localhost:8443";\r
- ksb = new KeystoreBuilder(endPointList);\r
- ksb1 = new org.onap.aai.sparky.util.test.KeystoreBuilder(endPointList);\r
- }\r
+ String endPointList = "https://localhost:9517;https://localhost:8443";\r
+ ksb = new KeystoreBuilder(endPointList);\r
+ ksb1 = new org.onap.aai.sparky.util.test.KeystoreBuilder(endPointList);\r
+ }\r
\r
- @Test(expected=IOException.class)\r
- public void testUpdateKeyStore() throws KeyManagementException, KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException {\r
- ksb.updateKeystore(folder.getRoot().getAbsolutePath(), "password-1");\r
- ksb1.updateKeystore(folder.getRoot().getAbsolutePath(), "password-1");\r
- }\r
+ @Test(expected = IOException.class)\r
+ public void testUpdateKeyStore() throws KeyManagementException, KeyStoreException,\r
+ CertificateException, IOException, NoSuchAlgorithmException {\r
+ ksb.updateKeystore(folder.getRoot().getAbsolutePath(), "password-1");\r
+ ksb1.updateKeystore(folder.getRoot().getAbsolutePath(), "password-1");\r
+ }\r
\r
- @Test(expected=InvocationTargetException.class)\r
- public void testCertificateChainMethods() throws NoSuchMethodException, SecurityException,\r
- IllegalAccessException, IllegalArgumentException, InvocationTargetException, UnknownHostException, IOException {\r
- SSLSocketFactory factory = Mockito.mock(SSLSocketFactory.class);\r
- SSLSocket socket = Mockito.mock(SSLSocket.class);\r
- Mockito.when(factory.createSocket("localhost",9517)).thenReturn(socket);\r
- Method method = KeystoreBuilder.class.getDeclaredMethod("getCertificateChainForRemoteEndpoint", String.class, int.class);\r
- method.setAccessible(true);\r
- X509Certificate[] certChain = (X509Certificate[])method.invoke(ksb, "localhost",9517);\r
- Assert.assertNotNull(certChain);\r
- }\r
+ @Test(expected = InvocationTargetException.class)\r
+ public void testCertificateChainMethods()\r
+ throws NoSuchMethodException, SecurityException, IllegalAccessException,\r
+ IllegalArgumentException, InvocationTargetException, UnknownHostException, IOException {\r
+ SSLSocketFactory factory = Mockito.mock(SSLSocketFactory.class);\r
+ SSLSocket socket = Mockito.mock(SSLSocket.class);\r
+ Mockito.when(factory.createSocket("localhost", 9517)).thenReturn(socket);\r
+ Method method = KeystoreBuilder.class.getDeclaredMethod("getCertificateChainForRemoteEndpoint",\r
+ String.class, int.class);\r
+ method.setAccessible(true);\r
+ X509Certificate[] certChain = (X509Certificate[]) method.invoke(ksb, "localhost", 9517);\r
+ Assert.assertNotNull(certChain);\r
+ }\r
\r
- @Test(expected=InvocationTargetException.class)\r
- public void testCertificateChainMethods1() throws NoSuchMethodException, SecurityException,\r
- IllegalAccessException, IllegalArgumentException, InvocationTargetException, UnknownHostException, IOException {\r
- SSLSocketFactory factory = Mockito.mock(SSLSocketFactory.class);\r
- SSLSocket socket = Mockito.mock(SSLSocket.class);\r
- Mockito.when(factory.createSocket("localhost",9517)).thenReturn(socket);\r
- Method method = org.onap.aai.sparky.util.test.KeystoreBuilder.class.getDeclaredMethod("getCertificateChainForRemoteEndpoint", String.class, int.class);\r
- method.setAccessible(true);\r
- X509Certificate[] certChain = (X509Certificate[])method.invoke(ksb1, "localhost",9517);\r
- Assert.assertNotNull(certChain);\r
- }\r
+ @Test(expected = InvocationTargetException.class)\r
+ public void testCertificateChainMethods1()\r
+ throws NoSuchMethodException, SecurityException, IllegalAccessException,\r
+ IllegalArgumentException, InvocationTargetException, UnknownHostException, IOException {\r
+ SSLSocketFactory factory = Mockito.mock(SSLSocketFactory.class);\r
+ SSLSocket socket = Mockito.mock(SSLSocket.class);\r
+ Mockito.when(factory.createSocket("localhost", 9517)).thenReturn(socket);\r
+ Method method = org.onap.aai.sparky.util.test.KeystoreBuilder.class\r
+ .getDeclaredMethod("getCertificateChainForRemoteEndpoint", String.class, int.class);\r
+ method.setAccessible(true);\r
+ X509Certificate[] certChain = (X509Certificate[]) method.invoke(ksb1, "localhost", 9517);\r
+ Assert.assertNotNull(certChain);\r
+ }\r
\r
}\r