List of usage examples for org.apache.hadoop.fs.viewfs ViewFileSystem ViewFileSystem
public ViewFileSystem() throws IOException
From source file:org.apache.carbondata.core.carbon.datastorage.filesystem.ViewFsCarbonFileTest.java
License:Apache License
@Test public void testListFilesForNullListStatus() { viewFSCarbonFile = new ViewFSCarbonFile(fileStatusWithOutDirectoryPermission); new MockUp<Path>() { @Mock/* w w w .j a v a 2 s .co m*/ public FileSystem getFileSystem(Configuration conf) throws IOException { return new ViewFileSystem(); } }; new MockUp<ViewFileSystem>() { @Mock public FileStatus[] listStatus(Path var1) throws IOException { return null; } }; new MockUp<ViewFileSystem>() { @Mock public boolean delete(Path var1, boolean var2) throws IOException { return true; } }; //public boolean delete(Path var1, boolean var2) throws IOException; viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); assertTrue(viewFSCarbonFile.listFiles().length == 0); }
From source file:org.apache.carbondata.core.carbon.datastorage.filesystem.ViewFsCarbonFileTest.java
License:Apache License
@Test public void testListDirectory() { viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); new MockUp<Path>() { @Mock//w w w. j av a 2 s .co m public FileSystem getFileSystem(Configuration conf) throws IOException { return new ViewFileSystem(); } }; new MockUp<ViewFileSystem>() { @Mock public FileStatus[] listStatus(Path var1) throws IOException { FileStatus[] fileStatus = new FileStatus[] { new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName)) }; return fileStatus; } }; assertTrue(viewFSCarbonFile.listFiles().length == 1); }
From source file:org.apache.carbondata.core.carbon.datastorage.filesystem.ViewFsCarbonFileTest.java
License:Apache License
@Test public void testlistFilesWithoutFilter() { CarbonFileFilter carbonFileFilter = new CarbonFileFilter() { @Override//from w ww .j a v a 2s . c o m public boolean accept(CarbonFile file) { return false; } }; new MockUp<Path>() { @Mock public FileSystem getFileSystem(Configuration conf) throws IOException { return new ViewFileSystem(); } }; new MockUp<ViewFileSystem>() { @Mock public FileStatus[] listStatus(Path var1) throws IOException { FileStatus[] fileStatus = new FileStatus[] { new FileStatus(12L, true, 60, 120l, 180L, new Path(fileName)) }; return fileStatus; } }; viewFSCarbonFile = new ViewFSCarbonFile(fileStatus); assertTrue(viewFSCarbonFile.listFiles(carbonFileFilter).length == 0); }
From source file:org.apache.carbondata.core.carbon.datastorage.filesystem.ViewFsCarbonFileTest.java
License:Apache License
@Test public void testrenameForceForViewFileSystem() { new MockUp<Path>() { @Mock/* ww w.j av a 2 s. c om*/ public FileSystem getFileSystem(Configuration conf) throws IOException { return new ViewFileSystem(); } }; new MockUp<ViewFileSystem>() { @Mock public boolean delete(Path f, boolean recursive) throws IOException { return true; } }; new MockUp<ViewFileSystem>() { @Mock public boolean rename(Path src, Path dst) throws IOException { return true; } }; assertTrue(viewFSCarbonFile.renameForce(fileName)); }