Author: anil.saldhana(a)jboss.com
Date: 2011-08-11 18:25:16 -0400 (Thu, 11 Aug 2011)
New Revision: 1185
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/authenticators/
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/authenticators/SPPostFormAuthenticatorUnitTestCase.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/config/
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContext.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaLoginConfig.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaRealm.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaRequest.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaResponse.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaSession.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletConfig.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletContext.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletRequest.java
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletResponse.java
Removed:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/authenticators/
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/config/
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/mock/
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/servlets/
Modified:
product/trunk/picketlink-core/src/test/java/org/picketlink/
Log:
merge the tests
Property changes on: product/trunk/picketlink-core/src/test/java/org/picketlink
___________________________________________________________________
Modified: svn:mergeinfo
-
/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink:1152-1154,1159-1173
+ /federation/trunk/picketlink-bindings/src/test/java/org/picketlink:1140-1173
/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink:1152-1154,1159-1173
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/authenticators/SPPostFormAuthenticatorUnitTestCase.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/authenticators/SPPostFormAuthenticatorUnitTestCase.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/authenticators/SPPostFormAuthenticatorUnitTestCase.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,70 @@
+/*
+ * 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.identity.federation.bindings.authenticators;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URL;
+import java.security.cert.X509Certificate;
+
+import org.junit.Test;
+import org.picketlink.identity.federation.bindings.tomcat.sp.SPPostFormAuthenticator;
+import org.picketlink.test.identity.federation.bindings.mock.MockCatalinaContext;
+import
org.picketlink.test.identity.federation.bindings.mock.MockCatalinaContextClassLoader;
+
+/**
+ * Unit test the {@link SPPostFormAuthenticator}
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Mar 1, 2011
+ */
+public class SPPostFormAuthenticatorUnitTestCase
+{
+ @Test
+ public void testIDPMetadataFile() throws Exception
+ {
+ MockCatalinaContext ctx = new MockCatalinaContext();
+ SPPostFormAuthenticator auth = new SPPostFormAuthenticator();
+ auth.setContainer(ctx);
+
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ URL configURL =
tccl.getResource("config/test-idp-metadata-file-config.xml");
+ URL[] urls = new URL[]
+ {configURL};
+ MockCatalinaContextClassLoader tcl = new MockCatalinaContextClassLoader(urls);
+ tcl.associate("/WEB-INF/picketlink-idfed.xml", configURL.openStream());
+ tcl.associate("/WEB-INF/picketlink-handlers.xml",
+
tccl.getResourceAsStream("saml2/post/sp/employee/WEB-INF/picketlink-handlers.xml"));
+ tcl.associate("/WEB-INF/testshib.org.idp-metadata.xml",
+
tccl.getResourceAsStream("metadata/testshib.org.idp-metadata.xml"));
+ tcl.setProfile("DUMMY");
+ tcl.setDelegate(tccl);
+
+ Thread.currentThread().setContextClassLoader(tcl);
+ auth.testStart();
+
assertEquals("https://idp.testshib.org/idp/profile/SAML2/POST/SSO",
auth.getIdentityURL());
+ X509Certificate idpCert = auth.getIdpCertificate();
+ assertNotNull(idpCert);
+
assertEquals("CN=idp.testshib.org, O=TestShib, L=Pittsburgh, ST=Pennsylvania,
C=US", idpCert.getIssuerDN()
+ .getName());
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/config/MetadataConfigUnitTestCase.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,80 @@
+/*
+ * 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.identity.federation.bindings.config;
+
+import java.io.InputStream;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.picketlink.identity.federation.core.config.IDPType;
+import org.picketlink.identity.federation.core.config.KeyValueType;
+import org.picketlink.identity.federation.core.config.MetadataProviderType;
+import org.picketlink.identity.federation.core.config.TrustType;
+import org.picketlink.identity.federation.core.parsers.config.SAMLConfigParser;
+
+
+/**
+ * Config for the SAMLv2 Metadata Profile
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 22, 2009
+ */
+public class MetadataConfigUnitTestCase extends TestCase
+{
+ String config = "config/test-metadata-config-";
+
+ public void testMetadata() throws Exception
+ {
+ Object object = this.unmarshall(config + "1.xml");
+ assertNotNull("IDP is not null", object);
+ IDPType idp = (IDPType) object;
+ assertEquals("20000", 20000L, idp.getAssertionValidity());
+ assertEquals("somefqn", idp.getRoleGenerator());
+
+ TrustType trust = idp.getTrust();
+ assertNotNull("Trust is not null", trust);
+ String domains = trust.getDomains();
+ assertTrue("localhost trusted", domains.indexOf("localhost")
> -1);
+
assertTrue("jboss.com trusted", domains.indexOf("jboss.com")
> -1);
+
+ MetadataProviderType metaDataProvider = idp.getMetaDataProvider();
+ assertNotNull("MetadataProvider is not null", metaDataProvider);
+ assertEquals("org.jboss.test.somefqn", metaDataProvider.getClassName());
+
+ List<KeyValueType> keyValues = metaDataProvider.getOption();
+ assertTrue(1 == keyValues.size());
+ KeyValueType kvt = keyValues.get(0);
+ assertEquals("FileName", kvt.getKey());
+ assertEquals("myfile", kvt.getValue());
+ }
+
+ private Object unmarshall(String configFile) throws Exception
+ {
+ //String schema = PicketLinkFederationConstants.SCHEMA_IDFED;
+
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ InputStream is = tcl.getResourceAsStream(configFile);
+ assertNotNull("Inputstream not null", is);
+
+ return (new SAMLConfigParser()).parse( is );
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContext.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContext.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContext.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,959 @@
+/*
+ * 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.identity.federation.bindings.mock;
+
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.naming.directory.DirContext;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.catalina.Cluster;
+import org.apache.catalina.Container;
+import org.apache.catalina.ContainerListener;
+import org.apache.catalina.Context;
+import org.apache.catalina.Loader;
+import org.apache.catalina.Manager;
+import org.apache.catalina.Pipeline;
+import org.apache.catalina.Realm;
+import org.apache.catalina.Wrapper;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.deploy.ApplicationParameter;
+import org.apache.catalina.deploy.ErrorPage;
+import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.deploy.FilterMap;
+import org.apache.catalina.deploy.LoginConfig;
+import org.apache.catalina.deploy.NamingResources;
+import org.apache.catalina.deploy.SecurityConstraint;
+import org.apache.catalina.util.CharsetMapper;
+import org.apache.juli.logging.Log;
+import org.apache.tomcat.util.http.mapper.Mapper;
+
+/**
+ * Mock Catalina Context
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+@SuppressWarnings(
+{"unchecked", "rawtypes"})
+public class MockCatalinaContext implements Context, Container, ServletContext
+{
+ private Realm realm;
+
+ public void addChild(Container arg0)
+ {
+ }
+
+ public void addContainerListener(ContainerListener arg0)
+ {
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener arg0)
+ {
+ }
+
+ public void backgroundProcess()
+ {
+ }
+
+ public Container findChild(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Container[] findChildren()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public ContainerListener[] findContainerListeners()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public int getBackgroundProcessorDelay()
+ {
+
+ return 0;
+ }
+
+ public Cluster getCluster()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public String getInfo()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Loader getLoader()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Log getLogger()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Manager getManager()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Object getMappingObject()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public String getName()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getObjectName()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Container getParent()
+ {
+ return this;
+ }
+
+ public ClassLoader getParentClassLoader()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Pipeline getPipeline()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public DirContext getResources()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void invoke(Request arg0, Response arg1) throws IOException, ServletException
+ {
+ }
+
+ public void removeChild(Container arg0)
+ {
+ }
+
+ public void removeContainerListener(ContainerListener arg0)
+ {
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener arg0)
+ {
+ }
+
+ public void setBackgroundProcessorDelay(int arg0)
+ {
+ }
+
+ public void setCluster(Cluster arg0)
+ {
+ }
+
+ public void setLoader(Loader arg0)
+ {
+ }
+
+ public void setManager(Manager arg0)
+ {
+ }
+
+ public void setName(String arg0)
+ {
+ }
+
+ public void setParent(Container arg0)
+ {
+ }
+
+ public void setParentClassLoader(ClassLoader arg0)
+ {
+ }
+
+ public void setRealm(Realm arg0)
+ {
+ this.realm = arg0;
+ }
+
+ public void setResources(DirContext arg0)
+ {
+ }
+
+ public void addApplicationListener(String arg0)
+ {
+ }
+
+ public void addApplicationParameter(ApplicationParameter arg0)
+ {
+ }
+
+ public void addConstraint(SecurityConstraint arg0)
+ {
+ }
+
+ public void addErrorPage(ErrorPage arg0)
+ {
+ }
+
+ public void addFilterDef(FilterDef arg0)
+ {
+ }
+
+ public void addFilterMap(FilterMap arg0)
+ {
+ }
+
+ public void addInstanceListener(String arg0)
+ {
+ }
+
+ public void addJspMapping(String arg0)
+ {
+ }
+
+ public void addLocaleEncodingMappingParameter(String arg0, String arg1)
+ {
+ }
+
+ public void addMimeMapping(String arg0, String arg1)
+ {
+ }
+
+ public void addParameter(String arg0, String arg1)
+ {
+ }
+
+ public void addRoleMapping(String arg0, String arg1)
+ {
+ }
+
+ public void addSecurityRole(String arg0)
+ {
+ }
+
+ public void addServletMapping(String arg0, String arg1)
+ {
+ }
+
+ public void addTaglib(String arg0, String arg1)
+ {
+ }
+
+ public void addWatchedResource(String arg0)
+ {
+ }
+
+ public void addWelcomeFile(String arg0)
+ {
+ }
+
+ public void addWrapperLifecycle(String arg0)
+ {
+ }
+
+ public void addWrapperListener(String arg0)
+ {
+ }
+
+ public Wrapper createWrapper()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findApplicationListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public ApplicationParameter[] findApplicationParameters()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public SecurityConstraint[] findConstraints()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public ErrorPage findErrorPage(int arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public ErrorPage findErrorPage(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public ErrorPage[] findErrorPages()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public FilterDef findFilterDef(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public FilterDef[] findFilterDefs()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public FilterMap[] findFilterMaps()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findInstanceListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findMimeMapping(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findMimeMappings()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findParameter(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findParameters()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findRoleMapping(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean findSecurityRole(String arg0)
+ {
+ return false;
+ }
+
+ public String[] findSecurityRoles()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findServletMapping(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findServletMappings()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findStatusPage(int arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public int[] findStatusPages()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findTaglib(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findTaglibs()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findWatchedResources()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean findWelcomeFile(String arg0)
+ {
+ return false;
+ }
+
+ public String[] findWelcomeFiles()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findWrapperLifecycles()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findWrapperListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getAltDDName()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Object[] getApplicationEventListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Object[] getApplicationLifecycleListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getAvailable()
+ {
+ return false;
+ }
+
+ public CharsetMapper getCharsetMapper()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getConfigFile()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getConfigured()
+ {
+ return false;
+ }
+
+ public boolean getCookies()
+ {
+ return false;
+ }
+
+ public boolean getCrossContext()
+ {
+ return false;
+ }
+
+ public String getDisplayName()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getDistributable()
+ {
+ return false;
+ }
+
+ public String getDocBase()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getEncodedPath()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getIgnoreAnnotations()
+ {
+ return false;
+ }
+
+ public LoginConfig getLoginConfig()
+ {
+ LoginConfig loginConfig = new LoginConfig();
+ loginConfig.setAuthMethod("BASIC");
+ return loginConfig;
+ }
+
+ public Mapper getMapper()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public NamingResources getNamingResources()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getOverride()
+ {
+ return false;
+ }
+
+ public String getPath()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getPrivileged()
+ {
+ return false;
+ }
+
+ public String getPublicId()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getReloadable()
+ {
+ return false;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return this;
+ }
+
+ public int getSessionTimeout()
+ {
+ return 0;
+ }
+
+ public boolean getSwallowOutput()
+ {
+ return false;
+ }
+
+ public boolean getTldNamespaceAware()
+ {
+ return false;
+ }
+
+ public boolean getTldValidation()
+ {
+ return false;
+ }
+
+ public String getWrapperClass()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getXmlNamespaceAware()
+ {
+ return false;
+ }
+
+ public boolean getXmlValidation()
+ {
+ return false;
+ }
+
+ public void reload()
+ {
+ }
+
+ public void removeApplicationListener(String arg0)
+ {
+ }
+
+ public void removeApplicationParameter(String arg0)
+ {
+ }
+
+ public void removeConstraint(SecurityConstraint arg0)
+ {
+ }
+
+ public void removeErrorPage(ErrorPage arg0)
+ {
+ }
+
+ public void removeFilterDef(FilterDef arg0)
+ {
+ }
+
+ public void removeFilterMap(FilterMap arg0)
+ {
+ }
+
+ public void removeInstanceListener(String arg0)
+ {
+ }
+
+ public void removeMimeMapping(String arg0)
+ {
+ }
+
+ public void removeParameter(String arg0)
+ {
+ }
+
+ public void removeRoleMapping(String arg0)
+ {
+ }
+
+ public void removeSecurityRole(String arg0)
+ {
+ }
+
+ public void removeServletMapping(String arg0)
+ {
+ }
+
+ public void removeTaglib(String arg0)
+ {
+ }
+
+ public void removeWatchedResource(String arg0)
+ {
+ }
+
+ public void removeWelcomeFile(String arg0)
+ {
+ }
+
+ public void removeWrapperLifecycle(String arg0)
+ {
+ }
+
+ public void removeWrapperListener(String arg0)
+ {
+ }
+
+ public void setAltDDName(String arg0)
+ {
+ }
+
+ public void setApplicationEventListeners(Object[] arg0)
+ {
+ }
+
+ public void setApplicationLifecycleListeners(Object[] arg0)
+ {
+ }
+
+ public void setAvailable(boolean arg0)
+ {
+ }
+
+ public void setCharsetMapper(CharsetMapper arg0)
+ {
+ }
+
+ public void setConfigFile(String arg0)
+ {
+ }
+
+ public void setConfigured(boolean arg0)
+ {
+ }
+
+ public void setCookies(boolean arg0)
+ {
+ }
+
+ public void setCrossContext(boolean arg0)
+ {
+ }
+
+ public void setDisplayName(String arg0)
+ {
+ }
+
+ public void setDistributable(boolean arg0)
+ {
+ }
+
+ public void setDocBase(String arg0)
+ {
+ }
+
+ public void setIgnoreAnnotations(boolean arg0)
+ {
+ }
+
+ public void setLoginConfig(LoginConfig arg0)
+ {
+ }
+
+ public void setNamingResources(NamingResources arg0)
+ {
+ }
+
+ public void setOverride(boolean arg0)
+ {
+ }
+
+ public void setPath(String arg0)
+ {
+ }
+
+ public void setPrivileged(boolean arg0)
+ {
+ }
+
+ public void setPublicId(String arg0)
+ {
+ }
+
+ public void setReloadable(boolean arg0)
+ {
+ }
+
+ public void setSessionTimeout(int arg0)
+ {
+ }
+
+ public void setSwallowOutput(boolean arg0)
+ {
+ }
+
+ public void setTldNamespaceAware(boolean arg0)
+ {
+ }
+
+ public void setTldValidation(boolean arg0)
+ {
+ }
+
+ public void setWrapperClass(String arg0)
+ {
+ }
+
+ public void setXmlNamespaceAware(boolean arg0)
+ {
+ }
+
+ public void setXmlValidation(boolean arg0)
+ {
+ }
+
+ public Realm getRealm()
+ {
+ return realm;
+ }
+
+ //Copied from MockServletContext
+ private final Map params = new HashMap();
+
+ private final Map attribs = new HashMap();
+
+ public Object getAttribute(String arg0)
+ {
+ return attribs.get(arg0);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return new Enumeration()
+ {
+ private final Iterator iter = attribs.entrySet().iterator();
+
+ public boolean hasMoreElements()
+ {
+ return iter.hasNext();
+ }
+
+ public Object nextElement()
+ {
+ Entry<String, Object> entry = (Entry<String, Object>)
iter.next();
+ return entry.getValue();
+ }
+ };
+ }
+
+ public ServletContext getContext(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getContextPath()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getInitParameter(String arg0)
+ {
+ return (String) params.get(arg0);
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ return new Enumeration()
+ {
+ private final Iterator iter = params.entrySet().iterator();
+
+ public boolean hasMoreElements()
+ {
+ return iter.hasNext();
+ }
+
+ public Object nextElement()
+ {
+ Entry<String, Object> entry = (Entry<String, Object>)
iter.next();
+ return entry.getKey();
+ }
+ };
+ }
+
+ public int getMajorVersion()
+ {
+ return 0;
+ }
+
+ public String getMimeType(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public int getMinorVersion()
+ {
+ return 0;
+ }
+
+ public RequestDispatcher getNamedDispatcher(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getRealPath(String arg0)
+ {
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0)
+ {
+ return new RequestDispatcher()
+ {
+
+ public void include(ServletRequest arg0, ServletResponse arg1) throws
ServletException, IOException
+ {
+ }
+
+ public void forward(ServletRequest arg0, ServletResponse arg1) throws
ServletException, IOException
+ {
+ }
+ };
+ }
+
+ public URL getResource(String arg0) throws MalformedURLException
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public InputStream getResourceAsStream(String arg0)
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ return tcl.getResourceAsStream(arg0);
+ }
+
+ public Set getResourcePaths(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getServerInfo()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Servlet getServlet(String arg0) throws ServletException
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getServletContextName()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Enumeration getServletNames()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Enumeration getServlets()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void log(String arg0)
+ {
+ }
+
+ public void log(Exception arg0, String arg1)
+ {
+ }
+
+ public void log(String arg0, Throwable arg1)
+ {
+ }
+
+ public void removeAttribute(String arg0)
+ {
+ this.attribs.remove(arg0);
+ }
+
+ public void setAttribute(String arg0, Object arg1)
+ {
+ this.attribs.put(arg0, arg1);
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,76 @@
+/*
+ * 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.identity.federation.bindings.mock;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Mock TCL
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 7, 2009
+ */
+public class MockCatalinaContextClassLoader extends URLClassLoader
+{
+ private String profile;
+
+ private ClassLoader delegate;
+
+ private final Map<String, InputStream> streams = new HashMap<String,
InputStream>();
+
+ public MockCatalinaContextClassLoader(URL[] urls)
+ {
+ super(urls);
+ }
+
+ public void setDelegate(ClassLoader tcl)
+ {
+ this.delegate = tcl;
+ }
+
+ public void setProfile(String profile)
+ {
+ this.profile = profile;
+ }
+
+ public void associate(String name, InputStream is)
+ {
+ this.streams.put(name, is);
+ }
+
+ @Override
+ public InputStream getResourceAsStream(String name)
+ {
+ if (streams.containsKey(name))
+ return streams.get(name);
+
+ if (profile == null)
+ throw new RuntimeException("null profile when seeking resource:" +
name);
+ InputStream is = delegate.getResourceAsStream(profile + "/" + name);
+ if (is == null)
+ is = super.getResourceAsStream(name);
+ return is;
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaLoginConfig.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaLoginConfig.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaLoginConfig.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,34 @@
+/*
+ * 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.identity.federation.bindings.mock;
+
+import org.apache.catalina.deploy.LoginConfig;
+
+/**
+ * Mock LoginConfig
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+public class MockCatalinaLoginConfig extends LoginConfig
+{
+ private static final long serialVersionUID = 1L;
+}
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaRealm.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaRealm.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaRealm.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,69 @@
+/*
+ * 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.identity.federation.bindings.mock;
+
+import java.security.Principal;
+
+import org.apache.catalina.realm.RealmBase;
+
+/**
+ * Mock Tomcat Realm
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 21, 2009
+ */
+public class MockCatalinaRealm extends RealmBase
+{
+ private String name;
+ private String pass;
+ private Principal principal;
+
+ public MockCatalinaRealm(String name, String pass, Principal p)
+ {
+ this.name = name;
+ this.pass = pass;
+ this.principal = p;
+ }
+
+ @Override
+ protected String getName()
+ {
+ return name;
+ }
+
+ @Override
+ protected String getPassword(String arg0)
+ {
+ return pass;
+ }
+
+ @Override
+ protected Principal getPrincipal(String arg0)
+ {
+ return principal;
+ }
+
+ @Override
+ public Principal authenticate(String arg0, String arg1)
+ {
+ return principal;
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaRequest.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaRequest.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaRequest.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,157 @@
+/*
+ * 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.identity.federation.bindings.mock;
+
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.Session;
+import org.apache.catalina.connector.Request;
+
+/**
+ * Request for catalina container
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+public class MockCatalinaRequest extends Request
+{
+ private Map<String,String> params = new HashMap<String, String>();
+ private Map<String,String> headers = new HashMap<String, String>();
+ private Session session;
+ private Principal principal;
+ private String method;
+ private String remotee;
+ private String queryString;
+
+
+ @Override
+ public void addHeader(String name, String value)
+ {
+ this.headers.put(name, value);
+ }
+
+ @Override
+ public String getHeader(String name)
+ {
+ return headers.get(name);
+ }
+
+ @Override
+ public Principal getPrincipal()
+ {
+ return principal;
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return principal;
+ }
+
+ @Override
+ public void setUserPrincipal(Principal arg0)
+ {
+ this.principal = arg0;
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ return this.params.get(name);
+ }
+
+ public void setParameter(String key, String value)
+ {
+ params.put(key, value);
+ }
+
+ @Override
+ public String getQueryString()
+ {
+ return this.queryString;
+ }
+
+ @Override
+ public void setQueryString(String query)
+ {
+ this.queryString = query;
+ }
+
+ @Override
+ public String getRemoteAddr()
+ {
+ return this.remotee;
+ }
+
+ @Override
+ public void setRemoteAddr(String remoteAddr)
+ {
+ this.remotee = remoteAddr;
+ }
+
+ @Override
+ public String getMethod()
+ {
+ return this.method;
+ }
+
+ @Override
+ public void setMethod(String method)
+ {
+ this.method = method;
+ }
+
+ @Override
+ public Session getSessionInternal()
+ {
+ return session;
+ }
+
+ @Override
+ public Session getSessionInternal(boolean b)
+ {
+ return session;
+ }
+
+ public void setSession(Session s)
+ {
+ this.session = s;
+ }
+
+ public HttpSession getSession(boolean b)
+ {
+ return this.session.getSession();
+ }
+
+ public HttpSession getSession()
+ {
+ return this.session.getSession();
+ }
+
+ public void clear()
+ {
+ this.params.clear();
+ this.session = null;
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaResponse.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaResponse.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaResponse.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,105 @@
+/*
+ * 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.identity.federation.bindings.mock;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.catalina.connector.Response;
+
+/**
+ * Mock catalina response
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+public class MockCatalinaResponse extends Response
+{
+ private Map<String, String> headers = new HashMap<String, String>();
+ private int status;
+ public String redirectString;
+ private PrintWriter mywriter;
+
+ @Override
+ public void setCharacterEncoding(String charset)
+ {
+ }
+
+ @Override
+ public void setHeader(String name, String value)
+ {
+ this.headers.put(name, value);
+ }
+
+ @Override
+ public int getStatus()
+ {
+ return this.status;
+ }
+
+ @Override
+ public void setStatus(int status)
+ {
+ this.status = status;
+ }
+
+ @Override
+ public void sendRedirect(String arg0) throws IOException
+ {
+ this.redirectString = arg0;
+ }
+
+ @Override
+ public boolean isCommitted()
+ {
+ return false;
+ }
+
+ public void setWriter(Writer w)
+ {
+ this.mywriter = (PrintWriter) w;
+ }
+
+
+ @Override
+ public PrintWriter getWriter() throws IOException
+ {
+ return this.mywriter;
+ }
+
+ @Override
+ public void setContentLength(int length)
+ {
+ }
+
+ @Override
+ public void setContentType(String arg0)
+ {
+ }
+
+ @Override
+ public void recycle()
+ {
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaSession.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaSession.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaSession.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,294 @@
+/*
+ * 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.identity.federation.bindings.mock;
+
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.Map.Entry;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
+import org.apache.catalina.SessionListener;
+
+/**
+ * Mock session for the catalina infrastructure
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+@SuppressWarnings({"deprecation", "unchecked",
"rawtypes"})
+public class MockCatalinaSession implements Session, HttpSession
+{
+ private Map<String, Object> notes = new HashMap<String,Object>();
+
+ public void setMaxInactiveInterval(int arg0)
+ {
+ }
+
+ public void access()
+ {
+ }
+
+ public void addSessionListener(SessionListener arg0)
+ {
+ }
+
+ public void endAccess()
+ {
+ }
+
+ public void expire()
+ {
+ }
+
+ public String getAuthType()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getIdInternal()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getInfo()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public long getLastAccessedTimeInternal()
+ {
+ return 0;
+ }
+
+ public Manager getManager()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Object getNote(String arg0)
+ {
+ return notes.get(arg0);
+ }
+
+ public Iterator getNoteNames()
+ {
+ return notes.keySet().iterator();
+ }
+
+ public Principal getPrincipal()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public HttpSession getSession()
+ {
+ return this;
+ }
+
+ public boolean isValid()
+ {
+ return this.valid;
+ }
+
+ public void recycle()
+ {
+ }
+
+ public void removeNote(String arg0)
+ {
+ }
+
+ public void removeSessionListener(SessionListener arg0)
+ {
+ }
+
+ public void setAuthType(String arg0)
+ {
+ }
+
+ public void setCreationTime(long arg0)
+ {
+ }
+
+ public void setId(String arg0)
+ {
+ }
+
+ public void setManager(Manager arg0)
+ {
+ }
+
+ public void setNew(boolean arg0)
+ {
+ }
+
+ public void setNote(String arg0, Object arg1)
+ {
+ this.notes.put(arg0, arg1);
+ }
+
+ public void setPrincipal(Principal arg0)
+ {
+ }
+
+ public void setValid(boolean arg0)
+ {
+ }
+
+ //Copied from MockHttpSession
+ private boolean valid = true;
+
+ private Map<String,Object> attribs = new HashMap<String,Object>();
+
+ private String id = UUID.randomUUID().toString();
+
+ private ServletContext context;
+
+ public boolean isInvalidated()
+ {
+ return valid == false;
+ }
+
+ public Object getAttribute(String arg0)
+ {
+ return attribs.get(arg0);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return new Enumeration()
+ {
+ private Iterator iter = attribs.entrySet().iterator();
+
+ public boolean hasMoreElements()
+ {
+ return iter.hasNext();
+ }
+
+ public Object nextElement()
+ {
+ Entry<String,Object> entry = (Entry<String, Object>)
iter.next();
+ return entry.getValue();
+ }
+ };
+ }
+
+ public long getCreationTime()
+ {
+ return 0;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public long getLastAccessedTime()
+ {
+ return 0;
+ }
+
+ public int getMaxInactiveInterval()
+ {
+ return 0;
+ }
+
+ public void setServletContext(ServletContext servletContext)
+ {
+ this.context = servletContext;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return this.context;
+ }
+
+ public HttpSessionContext getSessionContext()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Object getValue(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] getValueNames()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void invalidate()
+ {
+ this.valid = false;
+ }
+
+ public boolean isNew()
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+
+ return false;
+ }
+
+ public void putValue(String arg0, Object arg1)
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+ }
+
+ public void removeAttribute(String arg0)
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+
+ this.attribs.remove(arg0);
+ }
+
+ public void removeValue(String arg0)
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+ }
+
+ public void setAttribute(String arg0, Object arg1)
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+
+ this.attribs.put(arg0, arg1);
+ }
+
+ public void clear()
+ {
+ this.notes.clear();
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/SOAPSAMLXACMLServletUnitTestCase.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,185 @@
+/*
+ * 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.identity.federation.bindings.servlets;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.HashMap;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+
+import org.jboss.security.xacml.core.model.context.DecisionType;
+import org.jboss.security.xacml.core.model.context.ResultType;
+import org.junit.Test;
+import org.picketlink.identity.federation.bindings.servlets.SOAPSAMLXACMLServlet;
+import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
+import org.picketlink.identity.federation.core.saml.v2.util.SOAPSAMLXACMLUtil;
+import org.picketlink.identity.federation.core.util.SOAPUtil;
+import
org.picketlink.identity.federation.saml.v2.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Unit Test the SOAP SAML XACML Servlet
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 28, 2009
+ */
+public class SOAPSAMLXACMLServletUnitTestCase
+{
+ @Test
+ public void testPermit() throws Exception
+ {
+ validate("xacml/requests/XacmlRequest-01-01.xml",
DecisionType.PERMIT.value(), true);
+
+ validate("xacml/requests/XacmlRequest-format2-01-01.xml",
DecisionType.PERMIT.value(), true);
+ }
+
+ @Test
+ public void testDeny() throws Exception
+ {
+ validate("xacml/requests/XacmlRequest-01-02.xml",
DecisionType.DENY.value(), true);
+ }
+
+ @Test
+ public void testIncorrectInput() throws Exception
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ String garbage = "<fdfdsfdfk/>";
+ ByteArrayInputStream bis = new ByteArrayInputStream(garbage.getBytes());
+
+ SOAPSAMLXACMLServlet servlet = new SOAPSAMLXACMLServlet();
+ servlet.init(new TestServletConfig(getServletContext()));
+ ServletRequest sreq = new TestServletRequest(getSOAPStream(bis));
+ ServletResponse sresp = new TestServletResponse(baos);
+ servlet.service(sreq, sresp);
+
+ sresp.flushBuffer(); //Flush the servlet response ServletOutputStream to our baos
+
+ bis = new ByteArrayInputStream(baos.toByteArray());
+
+ SOAPMessage soapMessage = SOAPUtil.getSOAPMessage(bis);
+ Node xacmlNode = soapMessage.getSOAPBody().getChildNodes().item(0);
+ assertTrue(xacmlNode instanceof Element);
+ Element xacmlElement = (Element) xacmlNode;
+ assertTrue(xacmlElement.getLocalName().equals("Fault"));
+ /*Unmarshaller un = JAXBUtil.getUnmarshaller(SOAPSAMLXACMLUtil.getPackage());
+ JAXBElement<Envelope> jax = (JAXBElement<Envelope>) un.unmarshal(bis);
+ Envelope envelope = jax.getValue();
+ assertNotNull("Envelope is not null", envelope);
+ JAXBElement<?> fault = (JAXBElement<?>)
envelope.getBody().getAny().get(0);
+ assertTrue(fault.getValue() instanceof Fault);*/
+ }
+
+ @Test
+ public void testInteropSOAPRequest() throws Exception
+ {
+ validate("xacml/requests/interop-request.xml",
DecisionType.PERMIT.value(), false);
+ }
+
+ private void validate(String requestFile, String value, boolean needSOAPWrapping)
throws Exception
+ {
+ InputStream is = getInputStream(requestFile);
+ if (is == null)
+ throw new IllegalArgumentException("Input Stream to request file is
null");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ SOAPSAMLXACMLServlet servlet = new SOAPSAMLXACMLServlet();
+ servlet.init(new TestServletConfig(getServletContext()));
+
+ if (needSOAPWrapping)
+ is = getSOAPStream(is);
+
+ ServletRequest sreq = new TestServletRequest(is);
+ ServletResponse sresp = new TestServletResponse(baos);
+ servlet.service(sreq, sresp);
+
+ sresp.flushBuffer(); //Flush the servlet response ServletOutputStream to our baos
+
+ ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
+
+ SOAPMessage soapMessage = SOAPUtil.getSOAPMessage(bis);
+
+ Node xacmlNode = soapMessage.getSOAPBody().getChildNodes().item(0);
+ XACMLAuthzDecisionStatementType xacmlStatement =
SOAPSAMLXACMLUtil.getDecisionStatement(xacmlNode);
+ /*Unmarshaller un = JAXBUtil.getUnmarshaller(SOAPSAMLXACMLUtil.getPackage());
+ JAXBElement<Envelope> jax = (JAXBElement<Envelope>) un.unmarshal(bis);
+ Envelope envelope = jax.getValue();
+ assertNotNull("Envelope is not null", envelope);
+
+ JAXBElement<ResponseType> jaxbResponseType =
(JAXBElement<ResponseType>) envelope.getBody().getAny().get(0);
+ ResponseType responseType = jaxbResponseType.getValue();
+
+ assertNotNull("ResponseType is not null", responseType);
+ AssertionType assertion = (AssertionType)
responseType.getAssertionOrEncryptedAssertion().get(0);
+ XACMLAuthzDecisionStatementType xacmlStatement = (XACMLAuthzDecisionStatementType)
assertion.getStatementOrAuthnStatementOrAuthzDecisionStatement().get(0);
+ */
+
+ assertNotNull("XACML Authorization Statement is not null",
xacmlStatement);
+ org.jboss.security.xacml.core.model.context.ResponseType xacmlResponse =
xacmlStatement.getResponse();
+ ResultType resultType = xacmlResponse.getResult().get(0);
+ DecisionType decision = resultType.getDecision();
+ assertNotNull("Decision is not null", decision);
+ assertEquals(value, decision.value());
+ }
+
+ private ServletContext getServletContext()
+ {
+ HashMap<String, String> map = new HashMap<String, String>();
+ map.put("policyConfigFileName",
"xacml/policies/config/rsaConfPolicyConfig.xml");
+ return new TestServletContext(map);
+ }
+
+ private InputStream getInputStream(String requestFileLoc)
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ return tcl.getResourceAsStream(requestFileLoc);
+ }
+
+ private InputStream getSOAPStream(InputStream dataStream) throws Exception
+ {
+ SOAPMessage message = SOAPUtil.create();
+ SOAPPart soapPart = message.getSOAPPart();
+ SOAPEnvelope envelope = soapPart.getEnvelope();
+ SOAPBody body = envelope.getBody();
+
+ body.addDocument(DocumentUtil.getDocument(dataStream));
+ message.saveChanges();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ message.writeTo(baos);
+
+ return new ByteArrayInputStream(baos.toByteArray());
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletConfig.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletConfig.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletConfig.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,63 @@
+/*
+ * 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.identity.federation.bindings.servlets;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+
+
+/**
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 28, 2009
+ */
+@SuppressWarnings({"rawtypes"})
+public class TestServletConfig implements ServletConfig
+{
+ private ServletContext sc;
+
+ public TestServletConfig(ServletContext sc)
+ {
+ this.sc = sc;
+ }
+
+ public String getInitParameter(String name)
+ {
+ return sc.getInitParameter(name);
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ return null;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return sc;
+ }
+
+ public String getServletName()
+ {
+ return null;
+ }
+}
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletContext.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletContext.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletContext.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,170 @@
+/*
+ * 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.identity.federation.bindings.servlets;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Set;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+
+/**
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 28, 2009
+ */
+@SuppressWarnings({ "rawtypes"})
+public class TestServletContext implements ServletContext
+{
+ private HashMap<String,String> params = new HashMap<String,String>();
+
+ public TestServletContext(HashMap<String,String> map)
+ {
+ this.params = map;
+ }
+
+ public Object getAttribute(String name)
+ {
+ return null;
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ public ServletContext getContext(String uripath)
+ {
+ return null;
+ }
+
+ public String getContextPath()
+ {
+ return null;
+ }
+
+ public String getInitParameter(String name)
+ {
+ return this.params.get(name);
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ return null;
+ }
+
+ public int getMajorVersion()
+ {
+ return 0;
+ }
+
+ public String getMimeType(String file)
+ {
+ return null;
+ }
+
+ public int getMinorVersion()
+ {
+ return 0;
+ }
+
+ public RequestDispatcher getNamedDispatcher(String name)
+ {
+ return null;
+ }
+
+ public String getRealPath(String path)
+ {
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return null;
+ }
+
+ public URL getResource(String path) throws MalformedURLException
+ {
+ return null;
+ }
+
+ public InputStream getResourceAsStream(String path)
+ {
+ return null;
+ }
+
+ public Set getResourcePaths(String path)
+ {
+ return null;
+ }
+
+ public String getServerInfo()
+ {
+ return null;
+ }
+
+ public Servlet getServlet(String name) throws ServletException
+ {
+ return null;
+ }
+
+ public String getServletContextName()
+ {
+ return null;
+ }
+
+ public Enumeration getServletNames()
+ {
+ return null;
+ }
+
+ public Enumeration getServlets()
+ {
+ return null;
+ }
+
+ public void log(String msg)
+ {
+ }
+
+ public void log(Exception exception, String msg)
+ {
+ }
+
+ public void log(String message, Throwable throwable)
+ {
+ }
+
+ public void removeAttribute(String name)
+ {
+ }
+
+ public void setAttribute(String name, Object object)
+ {
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletRequest.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletRequest.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletRequest.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,329 @@
+/*
+ * 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.identity.federation.bindings.servlets;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+
+/**
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 28, 2009
+ */
+@SuppressWarnings({ "rawtypes"})
+public class TestServletRequest implements HttpServletRequest
+{
+ private BufferedInputStream is = null;
+
+ public TestServletRequest(InputStream is)
+ {
+ super();
+ this.is = new BufferedInputStream(is);
+ }
+
+ public String getAuthType()
+ {
+ return null;
+ }
+
+ public String getContextPath()
+ {
+ return null;
+ }
+
+ public Cookie[] getCookies()
+ {
+ return null;
+ }
+
+ public long getDateHeader(String name)
+ {
+ return 0;
+ }
+
+ public String getHeader(String name)
+ {
+ return null;
+ }
+
+ public Enumeration getHeaderNames()
+ {
+ return null;
+ }
+
+ public Enumeration getHeaders(String name)
+ {
+ return null;
+ }
+
+ public int getIntHeader(String name)
+ {
+ return 0;
+ }
+
+ public String getMethod()
+ {
+ return null;
+ }
+
+ public String getPathInfo()
+ {
+ return null;
+ }
+
+ public String getPathTranslated()
+ {
+ return null;
+ }
+
+ public String getQueryString()
+ {
+ return null;
+ }
+
+ public String getRemoteUser()
+ {
+ return null;
+ }
+
+ public String getRequestURI()
+ {
+ return null;
+ }
+
+ public StringBuffer getRequestURL()
+ {
+ return null;
+ }
+
+ public String getRequestedSessionId()
+ {
+ return null;
+ }
+
+ public String getServletPath()
+ {
+ return null;
+ }
+
+ public HttpSession getSession()
+ {
+ return null;
+ }
+
+ public HttpSession getSession(boolean create)
+ {
+ return null;
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return null;
+ }
+
+ public boolean isRequestedSessionIdFromCookie()
+ {
+ return false;
+ }
+
+ public boolean isRequestedSessionIdFromURL()
+ {
+ return false;
+ }
+
+ public boolean isRequestedSessionIdFromUrl()
+ {
+ return false;
+ }
+
+ public boolean isRequestedSessionIdValid()
+ {
+ return false;
+ }
+
+ public boolean isUserInRole(String role)
+ {
+ return false;
+ }
+
+ public Object getAttribute(String name)
+ {
+ return null;
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return null;
+ }
+
+ public int getContentLength()
+ {
+ return 0;
+ }
+
+ public String getContentType()
+ {
+ return null;
+ }
+
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return new ServletInputStream()
+ {
+ @Override
+ public int read() throws IOException
+ {
+ return is.read();
+ }
+ };
+ }
+
+ public String getLocalAddr()
+ {
+ return null;
+ }
+
+ public String getLocalName()
+ {
+ return null;
+ }
+
+ public int getLocalPort()
+ {
+ return 0;
+ }
+
+ public Locale getLocale()
+ {
+ return null;
+ }
+
+ public Enumeration getLocales()
+ {
+ return null;
+ }
+
+ public String getParameter(String name)
+ {
+ return null;
+ }
+
+ public Map getParameterMap()
+ {
+ return null;
+ }
+
+ public Enumeration getParameterNames()
+ {
+ return null;
+ }
+
+ public String[] getParameterValues(String name)
+ {
+ return null;
+ }
+
+ public String getProtocol()
+ {
+ return null;
+ }
+
+ public BufferedReader getReader() throws IOException
+ {
+ return null;
+ }
+
+ public String getRealPath(String path)
+ {
+ return null;
+ }
+
+ public String getRemoteAddr()
+ {
+ return null;
+ }
+
+ public String getRemoteHost()
+ {
+ return null;
+ }
+
+ public int getRemotePort()
+ {
+ return 0;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return null;
+ }
+
+ public String getScheme()
+ {
+ return null;
+ }
+
+ public String getServerName()
+ {
+ return null;
+ }
+
+ public int getServerPort()
+ {
+ return 0;
+ }
+
+ public boolean isSecure()
+ {
+ return false;
+ }
+
+ public void removeAttribute(String name)
+ {
+ }
+
+ public void setAttribute(String name, Object o)
+ {
+ }
+
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException
+ {
+ }
+}
\ No newline at end of file
Added:
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletResponse.java
===================================================================
---
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletResponse.java
(rev 0)
+++
product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/servlets/TestServletResponse.java 2011-08-11
22:25:16 UTC (rev 1185)
@@ -0,0 +1,196 @@
+/*
+ * 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.identity.federation.bindings.servlets;
+
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 28, 2009
+ */
+public class TestServletResponse implements HttpServletResponse
+{
+ private BufferedOutputStream bos = null;
+
+ public TestServletResponse(OutputStream os)
+ {
+ super();
+ bos = new BufferedOutputStream(os);
+ }
+
+ public void addCookie(Cookie cookie)
+ {
+ }
+
+ public void addDateHeader(String name, long date)
+ {
+ }
+
+ public void addHeader(String name, String value)
+ {
+ }
+
+ public void addIntHeader(String name, int value)
+ {
+ }
+
+ public boolean containsHeader(String name)
+ {
+ return false;
+ }
+
+ public String encodeRedirectURL(String url)
+ {
+ return null;
+ }
+
+ public String encodeRedirectUrl(String url)
+ {
+ return null;
+ }
+
+ public String encodeURL(String url)
+ {
+ return null;
+ }
+
+ public String encodeUrl(String url)
+ {
+ return null;
+ }
+
+ public void sendError(int sc) throws IOException
+ {
+ }
+
+ public void sendError(int sc, String msg) throws IOException
+ {
+ }
+
+ public void sendRedirect(String location) throws IOException
+ {
+ }
+
+ public void setDateHeader(String name, long date)
+ {
+ }
+
+ public void setHeader(String name, String value)
+ {
+ }
+
+ public void setIntHeader(String name, int value)
+ {
+ }
+
+ public void setStatus(int sc)
+ {
+ }
+
+ public void setStatus(int sc, String sm)
+ {
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ this.bos.flush();
+ }
+
+ public int getBufferSize()
+ {
+ return 0;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return null;
+ }
+
+ public String getContentType()
+ {
+ return null;
+ }
+
+ public Locale getLocale()
+ {
+ return null;
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ bos.flush();
+ return new ServletOutputStream()
+ {
+ @Override
+ public void write(int b) throws IOException
+ {
+ bos.write(b);
+ }
+ };
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ return null;
+ }
+
+ public boolean isCommitted()
+ {
+ return false;
+ }
+
+ public void reset()
+ {
+ }
+
+ public void resetBuffer()
+ {
+ }
+
+ public void setBufferSize(int size)
+ {
+ }
+
+ public void setCharacterEncoding(String charset)
+ {
+ }
+
+ public void setContentLength(int len)
+ {
+ }
+
+ public void setContentType(String type)
+ {
+ }
+
+ public void setLocale(Locale loc)
+ {
+ }
+}