Package org.geoserver.catalog

Examples of org.geoserver.catalog.WorkspaceInfo


        ExceptionThrowingListener l = new ExceptionThrowingListener();
        catalog.addListener(l);
       
        l.throwCatalogException = false;
       
        WorkspaceInfo ws = catalog.getFactory().createWorkspace();
        ws.setName("foo");
       
        //no exception thrown back
        catalog.add(ws);
       
        l.throwCatalogException = true;
        ws = catalog.getFactory().createWorkspace();
        ws.setName("bar");
       
        try {
            catalog.add(ws);
            fail();
        }
View Full Code Here


    public void validate(final Form form) {
        final FormComponent[] components = getDependentFormComponents();
        final FormComponent wsComponent = components[0];
        final FormComponent nameComponent = components[1];

        WorkspaceInfo workspace = (WorkspaceInfo) wsComponent.getConvertedInput();
        String name = (String) nameComponent.getConvertedInput();
       
        if(name == null) {
            ValidationError error = new ValidationError();
            error.addMessageKey("StoreNameValidator.storeNameRequired");
            nameComponent.error((IValidationError) error);
            return;
        }

        Catalog catalog = GeoServerApplication.get().getCatalog();

        final StoreInfo existing = catalog.getStoreByName(workspace, name, StoreInfo.class);
        if (existing != null) {
            final String existingId = existing.getId();
            if (!existingId.equals(edittingStoreId)) {
                ValidationError error = new ValidationError();
                error.addMessageKey("StoreNameValidator.storeExistsInWorkspace");
                error.setVariable("workspace", workspace.getName());
                error.setVariable("storeName", name);
                nameComponent.error((IValidationError) error);
            }
        }
    }
View Full Code Here

       
        NodeList links = xp.getMatchingNodes("//html:a", dom );
        assertEquals( workspaces.size(), links.getLength() );
       
        for ( int i = 0; i < workspaces.size(); i++ ){
            WorkspaceInfo ws = workspaces.get( i );
            Element link = (Element) links.item( i );
           
            assertTrue( link.getAttribute("href").endsWith( ws.getName() + ".html") );
        }
    }
View Full Code Here

        MockHttpServletResponse response = postAsServletResponse( "/rest/workspaces", xml, "text/xml" );
        assertEquals( 201, response.getStatusCode() );
        assertNotNull( response.getHeader( "Location") );
        assertTrue( response.getHeader("Location").endsWith( "/workspaces/foo" ) );
       
        WorkspaceInfo ws = getCatalog().getWorkspaceByName( "foo" );
        assertNotNull(ws);
    }
View Full Code Here

        assertEquals( 201, response.getStatusCode() );
        assertNotNull( response.getHeader( "Location") );
        assertTrue( response.getHeader("Location").endsWith( "/workspaces/foo" ) );
       
       
        WorkspaceInfo ws = getCatalog().getWorkspaceByName( "foo" );
        assertNotNull(ws);
    }
View Full Code Here

        assertEquals( "workspace", dom.getDocumentElement().getLocalName() );
        assertEquals( 1, dom.getElementsByTagName( "name" ).getLength() );
    }
   
    public void testPutDefaultWorkspace() throws Exception {
        WorkspaceInfo def = getCatalog().getDefaultWorkspace();
        assertEquals( "gs", def.getName() );
       
        String json = "{'workspace':{ 'name':'sf' }}";
        put( "/rest/workspaces/default", json, "text/json");
       
        def = getCatalog().getDefaultWorkspace();
        assertEquals( "sf", def.getName() );
    }
View Full Code Here

        assertNull(catalog.getResourceByName(lakes, ResourceInfo.class));
        assertNull(catalog.getLayerGroupByName(LAKES_GROUP));
    }
   
    public void testCascadeWorkspace() {
        WorkspaceInfo ws = catalog.getWorkspaceByName(MockData.CITE_PREFIX);
        assertNotNull(ws);
        assertTrue(getCatalog().getStoresByWorkspace(ws, StoreInfo.class).size() > 0);
       
        ws.accept(visitor);
        assertEquals(0, getCatalog().getStoresByWorkspace(ws, StoreInfo.class).size());
    }
View Full Code Here

import org.geoserver.test.GeoServerTestSupport;

public class WorkspaceNamespaceConstencyTest extends GeoServerTestSupport {
   
    public void testChangeWorkspace() {
        WorkspaceInfo ws = getCatalog().getDefaultWorkspace();
        ws.setName(ws.getName() + "abcd");
        getCatalog().save(ws);
       
        // check the corresponding namespace has been modified
        NamespaceInfo ns = getCatalog().getDefaultNamespace();
        assertNotNull(ns);
        assertEquals(ws.getName(), ns.getPrefix());
    }
View Full Code Here

        NamespaceInfo ns = getCatalog().getDefaultNamespace();
        ns.setPrefix(ns.getPrefix() + "abcd");
        getCatalog().save(ns);
       
        // check the corresponding namespace has been modified
        WorkspaceInfo ws = getCatalog().getDefaultWorkspace();
        assertNotNull(ws);
        assertEquals(ns.getPrefix(), ws.getName());
    }
View Full Code Here

    }
   
    public void testChangeDefaultWorkspace() {
        List<WorkspaceInfo> workspaces = getCatalog().getWorkspaces();
        workspaces.remove(getCatalog().getDefaultWorkspace());
        WorkspaceInfo newDefault = workspaces.get(0);
        getCatalog().setDefaultWorkspace(newDefault);
       
        // check the default namespace changed accordingly
        NamespaceInfo ns = getCatalog().getDefaultNamespace();
        assertNotNull(ns);
        assertEquals(newDefault.getName(), ns.getPrefix());
    }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.WorkspaceInfo

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.