geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r451403 - in /geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main: java/org/apache/geronimo/mavenplugins/selenium/ resources/org/apache/geronimo/mavenplugins/selenium/
Date Fri, 29 Sep 2006 19:48:14 GMT
Author: jdillon
Date: Fri Sep 29 12:48:14 2006
New Revision: 451403

URL: http://svn.apache.org/viewvc?view=rev&rev=451403
Log:
Refactor logging/output handling, now has only one output file and can take controls from
-D params

Added:
    geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartMojo.java
  (with props)
Modified:
    geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java
    geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/resources/org/apache/geronimo/mavenplugins/selenium/log4j.properties

Added: geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartMojo.java?view=auto&rev=451403
==============================================================================
--- geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartMojo.java
(added)
+++ geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartMojo.java
Fri Sep 29 12:48:14 2006
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.mavenplugins.selenium;
+
+/**
+ * Alias for <tt>start-server</tt>.
+ *
+ * @goal start
+ *
+ * @version $Rev$ $Date$
+ */
+public class StartMojo
+    extends StartServerMojo
+{
+    // empty
+}

Propchange: geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java?view=diff&rev=451403&r1=451402&r2=451403
==============================================================================
--- geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java
(original)
+++ geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java
Fri Sep 29 12:48:14 2006
@@ -42,10 +42,12 @@
 import org.apache.tools.ant.types.Environment;
 import org.apache.tools.ant.types.Path;
 
+import org.codehaus.plexus.util.FileUtils;
+
 /**
  * Start the Selenium server.
  *
- * @goal start
+ * @goal start-server
  *
  * @version $Rev$ $Date$
  */
@@ -55,21 +57,21 @@
     /**
      * The port number the server will use.
      *
-     * @parameter default-value="4444"
+     * @parameter expression="${port}" default-value="4444"
      */
     private int port = -1;
 
     /**
      * Timeout for the server in seconds.
      *
-     * @parameter default-value="-1"
+     * @parameter expression="${timeout}" default-value="-1"
      */
     private int timeout = -1;
 
     /**
      * Enable the server's debug mode..
      *
-     * @parameter default-value="false"
+     * @parameter expression="${debug}" default-value="false"
      */
     private boolean debug = false;
 
@@ -111,30 +113,21 @@
      * @required
      */
     private File workingDirectory = null;
-
-    /**
-     * The file that Selenium server logs will be written to.
-     *
-     * @parameter expression="${project.build.directory}/selenium/server.log"
-     * @required
-     */
-    private File logFile = null;
-
+    
     /**
-     * The file that Selenium server STDOUT will be written to.
+     * Enable logging mode.
      *
-     * @parameter expression="${project.build.directory}/selenium/server.out"
-     * @required
+     * @parameter expression="${logOutput}" default-value="false"
      */
-    private File outputFile = null;
-
+    protected boolean logOutput = false;
+    
     /**
-     * The file that Selenium server STDERR will be written to.
+     * The file that Selenium server logs will be written to.
      *
-     * @parameter expression="${project.build.directory}/selenium/server.err"
+     * @parameter expression="${logFile}" default-value="${project.build.directory}/selenium/server.log"
      * @required
      */
-    private File errorFile = null;
+    private File logFile = null;
 
     /**
      * Flag to control if we background the server or block Maven execution.
@@ -183,15 +176,22 @@
         log.info("Starting Selenium server...");
 
         final Java java = (Java)createTask("java");
-
+        
+        FileUtils.forceMkdir(workingDirectory);
+        
         java.setFork(true);
-        mkdir(workingDirectory);
         java.setDir(workingDirectory);
         java.setFailonerror(true);
-        java.setOutput(outputFile);
-        java.setError(errorFile);
-        java.setLogError(true);
-
+        
+        if (logOutput) {
+            FileUtils.forceMkdir(logFile.getParentFile());
+
+            log.info("Redirecting output to: " + logFile);
+            
+            java.setLogError(true);
+            java.setOutput(logFile);
+        }
+        
         java.setClassname("org.openqa.selenium.server.SeleniumServer");
 
         Path classpath = java.createClasspath();
@@ -207,6 +207,11 @@
         java.addSysproperty(var);
 
         var = new Environment.Variable();
+        var.setKey("selenium.loglevel");
+        var.setValue(debug == true ? "DEBUG" : "INFO");
+        java.addSysproperty(var);
+
+        var = new Environment.Variable();
         var.setKey("log4j.configuration");
         var.setValue("org/apache/geronimo/mavenplugins/selenium/log4j.properties");
         java.addSysproperty(var);
@@ -256,7 +261,7 @@
         };
         t.start();
 
-        log.info("Waiting for Selenium server...");
+        log.debug("Waiting for Selenium server...");
 
         // Verify server started
         URL url = new URL("http://localhost:" + port + "/selenium-server");

Modified: geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/resources/org/apache/geronimo/mavenplugins/selenium/log4j.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/resources/org/apache/geronimo/mavenplugins/selenium/log4j.properties?view=diff&rev=451403&r1=451402&r2=451403
==============================================================================
--- geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/resources/org/apache/geronimo/mavenplugins/selenium/log4j.properties
(original)
+++ geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/resources/org/apache/geronimo/mavenplugins/selenium/log4j.properties
Fri Sep 29 12:48:14 2006
@@ -21,11 +21,11 @@
 ## $Rev$ $Date$
 ##
 
-log4j.rootLogger=INFO, FILE
+log4j.rootLogger=${selenium.loglevel}, CONSOLE
 
-log4j.appender.FILE=org.apache.log4j.FileAppender
-log4j.appender.FILE.File=${selenium.log}
-log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
 
 #log4j.logger.org.mortbay=INFO



Mime
View raw message