Skip to content

Commit

Permalink
Fix some Checkstyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Oct 11, 2023
1 parent 6817f83 commit 1eda373
Show file tree
Hide file tree
Showing 16 changed files with 190 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
*/
public class FileExtensionSelectorTest {

private static FileObject BaseFolder;
private static FileObject baseFolder;

private static final int FileCount = 9;
private static final int FILE_COUNT = 9;

private static final int ExtensionCount = 3;
private static final int EXTENSION_COUNT = 3;

private static final int FilesPerExtensionCount = 3;
private static final int FILES_PER_EXTENSION_COUNT = 3;

/**
* Creates a RAM FS.
Expand All @@ -51,18 +51,18 @@ public class FileExtensionSelectorTest {
*/
@BeforeAll
public static void setUpClass() throws Exception {
BaseFolder = VFS.getManager().resolveFile("ram://" + FileExtensionSelectorTest.class.getName());
BaseFolder.deleteAll();
BaseFolder.createFolder();
BaseFolder.resolveFile("a.htm").createFile();
BaseFolder.resolveFile("a.html").createFile();
BaseFolder.resolveFile("a.xhtml").createFile();
BaseFolder.resolveFile("b.htm").createFile();
BaseFolder.resolveFile("b.html").createFile();
BaseFolder.resolveFile("b.xhtml").createFile();
BaseFolder.resolveFile("c.htm").createFile();
BaseFolder.resolveFile("c.html").createFile();
BaseFolder.resolveFile("c.xhtml").createFile();
baseFolder = VFS.getManager().resolveFile("ram://" + FileExtensionSelectorTest.class.getName());
baseFolder.deleteAll();
baseFolder.createFolder();
baseFolder.resolveFile("a.htm").createFile();
baseFolder.resolveFile("a.html").createFile();
baseFolder.resolveFile("a.xhtml").createFile();
baseFolder.resolveFile("b.htm").createFile();
baseFolder.resolveFile("b.html").createFile();
baseFolder.resolveFile("b.xhtml").createFile();
baseFolder.resolveFile("c.htm").createFile();
baseFolder.resolveFile("c.html").createFile();
baseFolder.resolveFile("c.xhtml").createFile();
}

/**
Expand All @@ -72,8 +72,8 @@ public static void setUpClass() throws Exception {
*/
@AfterAll
public static void tearDownClass() throws Exception {
if (BaseFolder != null) {
BaseFolder.deleteAll();
if (baseFolder != null) {
baseFolder.deleteAll();
}
}

Expand All @@ -85,7 +85,7 @@ public static void tearDownClass() throws Exception {
@Test
public void testEmpty() throws Exception {
final FileSelector selector = new FileExtensionSelector();
final FileObject[] foList = BaseFolder.findFiles(selector);
final FileObject[] foList = baseFolder.findFiles(selector);
assertEquals(0, foList.length);
}

Expand All @@ -96,7 +96,7 @@ public void testEmpty() throws Exception {
*/
@Test
public void testManyExtensions() throws Exception {
final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES);
final FileObject[] foArray = baseFolder.findFiles(Selectors.SELECT_FILES);
assertTrue(foArray.length > 0);
// gather file extensions.
final Set<String> extensionSet = new HashSet<>();
Expand All @@ -106,11 +106,11 @@ public void testManyExtensions() throws Exception {
final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(),
Arrays.asList(foArray).toString());
assertFalse(extensionSet.isEmpty(), message);
assertEquals(ExtensionCount, extensionSet.size(), message);
assertEquals(EXTENSION_COUNT, extensionSet.size(), message);
// check all unique extensions
final FileSelector selector = new FileExtensionSelector(extensionSet);
final FileObject[] list = BaseFolder.findFiles(selector);
assertEquals(FileCount, list.length);
final FileObject[] list = baseFolder.findFiles(selector);
assertEquals(FILE_COUNT, list.length);
}

/**
Expand All @@ -121,7 +121,7 @@ public void testManyExtensions() throws Exception {
@Test
public void testNullCollection() throws Exception {
final FileSelector selector0 = new FileExtensionSelector((Collection<String>) null);
final FileObject[] foList = BaseFolder.findFiles(selector0);
final FileObject[] foList = baseFolder.findFiles(selector0);
assertEquals(0, foList.length);
}

Expand All @@ -133,7 +133,7 @@ public void testNullCollection() throws Exception {
@Test
public void testNullString() throws Exception {
final FileSelector selector0 = new FileExtensionSelector((String) null);
final FileObject[] foList = BaseFolder.findFiles(selector0);
final FileObject[] foList = baseFolder.findFiles(selector0);
assertEquals(0, foList.length);
}

Expand All @@ -144,7 +144,7 @@ public void testNullString() throws Exception {
*/
@Test
public void testOneExtension() throws Exception {
final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES);
final FileObject[] foArray = baseFolder.findFiles(Selectors.SELECT_FILES);
assertTrue(foArray.length > 0);
// gather file extensions.
final Set<String> extensionSet = new HashSet<>();
Expand All @@ -153,18 +153,18 @@ public void testOneExtension() throws Exception {
}
final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(),
Arrays.asList(foArray).toString());
assertEquals(ExtensionCount, extensionSet.size(), message);
assertEquals(EXTENSION_COUNT, extensionSet.size(), message);
// check each extension
for (final String extension : extensionSet) {
final FileSelector selector = new FileExtensionSelector(extension);
final FileObject[] list = BaseFolder.findFiles(selector);
assertEquals(FilesPerExtensionCount, list.length);
final FileObject[] list = baseFolder.findFiles(selector);
assertEquals(FILES_PER_EXTENSION_COUNT, list.length);
}
// check each file against itself
for (final FileObject fo : foArray) {
final FileSelector selector = new FileExtensionSelector(fo.getName().getExtension());
final FileObject[] list = BaseFolder.findFiles(selector);
assertEquals(FilesPerExtensionCount, list.length);
final FileObject[] list = baseFolder.findFiles(selector);
assertEquals(FILES_PER_EXTENSION_COUNT, list.length);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@
*/
public class PatternFileSelectorTest {

private static FileObject BaseFolder;
private static FileObject baseFolder;

/**
* 9 files and 1 directory = 10
*/
private static final int EntryCount = 10;
private static final int ENTRY_COUNT = 10;

private static final int ExtensionCount = 3;
private static final int EXTENSION_COUNT = 3;

private static final int FilesPerExtensionCount = 3;
private static final int FILES_PER_EXTENSION_COUNT = 3;

static FileObject getBaseFolder() {
return BaseFolder;
return baseFolder;
}

/**
Expand All @@ -57,18 +57,18 @@ static FileObject getBaseFolder() {
*/
@BeforeAll
public static void setUpClass() throws Exception {
BaseFolder = VFS.getManager().resolveFile("ram://" + PatternFileSelectorTest.class.getName());
BaseFolder.deleteAll();
BaseFolder.createFolder();
BaseFolder.resolveFile("aa.htm").createFile();
BaseFolder.resolveFile("aa.html").createFile();
BaseFolder.resolveFile("aa.xhtml").createFile();
BaseFolder.resolveFile("b.htm").createFile();
BaseFolder.resolveFile("b.html").createFile();
BaseFolder.resolveFile("b.xhtml").createFile();
BaseFolder.resolveFile("c.htm").createFile();
BaseFolder.resolveFile("c.html").createFile();
BaseFolder.resolveFile("c.xhtml").createFile();
baseFolder = VFS.getManager().resolveFile("ram://" + PatternFileSelectorTest.class.getName());
baseFolder.deleteAll();
baseFolder.createFolder();
baseFolder.resolveFile("aa.htm").createFile();
baseFolder.resolveFile("aa.html").createFile();
baseFolder.resolveFile("aa.xhtml").createFile();
baseFolder.resolveFile("b.htm").createFile();
baseFolder.resolveFile("b.html").createFile();
baseFolder.resolveFile("b.xhtml").createFile();
baseFolder.resolveFile("c.htm").createFile();
baseFolder.resolveFile("c.html").createFile();
baseFolder.resolveFile("c.xhtml").createFile();
}

/**
Expand All @@ -78,8 +78,8 @@ public static void setUpClass() throws Exception {
*/
@AfterAll
public static void tearDownClass() throws Exception {
if (BaseFolder != null) {
BaseFolder.deleteAll();
if (baseFolder != null) {
baseFolder.deleteAll();
}
}

Expand All @@ -90,7 +90,7 @@ public static void tearDownClass() throws Exception {
*/
@Test
public void testFileExtensions() throws Exception {
final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES);
final FileObject[] foArray = baseFolder.findFiles(Selectors.SELECT_FILES);
assertTrue(foArray.length > 0);
final String regExPrefix = ".*\\.";
// gather file extensions.
Expand All @@ -100,18 +100,18 @@ public void testFileExtensions() throws Exception {
}
final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(),
Arrays.asList(foArray).toString());
assertEquals(ExtensionCount, extensionSet.size(), message);
assertEquals(EXTENSION_COUNT, extensionSet.size(), message);
// check each extension
for (final String extension : extensionSet) {
final FileSelector selector = new PatternFileSelector(extension);
final FileObject[] list = BaseFolder.findFiles(selector);
assertEquals(FilesPerExtensionCount, list.length);
final FileObject[] list = baseFolder.findFiles(selector);
assertEquals(FILES_PER_EXTENSION_COUNT, list.length);
}
// check each file against itself
for (final FileObject fo : foArray) {
final FileSelector selector = new PatternFileSelector(regExPrefix + fo.getName().getExtension());
final FileObject[] list = BaseFolder.findFiles(selector);
assertEquals(FilesPerExtensionCount, list.length);
final FileObject[] list = baseFolder.findFiles(selector);
assertEquals(FILES_PER_EXTENSION_COUNT, list.length);
}
}

Expand All @@ -122,8 +122,8 @@ public void testFileExtensions() throws Exception {
*/
@Test
public void testMatchAll() throws Exception {
final FileObject[] list = BaseFolder.findFiles(new PatternFileSelector(".*"));
assertEquals(EntryCount, list.length);
final FileObject[] list = baseFolder.findFiles(new PatternFileSelector(".*"));
assertEquals(ENTRY_COUNT, list.length);
}

/**
Expand All @@ -133,7 +133,7 @@ public void testMatchAll() throws Exception {
*/
@Test
public void testMatchPartial() throws Exception {
final FileObject[] list = BaseFolder.findFiles(new PatternFileSelector(".*a.htm"));
final FileObject[] list = baseFolder.findFiles(new PatternFileSelector(".*a.htm"));
assertEquals(1, list.length);
assertEquals("aa.htm", list[0].getName().getBaseName());
}
Expand All @@ -145,7 +145,7 @@ public void testMatchPartial() throws Exception {
*/
@Test
public void testMatchPartialDelimited() throws Exception {
final FileObject[] list = BaseFolder.findFiles(new PatternFileSelector("^.*\\/b.htm$"));
final FileObject[] list = baseFolder.findFiles(new PatternFileSelector("^.*\\/b.htm$"));
assertEquals(1, list.length);
assertEquals("b.htm", list[0].getName().getBaseName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public class FtpProviderTestCase extends AbstractProviderTestConfig {
/**
* Use %40 for @ in URLs
*/
private static String ConnectionUri;
private static String connectionUri;

private static FtpServer Server;
private static FtpServer server;

private static final String TEST_URI = "test.ftp.uri";

Expand All @@ -71,7 +71,7 @@ public FtpProviderTestCase(final boolean mdtmLastModifiedTime) {
}

static String getConnectionUri() {
return ConnectionUri;
return connectionUri;
}

static int getSocketPort() {
Expand All @@ -92,7 +92,7 @@ private static String getSystemTestUriOverride() {
*/
static void setUpClass(final String rootDirectory, final FileSystemFactory fileSystemFactory,
final CommandFactory commandFactory) throws FtpException {
if (Server != null) {
if (server != null) {
return;
}
final FtpServerFactory serverFactory = new FtpServerFactory();
Expand Down Expand Up @@ -121,10 +121,10 @@ static void setUpClass(final String rootDirectory, final FileSystemFactory fileS
serverFactory.addListener("default", factory.createListener());

// start the server
Server = serverFactory.createServer();
Server.start();
SocketPort = ((org.apache.ftpserver.impl.DefaultFtpServer) Server).getListener("default").getPort();
ConnectionUri = "ftp://test:test@localhost:" + SocketPort;
server = serverFactory.createServer();
server.start();
SocketPort = ((org.apache.ftpserver.impl.DefaultFtpServer) server).getListener("default").getPort();
connectionUri = "ftp://test:test@localhost:" + SocketPort;
}

/**
Expand Down Expand Up @@ -179,9 +179,9 @@ protected void tearDown() throws Exception {
* Stops the embedded Apache FTP Server (MINA).
*/
static void tearDownClass() {
if (Server != null) {
Server.stop();
Server = null;
if (server != null) {
server.stop();
server = null;
}
}

Expand All @@ -193,7 +193,7 @@ static void tearDownClass() {
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
String uri = getSystemTestUriOverride();
if (uri == null) {
uri = ConnectionUri;
uri = connectionUri;
}
final FileSystemOptions options = new FileSystemOptions();
final FtpFileSystemConfigBuilder builder = FtpFileSystemConfigBuilder.getInstance();
Expand Down
Loading

0 comments on commit 1eda373

Please sign in to comment.