001: /*
002: * Copyright (c) 2002-2008 Gargoyle Software Inc. All rights reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * 1. Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: * 2. Redistributions in binary form must reproduce the above copyright notice,
010: * this list of conditions and the following disclaimer in the documentation
011: * and/or other materials provided with the distribution.
012: * 3. The end-user documentation included with the redistribution, if any, must
013: * include the following acknowledgment:
014: *
015: * "This product includes software developed by Gargoyle Software Inc.
016: * (http://www.GargoyleSoftware.com/)."
017: *
018: * Alternately, this acknowledgment may appear in the software itself, if
019: * and wherever such third-party acknowledgments normally appear.
020: * 4. The name "Gargoyle Software" must not be used to endorse or promote
021: * products derived from this software without prior written permission.
022: * For written permission, please contact info@GargoyleSoftware.com.
023: * 5. Products derived from this software may not be called "HtmlUnit", nor may
024: * "HtmlUnit" appear in their name, without prior written permission of
025: * Gargoyle Software Inc.
026: *
027: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
028: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
029: * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE
030: * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
031: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
032: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
033: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
034: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
035: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
036: * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
037: */
038: package com.gargoylesoftware.htmlunit;
039:
040: import java.io.File;
041: import java.io.IOException;
042: import java.util.Properties;
043:
044: import com.gargoylesoftware.base.testing.AcceptAllTestFilter;
045: import com.gargoylesoftware.base.testing.RecursiveTestSuite;
046:
047: /**
048: * This class is used by the junitui and junit targets in the build file. It's
049: * only purpose is to initialize the RecursiveTestSuite properly and to
050: * ensure that all logging is turned up to its highest level.
051: *
052: * @version $Revision: 2132 $
053: * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
054: */
055: public class MainTestSuite extends RecursiveTestSuite {
056:
057: /**
058: * Create an instance that will start from the current directory and
059: * will include all tests.
060: *
061: * @param name Ignored field. The swing test runner expects to find
062: * a test with constructor that takes a string so we provide one here.
063: * We don't actually use this field.
064: * @exception IOException If an io error occurs.
065: */
066: public MainTestSuite(final String name) throws IOException {
067: super (new File("."), new AcceptAllTestFilter());
068:
069: //enableAllLogging();
070: }
071:
072: /**
073: * Set the appropriate logging levels for running the tests.
074: */
075: public void enableAllLogging() {
076: final Properties properties = System.getProperties();
077: properties.put("org.apache.commons.logging.Log",
078: "org.apache.commons.logging.impl.SimpleLog");
079: properties.put(
080: "org.apache.commons.logging.simplelog.defaultlog",
081: "trace");
082:
083: final String prefix = "org.apache.commons.logging.simplelog.log.";
084: properties
085: .put(
086: prefix
087: + "org.apache.commons.httpclient.Authenticator",
088: "info");
089: properties.put(prefix + "org.apache.commons.httpclient.Cookie",
090: "info");
091: properties
092: .put(
093: prefix
094: + "org.apache.commons.httpclient.HeaderElement",
095: "info");
096: properties.put(prefix
097: + "org.apache.commons.httpclient.HttpClient", "info");
098: properties.put(prefix
099: + "org.apache.commons.httpclient.HttpConnection",
100: "info");
101: properties.put(prefix
102: + "org.apache.commons.httpclient.HttpMethod", "info");
103: properties.put(prefix
104: + "org.apache.commons.httpclient.HttpParser", "info");
105: properties.put(prefix
106: + "org.apache.commons.httpclient.HttpState", "info");
107: properties.put(prefix
108: + "org.apache.commons.httpclient.ResponseInputStream",
109: "info");
110: properties.put(prefix
111: + "org.apache.commons.httpclient.cookie.CookieSpec",
112: "info");
113: properties.put(prefix
114: + "org.apache.commons.httpclient.methods.GetMethod",
115: "info");
116: properties.put(prefix
117: + "org.apache.commons.httpclient.HttpMethodBase",
118: "info");
119: properties.put(prefix
120: + "org.apache.commons.logging.simplelog.showdatetime",
121: "true");
122: properties.put(prefix + "httpclient.wire", "info");
123: properties
124: .put(prefix + "org.apache.commons.httpclient", "info");
125: }
126: }
|