List of usage examples for org.apache.commons.vfs2 FileObject exists
boolean exists() throws FileSystemException;
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
private FileObject createTestFile(FileSystem hdfs) throws IOException { // Create the directory hdfs.mkdirs(DIR1_PATH);/*from w ww . jav a 2 s . c om*/ FileObject dir = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(dir); Assert.assertTrue(dir.exists()); Assert.assertTrue(dir.getType().equals(FileType.FOLDER)); // Create the file in the directory hdfs.create(FILE1_PATH).close(); FileObject f = manager.resolveFile(TEST_FILE1); Assert.assertNotNull(f); Assert.assertTrue(f.exists()); Assert.assertTrue(f.getType().equals(FileType.FILE)); return f; }
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test public void testExistsFails() throws Exception { FileObject fo = manager.resolveFile(TEST_FILE1); Assert.assertNotNull(fo);/* w w w . j av a 2s.c o m*/ Assert.assertFalse(fo.exists()); }
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test public void testExistsSucceeds() throws Exception { FileObject fo = manager.resolveFile(TEST_FILE1); Assert.assertNotNull(fo);//w w w .j av a 2 s. c o m Assert.assertFalse(fo.exists()); // Create the file @SuppressWarnings("unused") FileObject f = createTestFile(hdfs); }
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test public void testDoListChildren() throws Exception { FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo);//from ww w . j av a 2 s . c o m Assert.assertFalse(fo.exists()); // Create the test file FileObject file = createTestFile(hdfs); FileObject dir = file.getParent(); FileObject[] children = dir.getChildren(); Assert.assertTrue(children.length == 1); Assert.assertTrue(children[0].getName().equals(file.getName())); }
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test public void testGetContentSize() throws Exception { FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo);//from w w w. j ava 2s .c o m Assert.assertFalse(fo.exists()); // Create the test file FileObject file = createTestFile(hdfs); Assert.assertEquals(0, file.getContent().getSize()); }
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test public void testGetInputStream() throws Exception { FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo);// www .j a v a 2 s . c o m Assert.assertFalse(fo.exists()); // Create the test file FileObject file = createTestFile(hdfs); file.getContent().getInputStream().close(); }
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test public void testIsHidden() throws Exception { FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo);/*www . j ava2 s .c o m*/ Assert.assertFalse(fo.exists()); // Create the test file FileObject file = createTestFile(hdfs); Assert.assertFalse(file.isHidden()); }
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test public void testIsReadable() throws Exception { FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo);/*ww w .j a v a2 s .c o m*/ Assert.assertFalse(fo.exists()); // Create the test file FileObject file = createTestFile(hdfs); Assert.assertTrue(file.isReadable()); }
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test public void testIsWritable() throws Exception { FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo);/*w w w .j av a 2 s . c o m*/ Assert.assertFalse(fo.exists()); // Create the test file FileObject file = createTestFile(hdfs); Assert.assertFalse(file.isWriteable()); }
From source file:org.apache.accumulo.start.classloader.vfs.providers.ReadOnlyHdfsFileProviderTest.java
@Test public void testLastModificationTime() throws Exception { FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo);// ww w .j a v a 2 s. co m Assert.assertFalse(fo.exists()); // Create the test file FileObject file = createTestFile(hdfs); Assert.assertFalse(-1 == file.getContent().getLastModifiedTime()); }