Package com.xebialabs.overthere

Examples of com.xebialabs.overthere.ConnectionOptions


import com.xebialabs.overthere.OverthereFile;

public class ManipulateFile {

  public static void main(String[] args) throws 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 {
      connection.execute(CmdLine.build("cp", "/etc/motd", "/tmp/motd1"));
      OverthereFile motd1 = connection.getFile("/tmp/motd1");
      OverthereFile motd2 = connection.getFile("/tmp/motd2");
View Full Code Here



public class ReadFile {

  public static void main(String[] args) throws 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 {
      OverthereFile motd = connection.getFile("/etc/motd");
      BufferedReader r = new BufferedReader(new InputStreamReader(motd.getInputStream()));
      try {
View Full Code Here

public class ExecuteOnWindows {

  public static void main(String[] args) {

    ConnectionOptions options = new ConnectionOptions();
    options.set(ADDRESS, "windows-box");
    options.set(USERNAME, "Administrator");
    options.set(PASSWORD, "secret");
    options.set(OPERATING_SYSTEM, WINDOWS);
    options.set(CONNECTION_TYPE, TELNET);
    OverthereConnection connection = Overthere.getConnection("cifs", options);

    try {
      connection.execute(CmdLine.build("type", "\\windows\\system32\\drivers\\etc\\hosts"));
    } finally {
View Full Code Here

import com.xebialabs.overthere.OverthereConnection;

public class ExecuteOnUnix {

  public static void main(String[] args) {
    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 {
      connection.execute(CmdLine.build("cat", "/etc/motd"));
    } finally {
      connection.close();
View Full Code Here

        this.path = path;
        this.contents = contents;
    }

    private static ByteArrayConnection createConnection() {
        ConnectionOptions options = new ConnectionOptions();
        OperatingSystemFamily os = getLocalHostOperatingSystemFamily();
        options.set(OPERATING_SYSTEM, os);
        options.set(TEMPORARY_DIRECTORY_PATH, os.getDefaultTemporaryDirectoryPath());
        return new ByteArrayConnection("byte_array", options);
    }
View Full Code Here

    private void connectToWinrsProxy(ConnectionOptions options) {
        logger.debug("Connecting to winrs proxy");

        String winrsProxyProtocol = options.get(WINRS_PROXY_PROTOCOL, WINRS_PROXY_PROTOCOL_DEFAULT);
        ConnectionOptions winrsProxyConnectionOptions = options.get(WINRS_PROXY_CONNECTION_OPTIONS, new ConnectionOptions());
        winrsProxyConnection = Overthere.getConnection(winrsProxyProtocol, winrsProxyConnectionOptions);
    }
View Full Code Here

        super(type, fixOptions(options), mapper);
        checkArgument(os == WINDOWS, "Cannot create a " + SSH_PROTOCOL + ":%s connection to a host that is not running Windows", sshConnectionType.toString().toLowerCase());
    }

    private static ConnectionOptions fixOptions(final ConnectionOptions options) {
        ConnectionOptions fixedOptions = new ConnectionOptions(options);
        fixedOptions.set(FILE_COPY_COMMAND_FOR_WINDOWS, "cmd /c " + fixedOptions.get(FILE_COPY_COMMAND_FOR_WINDOWS, FILE_COPY_COMMAND_FOR_WINDOWS_DEFAULT));
        return fixedOptions;
    }
View Full Code Here

    }

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

    private ConnectionOptions options;

    @BeforeMethod
    public void setupOptions() {
        options = new ConnectionOptions();
        options.set(OPERATING_SYSTEM, WINDOWS);
        options.set(CONNECTION_TYPE, WINRM_INTERNAL);
        options.set(PASSWORD, "foobar");
        options.set(PORT, PORT_DEFAULT_WINRM_HTTP);
        options.set(CIFS_PORT, CIFS_PORT_DEFAULT);
View Full Code Here

        return SSH_PROTOCOL;
    }

    @Override
    protected ConnectionOptions getOptions() {
        ConnectionOptions options = new ConnectionOptions();
        options.set(OPERATING_SYSTEM, UNIX);
        options.set(CONNECTION_TYPE, INTERACTIVE_SUDO);
        options.set(ADDRESS, UnixCloudHostListener.getHost().getHostName());
        options.set(PORT, 22);
        options.set(USERNAME, "untrusted");
        options.set(PASSWORD, "zePVB,%EU84i");
        options.set(SUDO_USERNAME, "overthere");
        options.set(SUDO_PASSWORD_PROMPT_REGEX, ".*[P|p]assword.*:");
        options.set(ALLOCATE_DEFAULT_PTY, true);
        options.set(SUDO_OVERRIDE_UMASK, true);
        return options;
    }
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.