@Test public void validateFormWithSSHTunnelingAndPassphraseAuthMethodToBeAsked() { frameFixture.textBox("labelField").setText("MyServer"); frameFixture.textBox("serverUrlsField").setText("localhost:25"); frameFixture.tabbedPane("tabbedSettings") .selectTab("SSH"); frameFixture.textBox("sshProxyUrlField").setText("remotehost:22"); frameFixture.comboBox("sshAuthenticationMethodComboBox").requireSelection("Private key"); frameFixture.label("passLabel").requireText("Passphrase:"); frameFixture.textBox("sshPrivateKeyPathField").setText("/Users/myself/.ssh/id_rsa"); frameFixture.textBox("sshProxyUsernameField").setText("john.doe"); ServerConfiguration configuration = new ServerConfiguration(); configurationPanel.applyConfigurationData(configuration); assertThat(configuration.getServerUrls()).containsExactly("localhost:25"); SshTunnelingConfiguration sshTunnelingConfiguration = configuration.getSshTunnelingConfiguration(); assertThat(sshTunnelingConfiguration).isNotNull(); assertThat(sshTunnelingConfiguration.getProxyUrl()).isEqualTo("remotehost:22"); assertThat(sshTunnelingConfiguration.getAuthenticationMethod()).isEqualTo(AuthenticationMethod.PRIVATE_KEY); assertThat(sshTunnelingConfiguration.getPrivateKeyPath()).isEqualTo("/Users/myself/.ssh/id_rsa"); assertThat(sshTunnelingConfiguration.getProxyUser()).isEqualTo("john.doe"); }
@RunsInEDT @Override @Nonnull public JLabelFixture label(@Nullable String name) { return new JLabelFixture(robot(), findByName(name, JLabel.class)); }
@RunsInEDT @Override @Nonnull public JLabelFixture label(@Nonnull GenericTypeMatcher<? extends JLabel> matcher) { return new JLabelFixture(robot(), find(matcher)); }
/** * Asserts that the text of this fixture's {@code JLabel} is equal to the specified {@code String}. * * @param expected the text to match. * @return this fixture. * @throws AssertionError if the text of this fixture's {@code JLabel} is not equal to the given one. */ @Override @Nonnull public JLabelFixture requireText(@Nullable String expected) { driver().requireText(target(), expected); return this; }
@Test public void validateFormWithSSHTunnelingAndPassphraseAuthMethod() { frameFixture.textBox("labelField").setText("MyServer"); frameFixture.textBox("serverUrlsField").setText("localhost:25"); frameFixture.tabbedPane("tabbedSettings") .selectTab("SSH"); frameFixture.textBox("sshProxyUrlField").setText("remotehost:22"); frameFixture.comboBox("sshAuthenticationMethodComboBox").requireSelection("Private key"); frameFixture.label("passLabel").requireText("Passphrase:"); frameFixture.textBox("sshPrivateKeyPathField").setText("/Users/myself/.ssh/id_rsa"); frameFixture.textBox("sshProxyUsernameField").setText("john.doe"); frameFixture.textBox("sshProxyPasswordField").setText("mySecuredPassphrase"); ServerConfiguration configuration = new ServerConfiguration(); configurationPanel.applyConfigurationData(configuration); assertThat(configuration.getServerUrls()).containsExactly("localhost:25"); SshTunnelingConfiguration sshTunnelingConfiguration = configuration.getSshTunnelingConfiguration(); assertThat(sshTunnelingConfiguration).isNotNull(); assertThat(sshTunnelingConfiguration.getProxyUrl()).isEqualTo("remotehost:22"); assertThat(sshTunnelingConfiguration.getAuthenticationMethod()).isEqualTo(AuthenticationMethod.PRIVATE_KEY); assertThat(sshTunnelingConfiguration.getPrivateKeyPath()).isEqualTo("/Users/myself/.ssh/id_rsa"); assertThat(sshTunnelingConfiguration.getProxyUser()).isEqualTo("john.doe"); assertThat(sshTunnelingConfiguration.getProxyPassword()).isEqualTo("mySecuredPassphrase"); }
@RunsInEDT @Override @Nonnull public JLabelFixture label() { return new JLabelFixture(robot(), findByType(JLabel.class)); }
/** * Asserts that the text of this fixture's {@code JLabel} matches the given regular expression pattern. * * @param pattern the regular expression pattern to match. * @return this fixture. * @throws AssertionError if the text of this fixture's {@code JLabel} does not match the given regular expression * pattern. * @throws NullPointerException if the given regular expression pattern is {@code null}. */ @Override @Nonnull public JLabelFixture requireText(@Nonnull Pattern pattern) { driver().requireText(target(), pattern); return this; } }
@Test public void validateFormWithSSHTunnelingAndPasswordAuthMethod() { frameFixture.textBox("labelField").setText("MyServer"); frameFixture.textBox("serverUrlsField").setText("localhost:25"); frameFixture.tabbedPane("tabbedSettings") .selectTab("SSH"); frameFixture.textBox("sshProxyUrlField").setText("remotehost:22"); frameFixture.comboBox("sshAuthenticationMethodComboBox").selectItem("Password"); frameFixture.label("passLabel").requireText("Password:"); frameFixture.panel(new TextFieldWithBrowseButtonGenericTypeMatcher("sshPrivateKeyPathComponent")).requireNotVisible(); frameFixture.textBox("sshProxyUsernameField").setText("john.doe"); frameFixture.textBox("sshProxyPasswordField").setText("myPassword"); ServerConfiguration configuration = new ServerConfiguration(); configurationPanel.applyConfigurationData(configuration); assertThat(configuration.getServerUrls()).containsExactly("localhost:25"); SshTunnelingConfiguration sshTunnelingConfiguration = configuration.getSshTunnelingConfiguration(); assertThat(sshTunnelingConfiguration).isNotNull(); assertThat(sshTunnelingConfiguration.getProxyUrl()).isEqualTo("remotehost:22"); assertThat(sshTunnelingConfiguration.getAuthenticationMethod()).isEqualTo(AuthenticationMethod.PASSWORD); assertThat(sshTunnelingConfiguration.getProxyUser()).isEqualTo("john.doe"); assertThat(sshTunnelingConfiguration.getPrivateKeyPath()).isNull(); assertThat(sshTunnelingConfiguration.getProxyPassword()).isEqualTo("myPassword"); }