diff options
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/KeyStoreTrustEngineTest.java')
-rw-r--r-- | bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/KeyStoreTrustEngineTest.java | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/KeyStoreTrustEngineTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/KeyStoreTrustEngineTest.java index 7d37dbe52..0a6036961 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/KeyStoreTrustEngineTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/KeyStoreTrustEngineTest.java @@ -32,7 +32,7 @@ import org.eclipse.osgi.tests.OSGiTestsActivator; public class KeyStoreTrustEngineTest extends TestCase { - private static char[] PASSWORD_DEFAULT = {'c', 'h', 'a', 'n', 'g', 'e', 'i', 't'}; + private static char[] PASSWORD_DEFAULT = { 'c', 'h', 'a', 'n', 'g', 'e', 'i', 't' }; private static String TYPE_DEFAULT = "JKS"; //$NON-NLS-1$ private static TestCase[] s_tests = { @@ -79,11 +79,11 @@ public class KeyStoreTrustEngineTest extends TestCase { public void runTest() { testAddTrustAnchor0(); } - }, /*, new KeyStoreTrustEngineTest("addTrustAnchor positive test: add with autogenerated alias", null) { - public void runTest() { - testAddTrustAnchor1(); - } - }*/ + }, /* + * , new + * KeyStoreTrustEngineTest("addTrustAnchor positive test: add with autogenerated alias" + * , null) { public void runTest() { testAddTrustAnchor1(); } } + */ new KeyStoreTrustEngineTest("addTrustAnchor negative test: null cert specified") { //$NON-NLS-1$ public void runTest() { testAddTrustAnchor2(); @@ -123,7 +123,7 @@ public class KeyStoreTrustEngineTest extends TestCase { testRemoveTrustAnchor5(); } }, - /* getTrustAnchor tests*/ + /* getTrustAnchor tests */ new KeyStoreTrustEngineTest("getTrustAnchor positive test: get by alias", "ca1_root") { //$NON-NLS-1$ //$NON-NLS-2$ public void runTest() { testGetTrustAnchor0(); @@ -142,7 +142,7 @@ public class KeyStoreTrustEngineTest extends TestCase { public void runTest() { testGetAliases0(); } - }}; + } }; public static Test suite() { TestSuite suite = new TestSuite("Unit tests for TrustEngine"); //$NON-NLS-1$ @@ -169,7 +169,7 @@ public class KeyStoreTrustEngineTest extends TestCase { TrustEngine engine; public KeyStoreTrustEngineTest() { - //placeholder + // placeholder } public KeyStoreTrustEngineTest(String name, String... aliases) { @@ -200,16 +200,16 @@ public class KeyStoreTrustEngineTest extends TestCase { } /** - * Closes a stream and ignores any resulting exception. This is useful - * when doing stream cleanup in a finally block where secondary exceptions - * are not worth logging. + * Closes a stream and ignores any resulting exception. This is useful when + * doing stream cleanup in a finally block where secondary exceptions are not + * worth logging. */ protected static void safeClose(OutputStream out) { try { if (out != null) out.close(); } catch (IOException e) { - //ignore + // ignore } } @@ -231,10 +231,10 @@ public class KeyStoreTrustEngineTest extends TestCase { return certs.toArray(new Certificate[] {}); } - //findTrustAnchor positive test: self signed trusted + // findTrustAnchor positive test: self signed trusted public void testFindTrustAnchor0() { try { - Certificate cert = engine.findTrustAnchor(new Certificate[] {getTestCertificate("ca1_root")}); //$NON-NLS-1$ + Certificate cert = engine.findTrustAnchor(new Certificate[] { getTestCertificate("ca1_root") }); //$NON-NLS-1$ assertNotNull("Did not return a cert for self-signed case", cert); //$NON-NLS-1$ assertEquals("Input and output certs not equal for self-signed case", cert, getTestCertificate("ca1_root")); //$NON-NLS-1$ //$NON-NLS-2$ } catch (Throwable t) { @@ -242,7 +242,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //findTrustAnchor positive test: chain with root trusted + // findTrustAnchor positive test: chain with root trusted public void testFindTrustAnchor1() { try { Certificate cert = engine.findTrustAnchor(getTestCertificateChain("ca1_leafb", "ca1_ou", "ca1_root")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -253,7 +253,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //findTrustAnchor positive test: chain with intermediate trusted + // findTrustAnchor positive test: chain with intermediate trusted public void testFindTrustAnchor2() { try { Certificate cert = engine.findTrustAnchor(getTestCertificateChain("ca1_leafb", "ca1_ou", "ca1_root")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -264,7 +264,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //findTrustAnchor positive test: chain with leaf trusted + // findTrustAnchor positive test: chain with leaf trusted public void testFindTrustAnchor3() { try { Certificate cert = engine.findTrustAnchor(getTestCertificateChain("ca1_leafb", "ca1_ou", "ca1_root")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -275,17 +275,17 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //findTrustAnchor negative test: untrusted self signed + // findTrustAnchor negative test: untrusted self signed public void testFindTrustAnchor4() { try { - Certificate cert = engine.findTrustAnchor(new Certificate[] {getTestCertificate("ca2_root")}); //$NON-NLS-1$ + Certificate cert = engine.findTrustAnchor(new Certificate[] { getTestCertificate("ca2_root") }); //$NON-NLS-1$ assertNull("Incorrectly returned a certificate for untrusted self-signed case", cert); //$NON-NLS-1$ } catch (Throwable t) { fail("Unexpected exception testing untrusted self-signed cert: " + t.getMessage()); //$NON-NLS-1$ } } - //findTrustAnchor negative test: untrusted chain + // findTrustAnchor negative test: untrusted chain public void testFindTrustAnchor5() { try { Certificate cert = engine.findTrustAnchor(getTestCertificateChain("ca2_leafb", "ca2_ou", "ca2_root")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -295,7 +295,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //findTrustAnchor negative test: invalid chain + // findTrustAnchor negative test: invalid chain public void testFindTrustAnchor6() { try { Certificate cert = engine.findTrustAnchor(getTestCertificateChain("ca2_leafa", "ca1_root")); //$NON-NLS-1$ //$NON-NLS-2$ @@ -305,7 +305,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //findTrustAnchor negative test: incomplete-able chain + // findTrustAnchor negative test: incomplete-able chain public void testFindTrustAnchor7() { try { Certificate cert = engine.findTrustAnchor(getTestCertificateChain("ca1_leafb", "ca1_root")); //$NON-NLS-1$ //$NON-NLS-2$ @@ -315,7 +315,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //findTrustAnchor negative test: null chain + // findTrustAnchor negative test: null chain public void testFindTrustAnchor8() { try { engine.findTrustAnchor(null); @@ -325,7 +325,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //testAddTrustAnchor positive test: add with alias + // testAddTrustAnchor positive test: add with alias public void testAddTrustAnchor0() { try { String alias = engine.addTrustAnchor(getTestCertificate("ca1_root"), "ca1_root"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -336,7 +336,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //testAddTrustAnchor positive test: add with autogenerated alias + // testAddTrustAnchor positive test: add with autogenerated alias public void testAddTrustAnchor1() { try { String alias = engine.addTrustAnchor(getTestCertificate("ca1_root"), null); //$NON-NLS-1$ @@ -346,7 +346,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //testAddTrustAnchor negative test: null cert specified + // testAddTrustAnchor negative test: null cert specified public void testAddTrustAnchor2() { try { engine.addTrustAnchor(null, "ca1_root"); //$NON-NLS-1$ @@ -356,7 +356,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //testAddTrustAnchor negative test: existing cert specified + // testAddTrustAnchor negative test: existing cert specified public void testAddTrustAnchor3() { try { engine.addTrustAnchor(getTestCertificate("ca1_root"), "new_root"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -368,7 +368,7 @@ public class KeyStoreTrustEngineTest extends TestCase { fail("Expected exception when adding trust anchor"); //$NON-NLS-1$ } - //testAddTrustAnchor negative test: existing alias specified + // testAddTrustAnchor negative test: existing alias specified public void testAddTrustAnchor4() { try { engine.addTrustAnchor(getTestCertificate("ca2_root"), "ca1_root"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -380,7 +380,7 @@ public class KeyStoreTrustEngineTest extends TestCase { fail("Expected exception when adding trust anchor"); //$NON-NLS-1$ } - //removeTrustAnchor positive test: remove by alias + // removeTrustAnchor positive test: remove by alias public void testRemoveTrustAnchor0() { try { engine.removeTrustAnchor("ca1_root"); //$NON-NLS-1$ @@ -389,7 +389,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //removeTrustAnchor positive test: remove by cert + // removeTrustAnchor positive test: remove by cert public void testRemoveTrustAnchor1() { try { engine.removeTrustAnchor(getTestCertificate("ca1_root")); //$NON-NLS-1$ @@ -398,7 +398,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //removeTrustAnchor negative test: cert not found + // removeTrustAnchor negative test: cert not found public void testRemoveTrustAnchor2() { try { engine.removeTrustAnchor(getTestCertificate("ca1_root")); //$NON-NLS-1$ @@ -408,7 +408,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //removeTrustAnchor negative test: by alias not found + // removeTrustAnchor negative test: by alias not found public void testRemoveTrustAnchor3() { try { engine.removeTrustAnchor("ca2_root"); //$NON-NLS-1$ @@ -420,7 +420,7 @@ public class KeyStoreTrustEngineTest extends TestCase { fail("Expected exception when removing trust anchor"); //$NON-NLS-1$ } - //removeTrustAnchor negative test: remove by null alias + // removeTrustAnchor negative test: remove by null alias public void testRemoveTrustAnchor4() { try { engine.removeTrustAnchor((String) null); @@ -430,7 +430,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //removeTrustAnchor negative test: remove by null certificate + // removeTrustAnchor negative test: remove by null certificate public void testRemoveTrustAnchor5() { try { engine.removeTrustAnchor((Certificate) null); @@ -440,7 +440,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //getTrustAnchor positive test: get by alias + // getTrustAnchor positive test: get by alias public void testGetTrustAnchor0() { try { Certificate cert = engine.getTrustAnchor("ca1_root"); //$NON-NLS-1$ @@ -450,7 +450,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //getTrustAnchor negative test: get by null alias + // getTrustAnchor negative test: get by null alias public void testGetTrustAnchor1() { try { engine.getTrustAnchor(null); @@ -460,7 +460,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //getTrustAnchor negative test: does not exist + // getTrustAnchor negative test: does not exist public void testGetTrustAnchor2() { try { Certificate cert = engine.getTrustAnchor("ca2_root"); //$NON-NLS-1$ @@ -471,7 +471,7 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //getAliases positive test: get the alias list + // getAliases positive test: get the alias list public void testGetAliases0() { try { engine.getAliases(); @@ -480,6 +480,6 @@ public class KeyStoreTrustEngineTest extends TestCase { } } - //TODO: thread safety tests - //TODO: performance tests + // TODO: thread safety tests + // TODO: performance tests } |