vdkoogh     2003/12/26 03:20:39

  Modified:    src_unitTests/org/apache/xml/security/test/encryption
                        XMLCipherTester.java BobKeyResolver.java
                        BaltimoreEncTest.java
               src_unitTests/org/apache/xml/security/test/c14n/implementations
                        Canonicalizer20010315Test.java
               
src_unitTests/org/apache/xml/security/test/external/org/apache/xalan/XPathAPI
                        XalanBug1425Test.java
               src_unitTests/org/apache/xml/security/test/c14n/helper
                        AttrCompareTest.java
  Log:
  Removed small sections of unused code
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.11      +10 -10    
xml-security/src_unitTests/org/apache/xml/security/test/encryption/XMLCipherTester.java
  
  Index: XMLCipherTester.java
  ===================================================================
  RCS file: 
/home/cvs/xml-security/src_unitTests/org/apache/xml/security/test/encryption/XMLCipherTester.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XMLCipherTester.java      17 Nov 2003 10:44:55 -0000      1.10
  +++ XMLCipherTester.java      26 Dec 2003 11:20:38 -0000      1.11
  @@ -183,7 +183,7 @@
   
           try {
   
  -                     source = toString(d);;
  +                     source = toString(d);
   
                        // Set up a Key Encryption Key
                        byte[] bits192 = "abcdefghijklmnopqrstuvwx".getBytes();
  @@ -248,7 +248,7 @@
   
           try {
   
  -                     source = toString(d);;
  +                     source = toString(d);
   
               // Generate an RSA key
               KeyPairGenerator rsaKeygen = KeyPairGenerator.getInstance("RSA");
  @@ -322,7 +322,7 @@
   
           try {
   
  -                     source = toString(d);;
  +                     source = toString(d);
   
                        // Set up a Key Encryption Key
                        byte[] bits192 = "abcdefghijklmnopqrstuvwx".getBytes();
  @@ -401,7 +401,7 @@
   
           try {
   
  -                     source = toString(d);;
  +                     source = toString(d);
   
               // prepare for encryption
               byte[] passPhrase = "24 Bytes per DESede key!".getBytes();
  @@ -450,7 +450,7 @@
   
           try {
   
  -                     source = toString(d);;
  +                     source = toString(d);
   
               // encrypt
               cipher = XMLCipher.getInstance(XMLCipher.AES_128);
  @@ -495,7 +495,7 @@
   
           try {
   
  -                     source = toString(d);;
  +                     source = toString(d);
   
               // encrypt
               cipher = XMLCipher.getInstance(XMLCipher.AES_192);
  @@ -542,7 +542,7 @@
   
           try {
   
  -                     source = toString(d);;
  +                     source = toString(d);
   
               // encrypt
               cipher = XMLCipher.getInstance(XMLCipher.AES_256);
  @@ -575,14 +575,14 @@
           Document d = document(); // source
           Document ed = null;      // target
           Document dd = null;      // target
  -        Element e = (Element) d.getDocumentElement();
  +        Element e = d.getDocumentElement();
           Element ee = null;
   
           String source = null;
           String target = null;
   
           try {
  -                     source = toString(d);;
  +                     source = toString(d);
   
               // prepare for encryption
               byte[] passPhrase = "24 Bytes per DESede key!".getBytes();
  @@ -625,7 +625,7 @@
                d.appendChild(docElement);
   
                // Create the XMLCipher object
  -             XMLCipher cipher = XMLCipher.getInstance();
  +             cipher = XMLCipher.getInstance();
   
                EncryptedData ed = 
                        cipher.createEncryptedData(CipherData.REFERENCE_TYPE,
  
  
  
  1.2       +0 -3      
xml-security/src_unitTests/org/apache/xml/security/test/encryption/BobKeyResolver.java
  
  Index: BobKeyResolver.java
  ===================================================================
  RCS file: 
/home/cvs/xml-security/src_unitTests/org/apache/xml/security/test/encryption/BobKeyResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BobKeyResolver.java       17 Nov 2003 10:43:32 -0000      1.1
  +++ BobKeyResolver.java       26 Dec 2003 11:20:39 -0000      1.2
  @@ -60,7 +60,6 @@
   
   import java.security.cert.X509Certificate;
   import java.security.PublicKey;
  -import java.security.PrivateKey;
   import javax.crypto.SecretKey;
   import javax.crypto.SecretKeyFactory;
   import javax.crypto.spec.DESedeKeySpec;
  @@ -81,8 +80,6 @@
   
   public class BobKeyResolver extends KeyResolverSpi {
        
  -     private static byte[] bobBytes = null;
  -
        /** [EMAIL PROTECTED] org.apache.commons.logging} logging facility */
       static org.apache.commons.logging.Log log = 
           
org.apache.commons.logging.LogFactory.getLog(BobKeyResolver.class.getName());
  
  
  
  1.11      +21 -31    
xml-security/src_unitTests/org/apache/xml/security/test/encryption/BaltimoreEncTest.java
  
  Index: BaltimoreEncTest.java
  ===================================================================
  RCS file: 
/home/cvs/xml-security/src_unitTests/org/apache/xml/security/test/encryption/BaltimoreEncTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- BaltimoreEncTest.java     17 Nov 2003 10:36:45 -0000      1.10
  +++ BaltimoreEncTest.java     26 Dec 2003 11:20:39 -0000      1.11
  @@ -62,36 +62,30 @@
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.IOException;
  -
  -import java.security.cert.X509Certificate;
  -import java.security.spec.PKCS8EncodedKeySpec;
  +import java.security.Key;
   import java.security.KeyFactory;
  -import java.security.PublicKey;
   import java.security.PrivateKey;
  -import java.security.Key;
  +import java.security.cert.X509Certificate;
  +import java.security.spec.PKCS8EncodedKeySpec;
  +
   import javax.crypto.SecretKey;
  -import javax.crypto.SecretKeyFactory;
   import javax.crypto.spec.SecretKeySpec;
  -import javax.crypto.spec.DESedeKeySpec;
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
   
  +import junit.framework.Assert;
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -import junit.framework.Assert;
   
   import org.apache.xml.security.encryption.EncryptedData;
   import org.apache.xml.security.encryption.EncryptedKey;
   import org.apache.xml.security.encryption.XMLCipher;
  -import org.apache.xml.security.keys.content.x509.XMLX509Certificate;
  +import org.apache.xml.security.keys.KeyInfo;
   import org.apache.xml.security.keys.content.KeyName;
   import org.apache.xml.security.keys.content.X509Data;
  -import org.apache.xml.security.keys.keyresolver.KeyResolverException;
  +import org.apache.xml.security.keys.content.x509.XMLX509Certificate;
   import org.apache.xml.security.keys.keyresolver.KeyResolver;
  -import org.apache.xml.security.keys.storage.StorageResolver;
  -import org.apache.xml.security.keys.KeyInfo;
  -import org.apache.xml.security.utils.Constants;
   import org.apache.xml.security.utils.XMLUtils;
   import org.apache.xml.serialize.DOMSerializer;
   import org.apache.xml.serialize.Method;
  @@ -136,7 +130,6 @@
        private static String rsaCertSerialNumber;
        private static String testDecryptString;
        private static int nodeCount = 0;
  -     private static byte[] bobBytes;
        private static byte[] jebBytes;
        private static byte[] jobBytes;
        private static byte[] jedBytes;
  @@ -169,14 +162,14 @@
         *
         * @param args
         */
  -
  +     
        protected void setUp() throws Exception {
                
                String[] testCaseName = { "-noloading",
                                                                  
BaltimoreEncTest.class.getName() };
  -
  +     
                // Create the comparison strings
  -
  +     
                DocumentBuilderFactory dbf =
                        DocumentBuilderFactory.newInstance();
                dbf.setNamespaceAware(true);
  @@ -185,50 +178,47 @@
                String filename = 
                        
"data/ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml";
                File f = new File(filename);
  -
  +     
                DocumentBuilder db = dbf.newDocumentBuilder();
                Document doc = db.parse(new java.io.FileInputStream(f));
  -
  +     
                cardNumber = retrieveCCNumber(doc);
  -
  +     
                // Test decrypt
                testDecryptString = new String("top secret message\n");
  -
  +     
                // Count the nodes in the document as a secondary test
                nodeCount = countNodes(doc);
  -
  +     
                // Create the keys
  -             bobBytes = 
  -                     "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
                jebBytes =
                        "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
                jobBytes = 
                        "abcdefghijklmnop".getBytes("ASCII");
                jedBytes = 
                        "abcdefghijklmnopqrstuvwxyz012345".getBytes("ASCII");
  -
  +     
                // Certificate information
                rsaCertSerialNumber = new String("1014918766910");
  -
  +     
                // rsaKey
                FileInputStream infile = 
                        new 
FileInputStream("data/ie/baltimore/merlin-examples/merlin-xmlenc-five/rsa.p8");
                byte[] pkcs8Bytes = new byte[10240];
  -             int inputSz = infile.read(pkcs8Bytes);
                infile.close();
  -
  +     
                PKCS8EncodedKeySpec pkcs8Spec = 
                        new PKCS8EncodedKeySpec(pkcs8Bytes);
  -
  +     
                // Create a key factory 
                KeyFactory keyFactory = 
                        KeyFactory.getInstance("RSA");
                        rsaKey = keyFactory.generatePrivate(pkcs8Spec);
        
                // Initialise the library
  -
  +     
                org.apache.xml.security.Init.init();
  -
  +     
                // Register our key resolver
                
KeyResolver.register("org.apache.xml.security.test.encryption.BobKeyResolver");
        }
  
  
  
  1.17      +6 -14     
xml-security/src_unitTests/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java
  
  Index: Canonicalizer20010315Test.java
  ===================================================================
  RCS file: 
/home/cvs/xml-security/src_unitTests/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Canonicalizer20010315Test.java    17 Sep 2003 22:08:28 -0000      1.16
  +++ Canonicalizer20010315Test.java    26 Dec 2003 11:20:39 -0000      1.17
  @@ -672,12 +672,11 @@
                     ParserConfigurationException, CanonicalizationException,
                     InvalidCanonicalizerException, TransformerException {
   
  -      String descri = "3.7 Document Subsets. (uncommented), c14n by 
NodeList";
  +      //String descri = "3.7 Document Subsets. (uncommented), c14n by 
NodeList";
         String fileIn = prefix + "in/37_input.xml";
         String fileRef = prefix + "in/37_c14n.xml";
  -      String fileOut = prefix + "out/xpath_37_output_c14nByNodeList.xml";
  -      String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
  -      boolean validating = true;
  +      //String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
  +      //boolean validating = true;
         DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
   
         dfactory.setNamespaceAware(true);
  @@ -799,8 +798,6 @@
                     ParserConfigurationException, CanonicalizationException,
                     InvalidCanonicalizerException, TransformerException {
   
  -      String descri = "";
  -      String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
         //J-
         String inputStr = ""
            + "<absolute:correct      
xmlns:absolute='http://www.absolute.org/#likeVodka'>"
  @@ -821,13 +818,8 @@
         try {
            Canonicalizer c14n =
               
Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
  -         byte c14nBytes[] = c14n.canonicalizeSubtree(doc);
  +         c14n.canonicalizeSubtree(doc);
   
  -         /*
  -         FileOutputStream fos = new 
FileOutputStream("data/org/apache/xml/security/out/relativeNS.xml");
  -         fos.write(c14nBytes);
  -         fos.close();
  -         */
         } catch (CanonicalizationException cex) {
   
            // if we reach this point - good.
  @@ -1244,8 +1236,8 @@
              throws ParserConfigurationException, IOException, SAXException,
                     TransformerConfigurationException, TransformerException {
   
  -      String ENCODING_ISO8859_1 = "ISO-8859-1";
  -      String ENCODING_UTF8 = "UTF-8";
  +      //String ENCODING_ISO8859_1 = "ISO-8859-1";
  +      //String ENCODING_UTF8 = "UTF-8";
         String ENCODING_UTF16 = "UTF-16";
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         DocumentBuilder db = dbf.newDocumentBuilder();
  
  
  
  1.7       +0 -1      
xml-security/src_unitTests/org/apache/xml/security/test/external/org/apache/xalan/XPathAPI/XalanBug1425Test.java
  
  Index: XalanBug1425Test.java
  ===================================================================
  RCS file: 
/home/cvs/xml-security/src_unitTests/org/apache/xml/security/test/external/org/apache/xalan/XPathAPI/XalanBug1425Test.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XalanBug1425Test.java     29 Apr 2003 21:36:58 -0000      1.6
  +++ XalanBug1425Test.java     26 Dec 2003 11:20:39 -0000      1.7
  @@ -164,7 +164,6 @@
                                                 "COMMENT", "DOCUMENT",
                                                 "DOCUMENT_TYPE",
                                                 "DOCUMENT_FRAGMENT", 
"NOTATION" };
  -      int i = 0;
         Node n;
   
         while ((n = nl.nextNode()) != null) {
  
  
  
  1.6       +7 -8      
xml-security/src_unitTests/org/apache/xml/security/test/c14n/helper/AttrCompareTest.java
  
  Index: AttrCompareTest.java
  ===================================================================
  RCS file: 
/home/cvs/xml-security/src_unitTests/org/apache/xml/security/test/c14n/helper/AttrCompareTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AttrCompareTest.java      17 Sep 2003 22:02:16 -0000      1.5
  +++ AttrCompareTest.java      26 Dec 2003 11:20:39 -0000      1.6
  @@ -189,15 +189,14 @@
         AttrCompare attrCompare = new AttrCompare();
   
         assertEquals("attrCompare.compare((Object) attr0, (Object) attr1)", -1,
  -                   attrCompare.compare((Object) attr0, (Object) attr1));
  +                   attrCompare.compare(attr0, attr1));
         assertEquals("attrCompare.compare((Object) attr1, (Object) attr0)", 1,
  -                   attrCompare.compare((Object) attr1, (Object) attr0));
  +                   attrCompare.compare(attr1, attr0));
      }
   
      public static void testA2() throws ParserConfigurationException {
   
         Document doc = createDoc("documentElement");
  -      Element root = doc.getDocumentElement();
         Attr attr0 = doc.createAttributeNS("http://goo";, "goo:foo");
         Attr attr1 = doc.createAttributeNS(null, "foo");
   
  @@ -207,9 +206,9 @@
         AttrCompare attrCompare = new AttrCompare();
   
         assertEquals("attrCompare.compare((Object) attr0, (Object) attr1)", 1,
  -                   attrCompare.compare((Object) attr0, (Object) attr1));
  +                   attrCompare.compare(attr0, attr1));
         assertEquals("attrCompare.compare((Object) attr1, (Object) attr0)", -1,
  -                   attrCompare.compare((Object) attr1, (Object) attr0));
  +                   attrCompare.compare(attr1, attr0));
   
      }
   
  @@ -242,13 +241,13 @@
         AttrCompare attrCompare = new AttrCompare();
   
         assertEquals("attrCompare.compare((Object) attr0, (Object) attr1)", -1,
  -                   attrCompare.compare((Object) attr0, (Object) attr1));
  +                   attrCompare.compare(attr0, attr1));
         assertEquals("attrCompare.compare((Object) attr1, (Object) attr0)", 1,
  -                   attrCompare.compare((Object) attr1, (Object) attr0));
  +                   attrCompare.compare(attr1, attr0));
      }
   
      /**
  -    * This test uses teh attrs[] array to compare every attribute against
  +    * This test uses the attrs[] array to compare every attribute against
       * the others (and vice versa).
       *
       * The attribute values are taken from example 3.3 Start and End Tags
  
  
  

Reply via email to