You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by mu...@apache.org on 2008/02/11 17:21:03 UTC
svn commit: r620515 - in
/xml/security/trunk/src_samples/org/apache/xml/security/samples: ./
canonicalization/ iaik/ keys/ signature/ signature/contract/ transforms/
Author: mullan
Date: Mon Feb 11 08:21:01 2008
New Revision: 620515
URL: http://svn.apache.org/viewvc?rev=620515&view=rev
Log:
Fix nightly build error by removing dependency on org.apache.xml.security.test.TestUtils.
Added:
xml/security/trunk/src_samples/org/apache/xml/security/samples/SampleUtils.java
Modified:
xml/security/trunk/src_samples/org/apache/xml/security/samples/ResolverUsageHTTP.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/TestSignature.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifySignature.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformChaining.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformEnvelopedSignature.java
xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformXPathHereFunc.java
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/ResolverUsageHTTP.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/ResolverUsageHTTP.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/ResolverUsageHTTP.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/ResolverUsageHTTP.java Mon Feb 11 08:21:01 2008
@@ -19,8 +19,8 @@
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.test.TestUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xml.security.utils.resolver.ResourceResolver;
@@ -106,7 +106,7 @@
javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
org.w3c.dom.Document doc =
db.parse(new java.io.ByteArrayInputStream(inputStr.getBytes()));
- Element context = TestUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
+ Element context = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
Element dsElem = (Element) XPathAPI.selectSingleNode(doc,
"//ds:Signature[1]", context);
Added: xml/security/trunk/src_samples/org/apache/xml/security/samples/SampleUtils.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/SampleUtils.java?rev=620515&view=auto
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/SampleUtils.java (added)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/SampleUtils.java Mon Feb 11 08:21:01 2008
@@ -0,0 +1,31 @@
+package org.apache.xml.security.samples;
+
+import org.apache.xml.security.utils.Constants;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class SampleUtils {
+
+ /**
+ * Method createDSctx
+ *
+ * @param doc
+ * @param prefix
+ * @param namespace
+ * @return the element.
+ */
+ public static Element createDSctx
+ (Document doc, String prefix, String namespace) {
+
+ if ((prefix == null) || (prefix.trim().length() == 0)) {
+ throw new IllegalArgumentException("You must supply a prefix");
+ }
+
+ Element ctx = doc.createElementNS(null, "namespaceContext");
+
+ ctx.setAttributeNS
+ (Constants.NamespaceSpecNS, "xmlns:" + prefix.trim(), namespace);
+
+ return ctx;
+ }
+}
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/canonicalization/CanonSubTree.java Mon Feb 11 08:21:01 2008
@@ -25,7 +25,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.xml.security.c14n.Canonicalizer;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
@@ -89,7 +89,7 @@
Canonicalizer c14n =
Canonicalizer
.getInstance("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
- Element nscontext = TestUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
+ Element nscontext = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
Node signedInfo = XPathAPI.selectSingleNode(doc, "//ds:SignedInfo",
nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/iaik/IAIKInterOp.java Mon Feb 11 08:21:01 2008
@@ -26,7 +26,7 @@
import org.apache.xml.security.keys.KeyInfo;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
@@ -159,7 +159,7 @@
javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
- Element nscontext = TestUtils.createDSctx(doc, "ds",
+ Element nscontext = SampleUtils.createDSctx(doc, "ds",
Constants.SignatureSpecNS);
Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
"//ds:Signature[1]", nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/keys/RetrievePublicKeys.java Mon Feb 11 08:21:01 2008
@@ -25,7 +25,7 @@
import org.apache.xml.security.keys.KeyInfo;
import org.apache.xml.security.keys.storage.StorageResolver;
import org.apache.xml.security.keys.storage.implementations.CertsInFilesystemDirectoryResolver;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
@@ -92,7 +92,7 @@
javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
org.w3c.dom.Document doc =
db.parse(new java.io.FileInputStream(filename));
- Element nscontext = TestUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
+ Element nscontext = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
Element kiElement = (Element) XPathAPI.selectSingleNode(doc,
"//ds:KeyInfo[1]", nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/TestSignature.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/TestSignature.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/TestSignature.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/TestSignature.java Mon Feb 11 08:21:01 2008
@@ -26,7 +26,7 @@
import org.apache.xml.security.keys.storage.StorageResolver;
import org.apache.xml.security.samples.utils.resolver.OfflineResolver;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
@@ -95,7 +95,7 @@
db.parse(new java.io.FileInputStream(filename));
//create a namespace context for use in the XPath expression below
- Element nscontext = TestUtils.createDSctx(doc, "ds",
+ Element nscontext = SampleUtils.createDSctx(doc, "ds",
Constants.SignatureSpecNS);
//retrieve the signature Element from the document
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyCollectableSignature.java Mon Feb 11 08:21:01 2008
@@ -22,7 +22,7 @@
import org.apache.xml.security.signature.SignedInfo;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
@@ -68,7 +68,7 @@
org.w3c.dom.Document doc =
db.parse(new java.io.FileInputStream(signatureFile));
- Element nscontext = TestUtils.createDSctx(doc, "ds",
+ Element nscontext = SampleUtils.createDSctx(doc, "ds",
Constants.SignatureSpecNS);
NodeList signatureElems = XPathAPI.selectNodeList(doc,
"//ds:Signature", nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesFifteen.java Mon Feb 11 08:21:01 2008
@@ -25,7 +25,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
@@ -162,7 +162,7 @@
org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
- Element nscontext = TestUtils.createDSctx(doc, "ds",
+ Element nscontext = SampleUtils.createDSctx(doc, "ds",
Constants.SignatureSpecNS);
Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
"//ds:Signature[1]", nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesSixteen.java Mon Feb 11 08:21:01 2008
@@ -28,7 +28,7 @@
import org.apache.xml.security.keys.KeyInfo;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
@@ -147,7 +147,7 @@
org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
- Element nscontext = TestUtils.createDSctx(doc, "ds",
+ Element nscontext = SampleUtils.createDSctx(doc, "ds",
Constants.SignatureSpecNS);
Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
"//ds:Signature[1]", nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifyMerlinsExamplesTwentyThree.java Mon Feb 11 08:21:01 2008
@@ -28,7 +28,7 @@
import org.apache.xml.security.keys.KeyInfo;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
@@ -157,7 +157,7 @@
org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
- Element nscontext = TestUtils.createDSctx(doc, "ds",
+ Element nscontext = SampleUtils.createDSctx(doc, "ds",
Constants.SignatureSpecNS);
Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
"//ds:Signature[1]", nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifySignature.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifySignature.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifySignature.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/VerifySignature.java Mon Feb 11 08:21:01 2008
@@ -27,7 +27,7 @@
import org.apache.xml.security.keys.KeyInfo;
import org.apache.xml.security.samples.utils.resolver.OfflineResolver;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
@@ -117,7 +117,7 @@
}
org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
- Element nscontext = TestUtils.createDSctx(doc, "ds",
+ Element nscontext = SampleUtils.createDSctx(doc, "ds",
Constants.SignatureSpecNS);
Element sigElement = (Element) XPathAPI.selectSingleNode(doc,
"//ds:Signature[1]", nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/signature/contract/ThreeSignerContractVerify.java Mon Feb 11 08:21:01 2008
@@ -21,7 +21,7 @@
import java.io.File;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
@@ -65,7 +65,7 @@
org.w3c.dom.Document doc =
db.parse(new java.io.FileInputStream(signatureFile));
- Element nscontext = TestUtils.createDSctx(doc, "ds",
+ Element nscontext = SampleUtils.createDSctx(doc, "ds",
Constants.SignatureSpecNS);
NodeList signatureElems = XPathAPI.selectNodeList(doc,
"//ds:Signature", nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformChaining.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformChaining.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformChaining.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformChaining.java Mon Feb 11 08:21:01 2008
@@ -20,7 +20,7 @@
import org.apache.xml.security.signature.XMLSignatureInput;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.transforms.Transforms;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
@@ -91,7 +91,7 @@
db.parse(new java.io.ByteArrayInputStream(inputStr.getBytes()));
// catch the ds:Transforms
- Element nscontext = TestUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
+ Element nscontext = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
Element transformsElement = (Element) XPathAPI.selectSingleNode(doc,
"//ds:Transforms", nscontext);
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformEnvelopedSignature.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformEnvelopedSignature.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformEnvelopedSignature.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformEnvelopedSignature.java Mon Feb 11 08:21:01 2008
@@ -20,7 +20,7 @@
import org.apache.xml.security.signature.XMLSignatureInput;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.transforms.Transforms;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
@@ -81,7 +81,7 @@
javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
org.w3c.dom.Document doc =
db.parse(new java.io.ByteArrayInputStream(inputStr.getBytes()));
- Element nscontext = TestUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
+ Element nscontext = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
Element transformsElem = (Element) XPathAPI.selectSingleNode(
doc, "//ds:Signature[@Id='SignatureToBeOmitted']//ds:Transforms",
Modified: xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformXPathHereFunc.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformXPathHereFunc.java?rev=620515&r1=620514&r2=620515&view=diff
==============================================================================
--- xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformXPathHereFunc.java (original)
+++ xml/security/trunk/src_samples/org/apache/xml/security/samples/transforms/SampleTransformXPathHereFunc.java Mon Feb 11 08:21:01 2008
@@ -20,7 +20,7 @@
import org.apache.xml.security.signature.XMLSignatureInput;
-import org.apache.xml.security.test.TestUtils;
+import org.apache.xml.security.samples.SampleUtils;
import org.apache.xml.security.transforms.Transforms;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.XMLUtils;
@@ -78,7 +78,7 @@
javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
org.w3c.dom.Document doc =
db.parse(new java.io.ByteArrayInputStream(inputStr.getBytes()));
- Element nscontext = TestUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
+ Element nscontext = SampleUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
Element transformsElem = (Element) XPathAPI.selectSingleNode(
doc,