/*
 *    GeoTools - OpenSource mapping toolkit
 *    http://geotools.org
 *    (C) 2004-2006, Geotools Project Managment Committee (PMC)
 *
 *    This library 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 library 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.
 */
package org.geotools.data.wms.test;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.ConnectException;
import java.net.NoRouteToHostException;
import java.net.UnknownHostException;

import junit.framework.TestCase;
/**
 * A JUnit TestCase subclass that allows other test cases to talk to remote
 * servers, but does not fail if those servers are down or otherwise 
 * unavailable.
 * 
 * Note that it is still the responsibility of the individual test case to
 * decrease time-out time, if that is desired.
 * 
 * It is recommended that developers using this class do not output any other
 * text from within their test cases. This means that output will only be 
 * generated if there is an issue, and can make scanning for problems easier.
 * 
 * It will currently catch and print out network-related IOExceptions thrown
 * by setup() and test*() methods.
 * 
 * @author rgould
 * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/wms/src/test/java/org/geotools/data/wms/test/ServerTestCase.java $
 */
public class ServerTestCase extends TestCase {

    
    
    public ServerTestCase() {
        super();
    }

    public ServerTestCase( String arg0 ) {
        super(arg0);
    }

    public void runBare() throws Throwable {
        try {
            super.runBare();
        } catch (ConnectException e) {
            e.printStackTrace(System.err);
        } catch (UnknownHostException e) {
            e.printStackTrace(System.err);
        } catch (NoRouteToHostException e) {
            e.printStackTrace(System.err);
        } catch (FileNotFoundException e) {
            e.printStackTrace(System.err);
        } catch (IOException e) {
            e.printStackTrace(System.err);
        }
    }

    protected void runTest() throws Throwable {
        try {
            super.runTest();
        } catch (ConnectException e) {
            e.printStackTrace(System.err);
        } catch (UnknownHostException e) {
            e.printStackTrace(System.err);
        } catch (NoRouteToHostException e) {
            e.printStackTrace(System.err);
        } catch (FileNotFoundException e) {
            e.printStackTrace(System.err);
        } catch (IOException e) {
            e.printStackTrace(System.err);
        }
    }
}
