Source Code Cross Referenced for WMSTestSupport.java in  » GIS » GeoServer » org » geoserver » wms » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoServer » org.geoserver.wms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
002:         * This code is licensed under the GPL 2.0 license, availible at the root
003:         * application directory.
004:         */
005:        package org.geoserver.wms;
006:
007:        import com.vividsolutions.jts.geom.Envelope;
008:        import org.geoserver.test.GeoServerTestSupport;
009:        import org.geotools.data.DataStore;
010:        import org.geotools.data.wfs.WFSDataStoreFactory;
011:        import org.geotools.map.DefaultMapLayer;
012:        import org.geotools.map.MapLayer;
013:        import org.geotools.referencing.crs.DefaultGeographicCRS;
014:        import org.geotools.styling.Style;
015:        import org.vfny.geoserver.global.ConfigurationException;
016:        import org.vfny.geoserver.global.FeatureTypeInfo;
017:        import org.vfny.geoserver.global.MapLayerInfo;
018:        import org.vfny.geoserver.global.WMS;
019:        import org.vfny.geoserver.global.dto.CoverageInfoDTO;
020:        import org.vfny.geoserver.global.dto.FeatureTypeInfoDTO;
021:        import org.vfny.geoserver.wms.requests.GetMapRequest;
022:        import org.vfny.geoserver.wms.servlets.GetMap;
023:        import java.io.IOException;
024:        import java.lang.reflect.Array;
025:        import java.net.MalformedURLException;
026:        import java.net.URL;
027:        import java.util.ArrayList;
028:        import java.util.HashMap;
029:        import java.util.List;
030:        import java.util.Map;
031:        import java.util.logging.Level;
032:
033:        import javax.xml.namespace.QName;
034:
035:        /**
036:         * Base support class for wms tests.
037:         * <p>
038:         * Deriving from this test class provides the test case with preconfigured
039:         * geoserver and wms objects.
040:         * </p>
041:         * @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
042:         *
043:         */
044:        public class WMSTestSupport extends GeoServerTestSupport {
045:            /**
046:             * @return The global wms singleton from the application context.
047:             */
048:            protected WMS getWMS() {
049:                return (WMS) applicationContext.getBean("wms");
050:            }
051:
052:            /**
053:             * Convenience method for subclasses to create a map layer from a layer name.
054:             * <p>
055:             * The map layer is created with the default style for the layer.
056:             * </p>
057:             * @param layerName The name of the layer.
058:             *
059:             * @return A new map layer.
060:             */
061:            protected MapLayer createMapLayer(QName layerName)
062:                    throws IOException {
063:                //TODO: support coverages
064:                FeatureTypeInfo info = getCatalog().getFeatureTypeInfo(
065:                        layerName);
066:                Style style = info.getDefaultStyle();
067:
068:                DefaultMapLayer layer = new DefaultMapLayer(info
069:                        .getFeatureSource(), style);
070:                layer.setTitle(info.getTypeName());
071:
072:                return layer;
073:            }
074:
075:            /**
076:             * Calls through to {@link #createGetMapRequest(QName[])}.
077:             *
078:             */
079:            protected GetMapRequest createGetMapRequest(QName layerName) {
080:                return createGetMapRequest(new QName[] { layerName });
081:            }
082:
083:            /**
084:             * Convenience method for subclasses to create a new GetMapRequest object.
085:             * <p>
086:             * The returned object has the following properties:
087:             *  <ul>
088:             *    <li>styles set to default styles for layers specified
089:             *    <li>bbox set to (-180,-90,180,180 )
090:             *    <li>crs set to epsg:4326
091:             *  </ul>
092:             *  Caller must set additional parameters of request as need be.
093:             * </p>
094:             *
095:             * @param The layer names of the request.
096:             *
097:             * @return A new GetMapRequest object.
098:             */
099:            protected GetMapRequest createGetMapRequest(QName[] layerNames) {
100:                GetMapRequest request = new GetMapRequest(new GetMap(getWMS()));
101:                request.setHttpServletRequest(createRequest("wms"));
102:
103:                MapLayerInfo[] layers = new MapLayerInfo[layerNames.length];
104:                List styles = new ArrayList();
105:
106:                for (int i = 0; i < layerNames.length; i++) {
107:                    FeatureTypeInfo ftInfo = getCatalog().getFeatureTypeInfo(
108:                            layerNames[i]);
109:                    styles.add(ftInfo.getDefaultStyle());
110:
111:                    layers[i] = new MapLayerInfo(ftInfo);
112:                }
113:
114:                request.setLayers(layers);
115:                request.setStyles(styles);
116:                request.setBbox(new Envelope(-180, -90, 180, 90));
117:                request.setCrs(DefaultGeographicCRS.WGS84);
118:                request.setSRS("EPSG:4326");
119:                request.setRawKvp(new HashMap());
120:                return request;
121:            }
122:
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.