Package org.geoserver.config

Examples of org.geoserver.config.GeoServerInfo


        getTestData().registerNamespaces(namespaces);

        NamespaceContext ctx = new SimpleNamespaceContext(namespaces);
        XMLUnit.setXpathNamespaceContext(ctx);

        GeoServerInfo global = getGeoServer().getGlobal();
        global.setProxyBaseUrl("src/test/resources/geoserver");
        getGeoServer().save(global);
    }
View Full Code Here


        service.getKeywords().clear();
        service.getKeywords().add("test keyword 1");
        service.getKeywords().add("test keyword 2");
        service.setMaintainer("test maintainer");
        service.setOnlineResource("http://example.com/geoserver");
        GeoServerInfo global = getGeoServer().getGlobal();
        ContactInfo contact = global.getContact();
        contact.setAddress("__address");
        contact.setAddressCity("__city");
        contact.setAddressCountry("__country");
        contact.setAddressPostalCode("__ZIP");
        contact.setAddressState("__state");
View Full Code Here

                + System.getProperty("java.version") + " (" + System.getProperty("java.vm.name") + ")");
       
        values.put(KEY_JAI_AVAILABLE, Boolean.toString(isNativeJAIAvailable()));
        values.put(KEY_JAI_IMAGEIO_AVAILABLE, Boolean.toString(PackageUtil.isCodecLibAvailable()));

        GeoServerInfo geoServerInfo = getGeoServer().getGlobal();
        JAIInfo jaiInfo = geoServerInfo.getJAI();
        JAI jai =  jaiInfo.getJAI();
        CoverageAccessInfo coverageAccess = geoServerInfo.getCoverageAccess();
        SunTileCache jaiCache = jaiInfo.getTileCache();

        values.put(KEY_JAI_MAX_MEM, formatMemory(jaiCache.getMemoryCapacity()));
        values.put(KEY_JAI_MEM_USAGE, formatMemory(jaiCache.getCacheMemoryUsed()));
        values.put(KEY_JAI_MEM_THRESHOLD, Float.toString(100.0f * jaiCache.getMemoryThreshold()));
        values.put(KEY_JAI_TILE_THREADS, Integer.toString(jai.getTileScheduler().getParallelism()));
        values.put(KEY_JAI_TILE_THREAD_PRIORITY, Integer.toString(jai.getTileScheduler()
                .getPriority()));
       
        values.put(KEY_COVERAGEACCESS_CORE_POOL_SIZE, Integer.toString(coverageAccess.getCorePoolSize()));
        values.put(KEY_COVERAGEACCESS_MAX_POOL_SIZE, Integer.toString(coverageAccess.getMaxPoolSize()));
        values.put(KEY_COVERAGEACCESS_KEEP_ALIVE_TIME, Integer.toString(coverageAccess.getKeepAliveTime()));

        values.put(KEY_UPDATE_SEQUENCE, Long.toString(geoServerInfo.getUpdateSequence()));
    }
View Full Code Here

        String url =  buildURL(BASEURL, "test", Collections.singletonMap("param", "value()"), URLType.SERVICE);
        assertEquals("http://localhost:8080/geoserver/test?param=value%28%29", url);
    }
   
    public void testProxyBase() {
        GeoServerInfo gi = getGeoServer().getGlobal();
        gi.setProxyBaseUrl("http://geoserver.org/");
        getGeoServer().save(gi);
       
        String url =  buildURL(BASEURL, "test", null, URLType.SERVICE);
        assertEquals("http://geoserver.org/test", url);
    }
View Full Code Here

        new File(wsDir, "shapezip.ftl").delete();
    }
   
    @Before
    public void resetServiceConfiguration() throws Exception {
        GeoServerInfo gs = getGeoServer().getGlobal();
        gs.getSettings().setProxyBaseUrl(null);
        getGeoServer().save(gs);
    }
