GH-7: Add checkstyle and javaformat plugins

Fixes: #7

* Run `./gradlew format`
* Updates from PR review suggestions
This commit is contained in:
Chris Bono
2023-12-29 21:08:58 -06:00
committed by Artem Bilan
parent 84e732da08
commit 836708f0f2
357 changed files with 4344 additions and 4519 deletions

View File

@@ -80,13 +80,14 @@ public abstract class RemoteFileTestSupport {
* localTarget/
* </pre>
*
* The intent is tests retrieve from remoteSource and verify arrival in localTarget or send from localSource and verify
* arrival in remoteTarget.
* The intent is tests retrieve from remoteSource and verify arrival in localTarget or
* send from localSource and verify arrival in remoteTarget.
* <p>
* Subclasses can change 'remote' in these names by overriding {@link #prefix()} or override this method completely to
* create a different structure.
* Subclasses can change 'remote' in these names by overriding {@link #prefix()} or
* override this method completely to create a different structure.
* <p>
* While a single server exists for all tests, the directory structure is rebuilt for each test.
* While a single server exists for all tests, the directory structure is rebuilt for
* each test.
* @throws IOException IO Exception.
*/
@BeforeEach
@@ -151,4 +152,5 @@ public abstract class RemoteFileTestSupport {
protected String prefix() {
return "remote";
}
}

View File

@@ -79,14 +79,12 @@ public class FtpTestSupport extends RemoteFileTestSupport {
private TestUserManager(String homeDirectory) {
this.testUser = new BaseUser();
this.testUser.setAuthorities(Arrays.asList(new ConcurrentLoginPermission(1024, 1024),
new WritePermission(),
this.testUser.setAuthorities(Arrays.asList(new ConcurrentLoginPermission(1024, 1024), new WritePermission(),
new TransferRatePermission(1024, 1024)));
this.testUser.setHomeDirectory(homeDirectory);
this.testUser.setName("TEST_USER");
}
@Override
public User getUserByName(String s) throws FtpException {
return this.testUser;
@@ -126,4 +124,5 @@ public class FtpTestSupport extends RemoteFileTestSupport {
}
}
}

View File

@@ -58,8 +58,13 @@ public class SftpTestSupport extends RemoteFileTestSupport {
@BeforeAll
public static void createServer() throws Exception {
server = SshServer.setUpDefaultServer();
server.setPasswordAuthenticator((username, password, session) ->
StringUtils.hasText(password) && !"badPassword".equals(password)); // fail if pub key validation failed
server.setPasswordAuthenticator(
(username, password, session) -> StringUtils.hasText(password) && !"badPassword".equals(password)); // fail
// if
// pub
// key
// validation
// failed
server.setPublickeyAuthenticator((username, key, session) -> key.equals(decodePublicKey("id_rsa_pp.pub")));
server.setPort(0);
server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File("hostkey.ser").toPath()));
@@ -67,8 +72,7 @@ public class SftpTestSupport extends RemoteFileTestSupport {
server.setFileSystemFactory(new VirtualFileSystemFactory(remoteTemporaryFolder));
server.start();
System.setProperty("sftp.factory.port", String.valueOf(server.getPort()));
System.setProperty("sftp.consumer.localDir",
localTemporaryFolder + File.separator + "localTarget");
System.setProperty("sftp.consumer.localDir", localTemporaryFolder + File.separator + "localTarget");
}
@AfterAll
@@ -117,4 +121,5 @@ public class SftpTestSupport extends RemoteFileTestSupport {
bb.get(bytes);
return new BigInteger(bytes);
}
}

View File

@@ -57,4 +57,5 @@ public class WebsocketConsumerClientHandler extends AbstractWebSocketHandler {
public List<String> getReceivedMessages() {
return receivedMessages;
}
}

View File

@@ -57,8 +57,7 @@ public interface XmppTestContainerSupport {
/**
* The container.
*/
GenericContainer<?> XMPP_CONTAINER = new GenericContainer<>("fishbowler/openfire:v4.7.0")
.withExposedPorts(5222)
GenericContainer<?> XMPP_CONTAINER = new GenericContainer<>("fishbowler/openfire:v4.7.0").withExposedPorts(5222)
.withClasspathResourceMapping("xmpp/conf", "/var/lib/openfire/conf", BindMode.READ_ONLY)
.withCommand("-demoboot")
.withStartupTimeout(Duration.ofSeconds(120))