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.wfs;
17:
18: import java.io.IOException;
19: import java.net.MalformedURLException;
20: import java.net.URL;
21: import java.util.NoSuchElementException;
22:
23: import javax.naming.OperationNotSupportedException;
24:
25: import junit.framework.TestCase;
26:
27: import org.geotools.feature.IllegalAttributeException;
28: import org.xml.sax.SAXException;
29:
30: /**
31: * @author dzwiers
32: * @since 0.6.0
33: * @source $URL:
34: * http://svn.geotools.org/geotools/trunk/gt/plugin/wfs/test/org/geotools/data/wfs/IonicTest.java $
35: */
36: public class IonicOnlineTest extends TestCase {
37:
38: private URL url = null;
39:
40: public IonicOnlineTest() throws MalformedURLException {
41: url = new URL(
42: "http://webservices.ionicsoft.com/ionicweb/wfs/BOSTON_ORA?version=1.0.0&request=getcapabilities&service=WFS");
43: }
44:
45: public void testFeatureType() throws NoSuchElementException,
46: IOException, SAXException {
47: try {
48: WFSDataStoreReadTest.doFeatureType(url, true, true, 0);
49: } catch (IOException e) {
50: skipHttpErrors(e);
51: }
52: }
53:
54: public void testFeatureReader() throws NoSuchElementException,
55: IOException, IllegalAttributeException, SAXException {
56: // FAILS due to Choice !!!
57: try {
58: WFSDataStoreReadTest.doFeatureReader(url, true, true, 0);
59: } catch (IOException e) {
60: skipHttpErrors(e);
61: }
62: }
63:
64: public void testFeatureReaderWithQuery()
65: throws NoSuchElementException,
66: OperationNotSupportedException, IllegalAttributeException,
67: IOException, SAXException {
68: try {
69: WFSDataStoreReadTest.doFeatureReaderWithQuery(url, true,
70: true, 0);
71: } catch (IOException e) {
72: skipHttpErrors(e);
73: }
74: }
75:
76: /**
77: * I the exception is a HTTP failure, skip the test to avoid breaking the build
78: * @param e
79: * @throws IOException
80: */
81: private void skipHttpErrors(IOException e) throws IOException {
82: if (e.getMessage().indexOf(
83: "Server returned HTTP response code:") == -1)
84: throw e;
85: System.out.println("WARNING, skipping test due to HTTP error: "
86: + e.getMessage());
87: }
88: }
|