Package org.geoserver.config

Examples of org.geoserver.config.ServiceInfo


   
    @Test
    public void testModifyService() throws Exception {
        testAddService();
       
        ServiceInfo service = dao.getServiceByName("someName", ServiceInfo.class);
        service.setName("someOtherName");
        dao.save(service);
       
        assertNull(dao.getServiceByName("someName", ServiceInfo.class));
        assertNotNull(dao.getServiceByName("someOtherName", ServiceInfo.class));
    }
View Full Code Here


    }
   
    @Override
    @Test
    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" );
        service.getKeywords().add(new Keyword("keyword"));
        geoServer.add( service );

        assertEquals(service.getKeywords(), geoServer.getService("id", ServiceInfo.class).getKeywords());

        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

    }
   
    @Override
    @Test
    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;
        if (workspace == null) {
            if (other.getWorkspace() != null)
                return false;
        } else if (!workspace.equals(other.getWorkspace()))
            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

        if (ev == null) {
            throw new NullArgumentException("Incoming event is null");
        }
        try {
            // localize service
            final ServiceInfo localObject = localizeService(geoServer, ev);

            // disable the message producer to avoid recursion
            producer.disable();
            // save the localized object
            geoServer.save(localObject);
View Full Code Here

            final JMSServiceModifyEvent ev) throws IllegalAccessException,
            InvocationTargetException, NoSuchMethodException {
        if (geoServer == null || ev == null)
            throw new IllegalArgumentException("wrong passed arguments are null");

        final ServiceInfo info = JMSServiceHandler.getLocalService(geoServer, ev);

        BeanUtils.smartUpdate(info, ev.getPropertyNames(), ev.getNewValues());

        // LOCALIZE service
        info.setGeoServer(geoServer);

        return info;
    }
View Full Code Here

     * @return
     */
    public static ServiceInfo getLocalService(final GeoServer geoServer,
            final JMSServiceModifyEvent ev) {

        final ServiceInfo service = ev.getSource();
        if (service == null) {
            throw new IllegalArgumentException("passed service is null");
        }

        // localize service
        final ServiceInfo localObject;

        // check if name is changed
        final List<String> props = ev.getPropertyNames();
        final int index = props.indexOf("name");
        if (index != -1) {
View Full Code Here

    @Override
    public void testAddService() throws Exception {
        super.testAddService();

        //ensure s.getGeoServer() != null
        ServiceInfo s = geoServer.getServiceByName( "foo", ServiceInfo.class );
        assertNotNull(s.getGeoServer());
    }
View Full Code Here

        assertEquals( global, geoServer.getGlobal() );
    }
   
    @Test
    public void testModifyService() throws Exception {
        ServiceInfo service = geoServer.getFactory().createService();
        ((ServiceInfoImpl)service).setId( "id" );
        service.setName( "foo" );
        service.setTitle( "bar" );
        service.setMaintainer( "quux" );
       
        geoServer.add( service );
       
        ServiceInfo s1 = geoServer.getServiceByName( "foo", ServiceInfo.class );
        s1.setMaintainer("quam");
       
        ServiceInfo s2 = geoServer.getServiceByName( "foo", ServiceInfo.class );
        assertEquals( "quux", s2.getMaintainer() );
       
        geoServer.save( s1 );
        s2 = geoServer.getServiceByName( "foo", ServiceInfo.class );
        assertEquals( "quam", s2.getMaintainer() );
    }
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.