[Geoserver-devel] [jira] Created: (GEOS-3040) Include layer group support in the MockData suite

Include layer group support in the MockData suite
-------------------------------------------------

                 Key: GEOS-3040
                 URL: http://jira.codehaus.org/browse/GEOS-3040
             Project: GeoServer
          Issue Type: Improvement
            Reporter: Andrea Aime
            Assignee: Andrea Aime
             Fix For: 2.0-beta1

I already have 3 tests in need of layer groups. However, MockData support for groups is non existent, and various changes are needed to add those.
The code I'm duplicating looks like this:

{code}
@Override
    protected void setUpInternal() throws Exception {
        Catalog catalog = getCatalog();
        String lakes = MockData.LAKES.getLocalPart();
        String forests = MockData.FORESTS.getLocalPart();
        String bridges = MockData.BRIDGES.getLocalPart();
        
        setNativeBox(catalog, lakes);
        setNativeBox(catalog, forests);
        setNativeBox(catalog, bridges);
        
        LayerGroupInfo lg = catalog.getFactory().createLayerGroup();
        lg.setName("lakes");
        lg.getLayers().add(catalog.getLayerByName(lakes));
        lg.getStyles().add(catalog.getStyleByName(lakes));
        lg.getLayers().add(catalog.getLayerByName(forests));
        lg.getStyles().add(catalog.getStyleByName(forests));
        lg.getLayers().add(catalog.getLayerByName(bridges));
        lg.getStyles().add(catalog.getStyleByName(bridges));
        CatalogBuilder builder = new CatalogBuilder(catalog);
        builder.calculateLayerGroupBounds(lg);
        catalog.add(lg);
    }
    
    public void setNativeBox(Catalog catalog, String name) throws Exception {
        FeatureTypeInfo fti = catalog.getFeatureTypeByName(name);
        fti.setNativeBoundingBox(fti.getFeatureSource(null, null).getBounds());
        fti.setLatLonBoundingBox(new ReferencedEnvelope(fti.getNativeBoundingBox(), DefaultGeographicCRS.WGS84));
        catalog.save(fti);
    }
{code}

Note how there is a need to post-compute the layer bounds since MockData does not do this (mind MockData works at the fs level, not at the Catalog level, the catalog is then loaded form the fs), and also the group itself cannot be taken for granted as a test can decide not to include the default set of data.

Finally, MockData needs rewriting (imho) to deal with the new fs layout and persistence, and/or get rid of fs dependence and just unpack the data somewhere and build the catalog in memory instead.

Anyways, when some support for groups is added factor out the duplicated code in LayerGroupBaseTest, CascadeDeleteVisitorTest and ReachableObjectsVisitorTest

--
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