|
| 1 | +package org.bouncycastle.openpgp.test; |
| 2 | + |
| 3 | +import java.security.Security; |
| 4 | + |
| 5 | +import junit.extensions.TestSetup; |
| 6 | +import junit.framework.Test; |
| 7 | +import junit.framework.TestCase; |
| 8 | +import junit.framework.TestSuite; |
| 9 | +import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| 10 | +import org.bouncycastle.test.PrintTestResult; |
| 11 | +import org.bouncycastle.util.test.SimpleTestResult; |
| 12 | + |
| 13 | +public class AllTests |
| 14 | + extends TestCase |
| 15 | +{ |
| 16 | + public void testPGP() |
| 17 | + { |
| 18 | + Security.addProvider(new BouncyCastleProvider()); |
| 19 | + |
| 20 | + org.bouncycastle.util.test.Test[] tests = RegressionTest.tests; |
| 21 | + |
| 22 | + for (int i = 0; i != tests.length; i++) |
| 23 | + { |
| 24 | + SimpleTestResult result = (SimpleTestResult)tests[i].perform(); |
| 25 | + |
| 26 | + if (!result.isSuccessful()) |
| 27 | + { |
| 28 | + fail(tests[i].getClass().getName() + " " + result.toString()); |
| 29 | + } |
| 30 | + } |
| 31 | + } |
| 32 | + |
| 33 | + public static void main(String[] args) |
| 34 | + { |
| 35 | + PrintTestResult.printResult(junit.textui.TestRunner.run(suite())); |
| 36 | + } |
| 37 | + |
| 38 | + public static Test suite() |
| 39 | + { |
| 40 | + TestSuite suite = new TestSuite("OpenPGP Tests"); |
| 41 | + |
| 42 | + suite.addTestSuite(AllTests.class); |
| 43 | + suite.addTestSuite(DSA2Test.class); |
| 44 | + suite.addTestSuite(PGPUnicodeTest.class); |
| 45 | + |
| 46 | + return new BCTestSetup(suite); |
| 47 | + } |
| 48 | + |
| 49 | + static class BCTestSetup |
| 50 | + extends TestSetup |
| 51 | + { |
| 52 | + public BCTestSetup(Test test) |
| 53 | + { |
| 54 | + super(test); |
| 55 | + } |
| 56 | + |
| 57 | + protected void setUp() |
| 58 | + { |
| 59 | + Security.addProvider(new BouncyCastleProvider()); |
| 60 | + } |
| 61 | + |
| 62 | + protected void tearDown() |
| 63 | + { |
| 64 | + Security.removeProvider("BC"); |
| 65 | + } |
| 66 | + } |
| 67 | +} |
0 commit comments