Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/perf/FileNamePerformance.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/perf/FileNamePerformance.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/perf/FileNamePerformance.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/perf/FileNamePerformance.java Thu Sep 14 19:26:39 2017 @@ -22,16 +22,13 @@ import org.apache.commons.vfs2.FileSyste import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; -public class FileNamePerformance -{ +public class FileNamePerformance { private final static int NUOF_RESOLVES = 100000; - public static void main(final String[] args) throws FileSystemException - { + public static void main(final String[] args) throws FileSystemException { final FileSystemManager mgr = VFS.getManager(); - final FileObject root = mgr - .resolveFile("smb://HOME\\vfsusr:vfs%2f%25\\te:[email protected]/vfsusr"); + final FileObject root = mgr.resolveFile("smb://HOME\\vfsusr:vfs%2f%25\\te:[email protected]/vfsusr"); final FileName rootName = root.getName(); testNames(mgr, rootName); @@ -41,62 +38,50 @@ public class FileNamePerformance testFiles(mgr); } - private static void testFiles(final FileSystemManager mgr) throws FileSystemException - { - for (int i = 0; i < 10; i++) - { + private static void testFiles(final FileSystemManager mgr) throws FileSystemException { + for (int i = 0; i < 10; i++) { // warmup jvm - mgr.resolveFile("smb://HOME\\vfsusr:vfs%2f%25\\te:[email protected]/vfsusr/many/path/elements/with%25esc/any%25where/to/file.txt"); + mgr.resolveFile( + "smb://HOME\\vfsusr:vfs%2f%25\\te:[email protected]/vfsusr/many/path/elements/with%25esc/any%25where/to/file.txt"); } final long start = System.currentTimeMillis(); - for (int i = 0; i < NUOF_RESOLVES; i++) - { - mgr.resolveFile("smb://HOME\\vfsusr:vfs%2f%25\\te:[email protected]/vfsusr/many/path/elements/with%25esc/any%25where/to/file.txt"); + for (int i = 0; i < NUOF_RESOLVES; i++) { + mgr.resolveFile( + "smb://HOME\\vfsusr:vfs%2f%25\\te:[email protected]/vfsusr/many/path/elements/with%25esc/any%25where/to/file.txt"); } final long end = System.currentTimeMillis(); - System.err.println("time to resolve " + NUOF_RESOLVES + " files: " - + (end - start) + "ms"); + System.err.println("time to resolve " + NUOF_RESOLVES + " files: " + (end - start) + "ms"); } - private static void testChildren(final FileObject root) throws FileSystemException - { - for (int i = 0; i < 10; i++) - { + private static void testChildren(final FileObject root) throws FileSystemException { + for (int i = 0; i < 10; i++) { // warmup jvm root.resolveFile("/many/path/elements/with%25esc/any%25where/to/file.txt"); } final long start = System.currentTimeMillis(); - for (int i = 0; i < NUOF_RESOLVES; i++) - { + for (int i = 0; i < NUOF_RESOLVES; i++) { root.resolveFile("/many/path/elements/with%25esc/any%25where/to/file.txt"); } final long end = System.currentTimeMillis(); - System.err.println("time to resolve " + NUOF_RESOLVES + " children: " - + (end - start) + "ms"); + System.err.println("time to resolve " + NUOF_RESOLVES + " children: " + (end - start) + "ms"); } - private static void testNames(final FileSystemManager mgr, final FileName rootName) throws FileSystemException - { - for (int i = 0; i < 10; i++) - { + private static void testNames(final FileSystemManager mgr, final FileName rootName) throws FileSystemException { + for (int i = 0; i < 10; i++) { // warmup jvm - mgr.resolveName(rootName, - "/many/path/elements/with%25esc/any%25where/to/file.txt"); + mgr.resolveName(rootName, "/many/path/elements/with%25esc/any%25where/to/file.txt"); } final long start = System.currentTimeMillis(); - for (int i = 0; i < NUOF_RESOLVES; i++) - { - mgr.resolveName(rootName, - "/many/path/elements/with%25esc/any%25where/to/file.txt"); + for (int i = 0; i < NUOF_RESOLVES; i++) { + mgr.resolveName(rootName, "/many/path/elements/with%25esc/any%25where/to/file.txt"); } final long end = System.currentTimeMillis(); - System.err.println("time to resolve " + NUOF_RESOLVES + " names: " - + (end - start) + "ms"); + System.err.println("time to resolve " + NUOF_RESOLVES + " names: " + (end - start) + "ms"); } }
Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTestCase.java Thu Sep 14 19:26:39 2017 @@ -23,18 +23,15 @@ import org.junit.Test; * * @version $Id$ */ -public class UriParserTestCase -{ +public class UriParserTestCase { @Test - public void testColonInFileName() - { + public void testColonInFileName() { Assert.assertEquals(null, UriParser.extractScheme("some/path/some:file")); } @Test - public void testNormalScheme() - { + public void testNormalScheme() { Assert.assertEquals("ftp", UriParser.extractScheme("ftp://user:pass@host/some/path/some:file")); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderTestCase.java Thu Sep 14 19:26:39 2017 @@ -44,8 +44,7 @@ import junit.framework.Test; /** * Tests for FTP file systems. */ -public class FtpProviderTestCase extends AbstractProviderTestConfig -{ +public class FtpProviderTestCase extends AbstractProviderTestConfig { private static int SocketPort; /** @@ -59,23 +58,19 @@ public class FtpProviderTestCase extends private static final String USER_PROPS_RES = "org.apache.ftpserver/users.properties"; - static String getConnectionUri() - { + static String getConnectionUri() { return ConnectionUri; } - static int getSocketPort() - { + static int getSocketPort() { return SocketPort; } - private static String getSystemTestUriOverride() - { + private static String getSystemTestUriOverride() { return System.getProperty(TEST_URI); } - static void init() throws IOException - { + static void init() throws IOException { SocketPort = FreeSocketPortUtil.findFreeLocalPort(); // Use %40 for @ in a URL ConnectionUri = "ftp://test:test@localhost:" + SocketPort; @@ -83,15 +78,15 @@ public class FtpProviderTestCase extends /** * Creates and starts an embedded Apache FTP Server (MINA). + * * @param rootDirectory the local FTP server rootDirectory * @param fileSystemFactory optional local FTP server FileSystemFactory * @throws FtpException * @throws IOException */ - static void setUpClass(final String rootDirectory, final FileSystemFactory fileSystemFactory) throws FtpException, IOException - { - if (Server != null) - { + static void setUpClass(final String rootDirectory, final FileSystemFactory fileSystemFactory) + throws FtpException, IOException { + if (Server != null) { return; } init(); @@ -125,31 +120,25 @@ public class FtpProviderTestCase extends /** * Creates the test suite for the ftp file system. */ - public static Test suite() throws Exception - { + public static Test suite() throws Exception { return suite(new FtpProviderTestCase()); } /** * Creates the test suite for subclasses of the ftp file system. */ - protected static Test suite(final FtpProviderTestCase testCase) throws Exception - { - return new ProviderTestSuite(testCase) - { + protected static Test suite(final FtpProviderTestCase testCase) throws Exception { + return new ProviderTestSuite(testCase) { @Override - protected void setUp() throws Exception - { - if (getSystemTestUriOverride() == null) - { + protected void setUp() throws Exception { + if (getSystemTestUriOverride() == null) { setUpClass(testCase.getFtpRootDir(), testCase.getFtpFileSystem()); } super.setUp(); } @Override - protected void tearDown() throws Exception - { + protected void tearDown() throws Exception { try { // This will report running threads of the FTP server. // However, shutting down the FTP server first will always @@ -166,10 +155,8 @@ public class FtpProviderTestCase extends /** * Stops the embedded Apache FTP Server (MINA). */ - static void tearDownClass() - { - if (Server != null) - { + static void tearDownClass() { + if (Server != null) { Server.stop(); Server = null; } @@ -180,11 +167,9 @@ public class FtpProviderTestCase extends * TEST_URI. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { String uri = getSystemTestUriOverride(); - if (uri == null) - { + if (uri == null) { uri = ConnectionUri; } final FileSystemOptions opts = new FileSystemOptions(); @@ -201,8 +186,7 @@ public class FtpProviderTestCase extends /** * Gets the setting for UserDirIsRoot. */ - protected boolean getUserDirIsRoot() - { + protected boolean getUserDirIsRoot() { return false; } @@ -217,8 +201,7 @@ public class FtpProviderTestCase extends /** * Gets the root of the local FTP Server file system. */ - protected String getFtpRootDir() - { + protected String getFtpRootDir() { return getTestDirectory(); } @@ -226,8 +209,7 @@ public class FtpProviderTestCase extends * Prepares the file system manager. */ @Override - public void prepare(final DefaultFileSystemManager manager) throws Exception - { + public void prepare(final DefaultFileSystemManager manager) throws Exception { manager.addProvider("ftp", new FtpFileProvider()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderUserDirTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderUserDirTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderUserDirTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/FtpProviderUserDirTestCase.java Thu Sep 14 19:26:39 2017 @@ -31,13 +31,11 @@ import java.io.IOException; /** * Tests for FTP file systems (with homeDirIsRoot=true). */ -public class FtpProviderUserDirTestCase extends FtpProviderTestCase -{ +public class FtpProviderUserDirTestCase extends FtpProviderTestCase { /** * Creates the test suite for the ftp file system. */ - public static Test suite() throws Exception - { + public static Test suite() throws Exception { return suite(new FtpProviderUserDirTestCase()); } @@ -45,8 +43,7 @@ public class FtpProviderUserDirTestCase * Prepares the file system manager. */ @Override - protected boolean getUserDirIsRoot() - { + protected boolean getUserDirIsRoot() { return true; } @@ -56,27 +53,23 @@ public class FtpProviderUserDirTestCase @Override protected FileSystemFactory getFtpFileSystem() throws IOException { // simulate a non-root home directory by copying test directory to it - final File testDir = new File(getTestDirectory()); + final File testDir = new File(getTestDirectory()); final File rootDir = new File(testDir, "homeDirIsRoot"); final File homesDir = new File(rootDir, "home"); final File initialDir = new File(homesDir, "test"); FileUtils.deleteDirectory(rootDir); - //noinspection ResultOfMethodCallIgnored + // noinspection ResultOfMethodCallIgnored rootDir.mkdir(); - FileUtils.copyDirectory(testDir, initialDir, new FileFilter() - { + FileUtils.copyDirectory(testDir, initialDir, new FileFilter() { @Override - public boolean accept(final File pathname) - { + public boolean accept(final File pathname) { return !pathname.getPath().contains(rootDir.getName()); } }); - return new NativeFileSystemFactory() - { + return new NativeFileSystemFactory() { @Override - public FileSystemView createFileSystemView(final User user) throws FtpException - { + public FileSystemView createFileSystemView(final User user) throws FtpException { final FileSystemView fsView = super.createFileSystemView(user); fsView.changeWorkingDirectory("home/test"); return fsView; @@ -88,10 +81,8 @@ public class FtpProviderUserDirTestCase * Gets the root of the local FTP Server file system. */ @Override - protected String getFtpRootDir() - { + protected String getFtpRootDir() { return new File(getTestDirectory(), "homeDirIsRoot").getPath(); } - } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/MultipleConnectionTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/MultipleConnectionTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/MultipleConnectionTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/test/MultipleConnectionTestCase.java Thu Sep 14 19:26:39 2017 @@ -29,51 +29,41 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -public class MultipleConnectionTestCase -{ +public class MultipleConnectionTestCase { @BeforeClass - public static void setUpClass() throws FtpException, IOException - { + public static void setUpClass() throws FtpException, IOException { FtpProviderTestCase.setUpClass(FtpProviderTestCase.getTestDirectory(), null); } @AfterClass - public static void tearDownClass() throws MalformedURLException, FtpException - { + public static void tearDownClass() throws MalformedURLException, FtpException { FtpProviderTestCase.tearDownClass(); } - private FileObject resolveRoot() throws FileSystemException - { + private FileObject resolveRoot() throws FileSystemException { return VFS.getManager().resolveFile(FtpProviderTestCase.getConnectionUri()); } @Test - public void testConnectRoot() throws SocketException, IOException - { + public void testConnectRoot() throws SocketException, IOException { resolveRoot(); resolveRoot(); } @Test - public void testUnderlyingConnect() throws SocketException, IOException - { + public void testUnderlyingConnect() throws SocketException, IOException { final FTPClient client1 = new FTPClient(); final FTPClient client2 = new FTPClient(); - try - { + try { final String hostname = "localhost"; client1.connect(hostname, FtpProviderTestCase.getSocketPort()); client2.connect(hostname, FtpProviderTestCase.getSocketPort()); - } finally - { - if (client1 != null) - { + } finally { + if (client1 != null) { client1.disconnect(); } - if (client2 != null) - { + if (client2 != null) { client2.disconnect(); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/AbstractFtpsProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/AbstractFtpsProviderTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/AbstractFtpsProviderTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/AbstractFtpsProviderTestCase.java Thu Sep 14 19:26:39 2017 @@ -43,8 +43,7 @@ import org.junit.Assert; /** * Abstract tests for FTP file systems. */ -abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig -{ +abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig { private static int SocketPort; /** @@ -62,23 +61,19 @@ abstract class AbstractFtpsProviderTestC private static final String SERVER_JKS_RES = "org.apache.ftpsserver/ftpserver.jks"; - static String getConnectionUri() - { + static String getConnectionUri() { return ConnectionUri; } - static int getSocketPort() - { + static int getSocketPort() { return SocketPort; } - static String getSystemTestUriOverride() - { + static String getSystemTestUriOverride() { return System.getProperty(TEST_URI); } - static void init() throws IOException - { + static void init() throws IOException { SocketPort = FreeSocketPortUtil.findFreeLocalPort(); // Use %40 for @ in a URL ConnectionUri = "ftps://test:test@localhost:" + SocketPort; @@ -91,10 +86,8 @@ abstract class AbstractFtpsProviderTestC * @throws FtpException * @throws IOException */ - static void setUpClass(final boolean implicit) throws FtpException, IOException - { - if (Server != null) - { + static void setUpClass(final boolean implicit) throws FtpException, IOException { + if (Server != null) { return; } init(); @@ -137,10 +130,8 @@ abstract class AbstractFtpsProviderTestC /** * Stops the embedded Apache FTP Server (MINA). */ - static void tearDownClass() - { - if (Server != null) - { + static void tearDownClass() { + if (Server != null) { Server.stop(); Server = null; } @@ -149,25 +140,21 @@ abstract class AbstractFtpsProviderTestC static final class FtpProviderTestSuite extends ProviderTestSuite { private final boolean implicit; - public FtpProviderTestSuite(final AbstractFtpsProviderTestCase providerConfig) throws Exception - { + public FtpProviderTestSuite(final AbstractFtpsProviderTestCase providerConfig) throws Exception { super(providerConfig); this.implicit = providerConfig.isImplicit(); } @Override - protected void setUp() throws Exception - { - if (getSystemTestUriOverride() == null) - { + protected void setUp() throws Exception { + if (getSystemTestUriOverride() == null) { setUpClass(implicit); } super.setUp(); } @Override - protected void tearDown() throws Exception - { + protected void tearDown() throws Exception { try { // This will report running threads of the FTP server. // However, shutting down the FTP server first will always @@ -187,28 +174,23 @@ abstract class AbstractFtpsProviderTestC * TEST_URI. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { String uri = getSystemTestUriOverride(); - if (uri == null) - { + if (uri == null) { uri = ConnectionUri; } return manager.resolveFile(uri, getFileSystemOptions()); } - protected FileSystemOptions getFileSystemOptions() - { - if (fileSystemOptions == null) - { + protected FileSystemOptions getFileSystemOptions() { + if (fileSystemOptions == null) { fileSystemOptions = new FileSystemOptions(); setupOptions(FtpsFileSystemConfigBuilder.getInstance()); } return fileSystemOptions; } - protected void setupOptions(final FtpsFileSystemConfigBuilder builder) - { + protected void setupOptions(final FtpsFileSystemConfigBuilder builder) { builder.setConnectTimeout(fileSystemOptions, Integer.valueOf(1000)); builder.setDataTimeout(fileSystemOptions, Integer.valueOf(2000)); } @@ -217,8 +199,7 @@ abstract class AbstractFtpsProviderTestC * Prepares the file system manager. */ @Override - public void prepare(final DefaultFileSystemManager manager) throws Exception - { + public void prepare(final DefaultFileSystemManager manager) throws Exception { manager.addProvider("ftps", new FtpsFileProvider()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderExplicitTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderExplicitTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderExplicitTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderExplicitTestCase.java Thu Sep 14 19:26:39 2017 @@ -25,17 +25,14 @@ import org.apache.commons.vfs2.provider. /** * Tests for FTPS file systems with explicit FTPS connection. */ -public class FtpsProviderExplicitTestCase extends AbstractFtpsProviderTestCase -{ +public class FtpsProviderExplicitTestCase extends AbstractFtpsProviderTestCase { @Override - protected boolean isImplicit() - { + protected boolean isImplicit() { return false; } @Override - protected void setupOptions(final FtpsFileSystemConfigBuilder builder) - { + protected void setupOptions(final FtpsFileSystemConfigBuilder builder) { super.setupOptions(builder); builder.setDataChannelProtectionLevel(fileSystemOptions, FtpsDataChannelProtectionLevel.P); builder.setFtpsMode(fileSystemOptions, FtpsMode.EXPLICIT); @@ -44,8 +41,7 @@ public class FtpsProviderExplicitTestCas /** * Creates the test suite for the ftps file system. */ - public static Test suite() throws Exception - { + public static Test suite() throws Exception { return new FtpProviderTestSuite(new FtpsProviderExplicitTestCase()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderImplicitTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderImplicitTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderImplicitTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderImplicitTestCase.java Thu Sep 14 19:26:39 2017 @@ -24,21 +24,19 @@ import org.apache.commons.vfs2.provider. /** * Tests for FTPS file systems with implicit FTPS connection. * - * TODO: Fails for concurrent access. - * Note, that the implicit mode is not standardized and the protocol may differ between the FTPS servers. + * TODO: Fails for concurrent access. Note, that the implicit mode is not standardized and the protocol may differ + * between the FTPS servers. + * * @see <a href="http://en.wikipedia.org/wiki/FTPS#Implicit">Wikipedia: FTPS/Implicit</a> */ -public class FtpsProviderImplicitTestCase extends AbstractFtpsProviderTestCase -{ +public class FtpsProviderImplicitTestCase extends AbstractFtpsProviderTestCase { @Override - protected boolean isImplicit() - { + protected boolean isImplicit() { return true; } @Override - protected void setupOptions(final FtpsFileSystemConfigBuilder builder) - { + protected void setupOptions(final FtpsFileSystemConfigBuilder builder) { super.setupOptions(builder); builder.setFtpsMode(fileSystemOptions, FtpsMode.IMPLICIT); } @@ -46,8 +44,7 @@ public class FtpsProviderImplicitTestCas /** * Creates the test suite for the ftps file system. */ - public static Test suite() throws Exception - { + public static Test suite() throws Exception { return new FtpProviderTestSuite(new FtpsProviderImplicitTestCase()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java Thu Sep 14 19:26:39 2017 @@ -28,58 +28,47 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -public class MultipleConnectionTestCase -{ +public class MultipleConnectionTestCase { @BeforeClass - public static void setUpClass() throws FtpException, IOException - { + public static void setUpClass() throws FtpException, IOException { AbstractFtpsProviderTestCase.setUpClass(true); } @AfterClass - public static void tearDownClass() - { + public static void tearDownClass() { AbstractFtpsProviderTestCase.tearDownClass(); } - private FTPSClient init(final FTPSClient client) - { + private FTPSClient init(final FTPSClient client) { client.enterLocalPassiveMode(); return client; } - private FileObject resolveRoot() throws FileSystemException - { + private FileObject resolveRoot() throws FileSystemException { return VFS.getManager().resolveFile(AbstractFtpsProviderTestCase.getConnectionUri(), new FtpsProviderImplicitTestCase().getFileSystemOptions()); } @Test - public void testConnectRoot() throws IOException - { + public void testConnectRoot() throws IOException { resolveRoot(); resolveRoot(); } @Test - public void testUnderlyingConnect() throws SocketException, IOException - { + public void testUnderlyingConnect() throws SocketException, IOException { final FTPSClient client1 = this.init(new FTPSClient(true)); final FTPSClient client2 = this.init(new FTPSClient(true)); - try - { + try { final String hostname = "localhost"; client1.connect(hostname, AbstractFtpsProviderTestCase.getSocketPort()); client2.connect(hostname, AbstractFtpsProviderTestCase.getSocketPort()); - } finally - { - if (client1 != null) - { + } finally { + if (client1 != null) { client1.disconnect(); } - if (client2 != null) - { + if (client2 != null) { client2.disconnect(); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTest.java Thu Sep 14 19:26:39 2017 @@ -50,12 +50,10 @@ import org.junit.Test; * This will only work on systems that Hadoop supports. */ @SuppressWarnings("resource") -public class HdfsFileProviderTest -{ +public class HdfsFileProviderTest { // Turn off the MiniDFSCluster logging - static - { + static { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); } @@ -73,8 +71,7 @@ public class HdfsFileProviderTest protected static MiniDFSCluster cluster; @BeforeClass - public static void setUp() throws Exception - { + public static void setUp() throws Exception { Logger.getRootLogger().setLevel(Level.ERROR); // Put the MiniDFSCluster directory in the target directory @@ -104,22 +101,18 @@ public class HdfsFileProviderTest /** * Add {@code dfs.datanode.data.dir.perm} setting if OS needs it. * <P> - * MiniDFSCluster will check the permissions on the data directories, but does not do a - * good job of setting them properly. We need to get the users umask and set the - * appropriate Hadoop property so that the data directories will be created with - * the correct permissions. + * MiniDFSCluster will check the permissions on the data directories, but does not do a good job of setting them + * properly. We need to get the users umask and set the appropriate Hadoop property so that the data directories + * will be created with the correct permissions. * <P> * Will do nothing on Windows. */ - public static void setUmask(final Configuration conf2) - { - if (Os.isFamily(Os.OS_FAMILY_WINDOWS)) - { + public static void setUmask(final Configuration conf2) { + if (Os.isFamily(Os.OS_FAMILY_WINDOWS)) { return; } - try - { + try { final Process p = Runtime.getRuntime().exec("/bin/sh -c umask"); final BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream())); final String line = bri.readLine(); @@ -129,34 +122,27 @@ public class HdfsFileProviderTest // leading zero makes java interpret as base 8 final int newPermission = 0777 ^ umask; conf2.set("dfs.datanode.data.dir.perm", String.format("%03o", newPermission)); - } - catch (final Exception e) - { + } catch (final Exception e) { throw new RuntimeException("Error getting umask from O/S", e); } } @AfterClass - public static void tearDown() throws Exception - { - if (null != hdfs) - { + public static void tearDown() throws Exception { + if (null != hdfs) { hdfs.close(); } manager.close(); } @After - public void after() throws Exception - { - if (null != hdfs) - { + public void after() throws Exception { + if (null != hdfs) { hdfs.delete(DIR1_PATH, true); } } - private FileObject createTestFile(final FileSystem hdfs) throws IOException - { + private FileObject createTestFile(final FileSystem hdfs) throws IOException { // Create the directory hdfs.mkdirs(DIR1_PATH); final FileObject dir = manager.resolveFile(TEST_DIR1); @@ -174,16 +160,14 @@ public class HdfsFileProviderTest } @Test(expected = UnsupportedOperationException.class) - public void testCanRenameTo() throws Exception - { + public void testCanRenameTo() throws Exception { final FileObject fo = createTestFile(hdfs); Assert.assertNotNull(fo); fo.canRenameTo(fo); } @Test - public void testDoListChildren() throws Exception - { + public void testDoListChildren() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); @@ -200,8 +184,7 @@ public class HdfsFileProviderTest } @Test - public void testEquals() throws Exception - { + public void testEquals() throws Exception { // Create test file (and check parent was created) final FileObject dir = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(dir); @@ -220,8 +203,7 @@ public class HdfsFileProviderTest } @Test - public void testGetAttributes() throws Exception - { + public void testGetAttributes() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); @@ -240,8 +222,7 @@ public class HdfsFileProviderTest } @Test - public void testGetContentSize() throws Exception - { + public void testGetContentSize() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); @@ -253,8 +234,7 @@ public class HdfsFileProviderTest } @Test - public void testGetInputStream() throws Exception - { + public void testGetInputStream() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); @@ -266,16 +246,14 @@ public class HdfsFileProviderTest } @Test - public void testInit() throws Exception - { + public void testInit() throws Exception { final FileObject fo = manager.resolveFile(TEST_FILE1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); } @Test - public void testIsHidden() throws Exception - { + public void testIsHidden() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); @@ -287,8 +265,7 @@ public class HdfsFileProviderTest } @Test - public void testIsReadable() throws Exception - { + public void testIsReadable() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); @@ -300,8 +277,7 @@ public class HdfsFileProviderTest } @Test - public void testIsWritable() throws Exception - { + public void testIsWritable() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); @@ -313,8 +289,7 @@ public class HdfsFileProviderTest } @Test - public void testLastModificationTime() throws Exception - { + public void testLastModificationTime() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); @@ -326,8 +301,7 @@ public class HdfsFileProviderTest } @Test(expected = FileSystemException.class) - public void testRandomAccessContent() throws Exception - { + public void testRandomAccessContent() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); @@ -339,8 +313,7 @@ public class HdfsFileProviderTest } @Test - public void testRandomAccessContent2() throws Exception - { + public void testRandomAccessContent2() throws Exception { final FileObject fo = manager.resolveFile(TEST_DIR1); Assert.assertNotNull(fo); Assert.assertFalse(fo.exists()); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/test/HdfsFileProviderTestCase.java Thu Sep 14 19:26:39 2017 @@ -43,42 +43,31 @@ import org.apache.log4j.Logger; * <P> * This will only work on systems that Hadoop supports. */ -public class HdfsFileProviderTestCase extends AbstractProviderTestConfig -{ - public static class HdfsProviderTestSuite extends ProviderTestSuite - { +public class HdfsFileProviderTestCase extends AbstractProviderTestConfig { + public static class HdfsProviderTestSuite extends ProviderTestSuite { // Turn off the MiniDFSCluster logging - static - { + static { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); } - public HdfsProviderTestSuite(final ProviderTestConfig providerConfig, final boolean addEmptyDir) throws Exception - { + public HdfsProviderTestSuite(final ProviderTestConfig providerConfig, final boolean addEmptyDir) + throws Exception { super(providerConfig, addEmptyDir); } @SuppressWarnings("deprecation") - private void copyTestResources(final File directory, final Path parent) throws Exception - { - for (final File file : directory.listFiles()) - { - if (file.isFile()) - { + private void copyTestResources(final File directory, final Path parent) throws Exception { + for (final File file : directory.listFiles()) { + if (file.isFile()) { final Path src = new Path(file.getAbsolutePath()); final Path dst = new Path(parent, file.getName()); hdfs.copyFromLocalFile(src, dst); - } - else if (file.isDirectory()) - { + } else if (file.isDirectory()) { final Path dir = new Path(parent, file.getName()); - if (hdfs.mkdirs(dir)) - { + if (hdfs.mkdirs(dir)) { copyTestResources(file, dir); - } - else - { + } else { fail("Unable to make directory: " + dir); } } @@ -88,8 +77,7 @@ public class HdfsFileProviderTestCase ex @SuppressWarnings("deprecation") @Override - protected void setUp() throws Exception - { + protected void setUp() throws Exception { Logger.getRootLogger().setLevel(Level.OFF); // Put the MiniDFSCluster directory in the target directory @@ -106,13 +94,10 @@ public class HdfsFileProviderTestCase ex HdfsFileProviderTest.setUmask(conf); - try - { + try { cluster = new MiniDFSCluster(PORT, conf, 1, true, true, true, null, null, null, null); cluster.waitActive(); - } - catch (final IOException e) - { + } catch (final IOException e) { throw new RuntimeException("Error setting up mini cluster", e); } hdfs = cluster.getFileSystem(); @@ -127,15 +112,14 @@ public class HdfsFileProviderTestCase ex } @Override - protected void tearDown() throws Exception - { + protected void tearDown() throws Exception { super.tearDown(); - if (null != hdfs) - { + if (null != hdfs) { hdfs.close(); } } } + private static final int PORT = 8720; private static final String HDFS_URI = "hdfs://localhost:" + PORT; private static FileSystem hdfs; @@ -146,8 +130,7 @@ public class HdfsFileProviderTestCase ex /** * Creates the test suite for the zip file system. */ - public static Test suite() throws Exception - { + public static Test suite() throws Exception { return new HdfsProviderTestSuite(new HdfsFileProviderTestCase(), false); } @@ -155,8 +138,7 @@ public class HdfsFileProviderTestCase ex * Returns the base folder for read tests. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final String uri = HDFS_URI + "/test-data"; return manager.resolveFile(uri); } @@ -165,8 +147,7 @@ public class HdfsFileProviderTestCase ex * Prepares the file system manager. */ @Override - public void prepare(final DefaultFileSystemManager manager) throws Exception - { + public void prepare(final DefaultFileSystemManager manager) throws Exception { manager.addProvider("hdfs", new HdfsFileProvider()); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/GetContentInfoFunctionalTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/GetContentInfoFunctionalTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/GetContentInfoFunctionalTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/GetContentInfoFunctionalTest.java Thu Sep 14 19:26:39 2017 @@ -29,18 +29,15 @@ import org.junit.Test; * * @since 2.1 */ -public class GetContentInfoFunctionalTest -{ +public class GetContentInfoFunctionalTest { /** * Tests VFS-427 NPE on HttpFileObject.getContent().getContentInfo(). * - * @throws FileSystemException - * thrown when the getContentInfo API fails. + * @throws FileSystemException thrown when the getContentInfo API fails. */ @Test - public void testGetContentInfo() throws FileSystemException - { + public void testGetContentInfo() throws FileSystemException { final FileSystemManager fsManager = VFS.getManager(); final FileObject fo = fsManager.resolveFile("http://www.apache.org/licenses/LICENSE-2.0.txt"); final FileContent content = fo.getContent(); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpFilesCacheTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpFilesCacheTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpFilesCacheTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpFilesCacheTestCase.java Thu Sep 14 19:26:39 2017 @@ -31,15 +31,13 @@ import org.junit.Test; * @version $Id$ * @since 2.1 */ -public class HttpFilesCacheTestCase extends TestCase -{ +public class HttpFilesCacheTestCase extends TestCase { /** * Tests https://issues.apache.org/jira/browse/VFS-426 */ @Test - public void testQueryStringUrls() throws FileSystemException - { + public void testQueryStringUrls() throws FileSystemException { final String noQueryStringUrl = "http://commons.apache.org/vfs"; final String queryStringUrl = "http://commons.apache.org/vfs?query=string"; final String queryStringUrl2 = "http://commons.apache.org/vfs?query=string&more=stuff"; Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/test/HttpProviderTestCase.java Thu Sep 14 19:26:39 2017 @@ -40,8 +40,7 @@ import org.junit.Assert; * Test cases for the HTTP provider. * */ -public class HttpProviderTestCase extends AbstractProviderTestConfig -{ +public class HttpProviderTestCase extends AbstractProviderTestConfig { private static NHttpServer Server; private static int SocketPort; @@ -53,8 +52,7 @@ public class HttpProviderTestCase extend */ private static String ConnectionUri; - private static String getSystemTestUriOverride() - { + private static String getSystemTestUriOverride() { return System.getProperty(TEST_URI); } @@ -63,11 +61,9 @@ public class HttpProviderTestCase extend * * @throws Exception */ - private static void setUpClass() throws Exception - { + private static void setUpClass() throws Exception { Server = new NHttpServer(); - if (!Server.run(SocketPort, new File(getTestDirectory()), 5000)) - { + if (!Server.run(SocketPort, new File(getTestDirectory()), 5000)) { throw new IllegalStateException("The embedded HTTP server has not completed startup, increase wait time"); } } @@ -76,36 +72,29 @@ public class HttpProviderTestCase extend * Creates a new test suite. * * @return a new test suite. - * @throws Exception - * Thrown when the suite cannot be constructed. + * @throws Exception Thrown when the suite cannot be constructed. */ - public static Test suite() throws Exception - { - return new ProviderTestSuite(new HttpProviderTestCase()) - { + public static Test suite() throws Exception { + return new ProviderTestSuite(new HttpProviderTestCase()) { /** * Adds base tests - excludes the nested test cases. */ @Override - protected void addBaseTests() throws Exception - { + protected void addBaseTests() throws Exception { super.addBaseTests(); addTests(HttpProviderTestCase.class); } @Override - protected void setUp() throws Exception - { - if (getSystemTestUriOverride() == null) - { + protected void setUp() throws Exception { + if (getSystemTestUriOverride() == null) { setUpClass(); } super.setUp(); } @Override - protected void tearDown() throws Exception - { + protected void tearDown() throws Exception { tearDownClass(); super.tearDown(); } @@ -117,10 +106,8 @@ public class HttpProviderTestCase extend * * @throws IOException */ - private static void tearDownClass() throws IOException - { - if (Server != null) - { + private static void tearDownClass() throws IOException { + if (Server != null) { Server.stop(); } } @@ -128,18 +115,15 @@ public class HttpProviderTestCase extend /** * Builds a new test case. * - * @throws IOException - * Thrown if a free local socket port cannot be found. + * @throws IOException Thrown if a free local socket port cannot be found. */ - public HttpProviderTestCase() throws IOException - { + public HttpProviderTestCase() throws IOException { SocketPort = FreeSocketPortUtil.findFreeLocalPort(); // Use %40 for @ in a URL ConnectionUri = "http://localhost:" + SocketPort; } - private void checkReadTestsFolder(final FileObject file) throws FileSystemException - { + private void checkReadTestsFolder(final FileObject file) throws FileSystemException { Assert.assertNotNull(file.getChildren()); Assert.assertTrue(file.getChildren().length > 0); } @@ -148,11 +132,9 @@ public class HttpProviderTestCase extend * Returns the base folder for tests. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { String uri = getSystemTestUriOverride(); - if (uri == null) - { + if (uri == null) { uri = ConnectionUri; } return manager.resolveFile(uri); @@ -162,56 +144,47 @@ public class HttpProviderTestCase extend * Prepares the file system manager. */ @Override - public void prepare(final DefaultFileSystemManager manager) throws Exception - { + public void prepare(final DefaultFileSystemManager manager) throws Exception { manager.addProvider("http", new HttpFileProvider()); } - private void testResloveFolderSlash(final String uri, final boolean followRedirect) throws FileSystemException - { + private void testResloveFolderSlash(final String uri, final boolean followRedirect) throws FileSystemException { VFS.getManager().getFilesCache().close(); final FileSystemOptions opts = new FileSystemOptions(); HttpFileSystemConfigBuilder.getInstance().setFollowRedirect(opts, followRedirect); final FileObject file = VFS.getManager().resolveFile(uri, opts); - try - { + try { checkReadTestsFolder(file); - } catch (final FileNotFolderException e) - { + } catch (final FileNotFolderException e) { // Expected: VFS HTTP does not support listing children yet. } } - public void testResloveFolderSlashNoRedirectOff() throws FileSystemException - { + public void testResloveFolderSlashNoRedirectOff() throws FileSystemException { testResloveFolderSlash(ConnectionUri + "/read-tests", false); } - public void testResloveFolderSlashNoRedirectOn() throws FileSystemException - { + public void testResloveFolderSlashNoRedirectOn() throws FileSystemException { testResloveFolderSlash(ConnectionUri + "/read-tests", true); } - public void testResloveFolderSlashYesRedirectOff() throws FileSystemException - { + public void testResloveFolderSlashYesRedirectOff() throws FileSystemException { testResloveFolderSlash(ConnectionUri + "/read-tests/", false); } - public void testResloveFolderSlashYesRedirectOn() throws FileSystemException - { + public void testResloveFolderSlashYesRedirectOn() throws FileSystemException { testResloveFolderSlash(ConnectionUri + "/read-tests/", true); } // Test no longer passing 2016/04/28 - public void ignoreTestHttp405() throws FileSystemException - { - final FileObject f = VFS.getManager().resolveFile("http://www.w3schools.com/webservices/tempconvert.asmx?action=WSDL"); + public void ignoreTestHttp405() throws FileSystemException { + final FileObject f = VFS.getManager() + .resolveFile("http://www.w3schools.com/webservices/tempconvert.asmx?action=WSDL"); assert f.getContent().getSize() > 0; } - /** Ensure VFS-453 options are present. */ - public void testHttpTimeoutConfig() throws FileSystemException - { + /** Ensure VFS-453 options are present. */ + public void testHttpTimeoutConfig() throws FileSystemException { final FileSystemOptions opts = new FileSystemOptions(); final HttpFileSystemConfigBuilder builder = HttpFileSystemConfigBuilder.getInstance(); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/test/GetContentInfoFunctionalTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/test/GetContentInfoFunctionalTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/test/GetContentInfoFunctionalTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/test/GetContentInfoFunctionalTest.java Thu Sep 14 19:26:39 2017 @@ -34,20 +34,16 @@ import org.junit.Test; * * @since 2.1 */ -public class GetContentInfoFunctionalTest -{ +public class GetContentInfoFunctionalTest { /** * Tests VFS-427 NPE on HttpFileObject.getContent().getContentInfo(). * - * @throws FileSystemException - * thrown when the getContentInfo API fails. - * @throws MalformedURLException - * thrown when the System environment contains an invalid URL for an HTTPS proxy. + * @throws FileSystemException thrown when the getContentInfo API fails. + * @throws MalformedURLException thrown when the System environment contains an invalid URL for an HTTPS proxy. */ @Test - public void testGetContentInfo() throws FileSystemException, MalformedURLException - { + public void testGetContentInfo() throws FileSystemException, MalformedURLException { String httpsProxyHost = null; int httpsProxyPort = -1; final String httpsProxy = System.getenv("https_proxy"); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/JarAttributesTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/JarAttributesTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/JarAttributesTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/JarAttributesTestCase.java Thu Sep 14 19:26:39 2017 @@ -29,7 +29,7 @@ import org.junit.Test; * @version $Id$ */ public class JarAttributesTestCase { - + private void printAttributes(final Map<String, Object> attributes) { for (final Map.Entry<String, Object> e : attributes.entrySet()) { System.out.println("Key: " + e.getKey() + ", Value: " + e.getValue()); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/JarProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/JarProviderTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/JarProviderTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/JarProviderTestCase.java Thu Sep 14 19:26:39 2017 @@ -31,10 +31,8 @@ import junit.framework.Test; /** * Tests for the Jar file system. */ -public class JarProviderTestCase extends AbstractProviderTestConfig -{ - static FileObject getTestJar(final FileSystemManager manager, final String name) throws Exception - { +public class JarProviderTestCase extends AbstractProviderTestConfig { + static FileObject getTestJar(final FileSystemManager manager, final String name) throws Exception { final File jarFile = AbstractVfsTestCase.getTestResource(name); final String uri = "jar:file:" + jarFile.getAbsolutePath() + "!/"; return manager.resolveFile(uri); @@ -43,8 +41,7 @@ public class JarProviderTestCase extends /** * Creates the test suite for the jar file system. */ - public static Test suite() throws Exception - { + public static Test suite() throws Exception { return new ProviderTestSuite(new JarProviderTestCase(), true); } @@ -52,8 +49,7 @@ public class JarProviderTestCase extends * Returns the base folder for tests. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { return JarProviderTestCase.getTestJar(manager, "test.jar"); } @@ -61,8 +57,7 @@ public class JarProviderTestCase extends * Prepares the file system manager. */ @Override - public void prepare(final DefaultFileSystemManager manager) throws Exception - { + public void prepare(final DefaultFileSystemManager manager) throws Exception { manager.addProvider("jar", new JarFileProvider()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/NestedJarTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/NestedJarTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/NestedJarTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/jar/test/NestedJarTestCase.java Thu Sep 14 19:26:39 2017 @@ -31,14 +31,11 @@ import junit.framework.Test; /** * Tests for the Zip file system. */ -public class NestedJarTestCase - extends AbstractProviderTestConfig -{ +public class NestedJarTestCase extends AbstractProviderTestConfig { /** * Creates the test suite for nested jar files. */ - public static Test suite() throws Exception - { + public static Test suite() throws Exception { return new ProviderTestSuite(new NestedJarTestCase(), true); } @@ -46,9 +43,7 @@ public class NestedJarTestCase * Prepares the file system manager. */ @Override - public void prepare(final DefaultFileSystemManager manager) - throws Exception - { + public void prepare(final DefaultFileSystemManager manager) throws Exception { manager.addProvider("jar", new JarFileProvider()); manager.addExtensionMap("jar", "jar"); } @@ -57,8 +52,7 @@ public class NestedJarTestCase * Returns the base folder for tests. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { // Locate the Jar file final File outerFile = AbstractVfsTestCase.getTestResource("nested.jar"); final String uri = "jar:file:" + outerFile.getAbsolutePath() + "!/test.jar"; Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/ConversionTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/ConversionTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/ConversionTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/ConversionTestCase.java Thu Sep 14 19:26:39 2017 @@ -36,13 +36,11 @@ import org.junit.Test; * <p> * VFS-443 Need an easy way to convert from a FileObject to a File. */ -public class ConversionTestCase -{ +public class ConversionTestCase { @Test @Ignore - public void testFileNameWithSpaces() throws URISyntaxException, IOException - { + public void testFileNameWithSpaces() throws URISyntaxException, IOException { final File file = new File("target", "a name.txt"); final String fileURL = file.toURI().toURL().toExternalForm(); assertEquals(file.getAbsoluteFile(), new File(file.toURI().getPath())); @@ -55,14 +53,12 @@ public class ConversionTestCase @Test @Ignore - public void testFileNameWithCharacters() throws URISyntaxException, IOException - { + public void testFileNameWithCharacters() throws URISyntaxException, IOException { final File file = new File("target", "+# %&.txt"); final String fileURL = file.toURI().toURL().toExternalForm(); assertEquals(file.getAbsoluteFile(), new File(file.toURI().getPath())); assertEquals(file.getAbsoluteFile(), new File(new URL(fileURL).toURI().getPath())); - try - { + try { new FileOutputStream(file).close(); assertTrue(file.exists()); @@ -70,9 +66,7 @@ public class ConversionTestCase final FileObject fo = manager.resolveFile(fileURL); assertTrue(fo.exists()); assertEquals(file.getAbsoluteFile(), new File(new URL(fo.getURL().toExternalForm()).toURI().getPath())); - } - finally - { + } finally { file.delete(); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/FileNameTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/FileNameTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/FileNameTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/FileNameTests.java Thu Sep 14 19:26:39 2017 @@ -24,14 +24,11 @@ import org.apache.commons.vfs2.test.Abst /** * Additional naming tests for local file system. */ -public class FileNameTests - extends AbstractProviderTestCase -{ +public class FileNameTests extends AbstractProviderTestCase { /** * Tests resolution of an absolute file name. */ - public void testAbsoluteFileName() throws Exception - { + public void testAbsoluteFileName() throws Exception { // Locate file by absolute file name final String fileName = new File("testdir").getAbsolutePath(); final FileObject absFile = getManager().resolveFile(fileName); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/LocalProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/LocalProviderTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/LocalProviderTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/LocalProviderTestCase.java Thu Sep 14 19:26:39 2017 @@ -31,14 +31,11 @@ import junit.framework.Test; /** * Tests for the local file system. */ -public class LocalProviderTestCase - extends AbstractProviderTestConfig -{ +public class LocalProviderTestCase extends AbstractProviderTestConfig { /** * Creates the test suite for the local file system. */ - public static Test suite() throws Exception - { + public static Test suite() throws Exception { final ProviderTestSuite testSuite = new ProviderTestSuite(new LocalProviderTestCase()); testSuite.addTests(FileNameTests.class); @@ -46,8 +43,7 @@ public class LocalProviderTestCase testSuite.addTests(UrlTests.class); testSuite.addTests(PermissionsTests.class); - if (Os.isFamily(Os.OS_FAMILY_WINDOWS)) - { + if (Os.isFamily(Os.OS_FAMILY_WINDOWS)) { testSuite.addTests(WindowsFileNameTests.class); } @@ -58,8 +54,7 @@ public class LocalProviderTestCase * Returns the base folder for tests. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final File testDir = AbstractVfsTestCase.getTestDirectoryFile(); return manager.toFileObject(testDir); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/UrlTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/UrlTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/UrlTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/UrlTests.java Thu Sep 14 19:26:39 2017 @@ -28,31 +28,25 @@ import org.apache.commons.vfs2.test.Abst * * @version $Revision$ */ -public class UrlTests - extends AbstractProviderTestCase -{ +public class UrlTests extends AbstractProviderTestCase { /** * Tests FindFiles with a filename that has a hash sign in it. */ - public void testHashFindFiles() throws Exception - { + public void testHashFindFiles() throws Exception { final FileSystemManager fsManager = VFS.getManager(); final FileObject[] foList = getBaseFolder().findFiles(Selectors.SELECT_FILES); boolean hashFileFound = false; - for (final FileObject fo : foList) - { - if (fo.getURL().toString().contains("test-hash")) - { + for (final FileObject fo : foList) { + if (fo.getURL().toString().contains("test-hash")) { hashFileFound = true; assertEquals(fo.toString(), UriParser.decode(fo.getURL().toString())); } } - if (!hashFileFound) - { + if (!hashFileFound) { fail("Test hash file containing 'test-hash' not found"); } } @@ -60,8 +54,7 @@ public class UrlTests /** * Tests resolution of an absolute file name. */ - public void testHashURL() throws Exception - { + public void testHashURL() throws Exception { final FileObject file = getReadFolder().resolveFile("test-hash-#test.txt"); assertEquals(file.toString(), UriParser.decode(file.getURL().toString())); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/WindowsFileNameTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/WindowsFileNameTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/WindowsFileNameTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/WindowsFileNameTests.java Thu Sep 14 19:26:39 2017 @@ -27,16 +27,12 @@ import org.apache.commons.vfs2.test.Abst * <p> * Only executed on Windows O/S. */ -public class WindowsFileNameTests - extends AbstractProviderTestCase -{ - public void testWindowsRoots() throws Exception - { +public class WindowsFileNameTests extends AbstractProviderTestCase { + public void testWindowsRoots() throws Exception { // valid URI forms of the filesystem root final String[] tests = new String[] { "file:///C:/", "file://C:/", "file:/C:/", "file:C:/" }; - for(final String name : tests) - { + for (final String name : tests) { final FileName fn = getManager().resolveFile(name).getName(); // the following tests work for Windows file names only @@ -56,54 +52,41 @@ public class WindowsFileNameTests } } - public void testWindowsWrongRoots() throws Exception - { + public void testWindowsWrongRoots() throws Exception { final String[] tests = new String[] { "file:///C:", "file://C:", "file:/C:", "file:C:" }; - for(final String name : tests) - { - try - { + for (final String name : tests) { + try { final FileName fn = getManager().resolveFile(name).getName(); fail("should not accept root " + name); - } - catch (final FileSystemException ex) - { + } catch (final FileSystemException ex) { assertEquals("vfs.provider/invalid-absolute-uri.error", ex.getCode()); assertTrue(ex.toString().indexOf(name) >= 0); } } } - public void testWindowsFilenameUNCStartError() throws Exception - { - try - { + public void testWindowsFilenameUNCStartError() throws Exception { + try { final String FILE = "file://///"; final FileObject fo = getManager().resolveFile(FILE); fail("Windows File Parser should not allow " + FILE + " " + fo); - } - catch(FileSystemException ex) - { + } catch (FileSystemException ex) { assertEquals("Exception code", "vfs.provider/invalid-absolute-uri.error", ex.getCode()); - ex = (FileSystemException)ex.getCause(); + ex = (FileSystemException) ex.getCause(); assertEquals("Exception code", "vfs.provider.local/missing-share-name.error", ex.getCode()); } } - public void testWindowsFilenameParserError() throws Exception - { + public void testWindowsFilenameParserError() throws Exception { // check VFS-338 with 2+4 slashes we want a dedicated error - try - { + try { final String FILE = "file://////"; final FileObject fo = getManager().resolveFile(FILE); fail("Windows File Parser should not allow " + FILE + " " + fo); - } - catch(FileSystemException ex) - { + } catch (FileSystemException ex) { assertEquals("Exception code", "vfs.provider/invalid-absolute-uri.error", ex.getCode()); - ex = (FileSystemException)ex.getCause(); + ex = (FileSystemException) ex.getCause(); assertEquals("Exception code", "vfs.provider.local/not-absolute-file-name.error", ex.getCode()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java Thu Sep 14 19:26:39 2017 @@ -45,9 +45,8 @@ import org.junit.Test; * * @version $Id$ */ -public class CustomRamProviderTest -{ - private static final byte[] NON_EMPTY_FILE_CONTENT = new byte[]{ 1, 2, 3 }; +public class CustomRamProviderTest { + private static final byte[] NON_EMPTY_FILE_CONTENT = new byte[] { 1, 2, 3 }; private final List<Closeable> closeables = new ArrayList<>(); @@ -62,21 +61,18 @@ public class CustomRamProviderTest /** * Closes the given {@link Closeable} during the tearDown phase. */ - private <C extends Closeable> C closeOnTearDown(final C closeable) - { + private <C extends Closeable> C closeOnTearDown(final C closeable) { this.closeables.add(closeable); return closeable; } - private InputStream createEmptyFile() throws FileSystemException, IOException - { + private InputStream createEmptyFile() throws FileSystemException, IOException { final FileObject root = manager.resolveFile("ram://file"); root.createFile(); return this.closeOnTearDown(root.getContent().getInputStream()); } - private InputStream createNonEmptyFile() throws FileSystemException, IOException - { + private InputStream createNonEmptyFile() throws FileSystemException, IOException { final FileObject root = manager.resolveFile("ram://file"); root.createFile(); @@ -92,8 +88,7 @@ public class CustomRamProviderTest } @Before - public void setUp() throws Exception - { + public void setUp() throws Exception { manager = new DefaultFileSystemManager(); manager.addProvider("ram", new RamFileProvider()); manager.init(); @@ -104,15 +99,11 @@ public class CustomRamProviderTest } @After - public void tearDown() throws Exception - { - for (final Closeable closeable : this.closeables) - { - try - { + public void tearDown() throws Exception { + for (final Closeable closeable : this.closeables) { + try { closeable.close(); - } catch (final Exception e) - { + } catch (final Exception e) { // ignore } } @@ -120,15 +111,13 @@ public class CustomRamProviderTest } @Test - public void testReadEmptyFileByteByByte() throws FileSystemException, IOException - { + public void testReadEmptyFileByteByByte() throws FileSystemException, IOException { final InputStream input = this.createEmptyFile(); assertEquals("Empty file didnt return EOF -1", -1, input.read()); } @Test - public void testReadEmptyFileIntoBuffer() throws FileSystemException, IOException - { + public void testReadEmptyFileIntoBuffer() throws FileSystemException, IOException { final InputStream input = this.createEmptyFile(); final byte[] buffer = new byte[100]; @@ -137,8 +126,7 @@ public class CustomRamProviderTest } @Test - public void testReadEmptyFileIntoBufferWithOffsetAndLength() throws FileSystemException, IOException - { + public void testReadEmptyFileIntoBufferWithOffsetAndLength() throws FileSystemException, IOException { final InputStream input = this.createEmptyFile(); final byte[] buffer = new byte[100]; assertEquals("Empty file didnt return when filling buffer", -1, input.read(buffer, 10, 90)); @@ -146,8 +134,7 @@ public class CustomRamProviderTest } @Test - public void testReadNonEmptyFileByteByByte() throws FileSystemException, IOException - { + public void testReadNonEmptyFileByteByByte() throws FileSystemException, IOException { final InputStream input = this.createNonEmptyFile(); assertEquals("Read 1st byte failed", 1, input.read()); @@ -157,8 +144,7 @@ public class CustomRamProviderTest } @Test - public void testReadNonEmptyFileIntoBuffer() throws FileSystemException, IOException - { + public void testReadNonEmptyFileIntoBuffer() throws FileSystemException, IOException { final InputStream input = this.createNonEmptyFile(); final byte[] buffer = new byte[100]; @@ -176,8 +162,7 @@ public class CustomRamProviderTest } @Test - public void testReadNonEmptyFileIntoBufferWithOffsetAndLength() throws FileSystemException, IOException - { + public void testReadNonEmptyFileIntoBufferWithOffsetAndLength() throws FileSystemException, IOException { final InputStream input = this.createNonEmptyFile(); final byte[] buffer = new byte[100]; @@ -202,25 +187,21 @@ public class CustomRamProviderTest * @throws FileSystemException */ @Test - public void testRootFolderExists() throws FileSystemException - { + public void testRootFolderExists() throws FileSystemException { final FileObject root = manager.resolveFile("ram:///", defaultRamFso); assertTrue(root.getType().hasChildren()); - try - { + try { root.delete(); fail(); - } catch (final FileSystemException e) - { + } catch (final FileSystemException e) { // Expected } } @Test - public void testFSOptions() throws Exception - { + public void testFSOptions() throws Exception { // Default FS final FileObject fo1 = manager.resolveFile("ram:/"); final FileObject fo2 = manager.resolveFile("ram:/"); @@ -233,8 +214,10 @@ public class CustomRamProviderTest // Small FS final FileObject fo3 = manager.resolveFile("ram:/fo3", smallSizedFso); final FileObject fo4 = manager.resolveFile("ram:/", smallSizedFso); - assertTrue("Both files should exist in the same FileSystem instance.", fo3.getFileSystem() == fo4.getFileSystem()); - assertTrue("Both files should exist in different FileSystem instance.", fo1.getFileSystem() != fo3.getFileSystem()); + assertTrue("Both files should exist in the same FileSystem instance.", + fo3.getFileSystem() == fo4.getFileSystem()); + assertTrue("Both files should exist in different FileSystem instance.", + fo1.getFileSystem() != fo3.getFileSystem()); fsOptions = fo3.getFileSystem().getFileSystemOptions(); maxFilesystemSize = RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions); @@ -242,29 +225,24 @@ public class CustomRamProviderTest } @Test - public void testSmallFS() throws Exception - { + public void testSmallFS() throws Exception { // Small FS final FileObject fo3 = manager.resolveFile("ram:/fo3", smallSizedFso); fo3.createFile(); - try - { + try { final OutputStream os = fo3.getContent().getOutputStream(); os.write(new byte[10]); os.close(); - } catch (final FileSystemException e) - { + } catch (final FileSystemException e) { fail("Test should be able to save such a small file"); } - try - { + try { final OutputStream os = fo3.getContent().getOutputStream(); os.write(new byte[11]); os.close(); fail("It shouldn't save such a big file"); - } catch (final FileSystemException e) - { + } catch (final FileSystemException e) { // Expected } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamProviderTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamProviderTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamProviderTestCase.java Thu Sep 14 19:26:39 2017 @@ -16,7 +16,6 @@ */ package org.apache.commons.vfs2.provider.ram.test; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.vfs2.FileObject; @@ -33,8 +32,7 @@ import junit.framework.Test; /** * Tests for the RAM file system. */ -public class RamProviderTestCase extends AbstractProviderTestConfig -{ +public class RamProviderTestCase extends AbstractProviderTestConfig { private boolean inited = false; /** logger */ @@ -43,8 +41,7 @@ public class RamProviderTestCase extends /** * Creates the test suite for the ram file system. */ - public static Test suite() throws Exception - { + public static Test suite() throws Exception { return new ProviderTestSuite(new RamProviderTestCase()); } @@ -56,16 +53,11 @@ public class RamProviderTestCase extends * @throws Exception */ @Override - public void prepare(final DefaultFileSystemManager manager) - throws Exception - { - try - { + public void prepare(final DefaultFileSystemManager manager) throws Exception { + try { manager.addProvider("ram", new RamFileProvider()); manager.addProvider("file", new DefaultLocalFileProvider()); - } - catch (final Exception e) - { + } catch (final Exception e) { log.error(e); throw e; } @@ -75,18 +67,15 @@ public class RamProviderTestCase extends * Returns the base folder for tests. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) - throws Exception - { - if (!inited) - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { + if (!inited) { // Import the test tree final FileObject fo = manager.resolveFile("ram:/"); final RamFileSystem fs = (RamFileSystem) fo.getFileSystem(); fs.importTree(getTestDirectoryFile()); fo.close(); - inited=true; + inited = true; } final String uri = "ram:/"; Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/test/ResourceProviderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/test/ResourceProviderTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/test/ResourceProviderTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/test/ResourceProviderTestCase.java Thu Sep 14 19:26:39 2017 @@ -32,20 +32,16 @@ import org.apache.commons.vfs2.test.Prov /** * Test cases for the resource provider. */ -public class ResourceProviderTestCase extends AbstractProviderTestConfig -{ - public static Test suite() throws Exception - { +public class ResourceProviderTestCase extends AbstractProviderTestConfig { + public static Test suite() throws Exception { return new ProviderTestSuite(new ResourceProviderTestCase()); } /** - * Prepares the file system manager. This implementation does nothing. + * Prepares the file system manager. This implementation does nothing. */ @Override - public void prepare(final DefaultFileSystemManager manager) - throws Exception - { + public void prepare(final DefaultFileSystemManager manager) throws Exception { manager.addProvider("res", new ResourceFileProvider()); manager.addProvider("file", new UrlFileProvider()); manager.addProvider("jar", new JarFileProvider()); @@ -55,9 +51,7 @@ public class ResourceProviderTestCase ex * Returns the base folder for tests. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) - throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final String baseDir = AbstractVfsTestCase.getResourceTestDirectory(); return manager.resolveFile("res:" + baseDir); }
