vmassol     2003/08/09 09:51:39

  Modified:    framework/src/java/j2ee13/org/apache/cactus/extension/jetty
                        Tag: CACTUS_15_BRANCH JettyTestSetup.java
               documentation/docs/xdocs Tag: CACTUS_15_BRANCH changes.xml
  Log:
  Merged from HEAD
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +30 -8     
jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jetty/JettyTestSetup.java
  
  Index: JettyTestSetup.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jetty/JettyTestSetup.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- JettyTestSetup.java       14 Jul 2003 13:42:55 -0000      1.2
  +++ JettyTestSetup.java       9 Aug 2003 16:51:39 -0000       1.2.2.1
  @@ -111,6 +111,12 @@
       private File resourceDir;
   
       /**
  +     * The Jetty server object representing the running instance. It is
  +     * used to stop Jetty in [EMAIL PROTECTED] #tearDown()}.
  +     */
  +    private Object server; 
  +
  +    /**
        * @param theTest the test we are decorating (usually a test suite)
        */
       public JettyTestSetup(Test theTest)
  @@ -126,7 +132,7 @@
        *
        * @exception Exception if an error happens during initialization
        */
  -    public void setUp() throws Exception
  +    protected void setUp() throws Exception
       {
           // Note: We are currently using reflection in order not to need Jetty
           // to compile Cactus. If the code becomes more complex or we need to 
  @@ -141,10 +147,10 @@
           FilterConfiguration filterConfig = new FilterConfiguration();
   
           // Create a Jetty Server object and configure a listener
  -        Object server = createServer(baseConfig);
  +        this.server = createServer(baseConfig);
   
           // Create a Jetty context.
  -        Object context = createContext(server, baseConfig);
  +        Object context = createContext(this.server, baseConfig);
           
           // Add the Cactus Servlet redirector
           addServletRedirector(context, servletConfig);
  @@ -159,13 +165,29 @@
           // command line.
           if (getConfigFile() != null)
           {
  -            server.getClass().getMethod("configure", 
  -                new Class[] {String.class})
  -                .invoke(server, new Object[] {getConfigFile().toString()});
  +            this.server.getClass().getMethod("configure", 
  +                new Class[] {String.class}).invoke(
  +                    this.server, new Object[] {getConfigFile().toString()});
           }
   
           // Start the Jetty server
  -        server.getClass().getMethod("start", null).invoke(server, null);
  +        this.server.getClass().getMethod("start", null).invoke(
  +            this.server, null);
  +    }
  +
  +    /**
  +     * Stop the running Jetty server.
  +     * 
  +     * @exception Exception if an error happens during the shutdown
  +     */
  +    protected void tearDown() throws Exception
  +    { 
  +        if (this.server != null)
  +        { 
  +            // Stop the Jetty server
  +            this.server.getClass().getMethod("stop", null).invoke(
  +                this.server, null); 
  +        } 
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.120.2.3 +4 -0      jakarta-cactus/documentation/docs/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/changes.xml,v
  retrieving revision 1.120.2.2
  retrieving revision 1.120.2.3
  diff -u -r1.120.2.2 -r1.120.2.3
  --- changes.xml       9 Aug 2003 14:30:24 -0000       1.120.2.2
  +++ changes.xml       9 Aug 2003 16:51:39 -0000       1.120.2.3
  @@ -68,6 +68,10 @@
         </devs>
   
         <release version="1.5-rc1" date="in CVS">
  +        <action dev="VMA" type="fix" fixes-bug="22249" due-to="James Stangler" 
due-to-email="[EMAIL PROTECTED]">
  +          Fixed the <code>JettyTestSetup</code> class so that it stops the
  +          running Jetty server at the end of the test suite execution.
  +        </action>
           <action dev="VMA" type="update">
             The Cactus distribution now packages commons-httpclient 2.0 RC1
             (we were previously including version 2.0 beta2).
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to