Very very cool. Thanks!

On Fri, Mar 26, 2010 at 12:33 PM,  <[email protected]> wrote:
> Author: uli
> Date: Fri Mar 26 19:33:00 2010
> New Revision: 928029
>
> URL: http://svn.apache.org/viewvc?rev=928029&view=rev
> Log:
> make the secure access integration test work.
>
> Added:
>    tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/
>    
> tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/cert8.db
>    (with props)
>    
> tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/cert_override.txt
> Modified:
>    
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/RunJetty.java
>    
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
>    
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
>    
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java
>    
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java
>    
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java
>
> Added: 
> tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/cert8.db
> URL: 
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/cert8.db?rev=928029&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: 
> tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/cert8.db
> ------------------------------------------------------------------------------
>    svn:mime-type = application/octet-stream
>
> Added: 
> tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/cert_override.txt
> URL: 
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/cert_override.txt?rev=928029&view=auto
> ==============================================================================
> --- 
> tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/cert_override.txt
>  (added)
> +++ 
> tapestry/tapestry5/trunk/tapestry-core/src/test/conf/ff_profile_template/cert_override.txt
>  Fri Mar 26 19:33:00 2010
> @@ -0,0 +1,3 @@
> +# PSM Certificate Override Settings file
> +# This is a generated file!  Do not edit.
> +localhost:8443 OID.2.16.840.1.101.3.4.2.1      
> AC:9D:B3:A8:70:15:50:D6:51:69:4D:48:70:00:91:53:88:44:A5:EB:12:23:EC:2D:E1:87:40:88:5B:55:E8:26
>  MUT     AAAAAAAAAAAAAAAEAAAAkknlCnYwgY8xCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZP  
> cmVnb24xETAPBgNVBAcTCFBvcnRsYW5kMSMwIQYDVQQKExpBcGFjaGUgU29mdHdh  
> cmUgRm91bmRhdGlvbjEYMBYGA1UECxMPQXBhY2hlIFRhcGVzdHJ5MR0wGwYDVQQD  
> ExRIb3dhcmQgTS4gTGV3aXMgU2hpcA==
>
> Modified: 
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/RunJetty.java
> URL: 
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/RunJetty.java?rev=928029&r1=928028&r2=928029&view=diff
> ==============================================================================
> --- 
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/RunJetty.java
>  (original)
> +++ 
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/RunJetty.java
>  Fri Mar 26 19:33:00 2010
> @@ -14,9 +14,7 @@
>
>  package org.apache.tapestry5.integration;
>
> -import org.apache.tapestry5.test.JettyRunner;
> -
> -import java.io.File;
> +import org.apache.tapestry5.test.Jetty7Runner;
>
>  /**
>  * A "shim" to run Demo App #1 inside IntelliJ.  I still haven't found a way 
> to get IntelliJ to export test classes and
> @@ -24,13 +22,11 @@ import java.io.File;
>  */
>  public class RunJetty
>  {
> -    public static void main(String[] args) throws InterruptedException
> +    public static void main(String[] args) throws Exception
>     {
>         String contextName = args[0];
>         String path = args[1];
> -
> -        File workingDir = new File(System.getProperty("user.dir"));
> -
> -        new JettyRunner(workingDir, contextName, 8080, path);
> +
> +        new Jetty7Runner(path, contextName, 9090, 8443);
>     }
>  }
>
> Modified: 
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
> URL: 
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java?rev=928029&r1=928028&r2=928029&view=diff
> ==============================================================================
> --- 
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
>  (original)
> +++ 
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
>  Fri Mar 26 19:33:00 2010
> @@ -1314,20 +1314,11 @@ public class CoreBehaviorsTests extends
>
>         // assertSourcePresent("<![CDATA[< & >]]>");
>     }
> -
> -    /**
> -     * This may need to be disabled or dropped from the test suite, I don't 
> know
> -     * that Selenium, especially Selenium
> -     * running headless on the CI server, can handle the transition to HTTPS:
> -     * there's warnings that pop up about
> -     * certificates.
> -     * <p/>
> -     * Verified: Selenium can't handle this, even with a user manually 
> OK-ing the certificate warning dialogs.
> -     */
> -   �...@test(enabled = false)
> +
> +   �...@test
>     public void secure_page_access()
>     {
> -        start("Secure Page Demo");
> +        clickThru("Secure Page Demo");
>
>         assertText("secure", "secure");
>
> @@ -1348,7 +1339,7 @@ public class CoreBehaviorsTests extends
>
>         // Back to the insecure home page.
>
> -        assertText("//h1", "Tapestry 5 Integration Application 1");
> +        assertText("//h1", "Tapestry Integration Test Application");
>     }
>
>     /** TAP5-815 */
>
> Modified: 
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
> URL: 
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java?rev=928029&r1=928028&r2=928029&view=diff
> ==============================================================================
> --- 
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
>  (original)
> +++ 
> tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
>  Fri Mar 26 19:33:00 2010
> @@ -1,4 +1,4 @@
> -// Copyright 2006, 2007, 2008, 2009 The Apache Software Foundation
> +// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
>  //
>  // Licensed under the Apache License, Version 2.0 (the "License");
>  // you may not use this file except in compliance with the License.
> @@ -14,6 +14,18 @@
>
>  package org.apache.tapestry5.integration.app1.services;
>
> +import static java.lang.annotation.ElementType.FIELD;
> +import static java.lang.annotation.ElementType.PARAMETER;
> +import static java.lang.annotation.RetentionPolicy.RUNTIME;
> +
> +import java.io.IOException;
> +import java.lang.annotation.Documented;
> +import java.lang.annotation.Retention;
> +import java.lang.annotation.Target;
> +import java.net.URL;
> +import java.util.List;
> +import java.util.Map;
> +
>  import org.apache.tapestry5.SymbolConstants;
>  import org.apache.tapestry5.ValueEncoder;
>  import org.apache.tapestry5.integration.app1.data.ToDoItem;
> @@ -24,23 +36,17 @@ import org.apache.tapestry5.ioc.MappedCo
>  import org.apache.tapestry5.ioc.OrderedConfiguration;
>  import org.apache.tapestry5.ioc.ServiceBinder;
>  import org.apache.tapestry5.ioc.annotations.Marker;
> -import org.apache.tapestry5.ioc.annotations.Symbol;
>  import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
> -import org.apache.tapestry5.services.*;
> -import org.apache.tapestry5.test.JettyRunner;
> +import org.apache.tapestry5.services.AliasContribution;
> +import org.apache.tapestry5.services.BaseURLSource;
> +import org.apache.tapestry5.services.ComponentClassTransformWorker;
> +import org.apache.tapestry5.services.Request;
> +import org.apache.tapestry5.services.RequestFilter;
> +import org.apache.tapestry5.services.RequestHandler;
> +import org.apache.tapestry5.services.Response;
> +import org.apache.tapestry5.services.ValueEncoderFactory;
>  import org.slf4j.Logger;
>
> -import java.io.IOException;
> -import java.lang.annotation.Documented;
> -import static java.lang.annotation.ElementType.FIELD;
> -import static java.lang.annotation.ElementType.PARAMETER;
> -import java.lang.annotation.Retention;
> -import static java.lang.annotation.RetentionPolicy.RUNTIME;
> -import java.lang.annotation.Target;
> -import java.net.URL;
> -import java.util.List;
> -import java.util.Map;
> -
>  /**
>  * I was just dying to see how fast requests are!
>  */
> @@ -75,7 +81,7 @@ public class AppModule
>
>                 // This is all a bit jury-rigged together. This is for 
> running the app
>                 // interactively; Selenium doesn't seem to handle the 
> transition to https.
> -                int port = secure ? JettyRunner.DEFAULT_SECURE_PORT : 
> JettyRunner.DEFAULT_PORT;
> +                int port = secure ? 8443 : 9090;
>
>                 return String.format("%s://localhost:%d", protocol, port);
>             }
>
> Modified: 
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java
> URL: 
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java?rev=928029&r1=928028&r2=928029&view=diff
> ==============================================================================
> --- 
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java
>  (original)
> +++ 
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/Jetty7Runner.java
>  Fri Mar 26 19:33:00 2010
> @@ -17,6 +17,7 @@ package org.apache.tapestry5.test;
>  import java.io.File;
>
>  import org.eclipse.jetty.server.Server;
> +import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
>  import org.eclipse.jetty.webapp.WebAppContext;
>
>  /**
> @@ -29,14 +30,18 @@ public class Jetty7Runner
>     private final String description;
>
>     private final int port;
> +
> +    private final int sslPort;
>
> -    public Jetty7Runner(String webappFolder, String contextPath, int port) 
> throws Exception
> +    public Jetty7Runner(String webappFolder, String contextPath, int port, 
> int sslPort) throws Exception
>     {
>         this.port = port;
> +
> +        this.sslPort = sslPort;
>
>         String expandedPath = expand(webappFolder);
>
> -        description = String.format("<Jetty7Runner: %s:%s (%s)", 
> contextPath, port, expandedPath);
> +        description = String.format("<Jetty7Runner: %s:%s/%s (%s)", 
> contextPath, port, sslPort, expandedPath);
>
>         jettyServer = new Server(port);
>
> @@ -44,7 +49,21 @@ public class Jetty7Runner
>         webapp.setContextPath(contextPath);
>         webapp.setWar(expandedPath);
>
> -        // TODO: SSL support
> +        // SSL support
> +
> +        SslSelectChannelConnector sslConnector = new 
> SslSelectChannelConnector();
> +
> +        sslConnector.setPort(sslPort);
> +
> +        File keystoreFile = new File(TapestryTestConstants.MODULE_BASE_DIR, 
> "src/test/conf/keystore");
> +
> +        sslConnector.setKeystore(keystoreFile.getPath());
> +
> +        sslConnector.setPassword("tapestry");
> +
> +        sslConnector.setKeyPassword("tapestry");
> +
> +        jettyServer.addConnector(sslConnector);
>
>         jettyServer.setHandler(webapp);
>
> @@ -54,7 +73,7 @@ public class Jetty7Runner
>     /** Immediately shuts down the server instance. */
>     public void stop()
>     {
> -        System.out.printf("Stopping Jetty instance on port %d\n", port);
> +        System.out.printf("Stopping Jetty instance on port %d/%d\n", port, 
> sslPort);
>
>         try
>         {
>
> Modified: 
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java
> URL: 
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java?rev=928029&r1=928028&r2=928029&view=diff
> ==============================================================================
> --- 
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java
>  (original)
> +++ 
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java
>  Fri Mar 26 19:33:00 2010
> @@ -14,6 +14,7 @@
>
>  package org.apache.tapestry5.test;
>
> +import java.io.File;
>  import java.util.Map;
>
>  import org.openqa.selenium.server.RemoteControlConfiguration;
> @@ -104,6 +105,12 @@ public class SeleniumLauncher
>      * <td>Port number for web server to listen to</td>
>      * </tr>
>      * <tr>
> +     * <td>sslPort</td>
> +     * <td>tapestry.ssl-port</td>
> +     * <td>8443</td>
> +     * <td>Port number for web server to listen to for secure requests</td>
> +     * </tr>
> +     * <tr>
>      * <td>browserStartCommand</td>
>      * <td>tapestry.browser-start-command</td>
>      * <td>*firefox</td>
> @@ -128,7 +135,7 @@ public class SeleniumLauncher
>     // shutdown(). Best to be safe!
>     @Parameters(
>     { TapestryTestConstants.WEB_APP_FOLDER_PARAMETER, 
> TapestryTestConstants.CONTEXT_PATH_PARAMTER,
> -            TapestryTestConstants.PORT_PARAMETER,
> +            TapestryTestConstants.PORT_PARAMETER, 
> TapestryTestConstants.SSL_PORT_PARAMETER,
>             TapestryTestConstants.BROWSER_START_COMMAND_PARAMETER })
>     @BeforeTest(dependsOnGroups = { "beforeStartup" })
>     public synchronized void startup(
> @@ -141,6 +148,9 @@ public class SeleniumLauncher
>
>     @Optional("9090")
>     int port,
> +
> +   �...@optional("8443")
> +    int sslPort,
>
>     @Optional("*firefox")
>     String browserStartCommand, ITestContext testContext, XmlTest xmlTest) 
> throws Exception
> @@ -161,9 +171,13 @@ public class SeleniumLauncher
>         
> if(testParameters.containsKey(TapestryTestConstants.BROWSER_START_COMMAND_PARAMETER))
>             browserStartCommand = 
> testParameters.get(TapestryTestConstants.BROWSER_START_COMMAND_PARAMETER);
>
> -        stopWebServer = launchWebServer(webAppFolder, contextPath, port);
> +        stopWebServer = launchWebServer(webAppFolder, contextPath, port, 
> sslPort);
>
>         seleniumServer = new SeleniumServer();
> +
> +        File ffProfileTemplate = new 
> File(TapestryTestConstants.MODULE_BASE_DIR, 
> "src/test/conf/ff_profile_template");
> +
> +        
> seleniumServer.getConfiguration().setFirefoxProfileTemplate(ffProfileTemplate);
>
>         seleniumServer.start();
>
> @@ -220,13 +234,15 @@ public class SeleniumLauncher
>      *            the path the context is mapped to, usually the empty string
>      * @param port
>      *            the port number the server should handle
> +     * @param sslPort
> +     *            the port number on which the server should handle secure 
> requests
>      * @return Runnable used to shut down the server
>      * @throws Exception
>      */
> -    protected Runnable launchWebServer(String webAppFolder, String 
> contextPath, int port)
> +    protected Runnable launchWebServer(String webAppFolder, String 
> contextPath, int port, int sslPort)
>             throws Exception
>     {
> -        final Jetty7Runner runner = new Jetty7Runner(webAppFolder, 
> contextPath, port);
> +        final Jetty7Runner runner = new Jetty7Runner(webAppFolder, 
> contextPath, port, sslPort);
>
>         return new Runnable()
>         {
>
> Modified: 
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java
> URL: 
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java?rev=928029&r1=928028&r2=928029&view=diff
> ==============================================================================
> --- 
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java
>  (original)
> +++ 
> tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java
>  Fri Mar 26 19:33:00 2010
> @@ -92,6 +92,11 @@ public class TapestryTestConstants
>     public static final String PORT_PARAMETER = "tapestry.port";
>
>     /**
> +     * {...@link XmlTest} parameter holding the web server ssl port.
> +     */
> +    public static final String SSL_PORT_PARAMETER = "tapestry.ssl-port";
> +
> +    /**
>      * {...@link XmlTest} parameter holding the browser command to pass to 
> Selenium.
>      */
>     public static final String BROWSER_START_COMMAND_PARAMETER = 
> "tapestry.browser-start-command";
>
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to