You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2017/10/16 16:32:18 UTC
svn commit: r1812306 - in
/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java:
javax/xml/crypto/test/dsig/ org/apache/xml/security/test/dom/algorithms/
org/apache/xml/security/test/stax/encryption/
org/apache/xml/security/test/stax/signature/
Author: coheigea
Date: Mon Oct 16 16:32:18 2017
New Revision: 1812306
URL: http://svn.apache.org/viewvc?rev=1812306&view=rev
Log:
Make the BouncyCastle initialization static to make sure that all the tests are running
Modified:
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/HMACSignatureAlgorithmTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/PKSignatureAlgorithmTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/HMACSignatureAlgorithmTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/KeyWrapEncryptionAlgorithmTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionCreationTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionVerificationTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureCreationTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureVerificationTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACCreationTest.java
santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACVerificationTest.java
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/HMACSignatureAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/HMACSignatureAlgorithmTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/HMACSignatureAlgorithmTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/HMACSignatureAlgorithmTest.java Mon Oct 16 16:32:18 2017
@@ -51,20 +51,21 @@ import org.w3c.dom.Text;
*/
public class HMACSignatureAlgorithmTest extends org.junit.Assert {
+ private static boolean bcInstalled;
private KeySelector sks;
private CanonicalizationMethod withoutComments;
private DigestMethod sha1;
private SignatureMethod hmacSha1, hmacSha224, hmacSha256, hmacSha384, hmacSha512, ripemd160;
private XMLSignatureFactory fac;
private DocumentBuilder db;
- private boolean bcInstalled;
static {
Security.insertProviderAt
(new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI(), 1);
}
- public HMACSignatureAlgorithmTest() throws Exception {
+ @org.junit.BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -83,6 +84,9 @@ public class HMACSignatureAlgorithmTest
bcInstalled = true;
}
}
+ }
+
+ public HMACSignatureAlgorithmTest() throws Exception {
db = XMLUtils.createDocumentBuilder(false);
// create common objects
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/PKSignatureAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/PKSignatureAlgorithmTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/PKSignatureAlgorithmTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/javax/xml/crypto/test/dsig/PKSignatureAlgorithmTest.java Mon Oct 16 16:32:18 2017
@@ -47,6 +47,7 @@ import javax.xml.crypto.test.KeySelector
import javax.xml.parsers.DocumentBuilder;
import org.apache.xml.security.utils.XMLUtils;
+import org.junit.BeforeClass;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
@@ -67,14 +68,15 @@ public class PKSignatureAlgorithmTest ex
private KeyPair rsaKeyPair, ecKeyPair;
private KeyInfo rsaki, ecki;
private boolean ecAlgParamsSupport = true;
- private boolean bcInstalled;
+ private static boolean bcInstalled;
static {
Security.insertProviderAt
(new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI(), 1);
}
- public PKSignatureAlgorithmTest() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -93,6 +95,9 @@ public class PKSignatureAlgorithmTest ex
bcInstalled = true;
}
}
+ }
+
+ public PKSignatureAlgorithmTest() throws Exception {
// check if EC AlgorithmParameters is supported - this is needed
// for marshalling ECKeyValue elements
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java Mon Oct 16 16:32:18 2017
@@ -33,6 +33,8 @@ import org.w3c.dom.Document;
*/
public class DigestAlgorithmTest extends org.junit.Assert {
+ private static boolean bcInstalled;
+
static {
org.apache.xml.security.Init.init();
}
@@ -53,6 +55,7 @@ public class DigestAlgorithmTest extends
if (cons != null) {
Provider provider = (Provider)cons.newInstance();
Security.insertProviderAt(provider, 2);
+ bcInstalled = true;
}
}
}
@@ -172,10 +175,7 @@ public class DigestAlgorithmTest extends
@org.junit.Test
public void testRIPEMD160() throws Exception {
- // This only works with BouncyCastle
- if (Security.getProvider("BC") == null) {
- return;
- }
+ org.junit.Assume.assumeTrue(bcInstalled);
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
MessageDigestAlgorithm digestAlgorithm =
@@ -194,10 +194,7 @@ public class DigestAlgorithmTest extends
@org.junit.Test
public void testWhirlpool() throws Exception {
- // This only works with BouncyCastle
- if (Security.getProvider("BC") == null) {
- return;
- }
+ org.junit.Assume.assumeTrue(bcInstalled);
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
MessageDigestAlgorithm digestAlgorithm =
@@ -216,10 +213,7 @@ public class DigestAlgorithmTest extends
@org.junit.Test
public void testSHA3_224() throws Exception {
- // This only works with BouncyCastle
- if (Security.getProvider("BC") == null) {
- return;
- }
+ org.junit.Assume.assumeTrue(bcInstalled);
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
MessageDigestAlgorithm digestAlgorithm =
@@ -238,10 +232,7 @@ public class DigestAlgorithmTest extends
@org.junit.Test
public void testSHA3_256() throws Exception {
- // This only works with BouncyCastle
- if (Security.getProvider("BC") == null) {
- return;
- }
+ org.junit.Assume.assumeTrue(bcInstalled);
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
MessageDigestAlgorithm digestAlgorithm =
@@ -260,10 +251,7 @@ public class DigestAlgorithmTest extends
@org.junit.Test
public void testSHA3_384() throws Exception {
- // This only works with BouncyCastle
- if (Security.getProvider("BC") == null) {
- return;
- }
+ org.junit.Assume.assumeTrue(bcInstalled);
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
MessageDigestAlgorithm digestAlgorithm =
@@ -282,10 +270,7 @@ public class DigestAlgorithmTest extends
@org.junit.Test
public void testSHA3_512() throws Exception {
- // This only works with BouncyCastle
- if (Security.getProvider("BC") == null) {
- return;
- }
+ org.junit.Assume.assumeTrue(bcInstalled);
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
MessageDigestAlgorithm digestAlgorithm =
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/HMACSignatureAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/HMACSignatureAlgorithmTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/HMACSignatureAlgorithmTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/HMACSignatureAlgorithmTest.java Mon Oct 16 16:32:18 2017
@@ -39,6 +39,7 @@ import org.apache.xml.security.test.dom.
import org.apache.xml.security.transforms.Transforms;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -52,9 +53,10 @@ public class HMACSignatureAlgorithmTest
org.apache.xml.security.Init.init();
}
- private boolean bcInstalled;
+ private static boolean bcInstalled;
- public HMACSignatureAlgorithmTest() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/KeyWrapEncryptionAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/KeyWrapEncryptionAlgorithmTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/KeyWrapEncryptionAlgorithmTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/KeyWrapEncryptionAlgorithmTest.java Mon Oct 16 16:32:18 2017
@@ -43,6 +43,7 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.test.dom.DSNamespaceContext;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -52,14 +53,15 @@ import org.w3c.dom.NodeList;
*/
public class KeyWrapEncryptionAlgorithmTest extends Assert {
- private KeyPair rsaKeyPair;
- private boolean bcInstalled;
+ private static KeyPair rsaKeyPair;
+ private static boolean bcInstalled;
static {
org.apache.xml.security.Init.init();
}
- public KeyWrapEncryptionAlgorithmTest() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java Mon Oct 16 16:32:18 2017
@@ -39,6 +39,7 @@ import org.apache.xml.security.test.dom.
import org.apache.xml.security.transforms.Transforms;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -48,14 +49,15 @@ import org.w3c.dom.NodeList;
*/
public class PKSignatureAlgorithmTest extends Assert {
- private KeyPair rsaKeyPair, ecKeyPair;
- private boolean bcInstalled;
+ private static KeyPair rsaKeyPair, ecKeyPair;
+ private static boolean bcInstalled;
static {
org.apache.xml.security.Init.init();
}
- public PKSignatureAlgorithmTest() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java Mon Oct 16 16:32:18 2017
@@ -38,6 +38,7 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.test.dom.DSNamespaceContext;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -47,13 +48,14 @@ import org.w3c.dom.NodeList;
*/
public class SymmetricEncryptionAlgorithmTest extends Assert {
- private boolean bcInstalled;
+ private static boolean bcInstalled;
static {
org.apache.xml.security.Init.init();
}
- public SymmetricEncryptionAlgorithmTest() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -63,12 +65,13 @@ public class SymmetricEncryptionAlgorith
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
- } catch (Exception e) { //NOPMD
+ } catch (Exception e) {
//ignore
}
if (cons != null) {
Provider provider = (Provider)cons.newInstance();
Security.insertProviderAt(provider, 2);
+ bcInstalled = true;
}
}
}
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionCreationTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionCreationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionCreationTest.java Mon Oct 16 16:32:18 2017
@@ -50,7 +50,7 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.Assert;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -61,17 +61,12 @@ import org.w3c.dom.NodeList;
*/
public class KeyWrapEncryptionCreationTest extends Assert {
+ private static KeyPair rsaKeyPair;
+ private static boolean bcInstalled;
private XMLInputFactory xmlInputFactory;
- private KeyPair rsaKeyPair;
- private boolean bcInstalled;
-
- @Before
- public void setUp() throws Exception {
- org.apache.xml.security.Init.init();
-
- xmlInputFactory = XMLInputFactory.newInstance();
- xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -81,7 +76,7 @@ public class KeyWrapEncryptionCreationTe
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
- } catch (Exception e) { //NOPMD
+ } catch (Exception e) {
//ignore
}
if (cons != null) {
@@ -94,6 +89,13 @@ public class KeyWrapEncryptionCreationTe
rsaKeyPair = KeyPairGenerator.getInstance("RSA").genKeyPair();
}
+ public KeyWrapEncryptionCreationTest() throws Exception {
+ org.apache.xml.security.Init.init();
+
+ xmlInputFactory = XMLInputFactory.newInstance();
+ xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ }
+
@org.junit.AfterClass
public static void cleanup() throws Exception {
Security.removeProvider("BC");
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionVerificationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionVerificationTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionVerificationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionVerificationTest.java Mon Oct 16 16:32:18 2017
@@ -56,7 +56,7 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.Assert;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -67,18 +67,13 @@ import org.w3c.dom.NodeList;
*/
public class KeyWrapEncryptionVerificationTest extends Assert {
- private boolean bcInstalled;
+ private static boolean bcInstalled;
+ private static KeyPair rsaKeyPair;
private XMLInputFactory xmlInputFactory;
private TransformerFactory transformerFactory = TransformerFactory.newInstance();
- private KeyPair rsaKeyPair;
-
- @Before
- public void setUp() throws Exception {
- org.apache.xml.security.Init.init();
-
- xmlInputFactory = XMLInputFactory.newInstance();
- xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -88,7 +83,7 @@ public class KeyWrapEncryptionVerificati
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
- } catch (Exception e) { //NOPMD
+ } catch (Exception e) {
//ignore
}
if (cons != null) {
@@ -101,6 +96,13 @@ public class KeyWrapEncryptionVerificati
rsaKeyPair = KeyPairGenerator.getInstance("RSA").genKeyPair();
}
+ public KeyWrapEncryptionVerificationTest() throws Exception {
+ org.apache.xml.security.Init.init();
+
+ xmlInputFactory = XMLInputFactory.newInstance();
+ xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ }
+
@org.junit.AfterClass
public static void cleanup() throws Exception {
Security.removeProvider("BC");
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java Mon Oct 16 16:32:18 2017
@@ -45,7 +45,7 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.Assert;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -56,16 +56,11 @@ import org.w3c.dom.NodeList;
*/
public class SymmetricEncryptionCreationTest extends Assert {
+ private static boolean bcInstalled;
private XMLInputFactory xmlInputFactory;
- private boolean bcInstalled;
-
- @Before
- public void setUp() throws Exception {
- org.apache.xml.security.Init.init();
-
- xmlInputFactory = XMLInputFactory.newInstance();
- xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -75,7 +70,7 @@ public class SymmetricEncryptionCreation
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
- } catch (Exception e) { //NOPMD
+ } catch (Exception e) {
//ignore
}
if (cons != null) {
@@ -86,6 +81,13 @@ public class SymmetricEncryptionCreation
}
}
+ public SymmetricEncryptionCreationTest() throws Exception {
+ org.apache.xml.security.Init.init();
+
+ xmlInputFactory = XMLInputFactory.newInstance();
+ xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ }
+
@org.junit.AfterClass
public static void cleanup() throws Exception {
Security.removeProvider("BC");
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java Mon Oct 16 16:32:18 2017
@@ -55,7 +55,7 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.Assert;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -66,17 +66,12 @@ import org.w3c.dom.NodeList;
*/
public class SymmetricEncryptionVerificationTest extends Assert {
- private boolean bcInstalled;
+ private static boolean bcInstalled;
private XMLInputFactory xmlInputFactory;
private TransformerFactory transformerFactory = TransformerFactory.newInstance();
- @Before
- public void setUp() throws Exception {
- org.apache.xml.security.Init.init();
-
- xmlInputFactory = XMLInputFactory.newInstance();
- xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
-
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -86,7 +81,7 @@ public class SymmetricEncryptionVerifica
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
- } catch (Exception e) { //NOPMD
+ } catch (Exception e) {
//ignore
}
if (cons != null) {
@@ -97,6 +92,13 @@ public class SymmetricEncryptionVerifica
}
}
+ public SymmetricEncryptionVerificationTest() throws Exception {
+ org.apache.xml.security.Init.init();
+
+ xmlInputFactory = XMLInputFactory.newInstance();
+ xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ }
+
@org.junit.AfterClass
public static void cleanup() throws Exception {
Security.removeProvider("BC");
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureCreationTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureCreationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureCreationTest.java Mon Oct 16 16:32:18 2017
@@ -41,6 +41,7 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -49,10 +50,11 @@ import org.w3c.dom.Document;
*/
public class PKSignatureCreationTest extends AbstractSignatureCreationTest {
- private boolean bcInstalled;
- private KeyPair rsaKeyPair, ecKeyPair;
+ private static boolean bcInstalled;
+ private static KeyPair rsaKeyPair, ecKeyPair;
- public PKSignatureCreationTest() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureVerificationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureVerificationTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureVerificationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureVerificationTest.java Mon Oct 16 16:32:18 2017
@@ -43,7 +43,7 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.test.stax.utils.StAX2DOM;
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -51,21 +51,13 @@ import org.w3c.dom.Document;
* A set of test-cases for Signature verification with various PublicKey algorithms
*/
public class PKSignatureVerificationTest extends AbstractSignatureVerificationTest {
-
- private boolean bcInstalled;
+ private static KeyPair rsaKeyPair, ecKeyPair;
+ private static boolean bcInstalled;
private XMLInputFactory xmlInputFactory;
private TransformerFactory transformerFactory = TransformerFactory.newInstance();
- private KeyPair rsaKeyPair, ecKeyPair;
-
- @Before
- public void setUp() throws Exception {
- Init.init(PKSignatureVerificationTest.class.getClassLoader().getResource("security-config.xml").toURI(),
- this.getClass());
- org.apache.xml.security.Init.init();
-
- xmlInputFactory = XMLInputFactory.newInstance();
- xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -75,7 +67,7 @@ public class PKSignatureVerificationTest
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
- } catch (Exception e) { //NOPMD
+ } catch (Exception e) {
//ignore
}
if (cons != null) {
@@ -92,6 +84,15 @@ public class PKSignatureVerificationTest
ecKeyPair = KeyPairGenerator.getInstance("EC").genKeyPair();
}
+ public PKSignatureVerificationTest() throws Exception {
+ Init.init(PKSignatureVerificationTest.class.getClassLoader().getResource("security-config.xml").toURI(),
+ this.getClass());
+ org.apache.xml.security.Init.init();
+
+ xmlInputFactory = XMLInputFactory.newInstance();
+ xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ }
+
@org.junit.AfterClass
public static void cleanup() throws Exception {
Security.removeProvider("BC");
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java Mon Oct 16 16:32:18 2017
@@ -46,15 +46,17 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
* A set of test-cases for Signature creation with various digest algorithms
*/
public class SignatureDigestCreationTest extends AbstractSignatureCreationTest {
- private boolean bcInstalled;
+ private static boolean bcInstalled;
- public SignatureDigestCreationTest() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -64,7 +66,7 @@ public class SignatureDigestCreationTest
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
- } catch (Exception e) { //NOPMD
+ } catch (Exception e) {
//ignore
}
if (cons != null) {
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACCreationTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACCreationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACCreationTest.java Mon Oct 16 16:32:18 2017
@@ -40,6 +40,7 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.stax.ext.XMLSecurityProperties;
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -48,9 +49,10 @@ import org.w3c.dom.Document;
*/
public class SignatureHMACCreationTest extends AbstractSignatureCreationTest {
- private boolean bcInstalled;
+ private static boolean bcInstalled;
- public SignatureHMACCreationTest() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -60,7 +62,7 @@ public class SignatureHMACCreationTest e
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
- } catch (Exception e) { //NOPMD
+ } catch (Exception e) {
//ignore
}
if (cons != null) {
Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACVerificationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACVerificationTest.java?rev=1812306&r1=1812305&r2=1812306&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACVerificationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/signature/SignatureHMACVerificationTest.java Mon Oct 16 16:32:18 2017
@@ -43,7 +43,7 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.test.stax.utils.StAX2DOM;
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -52,19 +52,12 @@ import org.w3c.dom.Document;
*/
public class SignatureHMACVerificationTest extends AbstractSignatureVerificationTest {
- private boolean bcInstalled;
+ private static boolean bcInstalled;
private XMLInputFactory xmlInputFactory;
private TransformerFactory transformerFactory = TransformerFactory.newInstance();
- @Before
- public void setUp() throws Exception {
- Init.init(SignatureHMACVerificationTest.class.getClassLoader().getResource("security-config.xml").toURI(),
- this.getClass());
- org.apache.xml.security.Init.init();
-
- xmlInputFactory = XMLInputFactory.newInstance();
- xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
-
+ @BeforeClass
+ public static void setup() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
@@ -74,7 +67,7 @@ public class SignatureHMACVerificationTe
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
- } catch (Exception e) { //NOPMD
+ } catch (Exception e) {
//ignore
}
if (cons != null) {
@@ -85,6 +78,15 @@ public class SignatureHMACVerificationTe
}
}
+ public SignatureHMACVerificationTest() throws Exception {
+ Init.init(SignatureHMACVerificationTest.class.getClassLoader().getResource("security-config.xml").toURI(),
+ this.getClass());
+ org.apache.xml.security.Init.init();
+
+ xmlInputFactory = XMLInputFactory.newInstance();
+ xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ }
+
@org.junit.AfterClass
public static void cleanup() throws Exception {
Security.removeProvider("BC");