aboutsummaryrefslogtreecommitdiff
path: root/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind
diff options
context:
space:
mode:
Diffstat (limited to 'spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind')
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java24
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java71
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java113
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java61
-rw-r--r--spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java81
5 files changed, 0 insertions, 350 deletions
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java b/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java
deleted file mode 100644
index 28f79729e..000000000
--- a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/AllTests.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package test.at.gv.egovernment.moa.spss.api.xmlbind;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Runs all tests in this package.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class AllTests {
- public static Test suite() {
- TestSuite suite = new TestSuite();
-
- suite.addTestSuite(CreateXMLSignatureRequestParserTest.class);
- suite.addTestSuite(TransformParserTest.class);
- suite.addTestSuite(VerifyCMSSignatureRequestParserTest.class);
- suite.addTestSuite(VerifyXMLSignatureRequestParserTest.class);
-
- return suite;
- }
-
-}
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java b/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java
deleted file mode 100644
index 7ce705b01..000000000
--- a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/CreateXMLSignatureRequestParserTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package test.at.gv.egovernment.moa.spss.api.xmlbind;
-
-import org.w3c.dom.Element;
-
-import test.at.gv.egovernment.moa.spss.SPSSTestCase;
-
-import at.gv.egovernment.moa.spss.api.xmlbind.CreateXMLSignatureRequestParser;
-import at.gv.egovernment.moa.spss.api.xmlsign.CreateSignatureEnvironmentProfileExplicit;
-import at.gv.egovernment.moa.spss.api.xmlsign.CreateTransformsInfoProfileExplicit;
-import at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest;
-import at.gv.egovernment.moa.spss.api.xmlsign.DataObjectInfo;
-import at.gv.egovernment.moa.spss.api.xmlsign.SingleSignatureInfo;
-
-/**
- * Test the <code>CreateXMLSignatureRequestParser</code>.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class CreateXMLSignatureRequestParserTest extends SPSSTestCase {
- private static final String TESTDATA_BASE =
- TESTDATA_ROOT + "xml/CreateXMLSignature/";
-
- private CreateXMLSignatureRequestParser requestParser;
-
- public CreateXMLSignatureRequestParserTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- requestParser = new CreateXMLSignatureRequestParser();
- }
-
- public void testParse() throws Exception {
- Element requestElem =
- parseXml(TESTDATA_BASE + "TestGeneratorCX2.001.Req.xml")
- .getDocumentElement();
- CreateXMLSignatureRequest request = requestParser.parse(requestElem);
- SingleSignatureInfo sigInfo;
- DataObjectInfo dataObjInfo;
- CreateTransformsInfoProfileExplicit transProfile;
- CreateSignatureEnvironmentProfileExplicit envProfile;
-
- assertNotNull(request);
- assertEquals("PKCS12RSAKey1", request.getKeyIdentifier());
- assertEquals(1, request.getSingleSignatureInfos().size());
-
- sigInfo = (SingleSignatureInfo) request.getSingleSignatureInfos().get(0);
- assertEquals(1, sigInfo.getDataObjectInfos().size());
- assertFalse(sigInfo.isSecurityLayerConform());
-
- dataObjInfo = (DataObjectInfo) sigInfo.getDataObjectInfos().get(0);
- assertNotNull(dataObjInfo.getDataObject());
-
- transProfile =
- (CreateTransformsInfoProfileExplicit) dataObjInfo
- .getCreateTransformsInfoProfile();
- assertNotNull(
- transProfile.getCreateTransformsInfo().getFinalDataMetaInfo());
-
- envProfile =
- (CreateSignatureEnvironmentProfileExplicit) sigInfo
- .getCreateSignatureInfo()
- .getCreateSignatureEnvironmentProfile();
- assertEquals(
- "//data:Document",
- envProfile.getCreateSignatureLocation().getXPathExpression());
- assertEquals(0, envProfile.getCreateSignatureLocation().getIndex());
- }
-
-}
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java b/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java
deleted file mode 100644
index f580f86bc..000000000
--- a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/TransformParserTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package test.at.gv.egovernment.moa.spss.api.xmlbind;
-
-import java.util.List;
-
-import org.w3c.dom.Element;
-
-import test.at.gv.egovernment.moa.spss.SPSSTestCase;
-
-import at.gv.egovernment.moa.spss.api.common.CanonicalizationTransform;
-import at.gv.egovernment.moa.spss.api.common.EnvelopedSignatureTransform;
-import at.gv.egovernment.moa.spss.api.common.ExclusiveCanonicalizationTransform;
-import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform;
-import at.gv.egovernment.moa.spss.api.common.XPathTransform;
-import at.gv.egovernment.moa.spss.api.common.XSLTTransform;
-import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser;
-
-/**
- * Test the <code>TransformParser</code>.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class TransformParserTest extends SPSSTestCase {
- private static String TESTDATA_BASE = TESTDATA_ROOT + "xml/dsigTransform/";
-
- private TransformParser transformParser;
-
- public TransformParserTest(String name) {
- super(name);
- }
-
- protected void setUp() {
- transformParser = new TransformParser();
- }
-
- public void testParseTransforms() throws Exception {
- Element transformsElem =
- parseXml(TESTDATA_BASE + "transforms.xml").getDocumentElement();
- List transforms = transformParser.parseTransforms(transformsElem);
-
- assertNotNull(transforms);
- assertEquals(3, transforms.size());
-
- }
-
- public void testParseCanonicalizationTransform() throws Exception {
- Element transformElem =
- parseXml(TESTDATA_BASE + "canonicalization.xml").getDocumentElement();
- CanonicalizationTransform transform =
- (CanonicalizationTransform) transformParser.parseTransform(transformElem);
-
- assertNotNull(transform);
- assertEquals(
- CanonicalizationTransform.CANONICAL_XML,
- transform.getAlgorithmURI());
- }
-
- public void testParseExclCanonicalizationTransform() throws Exception {
- Element transformElem =
- parseXml(TESTDATA_BASE + "exclusiveCanonicalization.xml")
- .getDocumentElement();
- ExclusiveCanonicalizationTransform transform =
- (ExclusiveCanonicalizationTransform) transformParser.parseTransform(
- transformElem);
-
- assertNotNull(transform);
- assertEquals(
- ExclusiveCanonicalizationTransform.EXCLUSIVE_CANONICAL_XML,
- transform.getAlgorithmURI());
- assertEquals(3, transform.getInclusiveNamespacePrefixes().size());
- }
-
- public void testParseEnvelopedTransform() throws Exception {
- Element transformElem =
- parseXml(TESTDATA_BASE + "enveloped.xml").getDocumentElement();
- EnvelopedSignatureTransform transform =
- (EnvelopedSignatureTransform) transformParser.parseTransform(
- transformElem);
-
- assertNotNull(transform);
- }
-
- public void testParseXPathTransform() throws Exception {
- Element transformElem =
- parseXml(TESTDATA_BASE + "xpath.xml").getDocumentElement();
- XPathTransform transform =
- (XPathTransform) transformParser.parseTransform(transformElem);
-
- assertNotNull(transform);
- assertEquals("//ToBeSigned/Data", transform.getXPathExpression());
- assertEquals(1, transform.getNamespaceDeclarations().size());
- }
-
- public void testParseXPathFilter2Transform() throws Exception {
- Element transformElem =
- parseXml(TESTDATA_BASE + "xpath2.xml").getDocumentElement();
- XPathFilter2Transform transform =
- (XPathFilter2Transform) transformParser.parseTransform(transformElem);
-
- assertNotNull(transform);
- assertEquals(3, transform.getFilters().size());
- }
-
- public void testParseXSLTTransform() throws Exception {
- Element transformElem =
- parseXml(TESTDATA_BASE + "xslt.xml").getDocumentElement();
- XSLTTransform transform =
- (XSLTTransform) transformParser.parseTransform(transformElem);
-
- assertNotNull(transform);
- }
-
-}
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java b/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java
deleted file mode 100644
index 4be7667eb..000000000
--- a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureRequestParserTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package test.at.gv.egovernment.moa.spss.api.xmlbind;
-
-import org.w3c.dom.Element;
-
-import at.gv.egovernment.moa.util.DateTimeUtils;
-
-import test.at.gv.egovernment.moa.spss.SPSSTestCase;
-
-import at.gv.egovernment.moa.spss.api.cmsverify.CMSContentExcplicit;
-import at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest;
-import at.gv.egovernment.moa.spss.api.common.MetaInfo;
-import at.gv.egovernment.moa.spss.api.xmlbind.VerifyCMSSignatureRequestParser;
-
-/**
- * Test the <code>VerifyCMSSignatureRequestParserTest</code>.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class VerifyCMSSignatureRequestParserTest extends SPSSTestCase {
- private static String TESTDATA_BASE =
- TESTDATA_ROOT + "xml/VerifyCMSSignature/";
-
- private VerifyCMSSignatureRequestParser requestParser;
-
- public VerifyCMSSignatureRequestParserTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- requestParser = new VerifyCMSSignatureRequestParser();
- }
-
- public void testParse() throws Exception {
- Element requestElem =
- parseXml(TESTDATA_BASE + "TestGeneratorVC0.001.Req.xml")
- .getDocumentElement();
- VerifyCMSSignatureRequest request = requestParser.parse(requestElem);
- MetaInfo metaInfo;
- CMSContentExcplicit content;
-
- assertNotNull(request);
- assertEquals(1, request.getSignatories()[0]);
- assertEquals(
- DateTimeUtils.parseDateTime("2003-04-04T09:30:47-05:00"),
- request.getDateTime());
- assertNotNull(request.getCMSSignature());
- assertNotNull(request.getDataObject());
- assertEquals("TrustProfile1", request.getTrustProfileId());
-
- metaInfo = request.getDataObject().getMetaInfo();
- assertNotNull(metaInfo);
- assertEquals("text/plain", metaInfo.getMimeType());
- assertEquals("http://10.16.46.109/TestDatenGenerator/resources/testDaten.txt", metaInfo.getDescription());
-
- content = (CMSContentExcplicit) request.getDataObject().getContent();
- assertNotNull(content.getBinaryContent());
-
- }
-
-}
diff --git a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java b/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java
deleted file mode 100644
index 3b8e8b00e..000000000
--- a/spss.server/src/test/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureRequestParserTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package test.at.gv.egovernment.moa.spss.api.xmlbind;
-
-import org.w3c.dom.Element;
-
-import test.at.gv.egovernment.moa.spss.SPSSTestCase;
-
-import at.gv.egovernment.moa.util.DateTimeUtils;
-
-import at.gv.egovernment.moa.spss.api.xmlbind.VerifyXMLSignatureRequestParser;
-import at.gv.egovernment.moa.spss.api.xmlverify.ReferenceInfo;
-import at.gv.egovernment.moa.spss.api.xmlverify.SignatureManifestCheckParams;
-import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureInfo;
-import at.gv.egovernment.moa.spss.api.xmlverify.VerifySignatureLocation;
-import at.gv.egovernment.moa.spss.api.xmlverify.VerifyTransformsInfoProfileExplicit;
-import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest;
-
-/**
- * Test the <code>VerifyXMLSignatureRequestParserTest</code>.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class VerifyXMLSignatureRequestParserTest extends SPSSTestCase {
- private static String TESTDATA_BASE =
- TESTDATA_ROOT + "xml/VerifyXMLSignature/";
-
- private VerifyXMLSignatureRequestParser parser;
-
- public VerifyXMLSignatureRequestParserTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- parser = new VerifyXMLSignatureRequestParser();
- }
-
- public void testParse() throws Exception {
- Element requestElem =
- parseXml(TESTDATA_BASE + "TestGeneratorVX.201.Req.xml")
- .getDocumentElement();
- VerifyXMLSignatureRequest request = parser.parse(requestElem);
- VerifySignatureInfo verifySignatureInfo;
- VerifySignatureLocation verifyLocation;
- SignatureManifestCheckParams checkParams;
- ReferenceInfo refInfo;
- VerifyTransformsInfoProfileExplicit transformsProfile;
-
- assertNotNull(request);
- assertEquals(
- DateTimeUtils.parseDateTime("2003-04-01T12:53:57+01:00"),
- request.getDateTime());
- assertFalse(request.getReturnHashInputData());
- assertEquals("TrustProfile1", request.getTrustProfileId());
-
- verifySignatureInfo = request.getSignatureInfo();
- assertNotNull(verifySignatureInfo);
- assertNotNull(verifySignatureInfo.getVerifySignatureEnvironment());
-
- verifyLocation = verifySignatureInfo.getVerifySignatureLocation();
- assertNotNull(verifyLocation);
- assertEquals("//dsig:Signature", verifyLocation.getXPathExpression());
- assertEquals(3, verifyLocation.getNamespaceDeclarations().size());
-
- checkParams = request.getSignatureManifestCheckParams();
- assertNotNull(checkParams);
- assertEquals(true, checkParams.getReturnReferenceInputData());
- assertEquals(1, checkParams.getReferenceInfos().size());
-
- refInfo = (ReferenceInfo) checkParams.getReferenceInfos().get(0);
- assertEquals(1, refInfo.getVerifyTransformsInfoProfiles().size());
-
- transformsProfile =
- (VerifyTransformsInfoProfileExplicit) refInfo
- .getVerifyTransformsInfoProfiles()
- .get(0);
- assertEquals(1, transformsProfile.getTransforms().size());
- assertEquals(1, transformsProfile.getTransformParameters().size());
-
- }
-
-}