01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.geoserver.wms;
06:
07: import java.io.IOException;
08: import java.net.URL;
09: import java.util.HashMap;
10: import java.util.Map;
11: import java.util.logging.Level;
12: import java.util.logging.Logger;
13:
14: import org.geotools.data.DataStore;
15: import org.geotools.data.wfs.WFSDataStoreFactory;
16:
17: /**
18: * Utility class used to check wheter REMOTE_OWS_XXX related tests can be run against Sigma
19: * or not.
20: * @author Andrea Aime - TOPP
21: */
22: public class RemoteOWSTestSupport {
23: static final Logger LOGGER = org.geotools.util.logging.Logging
24: .getLogger("org.geoserver.test");
25:
26: // support for remote OWS layers
27: public static final String TOPP_STATES = "topp:states";
28: public static final String WFS_SERVER_URL = "http://sigma.openplans.org:8080/geoserver/wfs?";
29: static Boolean remoteStatesAvailable;
30:
31: public static boolean isRemoteStatesAvailable() {
32: // todo: re-enable when http://jira.codehaus.org/browse/GEOS-1547 is fixed
33: return false;
34: // if(remoteStatesAvailable == null) {
35: // // let's check if the remote WFS tests are runnable
36: // try {
37: // WFSDataStoreFactory factory = new WFSDataStoreFactory();
38: // Map params = new HashMap(factory.getImplementationHints());
39: // URL url = new URL(WFS_SERVER_URL + "service=WFS&request=GetCapabilities");
40: // params.put(WFSDataStoreFactory.URL.key, url);
41: // params.put(WFSDataStoreFactory.TRY_GZIP.key, Boolean.TRUE);
42: // DataStore remoteStore = factory.createDataStore(params);
43: // remoteStore.getFeatureSource(TOPP_STATES);
44: // remoteStatesAvailable = Boolean.TRUE;
45: // } catch(IOException e) {
46: // LOGGER.log(Level.WARNING, "Skipping remote OWS test, either sigma " +
47: // "is down or the topp:states layer is not there", e);
48: // remoteStatesAvailable = Boolean.FALSE;
49: // }
50: // }
51: // return remoteStatesAvailable.booleanValue();
52: // see GEOS-
53: }
54: }
|