01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.data.wms.test;
17:
18: import java.io.FileNotFoundException;
19: import java.io.IOException;
20: import java.net.ConnectException;
21: import java.net.NoRouteToHostException;
22: import java.net.UnknownHostException;
23:
24: import junit.framework.TestCase;
25:
26: /**
27: * A JUnit TestCase subclass that allows other test cases to talk to remote
28: * servers, but does not fail if those servers are down or otherwise
29: * unavailable.
30: *
31: * Note that it is still the responsibility of the individual test case to
32: * decrease time-out time, if that is desired.
33: *
34: * It is recommended that developers using this class do not output any other
35: * text from within their test cases. This means that output will only be
36: * generated if there is an issue, and can make scanning for problems easier.
37: *
38: * It will currently catch and print out network-related IOExceptions thrown
39: * by setup() and test*() methods.
40: *
41: * @author rgould
42: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/wms/src/test/java/org/geotools/data/wms/test/ServerTestCase.java $
43: */
44: public class ServerTestCase extends TestCase {
45:
46: public ServerTestCase() {
47: super ();
48: }
49:
50: public ServerTestCase(String arg0) {
51: super (arg0);
52: }
53:
54: public void runBare() throws Throwable {
55: try {
56: super .runBare();
57: } catch (ConnectException e) {
58: e.printStackTrace(System.err);
59: } catch (UnknownHostException e) {
60: e.printStackTrace(System.err);
61: } catch (NoRouteToHostException e) {
62: e.printStackTrace(System.err);
63: } catch (FileNotFoundException e) {
64: e.printStackTrace(System.err);
65: } catch (IOException e) {
66: e.printStackTrace(System.err);
67: }
68: }
69:
70: protected void runTest() throws Throwable {
71: try {
72: super .runTest();
73: } catch (ConnectException e) {
74: e.printStackTrace(System.err);
75: } catch (UnknownHostException e) {
76: e.printStackTrace(System.err);
77: } catch (NoRouteToHostException e) {
78: e.printStackTrace(System.err);
79: } catch (FileNotFoundException e) {
80: e.printStackTrace(System.err);
81: } catch (IOException e) {
82: e.printStackTrace(System.err);
83: }
84: }
85: }
|