Package com.xebialabs.overthere

Examples of com.xebialabs.overthere.ConnectionOptions


public abstract class ItestsBase6Windows extends ItestsBase5Unix {

    @Test
    @Assumption(methods = {"onWindows", "onlyCifsWinrm"})
    public void shouldThrowValidationMessageWhenTryingToConnectWithOldStyleWindowsDomainAccount() {
        ConnectionOptions incorrectUserNameOptions = new ConnectionOptions(options);
        incorrectUserNameOptions.set(USERNAME, "DOMAIN\\user");
        try {
            Overthere.getConnection(protocol, incorrectUserNameOptions);
            fail("Expected not to be able to connect with an old-style Windows domain account");
        } catch (IllegalArgumentException expected) {
            assertThat(expected.getMessage(), containsString("Cannot create a " + CIFS_PROTOCOL + ":" + WINRM_INTERNAL.toString().toLowerCase() + " connection with an old-style Windows domain account"));
View Full Code Here


    }

    @Test
    @Assumption(methods = {"onWindows", "onlyCifsTelnet"})
    public void shouldThrowValidationMessageWhenTryingToConnectWithNewStyleWindowsDomainAccount() {
        ConnectionOptions incorrectUserNameOptions = new ConnectionOptions(options);
        incorrectUserNameOptions.set(USERNAME, "user@DOMAIN");
        try {
            Overthere.getConnection(protocol, incorrectUserNameOptions);
            fail("Expected not to be able to connect with a new-style Windows domain account");
        } catch (IllegalArgumentException expected) {
            assertThat(expected.getMessage(), containsString("Cannot create a " + CIFS_PROTOCOL + ":" + TELNET.toString().toLowerCase() + " connection with a new-style Windows domain account"));
View Full Code Here

        return LOCAL_PROTOCOL;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected ConnectionOptions getOptions() {
        ConnectionOptions options = new ConnectionOptions();
        options.set(TEMPORARY_DIRECTORY_PATH, temp.getRoot().getPath());
        return options;
    }
View Full Code Here

    }

    private static LocalConnection createConnection() {
        // Creating LocalConnection directly instead of through Overthere.getConnection() to prevent log messages from
        // appearing
        LocalConnection localConnectionThatWillNeverBeDisconnected = new LocalConnection(LOCAL_PROTOCOL, new ConnectionOptions());
        // FIXME: Creating a LocalConnection on the fly does not honour the original TEMPORARY_DIRECTORY_PATH (tmp)
        // setting
        return localConnectionThatWillNeverBeDisconnected;
    }
View Full Code Here

    public LocalConnection(String protocol, ConnectionOptions options) {
        this(protocol, options, new DefaultAddressPortMapper());
    }

    private static ConnectionOptions fixOptions(ConnectionOptions options) {
        options = new ConnectionOptions(options);
        options.set(OPERATING_SYSTEM, getLocalHostOperatingSystemFamily());
        if (options.getOptional(TEMPORARY_DIRECTORY_PATH) == null) {
            options.set(TEMPORARY_DIRECTORY_PATH, System.getProperty("java.io.tmpdir"));
        }
        return options;
View Full Code Here

    /**
     * Creates a connection to the local host.
     */
    public static OverthereConnection getLocalConnection() {
        return Overthere.getConnection(LOCAL_PROTOCOL, new ConnectionOptions());
    }
View Full Code Here

        return SSH_PROTOCOL;
    }

    @Override
    protected ConnectionOptions getOptions() {
        ConnectionOptions options = new ConnectionOptions();
        options.set(OPERATING_SYSTEM, WINDOWS);
        options.set(CONNECTION_TYPE, SFTP_CYGWIN);
        options.set(ADDRESS, WindowsCloudHostListener.getHost().getHostName());
        options.set(PORT, 22);
        options.set(USERNAME, REGULAR_USER_ITEST_USERNAME);
        options.set(PASSWORD, REGULAR_USER_ITEST_PASSWORD);
        return options;
    }
View Full Code Here

    }

    @Test
    @Assumption(methods = {"notLocal", "notCifs"})
    public void shouldNotConnectWithIncorrectUsername() {
        ConnectionOptions incorrectUserNameOptions = new ConnectionOptions(options);
        incorrectUserNameOptions.set(USERNAME, "an-incorrect-username");
        try {
            Overthere.getConnection(protocol, incorrectUserNameOptions);
            fail("Expected not to be able to connect with an incorrect username");
        } catch (RuntimeIOException expected) {
        }
View Full Code Here

    private ConnectionOptions connectionOptions;

    @BeforeMethod
    public void init() {
        MockitoAnnotations.initMocks(this);
        connectionOptions = new ConnectionOptions();
        connectionOptions.set(CONNECTION_TYPE, SFTP);
        connectionOptions.set(OPERATING_SYSTEM, UNIX);
        connectionOptions.set(ADDRESS, "nowhere.example.com");
        connectionOptions.set(USERNAME, "some-user");
    }
View Full Code Here

import com.xebialabs.overthere.OverthereProcess;

public class StartProcess {

  public static void main(String[] args) throws InterruptedException, IOException {
    ConnectionOptions options = new ConnectionOptions();
    options.set(ADDRESS, "unix-box");
    options.set(USERNAME, "demo");
    options.set(PASSWORD, "secret");
    options.set(OPERATING_SYSTEM, UNIX);
    options.set(CONNECTION_TYPE, SFTP);

    OverthereConnection connection = Overthere.getConnection("ssh", options);
    try {
      OverthereProcess process = connection.startProcess(CmdLine.build("cat", "/etc/motd"));
      BufferedReader stdout = new BufferedReader(new InputStreamReader(process.getStdout()));
View Full Code Here

TOP

Related Classes of com.xebialabs.overthere.ConnectionOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.