Author: anil.saldhana(a)jboss.com
Date: 2011-01-26 13:24:06 -0500 (Wed, 26 Jan 2011)
New Revision: 653
Added:
integration-tests/trunk/picketlink-openid-tests/
integration-tests/trunk/picketlink-openid-tests/.classpath
integration-tests/trunk/picketlink-openid-tests/.project
integration-tests/trunk/picketlink-openid-tests/ant-build.xml
integration-tests/trunk/picketlink-openid-tests/pom.xml
integration-tests/trunk/picketlink-openid-tests/src/
integration-tests/trunk/picketlink-openid-tests/src/test/
integration-tests/trunk/picketlink-openid-tests/src/test/java/
integration-tests/trunk/picketlink-openid-tests/src/test/java/org/
integration-tests/trunk/picketlink-openid-tests/src/test/java/org/picketlink/
integration-tests/trunk/picketlink-openid-tests/src/test/java/org/picketlink/test/
integration-tests/trunk/picketlink-openid-tests/src/test/java/org/picketlink/test/integration/
integration-tests/trunk/picketlink-openid-tests/src/test/java/org/picketlink/test/integration/openid/
integration-tests/trunk/picketlink-openid-tests/src/test/java/org/picketlink/test/integration/openid/OpenIDConsumerUnitTestCase.java
Modified:
integration-tests/trunk/pom.xml
Log:
incorporate openid integration
Added: integration-tests/trunk/picketlink-openid-tests/.classpath
===================================================================
--- integration-tests/trunk/picketlink-openid-tests/.classpath
(rev 0)
+++ integration-tests/trunk/picketlink-openid-tests/.classpath 2011-01-26 18:24:06 UTC
(rev 653)
@@ -0,0 +1,22 @@
+<classpath>
+ <classpathentry kind="src" path="src/test/java"
output="target/test-classes" including="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="var"
path="M2_REPO/ant/ant/1.5/ant-1.5.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/ant-contrib/ant-contrib/1.0b2/ant-contrib-1.0b2.jar"
sourcepath="M2_REPO/ant-contrib/ant-contrib/1.0b2/ant-contrib-1.0b2-sources.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-codec/commons-codec/1.3/commons-codec-1.3.jar"
sourcepath="M2_REPO/commons-codec/commons-codec/1.3/commons-codec-1.3-sources.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar"
sourcepath="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar"
sourcepath="M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1-sources.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar"
sourcepath="M2_REPO/commons-io/commons-io/2.0.1/commons-io-2.0.1-sources.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-lang/commons-lang/2.5/commons-lang-2.5.jar"
sourcepath="M2_REPO/commons-lang/commons-lang/2.5/commons-lang-2.5-sources.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"
sourcepath="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/cssparser/cssparser/0.9.4/cssparser-0.9.4.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/htmlunit/htmlunit/2.1/htmlunit-2.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/rhino/js/1.6R7/js-1.6R7.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/junit/junit/4.4/junit-4.4.jar"
sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/nekohtml/nekohtml/1.9.12/nekohtml-1.9.12.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/xalan/serializer/2.7.1/serializer-2.7.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1.jar"
sourcepath="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1-sources.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar"
sourcepath="M2_REPO/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04-sources.jar"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file
Added: integration-tests/trunk/picketlink-openid-tests/.project
===================================================================
--- integration-tests/trunk/picketlink-openid-tests/.project (rev
0)
+++ integration-tests/trunk/picketlink-openid-tests/.project 2011-01-26 18:24:06 UTC (rev
653)
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>picketlink-integration-openid-tests</name>
+ <comment>PicketLink Federation Tests to be run in a continous integration
environment such as Hudson</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: integration-tests/trunk/picketlink-openid-tests/ant-build.xml
===================================================================
--- integration-tests/trunk/picketlink-openid-tests/ant-build.xml
(rev 0)
+++ integration-tests/trunk/picketlink-openid-tests/ant-build.xml 2011-01-26 18:24:06 UTC
(rev 653)
@@ -0,0 +1,111 @@
+<project default="init" name="PicketLink Federation Integration Test
Suite">
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath path="${depclasspath}"/>
+ </taskdef>
+ <property name="JBAS_DEPLOY"
location="${basedir}/target/jboss-5.1.0.GA/server/default/deploy/" />
+ <property name="TOMCAT"
location="${basedir}/target/apache-tomcat-6.0.26/" />
+ <property name="TOMCAT_DEPLOY"
location="${basedir}/target/apache-tomcat-6.0.26/webapps/" />
+ <property name="TOMCAT_LIB"
location="${basedir}/target/apache-tomcat-6.0.26/lib/" />
+ <property name="COMMONS_HTTPCLIENT_VERSION" value="3.1" />
+ <property name="COMMONS_CODEC_VERSION" value="1.3" />
+ <property name="COMMONS_LOGGING_VERSION" value="1.0.4" />
+ <property name="OPENID4JAVA_VERSION" value="0.9.5" />
+ <property name="JSTL_VERSION" value="1.2" />
+ <property environment="env" />
+
+ <target name="init-jboss">
+ <!-- Unzip JBoss AS and Tomcat -->
+ <echo>Unzip JBOSS AS 5.1.0.GA</echo>
+ <unzip
src="${basedir}/../common-dist/jbossas/5.1.0.GA/jboss-5.1.0.GA-jdk6.zip"
+ dest="${basedir}/target"/>
+ </target>
+ <target name="init-tomcat">
+ <echo>Unzip Apache Tomcat 6.0.26</echo>
+ <unzip
src="${basedir}/../common-dist/tomcat/6.0.26/apache-tomcat-6.0.26.zip"
+ dest="${basedir}/target"/>
+ </target>
+
+
+ <target name="tomcat-thirdparty-deps" depends="init-tomcat"
>
+ <copy
file="${localRepository}/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar"
todir="${TOMCAT_LIB}"/>
+ </target>
+
+ <target name="copy-picketlink-tomcat"
depends="tomcat-thirdparty-deps" >
+ <copy
file="${localRepository}/org/picketlink/picketlink-bindings/${version}/picketlink-bindings-${version}.jar"
todir="${TOMCAT_LIB}"/>
+ <copy
file="${localRepository}/org/picketlink/picketlink-bindings-jboss/${version}/picketlink-bindings-jboss-${version}.jar"
todir="${TOMCAT_LIB}"/>
+ <copy
file="${localRepository}/org/picketlink/picketlink-fed/${version}/picketlink-fed-${version}.jar"
todir="${TOMCAT_LIB}"/>
+
+ <copy
file="${localRepository}/org/openid4java/openid4java-nodeps/${OPENID4JAVA_VERSION}/openid4java-nodeps-${OPENID4JAVA_VERSION}.jar"
todir="${TOMCAT_LIB}"/>
+ <copy
file="${localRepository}/commons-httpclient/commons-httpclient/${COMMONS_HTTPCLIENT_VERSION}/commons-httpclient-${COMMONS_HTTPCLIENT_VERSION}.jar"
todir="${TOMCAT_LIB}"/>
+ <copy
file="${localRepository}/commons-codec/commons-codec/${COMMONS_CODEC_VERSION}/commons-codec-${COMMONS_CODEC_VERSION}.jar"
todir="${TOMCAT_LIB}"/>
+ <copy
file="${localRepository}/commons-logging/commons-logging/${COMMONS_LOGGING_VERSION}/commons-logging-${COMMONS_LOGGING_VERSION}.jar"
todir="${TOMCAT_LIB}"/>
+ <copy
file="${localRepository}/jstl/jstl/${JSTL_VERSION}/jstl-${JSTL_VERSION}.jar"
todir="${TOMCAT_LIB}"/>
+
+ <unzip
src="${localRepository}/org/picketlink/picketlink-fed-webapps-assembly/${version}/picketlink-fed-webapps-assembly-${version}.zip"
+ dest="${TOMCAT_DEPLOY}"/>
+
+ <move todir="${TOMCAT_DEPLOY}">
+ <fileset dir="${TOMCAT_DEPLOY}/picketlink">
+ <include name="**/*.war"/>
+ </fileset>
+ </move>
+
+ <copy file="${basedir}/../common-dist/tomcat/tomcat-users.xml"
+ todir="${TOMCAT}/conf" />
+ <copy file="${basedir}/../common-dist/tomcat/log4j.xml"
+ todir="${TOMCAT}/lib" />
+ <chmod dir="${basedir}/target/apache-tomcat-6.0.26/bin"
perm="700" includes="**/*.sh"/>
+ <chmod dir="${basedir}/target/apache-tomcat-6.0.26/bin"
perm="700" includes="**/*.jar"/>
+ </target>
+
+ <target name="copy-picketlink-jbas" depends="init-jboss" >
+ <mkdir
dir="${basedir}/target/jboss-5.1.0.GA/server/default/deploy/picketlink" />
+ <copy
file="${localRepository}/org/picketlink/picketlink-bindings/${version}/picketlink-bindings-${version}.jar"
todir="${JBAS_DEPLOY}/picketlink"/>
+ <copy
file="${localRepository}/org/picketlink/picketlink-bindings-jboss/${version}/picketlink-bindings-jboss-${version}.jar"
todir="${JBAS_DEPLOY}/picketlink"/>
+ <copy
file="${localRepository}/org/picketlink/picketlink-fed/${version}/picketlink-fed-${version}.jar"
todir="${JBAS_DEPLOY}/picketlink"/>
+ <unzip
src="${localRepository}/org/picketlink/picketlink-fed-webapps-assembly/${version}/picketlink-fed-webapps-assembly-${version}.zip"
+ dest="${JBAS_DEPLOY}"/>
+
+ <copy
file="${localRepository}/org/openid4java/openid4java-nodeps/${OPENID4JAVA_VERSION}/openid4java-nodeps-${OPENID4JAVA_VERSION}.jar"
todir="${JBAS_DEPLOY}/picketlink"/>
+ <copy
file="${localRepository}/commons-httpclient/commons-httpclient/${COMMONS_HTTPCLIENT_VERSION}/commons-httpclient-${COMMONS_HTTPCLIENT_VERSION}.jar"
todir="${JBAS_DEPLOY}/picketlink"/>
+ <copy
file="${localRepository}/commons-codec/commons-codec/${COMMONS_CODEC_VERSION}/commons-codec-${COMMONS_CODEC_VERSION}.jar"
todir="${JBAS_DEPLOY}/picketlink"/>
+
+ <chmod file="${basedir}/target/jboss-5.1.0.GA/bin/run.sh"
perm="700"/>
+ </target>
+
+ <target name="start-jboss" depends="copy-picketlink-jbas" >
+ <echo>Starting Local 8080 </echo>
+ <exec executable="${basedir}/target/jboss-5.1.0.GA/bin/run.sh"
+ osfamily="unix" spawn="true" />
+ <waitfor maxwait="1" maxwaitunit="minute"
+ checkevery="100" checkeveryunit="millisecond">
+ <http url="http://localhost:8080" />
+ </waitfor>
+ <echo>:Local 8080 Started</echo>
+ </target>
+
+ <target name="start-tomcat" depends="copy-picketlink-tomcat"
>
+ <echo>Starting Local 8080 </echo>
+ <exec executable="${TOMCAT_DEPLOY}/../bin/startup.sh"
+ osfamily="unix" spawn="true" />
+ <waitfor maxwait="25" maxwaitunit="second"
+ checkevery="100" checkeveryunit="millisecond">
+ <http url="http://localhost:8080" />
+ </waitfor>
+ <echo>:Local 8080 Started</echo>
+ </target>
+
+ <target name="stop-jboss">
+ <echo>Stopping Local 8080 </echo>
+ <echo>Going to Kill the JBoss Process</echo>
+ <exec executable="${basedir}/../common-dist/scripts/stopjboss.sh"
+ osfamily="unix" />
+ </target>
+
+ <target name="stop-tomcat">
+ <echo>Stopping Local 8080 </echo>
+ <echo>Going to stop tomcat</echo>
+ <exec executable="${TOMCAT_DEPLOY}/../bin/shutdown.sh"
+ osfamily="unix" />
+ </target>
+</project>
Property changes on: integration-tests/trunk/picketlink-openid-tests/ant-build.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: integration-tests/trunk/picketlink-openid-tests/pom.xml
===================================================================
--- integration-tests/trunk/picketlink-openid-tests/pom.xml (rev
0)
+++ integration-tests/trunk/picketlink-openid-tests/pom.xml 2011-01-26 18:24:06 UTC (rev
653)
@@ -0,0 +1,238 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.picketlink</groupId>
+ <artifactId>picketlink-integration-tests-parent</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>picketlink-integration-openid-tests</artifactId>
+ <packaging>jar</packaging>
+ <name>PicketLink Integration Tests for OPENID</name>
+ <
url>http://labs.jboss.org/portal/picketlink/</url>
+ <description>PicketLink Federation Tests to be run in a continous integration
environment such as Hudson</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <
url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <properties>
+
<java.endorsed.dirs>${basedir}/src/test/resources/endorsed</java.endorsed.dirs>
+ <SERVICE_1_URL>http://localhost:8080/openid-consumer/</SERVICE_1_URL>
+ <SERVICE_2_URL>http://localhost:8080/openid-provider/</SERVICE_2_URL>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <phase>test</phase>
+ <printSummary>true</printSummary>
+ <disableXmlReport>false</disableXmlReport>
+ <includes>
+ <include>**/**TestCase.java</include>
+ </includes>
+ <forkMode>pertest</forkMode>
+
<argLine>-Djava.endorsed.dirs=${basedir}/src/test/resources/endorsed</argLine>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>phase-1</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <property name="depclasspath"
refid="maven.dependency.classpath"/>
+ <property name="version" value="${version}"/>
+ <property name="localRepository"
value="${user.home}/.m2/repository"/>
+ <ant antfile="${basedir}/ant-build.xml"
target="start-jboss" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>phase-2</id>
+ <phase>test</phase>
+ <configuration>
+ <tasks>
+ <property name="depclasspath"
refid="maven.dependency.classpath"/>
+ <property name="version" value="${version}"/>
+ <property name="localRepository"
value="${user.home}/.m2/repository"/>
+ <ant antfile="${basedir}/ant-build.xml"
target="stop-jboss" />
+ <ant antfile="${basedir}/ant-build.xml"
target="start-tomcat" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>phase-3</id>
+ <phase>integration-test</phase>
+ <configuration>
+ <tasks>
+ <property name="depclasspath"
refid="maven.dependency.classpath"/>
+ <property name="version" value="${version}"/>
+ <property name="localRepository"
value="${user.home}/.m2/repository"/>
+ <ant antfile="${basedir}/ant-build.xml"
target="stop-tomcat" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.0.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>cssparser</groupId>
+ <artifactId>cssparser</artifactId>
+ <version>0.9.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>2.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.6R7</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>nekohtml</groupId>
+ <artifactId>nekohtml</artifactId>
+ <version>1.9.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.9.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b2</version>
+ </dependency>
+
+ </dependencies>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.5.GA</version>
+ </docletArtifact>
+ <additionalparam>
+ -charset UTF-8
+ -docencoding UTF-8
+ -version
+ -author
+ -breakiterator
+ -windowtitle "${project.name} ${project.version} API Reference"
+ -doctitle "${project.name} ${project.version} API Reference"
+ -bottom "Copyright © ${project.inceptionYear}-Present
${project.organization.name}. All Rights Reserved."
+ -link
http://java.sun.com/javase/6/docs/api/
+ -sourceclasspath ${project.build.outputDirectory}
+ </additionalparam>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Property changes on: integration-tests/trunk/picketlink-openid-tests/pom.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
integration-tests/trunk/picketlink-openid-tests/src/test/java/org/picketlink/test/integration/openid/OpenIDConsumerUnitTestCase.java
===================================================================
---
integration-tests/trunk/picketlink-openid-tests/src/test/java/org/picketlink/test/integration/openid/OpenIDConsumerUnitTestCase.java
(rev 0)
+++
integration-tests/trunk/picketlink-openid-tests/src/test/java/org/picketlink/test/integration/openid/OpenIDConsumerUnitTestCase.java 2011-01-26
18:24:06 UTC (rev 653)
@@ -0,0 +1,113 @@
+/*
+ * 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.openid;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.junit.Test;
+import org.w3c.dom.Document;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
+
+/**
+ * Unit Test the OpenID Consumer App
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 25, 2011
+ */
+public class OpenIDConsumerUnitTestCase
+{
+ String SERVICE_1_URL = System.getProperty( "SERVICE_1_URL",
"http://localhost:8080/openid-consumer/" );
+
+ @Test
+ public void testOpenIDConsumer() throws Exception
+ {
+ final WebClient webClient = new WebClient();
+ webClient.setJavaScriptEnabled(true);
+
+ final HtmlPage page = (HtmlPage) webClient.getPage( SERVICE_1_URL );
+ HtmlForm form = page.getForms().get(0);
+ HtmlTextInput textField = (HtmlTextInput) form.getInputByName( "openid"
);
+
+ // Change the value of the text field
+ textField.setValueAttribute( "http://jbosstest.myopenid.com/" );
+ Iterable<HtmlElement> children = form.getAllHtmlChildElements();
+ HtmlSubmitInput button = null;
+
+ for( HtmlElement elem: children )
+ {
+ if (elem instanceof HtmlSubmitInput )
+ {
+ button = (HtmlSubmitInput) elem;
+ }
+ }
+
+ // Now submit the form by clicking the button and get back the second page.
+ HtmlPage page2 = (HtmlPage) button.click();
+ form = page2.getForms().get(0);
+
+ HtmlPasswordInput passwordField = (HtmlPasswordInput) form.getInputByName(
"password" );
+ passwordField.setValueAttribute( "jbosstest123" );
+
+ button = (HtmlSubmitInput) form.getInputByValue( "Sign In" );
+
+ page2 = (HtmlPage) button.click();
+ System.out.println( "Response after button click on myopenid" );
+
+ page2 = (HtmlPage) webClient.getPage( SERVICE_1_URL );
+ write( page2 );
+ String afterLoggingIn = page2.asText();
+ assertTrue( afterLoggingIn.contains( "Logged in as
http://jbosstest.myopenid.com/" ));
+ }
+
+ protected void write( HtmlPage page) throws Exception
+ {
+ Document doc = page;
+ Source source = new DOMSource( doc );
+ StringWriter sw = new StringWriter();
+
+ Result streamResult = new StreamResult(sw);
+ // Write the DOM document to the stream
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperty(OutputKeys.INDENT, "no");
+
+ transformer.transform(source, streamResult);
+
+ System.out.println( sw.toString() );
+ }
+}
\ No newline at end of file
Modified: integration-tests/trunk/pom.xml
===================================================================
--- integration-tests/trunk/pom.xml 2011-01-25 05:36:20 UTC (rev 652)
+++ integration-tests/trunk/pom.xml 2011-01-26 18:24:06 UTC (rev 653)
@@ -17,5 +17,6 @@
<module>parent</module>
<module>picketlink-saml-tests</module>
<module>picketlink-sts-tests</module>
+ <module>picketlink-openid-tests</module>
</modules>
</project>