Package org.geoserver.platform.resource

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


            when(r.path()).thenReturn(path);
            when(r.name()).thenReturn(path.substring(path.lastIndexOf('/')+1));
            when(r.getType()).thenReturn(Type.RESOURCE);
            when(r.lastmodified()).thenReturn( System.currentTimeMillis() );
            when(r.in()).thenReturn(content);
            when(r.out()).thenReturn(new ByteArrayOutputStream());
           
            when(resourceStore.get(path)).thenReturn(r);
            paths.add( path );
            return this;
        }
View Full Code Here


    }
   
    private void copyResToDir(Resource r, Resource newDir) throws IOException {
        Resource newR = newDir.get(r.name());
        try(InputStream in = r.in();
            OutputStream out = newR.out()){
            IOUtils.copy(in, out);
        }
    }
    private void ensureParent(Resource r) {
        r.parent().dir();
View Full Code Here

    public void theoryLeavesHaveOstream(String path) throws Exception {
        Resource res = getResource(path);
       
        assumeThat(res, is(resource()));
       
        OutputStream result = res.out();
       
        assertThat(result, notNullValue());
    }
   
    @Theory
View Full Code Here

    public void theoryUndefinedHaveOstream(String path) throws Exception {
        Resource res = getResource(path);
       
        assumeThat(res, is(undefined()));
       
        OutputStream result = res.out();
       
        assertThat(result, notNullValue());
    }
   
    @Theory
View Full Code Here

       
        assumeThat(res, not(directory()));
       
        byte[] test = {42, 29, 32, 120, 69, 0, 1};
       
        OutputStream ostream = res.out();
        try {
            ostream.write(test);
        } finally {
            ostream.close();
        }
View Full Code Here

    public void theoryDirectoriesHaveNoOstream(String path) throws Exception {
        Resource res = getResource(path);
        assumeThat(res, is(directory()));
       
        exception.expect(IllegalStateException.class);
        res.out();
    }
   
    @Theory
    public void theoryLeavesHaveNoListOfChildren(String path) throws Exception {
        Resource res = getResource(path);
View Full Code Here

       
        assumeThat(res, not(directory()));
       
        byte[] test = {42, 29, 32, 120, 69, 0, 1};
       
        OutputStream ostream = res.out();
        try {
            ostream.write(test);
        } finally {
            ostream.close();
        }
View Full Code Here

        byte[] testResource = {42, 29, 32, 120, 69, 0, 1};
        byte[] testFile = {27, 3, 5, 90, -120, -3};
       
        // Write to resource
        {
            OutputStream ostream = res.out();
            try {
                ostream.write(testResource);
            } finally {
                ostream.close();
            }
View Full Code Here

       
        final byte[] thread1Content = "This is the content for thread 1".getBytes();
        final byte[] thread2Content = "Thread 2 has this content".getBytes();
       
       
        try(OutputStream out1 = res.out();
            OutputStream out2 = res.out()) {
            for(int i=0; i<thread1Content.length || i<thread2Content.length; i++) {
                if(i<thread1Content.length) {
                    out1.write(thread1Content[i]);
                }
View Full Code Here

        final byte[] thread1Content = "This is the content for thread 1".getBytes();
        final byte[] thread2Content = "Thread 2 has this content".getBytes();
       
       
        try(OutputStream out1 = res.out();
            OutputStream out2 = res.out()) {
            for(int i=0; i<thread1Content.length || i<thread2Content.length; i++) {
                if(i<thread1Content.length) {
                    out1.write(thread1Content[i]);
                }
                if(i<thread2Content.length) {
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.