Author: anil.saldhana(a)jboss.com
Date: 2011-08-09 12:16:04 -0400 (Tue, 09 Aug 2011)
New Revision: 1165
Added:
integration-tests/trunk/picketlink-saml-tests/src/test/java/org/picketlink/test/integration/saml2/StandaloneSAMLUnitTestCase.java
Modified:
integration-tests/trunk/picketlink-saml-jbas51/pom.xml
integration-tests/trunk/picketlink-saml-jbas6/pom.xml
integration-tests/trunk/picketlink-saml-standalone/pom.xml
integration-tests/trunk/picketlink-saml-tomcat6/pom.xml
integration-tests/trunk/pom.xml
Log:
standalone test
Modified: integration-tests/trunk/picketlink-saml-jbas51/pom.xml
===================================================================
--- integration-tests/trunk/picketlink-saml-jbas51/pom.xml 2011-08-09 15:44:11 UTC (rev
1164)
+++ integration-tests/trunk/picketlink-saml-jbas51/pom.xml 2011-08-09 16:16:04 UTC (rev
1165)
@@ -39,6 +39,9 @@
<testClassesDirectory>${basedir}/../picketlink-saml-tests/target/test-classes</testClassesDirectory>
<printSummary>true</printSummary>
<disableXmlReport>false</disableXmlReport>
+ <excludes>
+ <exclude>**/Standalone**TestCase.java</exclude>
+ </excludes>
<includes>
<include>**/**TestCase.java</include>
</includes>
Modified: integration-tests/trunk/picketlink-saml-jbas6/pom.xml
===================================================================
--- integration-tests/trunk/picketlink-saml-jbas6/pom.xml 2011-08-09 15:44:11 UTC (rev
1164)
+++ integration-tests/trunk/picketlink-saml-jbas6/pom.xml 2011-08-09 16:16:04 UTC (rev
1165)
@@ -39,6 +39,9 @@
<testClassesDirectory>${basedir}/../picketlink-saml-tests/target/test-classes</testClassesDirectory>
<printSummary>true</printSummary>
<disableXmlReport>false</disableXmlReport>
+ <excludes>
+ <exclude>**/Standalone**TestCase.java</exclude>
+ </excludes>
<includes>
<include>**/**TestCase.java</include>
</includes>
Modified: integration-tests/trunk/picketlink-saml-standalone/pom.xml
===================================================================
--- integration-tests/trunk/picketlink-saml-standalone/pom.xml 2011-08-09 15:44:11 UTC
(rev 1164)
+++ integration-tests/trunk/picketlink-saml-standalone/pom.xml 2011-08-09 16:16:04 UTC
(rev 1165)
@@ -37,8 +37,9 @@
<phase>test</phase>
<printSummary>true</printSummary>
<disableXmlReport>false</disableXmlReport>
+
<testClassesDirectory>${basedir}/../picketlink-saml-tests/target/test-classes</testClassesDirectory>
<includes>
- <include>**/**TestCase.java</include>
+ <include>**/Standalone**TestCase.java</include>
</includes>
<forkMode>pertest</forkMode>
<argLine>-Djava.endorsed.dirs=${basedir}/../picketlink-saml-tests/src/test/resources/endorsed</argLine>
Added:
integration-tests/trunk/picketlink-saml-tests/src/test/java/org/picketlink/test/integration/saml2/StandaloneSAMLUnitTestCase.java
===================================================================
---
integration-tests/trunk/picketlink-saml-tests/src/test/java/org/picketlink/test/integration/saml2/StandaloneSAMLUnitTestCase.java
(rev 0)
+++
integration-tests/trunk/picketlink-saml-tests/src/test/java/org/picketlink/test/integration/saml2/StandaloneSAMLUnitTestCase.java 2011-08-09
16:16:04 UTC (rev 1165)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.picketlink.test.integration.saml2;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.SubmitButton;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebForm;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+/**
+ * SAML Test for Standalone Web Containers
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Aug 9, 2011
+ */
+public class StandaloneSAMLUnitTestCase
+{
+ String SERVICE_1_URL = System.getProperty( "SERVICE_1_URL",
"http://localhost:8080/sales-standalone/" );
+ String SERVICE_2_URL = System.getProperty( "SERVICE_2_URL",
"http://localhost:8080/employee-standalone/" );
+ String LOGOUT_URL = "?GLO=true";
+
+
+ public String getService1URL()
+ {
+ return SERVICE_1_URL;
+ }
+ public String getService2URL()
+ {
+ return SERVICE_2_URL;
+ }
+
+ @Test
+ public void testSAMLStandalone() throws Exception
+ {
+ //Sales Application Login
+ System.out.println("Trying "+ getService1URL());
+ WebRequest serviceRequest1 = new GetMethodWebRequest( getService1URL() );
+ WebConversation webConversation = new WebConversation();
+
+ WebResponse webResponse = webConversation.getResponse( serviceRequest1 );
+ WebForm loginForm = webResponse.getForms()[0];
+ loginForm.setParameter("JBID_USERNAME", "manager" );
+ loginForm.setParameter("JBID_PASSWORD", "tomcat" );
+ SubmitButton submitButton = loginForm.getSubmitButtons()[0];
+ submitButton.click();
+
+ webResponse = webConversation.getCurrentPage();
+ assertTrue( " Reached the sales index page ",
webResponse.getText().contains( "SalesTool" ));
+
+ //Employee Application Login
+ System.out.println("Trying "+ getService2URL());
+ webResponse = webConversation.getResponse( getService2URL() );
+ assertTrue( " Reached the employee index page ",
webResponse.getText().contains( "EmployeeDashboard" ));
+
+ //Logout from sales
+
+ System.out.println("Trying "+ getService1URL() + LOGOUT_URL);
+ webResponse = webConversation.getResponse( getService1URL() + LOGOUT_URL );
+ assertTrue( "Reached logged out page", webResponse.getText().contains(
"logged" ) );
+
+ //Hit the Sales App again
+ System.out.println("Trying "+ getService1URL());
+ webResponse = webConversation.getResponse( getService1URL() );
+ assertTrue( " Reached the Login page ", webResponse.getText().contains(
"Login" ));
+
+ //Hit the Employee App again
+ System.out.println("Trying "+ getService2URL());
+ webResponse = webConversation.getResponse( getService2URL() );
+ assertTrue( " Reached the Login page ", webResponse.getText().contains(
"Login" ));
+ }
+}
\ No newline at end of file
Modified: integration-tests/trunk/picketlink-saml-tomcat6/pom.xml
===================================================================
--- integration-tests/trunk/picketlink-saml-tomcat6/pom.xml 2011-08-09 15:44:11 UTC (rev
1164)
+++ integration-tests/trunk/picketlink-saml-tomcat6/pom.xml 2011-08-09 16:16:04 UTC (rev
1165)
@@ -39,6 +39,9 @@
<testClassesDirectory>${basedir}/../picketlink-saml-tests/target/test-classes</testClassesDirectory>
<printSummary>true</printSummary>
<disableXmlReport>false</disableXmlReport>
+ <excludes>
+ <exclude>**/Standalone**TestCase.java</exclude>
+ </excludes>
<includes>
<include>**/**TestCase.java</include>
</includes>
Modified: integration-tests/trunk/pom.xml
===================================================================
--- integration-tests/trunk/pom.xml 2011-08-09 15:44:11 UTC (rev 1164)
+++ integration-tests/trunk/pom.xml 2011-08-09 16:16:04 UTC (rev 1165)
@@ -20,6 +20,7 @@
<module>picketlink-saml-jbas51</module>
<module>picketlink-saml-jbas6</module>
<module>picketlink-saml-tomcat6</module>
+ <module>picketlink-saml-standalone</module>
<module>picketlink-sts-tests</module>
<module>picketlink-sts-jbas51-native</module>
<module>picketlink-sts-jbas51-cxf</module>