[Geoserver-devel] [jira] Created: (GEOS-3647) Greater abstraction of DefaultRasterMapProducer.java

Greater abstraction of DefaultRasterMapProducer.java
----------------------------------------------------

                 Key: GEOS-3647
                 URL: http://jira.codehaus.org/browse/GEOS-3647
             Project: GeoServer
          Issue Type: Improvement
          Components: WMS
         Environment: Java/JUnit
            Reporter: Tisham Dhar
            Assignee: Andrea Aime
            Priority: Minor
             Fix For: 2.0.x

The DefaultMapProducer test provides a generic harness for testing other raster map output formats but has too many instances of hardcoded image/gif. Making private mapFormat variable and a getter allows subclasses to reuse the testing code. Patch follows:

Index: DefaultRasterMapProducerTest.java

--- DefaultRasterMapProducerTest.java (revision 13608)
+++ DefaultRasterMapProducerTest.java (working copy)
@@ -65,6 +65,9 @@

     /** DOCUMENT ME! */
     private DefaultRasterMapProducer rasterMapProducer;
+
+ /** DOCUMENT ME! */
+ private String mapFormat = "image/gif";

     /**
      * This is a READ ONLY TEST so we can use one time setup
@@ -103,6 +106,11 @@
         this.rasterMapProducer = null;
         super.tearDownInternal();
     }
+
+ public String getMapFormat()
+ {
+ return this.mapFormat;
+ }

     /**
      * DOCUMENT ME!
@@ -111,7 +119,6 @@
      * DOCUMENT ME!
      */
     public void testSimpleGetMapQuery() throws Exception {
- final String mapFormat = "image/gif";

         Catalog catalog = getCatalog();
@@ -134,7 +141,7 @@
         Style basicStyle = styleByName.getStyle();
         map.addLayer(fs, basicStyle);

- this.rasterMapProducer.setOutputFormat(mapFormat);
+ this.rasterMapProducer.setOutputFormat(getMapFormat());
         this.rasterMapProducer.setMapContext(map);
         this.rasterMapProducer.produceMap();

@@ -199,7 +206,7 @@

         map.setAreaOfInterest(new ReferencedEnvelope(env, DefaultGeographicCRS.WGS84));

- this.rasterMapProducer.setOutputFormat("image/gif");
+ this.rasterMapProducer.setOutputFormat(getMapFormat());
         this.rasterMapProducer.setMapContext(map);
         this.rasterMapProducer.produceMap();

@@ -318,7 +325,7 @@
         map.setBgColor(BG_COLOR);
         map.setTransparent(false);

- this.rasterMapProducer.setOutputFormat("image/gif");
+ this.rasterMapProducer.setOutputFormat(getMapFormat());
         this.rasterMapProducer.setMapContext(map);
         this.rasterMapProducer.produceMap();

@@ -399,7 +406,7 @@
         
         StyleInfo someStyle = getCatalog().getStyles().get(0);
         map.addLayer(source, someStyle.getStyle());
- this.rasterMapProducer.setOutputFormat("image/gif");
+ this.rasterMapProducer.setOutputFormat(getMapFormat());
         this.rasterMapProducer.setMapContext(map);
         this.rasterMapProducer.produceMap();

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira