Package org.geotools.data.shapefile.files

Examples of org.geotools.data.shapefile.files.ShpFiles.unlockRead()


        File file = shpFiles.acquireReadFile(SHP, this);
        // under windows the two paths can be just different in terms of case..
        assertEquals( new File(path).getCanonicalPath().toLowerCase(), file.getPath().toLowerCase());
        assertEquals(1, shpFiles.numberOfLocks());
       
        shpFiles.unlockRead(file, this);
        shpFiles.dispose();
    }
    @Test
    public void testAcquireWriteFile() throws Throwable {
        ShpFiles shpFiles = new ShpFiles("http://somefile.com/shp.shp");
View Full Code Here


        Result<URL, State> result2 = shpFiles.tryAcquireRead(DBF, this);
        assertEquals("http://somefile.com/shp.dbf", result2.value
                .toExternalForm());
        assertEquals(3, shpFiles.numberOfLocks());

        shpFiles.unlockRead(result2.value, this);
        shpFiles.unlockRead(result1.value, testWriter);
        shpFiles.unlockRead(url, this);
        shpFiles.dispose();
    }
View Full Code Here

        assertEquals("http://somefile.com/shp.dbf", result2.value
                .toExternalForm());
        assertEquals(3, shpFiles.numberOfLocks());

        shpFiles.unlockRead(result2.value, this);
        shpFiles.unlockRead(result1.value, testWriter);
        shpFiles.unlockRead(url, this);
        shpFiles.dispose();
    }

    @Test
View Full Code Here

                .toExternalForm());
        assertEquals(3, shpFiles.numberOfLocks());

        shpFiles.unlockRead(result2.value, this);
        shpFiles.unlockRead(result1.value, testWriter);
        shpFiles.unlockRead(url, this);
        shpFiles.dispose();
    }

    @Test
    public void testUnlockReadAssertion() throws Throwable {
View Full Code Here

        assertEquals("http://somefile.com/shp.shx", result1.value
                .toExternalForm());
        assertEquals(2, shpFiles.numberOfLocks());

        try {
            shpFiles.unlockRead(result1.value, this);
            throw new RuntimeException(
                    "Unlock should fail because it is in the wrong reader");
        } catch (IllegalArgumentException e) {
            // good
        } catch (RuntimeException e) {
View Full Code Here

            // good
        } catch (RuntimeException e) {
            fail(e.getMessage());
        }

        shpFiles.unlockRead(result1.value, testWriter);
        shpFiles.unlockRead(url, this);
        shpFiles.dispose();
    }

    @Test
View Full Code Here

        } catch (RuntimeException e) {
            fail(e.getMessage());
        }

        shpFiles.unlockRead(result1.value, testWriter);
        shpFiles.unlockRead(url, this);
        shpFiles.dispose();
    }

    @Test
    public void testUnlockWriteAssertion() throws Throwable {
View Full Code Here

        assertEquals("http://somefile.com/shp.shx", result1.value
                .toExternalForm());
        assertEquals(2, shpFiles.numberOfLocks());

        try {
            shpFiles.unlockRead(result1.value, this);
            throw new RuntimeException(
                    "Unlock should fail because it is in the wrong reader");
        } catch (IllegalArgumentException e) {
            // good
        } catch (RuntimeException e) {
View Full Code Here

        try{
            assertEquals(base+shp, shpURL.toExternalForm());
            assertEquals(base+dbf, dbfURL.toExternalForm());
            assertEquals(base+shx, shxURL.toExternalForm());
        }finally{
            files.unlockRead(shpURL, requestor);
            files.unlockRead(dbfURL, requestor);
            files.unlockRead(shxURL, requestor);
        }
    }
   
View Full Code Here

            assertEquals(base+shp, shpURL.toExternalForm());
            assertEquals(base+dbf, dbfURL.toExternalForm());
            assertEquals(base+shx, shxURL.toExternalForm());
        }finally{
            files.unlockRead(shpURL, requestor);
            files.unlockRead(dbfURL, requestor);
            files.unlockRead(shxURL, requestor);
        }
    }
   
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.