Search in sources :

Example 1 with Password

use of com.oracle.bedrock.runtime.remote.Password in project oracle-bedrock by coherence-community.

the class DockerMachinePlatform method getRemotePlatform.

/**
 * Obtain a {@link RemotePlatform} on the Docker machine instance.
 *
 * @param options  the {@link Option}s
 *
 * @return a {@link RemotePlatform} on the Docker machine instance
 */
public RemotePlatform getRemotePlatform(Option... options) {
    String name = getName();
    InetAddress address = machine.getAddress(name);
    OptionsByType platformOptions = OptionsByType.of(this.getOptions()).add(StrictHostChecking.disabled()).addAll(options);
    return new RemotePlatform(name, address, "docker", new Password("tcuser"), platformOptions.asArray());
}
Also used : InetAddress(java.net.InetAddress) OptionsByType(com.oracle.bedrock.OptionsByType) RemotePlatform(com.oracle.bedrock.runtime.remote.RemotePlatform) Password(com.oracle.bedrock.runtime.remote.Password)

Example 2 with Password

use of com.oracle.bedrock.runtime.remote.Password in project oracle-bedrock by coherence-community.

the class WindowsRemoteTerminalTest method shouldMakeDirectories.

@Test
public void shouldMakeDirectories() throws Exception {
    String userName = "Bob";
    Authentication authentication = new Password("secret");
    String hostName = "foo.com";
    int port = 1234;
    OptionsByType optionsByType = OptionsByType.empty();
    WindowsSession session = mock(WindowsSession.class);
    RemotePlatform platform = mock(RemotePlatform.class);
    when(platform.getUserName()).thenReturn(userName);
    when(platform.getAuthentication()).thenReturn(authentication);
    when(platform.getAddress()).thenReturn(InetAddress.getByName(hostName));
    when(platform.getPort()).thenReturn(port);
    WindowsRemoteTerminal shell = new WindowsRemoteTerminalStub(platform, session);
    shell.makeDirectories("dir1\\dir2", optionsByType);
    InOrder inOrder = inOrder(session);
    inOrder.verify(session).connect();
    inOrder.verify(session).execute(eq("mkdir"), eq(Arrays.asList("dir1\\dir2")), any(InputStream.class), any(OutputStream.class), any(OutputStream.class));
}
Also used : InOrder(org.mockito.InOrder) HttpBasedAuthentication(com.oracle.bedrock.runtime.remote.http.HttpBasedAuthentication) Authentication(com.oracle.bedrock.runtime.remote.Authentication) InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) OptionsByType(com.oracle.bedrock.OptionsByType) RemotePlatform(com.oracle.bedrock.runtime.remote.RemotePlatform) Password(com.oracle.bedrock.runtime.remote.Password) Test(org.junit.Test)

Example 3 with Password

use of com.oracle.bedrock.runtime.remote.Password in project oracle-bedrock by coherence-community.

the class WindowsRemoteTerminalTest method shouldCreateWindowsSession.

@Test
public void shouldCreateWindowsSession() throws Exception {
    String userName = "Bob";
    HttpBasedAuthentication authentication = new Password("secret");
    String hostName = "foo.com";
    int port = 1234;
    RemotePlatform platform = mock(RemotePlatform.class);
    when(platform.getUserName()).thenReturn(userName);
    when(platform.getAuthentication()).thenReturn(authentication);
    when(platform.getAddress()).thenReturn(InetAddress.getByName(hostName));
    when(platform.getPort()).thenReturn(port);
    WindowsRemoteTerminal shell = new WindowsRemoteTerminal(platform);
    WindowsSession session = shell.createSession();
    assertThat(session, is(notNullValue()));
    SoapConnection soapConnection = session.getSoapConnection();
    assertThat(soapConnection.getUrl().getHost(), is("foo.com"));
    assertThat(soapConnection.getUrl().getPort(), is(1234));
    assertThat(soapConnection.getUserName(), is("Bob"));
    assertThat(soapConnection.getAuthentication(), is(sameInstance(authentication)));
}
Also used : RemotePlatform(com.oracle.bedrock.runtime.remote.RemotePlatform) HttpBasedAuthentication(com.oracle.bedrock.runtime.remote.http.HttpBasedAuthentication) Password(com.oracle.bedrock.runtime.remote.Password) Test(org.junit.Test)

Aggregations

Password (com.oracle.bedrock.runtime.remote.Password)3 RemotePlatform (com.oracle.bedrock.runtime.remote.RemotePlatform)3 OptionsByType (com.oracle.bedrock.OptionsByType)2 HttpBasedAuthentication (com.oracle.bedrock.runtime.remote.http.HttpBasedAuthentication)2 Test (org.junit.Test)2 Authentication (com.oracle.bedrock.runtime.remote.Authentication)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 InetAddress (java.net.InetAddress)1 InOrder (org.mockito.InOrder)1