Various improvements for MQTT modules code style

This commit is contained in:
Artem Bilan
2024-01-05 14:05:59 -05:00
parent fbe0d220f7
commit e1a1845dab
4 changed files with 7 additions and 8 deletions

View File

@@ -32,6 +32,9 @@ import org.testcontainers.junit.jupiter.Testcontainers;
@Testcontainers(disabledWithoutDocker = true)
public interface MosquittoContainerTest {
/**
* The Mosquitto Testcontainers instance.
*/
GenericContainer<?> MOSQUITTO_CONTAINER = new GenericContainer<>("eclipse-mosquitto:2.0.13")
.withCommand("mosquitto -c /mosquitto-no-auth.conf")
.withExposedPorts(1883);

View File

@@ -59,12 +59,8 @@ public class SftpTestSupport extends RemoteFileTestSupport {
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
// fail if pub key validation failed
(username, password, session) -> StringUtils.hasText(password) && !"badPassword".equals(password));
server.setPublickeyAuthenticator((username, key, session) -> key.equals(decodePublicKey("id_rsa_pp.pub")));
server.setPort(0);
server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File("hostkey.ser").toPath()));