use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionTest method should_not_equals_if_different_user.
@Test
public void should_not_equals_if_different_user() throws Exception {
// given
Connection two = new Connection(new ClientBuilder("https://localhost:8443").build(), null);
two.setUsername("bar");
// when
// then
assertThat(connection).isNotEqualTo(two);
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionPersistencyTest method shouldLoadUsernamesAsDefaultHostConnection.
@Ignore("no default server for OpenShift 3 yet")
@Test
public void shouldLoadUsernamesAsDefaultHostConnection() {
// pre-condition
ConnectionPersistency persistency = new ConnectionPersistency() {
@Override
protected String[] loadPersisted() {
return new String[] { "bingobongo@redhat.com" };
}
};
// operations
Collection<Connection> connections = persistency.load();
// verification
assertEquals(1, connections.size());
Connection connection = connections.iterator().next();
assertTrue(connection.isDefaultHost());
assertEquals("bingobongo@redhat.com", connection.getUsername());
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionWizardPageModelTest method should_disable_promptCredentials_on_edited_connection_when_disposing_model_and_was_disabled_before_editing_it.
@Test
public void should_disable_promptCredentials_on_edited_connection_when_disposing_model_and_was_disabled_before_editing_it() {
// given prompt is disabled once connection is being edited
Connection connection = mockOS3Connection("foo", "https://localhost");
doReturn(false).when(connection).isEnablePromptCredentials();
allConnections.add(connection);
ConnectionWizardPageModel model = new TestableConnectionWizardPageModel(connection, allConnections, connection.getClass(), true, wizardModel);
verify(connection).enablePromptCredentials(false);
// when
model.dispose();
// then disable 2x, once when editing, 2nd time when disposing
verify(connection, times(2)).enablePromptCredentials(false);
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionTest method should_credentialsEqual_for_cloned_connection.
@Test
public void should_credentialsEqual_for_cloned_connection() throws Exception {
// given
// when
Connection two = (Connection) connection.clone();
// then
assertThat(two).isEqualTo(connection);
assertThat(two.credentialsEqual(connection)).isTrue();
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionTest method setup.
@Before
public void setup() throws Exception {
this.client = createClient("foo", "42", "https://localhost:8443");
this.connection = new Connection(client, prompter);
this.testableConnection = createTestableConnection("42", client, prompter);
doReturn(createClient("foo", "42", "https://localhost:8443")).when(client).clone();
}
Aggregations