use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionTest method should_add_extendedProperty.
@Test
public void should_add_extendedProperty() throws Exception {
// given
Connection connection = new Connection("http://localhost", null, null);
assertThat(connection.getExtendedProperties()).isEmpty();
// when
connection.setExtendedProperty("foo", "bar");
// then
assertThat(connection.getExtendedProperties()).hasSize(1);
assertThat(connection.getExtendedProperties()).containsEntry("foo", "bar");
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionTest method should_update_connection_by_connection.
@Test
public void should_update_connection_by_connection() throws Exception {
// pre-conditions
Connection connection = new Connection("http://localhost:8443", null, null);
connection.setUsername("foo");
connection.setPassword("bar");
connection.setToken("000000000000111111111");
connection.setRememberPassword(true);
connection.setRememberToken(false);
String newUsername = "shadowman";
String newHost = "http://www.redhat.com";
String newPassword = "1q2w3e";
String newToken = "1234567890abcdefghijklmz";
boolean newRememberPassword = false;
boolean newRememberToken = true;
Connection updatingConnection = new Connection(newHost, null, null);
updatingConnection.setUsername(newUsername);
updatingConnection.setPassword(newPassword);
updatingConnection.setRememberPassword(newRememberPassword);
updatingConnection.setToken(newToken);
updatingConnection.setRememberToken(newRememberToken);
// operations
connection.update(updatingConnection);
// verifications
assertThat(connection.getHost()).isEqualTo(newHost);
assertThat(connection.getUsername()).isEqualTo(newUsername);
assertThat(connection.getPassword()).isEqualTo(newPassword);
assertThat(connection.getToken()).isEqualTo(newToken);
assertThat(connection.isRememberPassword()).isEqualTo(newRememberPassword);
assertThat(connection.isRememberToken()).isEqualTo(newRememberToken);
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionTest method should_not_equals_if_different_host.
@Test
public void should_not_equals_if_different_host() throws Exception {
// given
Connection two = new Connection("https://openshift.redhat.com:8443", null, null);
two.setUsername("foo");
// when
// then
assertThat(connection).isNotEqualTo(two);
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class LazyCredentialsPrompterTest method setup.
@Before
public void setup() throws MalformedURLException {
when(client.getBaseURL()).thenReturn(new URL("https://localhost:8443"));
this.lazyPrompter = spy(new LazyCredentialsPrompter());
this.connection = new Connection(client.getBaseURL().toString(), lazyPrompter, null);
when(permissiveExtensionPrompter.promptAndAuthenticate(connection, null)).thenReturn(true);
when(denyingExtensionPrompter.promptAndAuthenticate(connection, null)).thenReturn(true);
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionPersistencyTest method setup.
@Before
public void setup() throws Exception {
this.connection1 = new Connection("https://localhost:8442", null, null);
connection1.setUsername("foo");
connection1.setToken("bar");
this.connection2 = new Connection("https://localhost:8443", null, null);
connection2.setUsername("bar");
connection2.setToken("foo");
persistency = new TestConnectionPersistency();
}
Aggregations