aboutsummaryrefslogtreecommitdiff
path: root/id.server/src/test/at/gv/egovernment/moa/id/auth/servlet
diff options
context:
space:
mode:
authormcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
committermcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
commit43e57a42832ea8b4ceb0317f3c9028a4174ffa7b (patch)
treef5ed9074b8d7b89b2dd5b22d326f63be103e7551 /id.server/src/test/at/gv/egovernment/moa/id/auth/servlet
parent10889e9dea2cc2f70b475e6ff7af37fdba1621d9 (diff)
downloadmoa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.gz
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.bz2
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.zip
Adapted project directory structure to suit the new maven based build process.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@909 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'id.server/src/test/at/gv/egovernment/moa/id/auth/servlet')
-rw-r--r--id.server/src/test/at/gv/egovernment/moa/id/auth/servlet/GetAuthenticationDataServiceTest.java91
1 files changed, 0 insertions, 91 deletions
diff --git a/id.server/src/test/at/gv/egovernment/moa/id/auth/servlet/GetAuthenticationDataServiceTest.java b/id.server/src/test/at/gv/egovernment/moa/id/auth/servlet/GetAuthenticationDataServiceTest.java
deleted file mode 100644
index c78651fdb..000000000
--- a/id.server/src/test/at/gv/egovernment/moa/id/auth/servlet/GetAuthenticationDataServiceTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package test.at.gv.egovernment.moa.id.auth.servlet;
-
-import org.w3c.dom.Element;
-
-import test.at.gv.egovernment.moa.id.UnitTestCase;
-
-import at.gv.egovernment.moa.id.auth.servlet.GetAuthenticationDataService;
-import at.gv.egovernment.moa.util.Constants;
-import at.gv.egovernment.moa.util.DOMUtils;
-import at.gv.egovernment.moa.util.XPathUtils;
-
-/**
- * Test case instantiates GetAuthenticationDataService and calls the Request() method.
- * It DOES NOT call the web service via Axis.
- *
- * @author Paul Ivancsics
- * @version $Id$
- */
-public class GetAuthenticationDataServiceTest extends UnitTestCase implements Constants {
-
- private GetAuthenticationDataService service;
-
- public GetAuthenticationDataServiceTest(String arg0) {
- super(arg0);
- }
- protected void setUp() throws Exception {
- service = new GetAuthenticationDataService();
- }
-
- public void testService2Requests() throws Exception {
- String requestString =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
- "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" +
- "<saml:AssertionIDReference>123</saml:AssertionIDReference>" +
- "</samlp:Request>";
- Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement();
- Element response = service.Request(new Element[] {request, request})[0];
- assertStatus(response, "samlp:Requester", "samlp:TooManyResponses");
- }
- public void testServiceNoSAMLArtifact() throws Exception {
- String requestString =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
- "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" +
- "<saml:AssertionIDReference>123</saml:AssertionIDReference>" +
- "</samlp:Request>";
- Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement();
- Element response = service.Request(new Element[] {request})[0];
- assertStatus(response, "samlp:Requester", null);
- }
- public void testService2SAMLArtifacts() throws Exception {
- String requestString =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
- "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" +
- "<samlp:AssertionArtifact>123</samlp:AssertionArtifact>" +
- "<samlp:AssertionArtifact>456</samlp:AssertionArtifact>" +
- "</samlp:Request>";
- Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement();
- Element response = service.Request(new Element[] {request})[0];
- assertStatus(response, "samlp:Requester", "samlp:TooManyResponses");
- }
- public void testServiceWrongFormat() throws Exception {
- String requestString =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
- "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" +
- "</samlp:Request>";
- Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement();
- Element response = service.Request(new Element[] {request})[0];
- assertStatus(response, "samlp:Requester", null);
- }
- public void testServiceWrongSAMLArtifact() throws Exception {
- String requestString =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
- "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" +
- "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" +
- "</samlp:Request>";
- Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement();
- Element response = service.Request(new Element[] {request})[0];
- assertStatus(response, "samlp:Requester", "samlp:ResourceNotRecognized");
- }
- private void assertStatus(Element response, String statusCodeShould, String subStatusCodeShould) throws Exception {
- Element statusCodeNode = (Element)XPathUtils.selectSingleNode(response, "//samlp:StatusCode");
- String statusCode = statusCodeNode.getAttribute("Value");
- Element subStatusCodeNode = (Element)XPathUtils.selectSingleNode(statusCodeNode, "//samlp:StatusCode/samlp:StatusCode");
- String subStatusCode = subStatusCodeNode == null ? null : subStatusCodeNode.getAttribute("Value");
- System.out.println(statusCode + subStatusCode);
- assertEquals(statusCodeShould, statusCode);
- assertEquals(subStatusCodeShould, subStatusCode);
- }
-
-
-}