Package org.geoserver.config

Examples of org.geoserver.config.ServiceInfo


        assertEquals( "newAdminPassword", g2.getAdminPassword() );
    }
   
    @Override
    public void testAddService() throws Exception {
        ServiceInfo service = geoServer.getFactory().createService();
        service.setName( "foo" );
       
        try {
            geoServer.add( service );
            fail( "adding without id should throw exception" );
        }
        catch( Exception e ) {};
       
        ((ServiceInfoImpl)service).setId( "id" );
        geoServer.add( service );
       
        ServiceInfo s2 = geoServer.getFactory().createService();
        ((ServiceInfoImpl)s2).setId( "id" );
       
        try {
            geoServer.add( s2 );
            fail( "adding service with duplicate id should throw exception" );
        }
        catch( Exception e ) {}
       
        ServiceInfo s = geoServer.getServiceByName( "foo", ServiceInfo.class );
        assertEquals( service, s );
    }
View Full Code Here


        assertEquals( service, s );
    }
   
    @Override
    public void testModifyService() throws Exception {
        ServiceInfo service = geoServer.getFactory().createService();
        ((ServiceInfoImpl)service).setId( "id" );
        service.setName( "foo" );
        service.setTitle( "bar" );
       
        geoServer.add( service );
       
        ServiceInfo s1 = geoServer.getServiceByName( "foo", ServiceInfo.class );
        s1.setTitle( "changed" );
       
        geoServer.save( s1 );
        ServiceInfo s2 = geoServer.getServiceByName( "foo", ServiceInfo.class );
        assertEquals( "changed", s2.getTitle() );
    }
View Full Code Here

            return false;
        if (!( obj instanceof ServiceInfo ) ) {
            return false;
        }
       
        final ServiceInfo other = (ServiceInfo) obj;
        if (abstrct == null) {
            if (other.getAbstract() != null)
                return false;
        } else if (!abstrct.equals(other.getAbstract()))
            return false;
        if (accessConstraints == null) {
            if (other.getAccessConstraints() != null)
                return false;
        } else if (!accessConstraints.equals(other.getAccessConstraints()))
            return false;
        if (citeCompliant != other.isCiteCompliant())
            return false;
        if (enabled != other.isEnabled())
            return false;
        if (exceptionFormats == null) {
            if (other.getExceptionFormats() != null)
                return false;
        } else if (!exceptionFormats.equals(other.getExceptionFormats()))
            return false;
        if (fees == null) {
            if (other.getFees() != null)
                return false;
        } else if (!fees.equals(other.getFees()))
            return false;
        if (id == null) {
            if (other.getId() != null)
                return false;
        } else if (!id.equals(other.getId()))
            return false;
        if (keywords == null) {
            if (other.getKeywords() != null)
                return false;
        } else if (!keywords.equals(other.getKeywords()))
            return false;
        if (maintainer == null) {
            if (other.getMaintainer() != null)
                return false;
        } else if (!maintainer.equals(other.getMaintainer()))
            return false;
        if (metadataLink == null) {
            if (other.getMetadataLink() != null)
                return false;
        } else if (!metadataLink.equals(other.getMetadataLink()))
            return false;
        if (name == null) {
            if (other.getName() != null)
                return false;
        } else if (!name.equals(other.getName()))
            return false;
        if (onlineResource == null) {
            if (other.getOnlineResource() != null)
                return false;
        } else if (!onlineResource.equals(other.getOnlineResource()))
            return false;
        if (outputStrategy == null) {
            if (other.getOutputStrategy() != null)
                return false;
        } else if (!outputStrategy.equals(other.getOutputStrategy()))
            return false;
        if (schemaBaseURL == null) {
            if (other.getSchemaBaseURL() != null)
                return false;
        } else if (!schemaBaseURL.equals(other.getSchemaBaseURL()))
            return false;
        if (title == null) {
            if (other.getTitle() != null)
                return false;
        } else if (!title.equals(other.getTitle()))
            return false;
        if (verbose != other.isVerbose())
            return false;
        if (versions == null) {
            if (other.getVersions() != null)
                return false;
        } else if (!versions.equals(other.getVersions()))
            return false;
        return true;
    }
View Full Code Here

        // read services
        for ( LegacyServiceLoader sl : GeoServerExtensions.extensions( LegacyServiceLoader.class ) ) {
            try {
                sl.setReader(reader);
               
                ServiceInfo service = sl.load( geoServer );
                if ( service != null ) {
                    LOGGER.info( "Loading service '" + service.getId()  + "'");
                    geoServer.add( service );
                }
            }
            catch( Exception e ) {
                String msg = "Error occured loading service: " + sl.getServiceClass().getSimpleName();
View Full Code Here

                in.close();   
            }
        }
        else {
            //create an 'empty' object
            ServiceInfo service = createServiceFromScratch( gs );
            return initialize( (T) service );
        }
    }
View Full Code Here

            m = OwsUtils.getter( s.getClass(), "serviceInfo", ServiceInfo.class );
        }
       
        if ( m != null ) {
            try {
                ServiceInfo info = (ServiceInfo) m.invoke( s , null );
               
                if(info == null) {
                    // log a warning, we could not perform an important check
                    LOGGER.warning("Could not get a ServiceInfo for service " + service.getId()
                            + " even if the service implements ServiceInfo, thus could not check if the service is enabled");
                } else {
                    // check if the service is enabled
                    if (!info.isEnabled()) {
                        throw new ServiceException( "Service " + info.getName() + " is disabled" );
                    }
                }
            }
            catch (Exception e) {
                //TODO: log this
View Full Code Here

                in.close();   
            }
        }
        else {
            //create an 'empty' object
            ServiceInfo service = createServiceFromScratch( gs );
            return initialize( (T) service );
        }
    }
View Full Code Here

    @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

        //also ensure we have a service configuration for every service we know about
        final List<XStreamServiceLoader> loaders =
            GeoServerExtensions.extensions( XStreamServiceLoader.class );
        for (XStreamServiceLoader l : loaders) {
            ServiceInfo s = geoServer.getService(l.getServiceClass());
            if (s == null) {
                geoServer.add(l.create(geoServer));
            }
        }
    }
View Full Code Here

   
    @Test
    public void testAddService() throws Exception {
        assertEquals(0, dao.getServices().size());
       
        ServiceInfo service = dao.getGeoServer().getFactory().createService();
        ((ServiceInfoImpl)service).setId("someService");
        service.setName("someName");
       
        dao.add(service);
        assertEquals(1, dao.getServices().size());
       
        assertEquals(service, dao.getServices().iterator().next());
View Full Code Here

TOP

Related Classes of org.geoserver.config.ServiceInfo

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.