Package org.geoserver.wms

Examples of org.geoserver.wms.WMSInfoImpl


    @Test
    public void testCacheConfig() throws Exception {
        // Simulates the situation where multiple GeoServer instances are sharing a database.
     
        ServiceInfo service = new WMSInfoImpl();
        ((WMSInfoImpl) service).setId("WMS-TEST");
        service.setName("WMS");
        service.setMaintainer("Foo");


        service = database.add(service);
       
        assertEquals(service.getMaintainer(), "Foo");
       
        // Change the stored configuration
        // KS: sorry, this is an utter kludge
        Connection conn = testSupport.getDataSource().getConnection();
        try {
            Statement stmt = conn.createStatement();
            //assertEquals(1, stmt.executeUpdate("UPDATE object_property SET value='Bar' WHERE property_type=(SELECT oid FROM property_type WHERE type_id = (SELECT oid FROM type WHERE typename='org.geoserver.wms.ServiceInfo') AND name='maintainer') AND id = '"+service.getId()+"';"));
            assertEquals(1, stmt.executeUpdate("UPDATE object SET blob=(SELECT replace(blob, '<maintainer>Foo</maintainer>', '<maintainer>Bar</maintainer>') FROM object WHERE id = '"+service.getId()+"')"));
        } finally {
            conn.close();
        }
       
        // Should be cached
        service = database.getById(service.getId(), ServiceInfo.class);
        assertEquals("Foo", service.getMaintainer());
       
        // Notify of update
        for(ConfigurationListener l : database.getGeoServer().getListeners()){
            l.handlePostServiceChange(service);
        }
       
        // Should show the new value
        service = database.getById(service.getId(), ServiceInfo.class);
        assertEquals("Bar", service.getMaintainer());
    }
View Full Code Here


        service = database.getById(service.getId(), ServiceInfo.class);
        assertEquals("Bar", service.getMaintainer());
    }

    public void testGetServiceWithGeoServerRef() {
        WMSInfo service = new WMSInfoImpl();
        ((WMSInfoImpl) service).setId("WMS-TEST");
        service.setName("WMS");
        service.setMaintainer("Foo");

        service = database.add(service);
        database.clear(service);

        service = database.getAll(WMSInfo.class).iterator().next();
        assertNotNull(service.getGeoServer());
    }
View Full Code Here

    private Map<String, String> params;

    @Before
    public void setUp() throws Exception {
        geoServerImpl = new GeoServerImpl();
        geoServerImpl.add(new WMSInfoImpl());
        wms = new WMS(geoServerImpl);
        params = new HashMap<String, String>();
    }
View Full Code Here

        catalog.add(coverageStoreInfo);
        catalog.add(coverageInfo);
        catalog.add(coverageLayerInfo);

        geoServerImpl.add(new WMSInfoImpl());
        WMS wms = new WMS(geoServerImpl);
        request = new DescribeLayerRequest();
        request.setBaseUrl("http://localhost:8080/geoserver");
        request.setVersion(WMS.VERSION_1_1_1.toString());
    }
View Full Code Here

        geosInfo = new GeoServerInfoImpl(geosConfig);
        geosInfo.setContact(new ContactInfoImpl());
        geosConfig.setGlobal(geosInfo);

        wmsInfo = new WMSInfoImpl();
        geosConfig.add(wmsInfo);

        geosConfig.setCatalog(catalog);

        wmsConfig = new WMS(geosConfig);
View Full Code Here

        geosInfo = new GeoServerInfoImpl(geosConfig);
        geosInfo.setContact(new ContactInfoImpl());
        geosConfig.setGlobal(geosInfo);

        wmsInfo = new WMSInfoImpl();
        geosConfig.add(wmsInfo);

        catalog = new CatalogImpl();
        geosConfig.setCatalog(catalog);
View Full Code Here

        List<LayerInfo> layers = ImmutableList.of();
        List<LayerGroupInfo> groups = ImmutableList.of();
        when(rawCatalog.getLayers()).thenReturn(layers);
        when(rawCatalog.getLayerGroups()).thenReturn(groups);

        WMSInfoImpl wmsInfo = new WMSInfoImpl();
        // initialize wmsInfo with a value for the old direct wms integration flag
        wmsInfo.getMetadata().put(GWCInitializer.WMS_INTEGRATION_ENABLED_KEY, Boolean.TRUE);

        // make sure WMSInfo exists
        when(geoServer.getService(eq(WMSInfo.class))).thenReturn(wmsInfo);

        ArgumentCaptor<GWCConfig> captor = ArgumentCaptor.forClass(GWCConfig.class);
        // run layer initialization
        initializer.initialize(geoServer);

        verify(configPersister, times(2)).save(captor.capture());
        assertTrue(captor.getAllValues().get(0).isDirectWMSIntegrationEnabled());

        assertFalse(wmsInfo.getMetadata().containsKey(GWCInitializer.WMS_INTEGRATION_ENABLED_KEY));
        verify(geoServer).save(same(wmsInfo));

    }
View Full Code Here

TOP

Related Classes of org.geoserver.wms.WMSInfoImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.