View Full Code Here

    }
   
    @Test
    public void testRequestUrlWithProxyBase() throws Exception {
        // setup a proxy base url
        GeoServerInfo gs = getGeoServer().getGlobal();
        gs.getSettings().setProxyBaseUrl("https://www.geoserver.org/geoserver");
        getGeoServer().save(gs);
       
        // check it has been honored
        MockHttpServletResponse response = getAsServletResponse("wfs?service=WFS&version=1.0.0" +
                "&request=GetFeature&typeName=" + getLayerId(SystemTestData.BASIC_POLYGONS) + "&outputFormat=SHAPE-ZIP");
View Full Code Here

   
    GeoServer gs;

    public void initialize(GeoServer geoServer) throws Exception {
        this.gs = geoServer;
        final GeoServerInfo geoserverInfo = geoServer.getGlobal();
        CoverageAccessInfo coverageAccess = geoserverInfo.getCoverageAccess();
        if (coverageAccess == null){
            coverageAccess = new CoverageAccessInfoImpl();
            geoserverInfo.setCoverageAccess(coverageAccess);
        }
        initCoverage(coverageAccess);
       
        geoServer.addListener( new ConfigurationListenerAdapter() {
View Full Code Here

        "        </wfs:Query>\r\n" +
        "</wfs:GetFeature>";
   
    @Test
    public void testWfs1_0() throws Exception {
        GeoServerInfo cfg = getGeoServer().getGlobal();
        try {
            // enable entity parsing
            cfg.setXmlExternalEntitiesEnabled(true);           
            getGeoServer().save(cfg);
           
            String output = string(post("wfs", WFS_1_0_0_REQUEST));
            // the server tried to read a file on local file system
            Assert.assertTrue(output.indexOf("java.io.FileNotFoundException") > -1);
           
            // disable entity parsing
            cfg.setXmlExternalEntitiesEnabled(false);           
            getGeoServer().save(cfg);

            output = string(post("wfs", WFS_1_0_0_REQUEST));
            Assert.assertTrue(output.indexOf("java.net.MalformedURLException") > -1);
           
            // set default (entity parsing disabled);
            cfg.setXmlExternalEntitiesEnabled(null);           
            getGeoServer().save(cfg);
           
            output = string(post("wfs", WFS_1_0_0_REQUEST));
            Assert.assertTrue(output.indexOf("java.net.MalformedURLException") > -1);
        } finally {
            cfg.setXmlExternalEntitiesEnabled(null);           
            getGeoServer().save(cfg);
        }
    }
View Full Code Here

        }
    }
   
    @Test
    public void testWfs1_1() throws Exception {
        GeoServerInfo cfg = getGeoServer().getGlobal();
        try {
            // enable entity parsing
            cfg.setXmlExternalEntitiesEnabled(true);           
            getGeoServer().save(cfg);
           
            String output = string(post("wfs", WFS_1_1_0_REQUEST));
            // the server tried to read a file on local file system
            Assert.assertTrue(output.indexOf("java.io.FileNotFoundException") > -1);
           
            // disable entity parsing
            cfg.setXmlExternalEntitiesEnabled(false);           
            getGeoServer().save(cfg);

            output = string(post("wfs", WFS_1_1_0_REQUEST));
            Assert.assertTrue(output.indexOf("java.net.MalformedURLException") > -1);
           
            // set default (entity parsing disabled);
            cfg.setXmlExternalEntitiesEnabled(null);           
            getGeoServer().save(cfg);
           
            output = string(post("wfs", WFS_1_1_0_REQUEST));
            Assert.assertTrue(output.indexOf("java.net.MalformedURLException") > -1);
        } finally {
            cfg.setXmlExternalEntitiesEnabled(null);           
            getGeoServer().save(cfg);
        }
    }   
View Full Code Here

        }
    }   
   
    @Test
    public void testWfs2_0() throws Exception {
        GeoServerInfo cfg = getGeoServer().getGlobal();
        try {
            // enable entity parsing
            cfg.setXmlExternalEntitiesEnabled(true);           
            getGeoServer().save(cfg);
           
            String output = string(post("wfs", WFS_2_0_0_REQUEST));
            // the server tried to read a file on local file system
            Assert.assertTrue(output.indexOf("thisfiledoesnotexist") > -1);
           
            // disable entity parsing
            cfg.setXmlExternalEntitiesEnabled(false);           
            getGeoServer().save(cfg);

            output = string(post("wfs", WFS_2_0_0_REQUEST));
            System.out.println(output);
            Assert.assertTrue(output.indexOf("Request parsing failed") > -1);
            Assert.assertTrue(output.indexOf("thisfiledoesnotexist") == -1);
           
            // set default (entity parsing disabled);
            cfg.setXmlExternalEntitiesEnabled(null);           
            getGeoServer().save(cfg);
           
            output = string(post("wfs", WFS_2_0_0_REQUEST));
            Assert.assertTrue(output.indexOf("Request parsing failed") > -1);
            Assert.assertTrue(output.indexOf("thisfiledoesnotexist") == -1);
        } finally {
            cfg.setXmlExternalEntitiesEnabled(null);           
            getGeoServer().save(cfg);
        }
    }       
View Full Code Here

TOP

Related Classes of org.geoserver.config.GeoServerInfo

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.