[picketlink-commits] Picketlink SVN: r1095 - in product/trunk/picketlink-core/src/test: resources and 1 other directory.

picketlink-commits at lists.jboss.org picketlink-commits at lists.jboss.org
Tue Jul 19 09:32:12 EDT 2011


Author: anil.saldhana at jboss.com
Date: 2011-07-19 09:32:09 -0400 (Tue, 19 Jul 2011)
New Revision: 1095

Removed:
   product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/PingFederateResponseTestCase.java.bak
   product/trunk/picketlink-core/src/test/resources/responseIDP/
Log:
remove the ping response test

Deleted: product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/PingFederateResponseTestCase.java.bak
===================================================================
--- product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/PingFederateResponseTestCase.java.bak	2011-07-18 22:04:21 UTC (rev 1094)
+++ product/trunk/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/PingFederateResponseTestCase.java.bak	2011-07-19 13:32:09 UTC (rev 1095)
@@ -1,138 +0,0 @@
-/*
- * 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.workflow;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.catalina.deploy.LoginConfig;
-import org.junit.Test;
-import org.picketlink.identity.federation.bindings.tomcat.sp.SPPostFormAuthenticator;
-import org.picketlink.identity.federation.web.constants.GeneralConstants;
-import org.picketlink.identity.federation.web.util.PostBindingUtil;
-import org.picketlink.test.identity.federation.bindings.mock.MockCatalinaContext;
-import org.picketlink.test.identity.federation.bindings.mock.MockCatalinaContextClassLoader;
-import org.picketlink.test.identity.federation.bindings.mock.MockCatalinaRequest;
-import org.picketlink.test.identity.federation.bindings.mock.MockCatalinaResponse;
-import org.picketlink.test.identity.federation.bindings.mock.MockCatalinaSession;
-
-/**
- * Validating PicketLink SP Handling of
- * a response from Ping Federate IDP.
- * 
- * @author Anil.Saldhana at redhat.com
- * @since Feb 22, 2011
- */
-public class PingFederateResponseTestCase
-{
-   private final String profile = "saml2/post";
-
-   private final ClassLoader tcl = Thread.currentThread().getContextClassLoader();
-
-   @SuppressWarnings("unchecked")
-   @Test
-   public void testSP() throws Exception
-   {
-      MockCatalinaSession session = new MockCatalinaSession();
-      //First we go to the employee application
-      MockCatalinaContextClassLoader mclSPEmp = setupTCL(profile + "/ping");
-      Thread.currentThread().setContextClassLoader(mclSPEmp);
-      SPPostFormAuthenticator spEmpl = new SPPostFormAuthenticator();
-
-      MockCatalinaContext context = new MockCatalinaContext();
-      spEmpl.setContainer(context);
-      spEmpl.testStart();
-
-      MockCatalinaRequest catalinaRequest = new MockCatalinaRequest();
-      catalinaRequest.setSession(session);
-      catalinaRequest.setContext(context);
-
-      String idpResponse = PostBindingUtil.base64Encode(new String(readIDPResponse()));
-
-      catalinaRequest.setParameter(GeneralConstants.SAML_RESPONSE_KEY, idpResponse);
-
-      MockCatalinaResponse catalinaResponse = new MockCatalinaResponse();
-      ByteArrayOutputStream baos = new ByteArrayOutputStream();
-      catalinaResponse.setWriter(new PrintWriter(baos));
-
-      LoginConfig loginConfig = new LoginConfig();
-      assertTrue(spEmpl.authenticate(catalinaRequest, catalinaResponse, loginConfig));
-
-      Map<String, List<Object>> sessionMap = (Map<String, List<Object>>) session
-            .getAttribute(GeneralConstants.SESSION_ATTRIBUTE_MAP);
-      assertNotNull(sessionMap);
-      assertEquals("asptest_email", sessionMap.get("email").get(0));
-      assertEquals("asptest_zipcode", sessionMap.get("zipcode").get(0));
-   }
-
-   private byte[] readIDPResponse() throws IOException
-   {
-      File file = new File(tcl.getResource("responseIDP/pingidp.xml").getPath());
-      InputStream is = new FileInputStream(file);
-      assertNotNull(is);
-
-      long length = file.length();
-
-      // Create the byte array to hold the data
-      byte[] bytes = new byte[(int) length];
-
-      // Read in the bytes
-      int offset = 0;
-      int numRead = 0;
-      while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0)
-      {
-         offset += numRead;
-      }
-
-      // Ensure all the bytes have been read in
-      if (offset < bytes.length)
-      {
-         throw new IOException("Could not completely read file " + file.getName());
-      }
-
-      // Close the input stream and return bytes
-      is.close();
-      return bytes;
-   }
-
-   private MockCatalinaContextClassLoader setupTCL(String resource)
-   {
-      URL[] urls = new URL[]
-      {tcl.getResource(resource)};
-
-      MockCatalinaContextClassLoader mcl = new MockCatalinaContextClassLoader(urls);
-      mcl.setDelegate(tcl);
-      mcl.setProfile(resource);
-      return mcl;
-   }
-}
\ No newline at end of file



More information about the picketlink-commits mailing list