Package org.geoserver.platform.resource

Examples of org.geoserver.platform.resource.Resource.list()


                }
            });
            when(resourceStore.get(path)).thenReturn(r);
            paths.add( path );
           
            when(r.list()).then( new Answer<List<Resource>>() {
                @Override
                public List<Resource> answer(InvocationOnMock invocation) throws Throwable {
                    final List<String> c = new ArrayList<String>();
                    for(String p : paths ){
                        if( p.startsWith(path+'/')){
View Full Code Here


      // Test directory placeholder
      GeoServerResourceLoader rl = this.geoServer.getCatalog().getResourceLoader();
      Resource d = rl.get("workspaces/foo/styles");
      assertEquals( d.getType(), Type.DIRECTORY );
      assertEquals( 3, d.list().size() );
     
      MvcResult result = mvc.perform(get("/api/icons/foo"))
              .andExpect(status().isOk())
              .andExpect(content().contentType(MediaType.APPLICATION_JSON))
              .andReturn();
View Full Code Here

        Resource styles =  dataDir().get(ws, "styles");
        if (styles.getType() != Type.UNDEFINED) {
            Set<String> usedGraphics = findAllGraphics(ws);

            for(Resource r : styles.list()){
                String name = r.name();
                String ext = fileExt(name);

                if(!ICON_FORMATS.containsKey(ext.toLowerCase())){
                    continue;
View Full Code Here

    @Theory
    public void theoryLeavesHaveNoListOfChildren(String path) throws Exception {
        Resource res = getResource(path);
        assumeThat(res, is(resource()));
       
        Collection<Resource> result = res.list();
       
        assertThat(result, nullValue());
    }
   
    @Theory
View Full Code Here

    @Theory
    public void theoryUndefinedHaveNullListOfChildren(String path) throws Exception {
        Resource res = getResource(path);
        assumeThat(res, is(undefined()));
       
        Collection<Resource> result = res.list();
       
        assertThat(result, nullValue());
    }
   
    @Theory
View Full Code Here

    @Theory
    public void theoryDirectoriesHaveChildren(String path) throws Exception {
        Resource res = getResource(path);
        assumeThat(res, is(directory()));
       
        Collection<Resource> result = res.list();
       
        assertThat(result, notNullValue());
    }
   
    @Theory
View Full Code Here

   
    @Theory
    public void theoryChildrenKnowTheirParents(String path) throws Exception {
        Resource res = getResource(path);
        assumeThat(res, is(directory()));
        Collection<Resource> children = res.list();
        assumeThat(children, not(empty())); // Make sure this resource has children
       
        for(Resource child: children) {
            Resource parent = child.parent();
            assertThat(parent, equalTo(res));
View Full Code Here

        Resource res = getResource(path);
        assumeThat(res, is(directory()));
        Resource parent = res.parent();
        assumeThat(path,parent, notNullValue()); // Make sure this resource has a parent
       
        Collection<Resource> result = parent.list();
       
        assertThat(path,result, hasItem(res)); // this assumed equals was written!
    }
   
    @Theory
View Full Code Here

       
        assumeThat(res, is(directory()));
       
        File dir = res.dir();
       
        Collection<Resource> resChildren = res.list();
        String[] fileChildrenNames = dir.list();
       
        String[] resChildrenNames = new String[resChildren.size()];
       
        int i=0;
View Full Code Here

        Set<String> names = new HashSet<String>();
        names.addAll(Arrays.asList(new String[] { name + ".gif", name + ".png", name + ".pal",
                name + ".tif" }));

        List<Resource> paletteFiles = new ArrayList<Resource>();
        for (Resource item : palettes.list()) {
            if (names.contains(item.name().toLowerCase())) {
                paletteFiles.add(item);
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.