use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionTest method should_not_credentialsEqual_if_different_token.
@Test
public void should_not_credentialsEqual_if_different_token() throws Exception {
// given
connection = new Connection(new ClientBuilder("https://someplace").withUserName("foo").withPassword("bar").usingToken("mytoken").build(), null);
Connection two = (Connection) connection.clone();
assertThat(two).isEqualTo(connection);
assertThat(two.credentialsEqual(connection)).isTrue();
// when
two.setToken("tokenTwo");
// then
assertThat(two).isEqualTo(connection);
assertThat(two.credentialsEqual(connection)).isFalse();
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class ConnectionTest method should_not_credentialsEqual_if_different_password.
@Test
public void should_not_credentialsEqual_if_different_password() throws Exception {
// given
Connection two = (Connection) connection.clone();
// when
two.setPassword("aPassword123");
// then
assertThat(two).isEqualTo(connection);
assertThat(two.credentialsEqual(connection)).isFalse();
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class OpenShiftExplorerContentProviderTest method modelShouldHaveConnectionThatIsAddedInRegistry.
@Test
public void modelShouldHaveConnectionThatIsAddedInRegistry() throws MalformedURLException {
// given
int numOfConnections = model.getConnections().size();
Connection connection2 = ConnectionTestUtils.createConnection("aUser", "123456", "https://127.0.0.1:8080");
// when
registry.add(connection2);
// then
assertThat(model.getConnections()).hasSize(numOfConnections + 1);
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class OpenShiftExplorerLabelProviderTest method getStyledTextForAConnection.
@Test
public void getStyledTextForAConnection() throws Exception {
Connection connection = ConnectionTestUtils.createConnection("username", "token", client.getBaseURL().toString());
connection.setUsername("foo@bar.com");
String exp = String.format("foo@bar.com %s", client.getBaseURL().toString());
assertEquals("Exp. a connection to display its base URL", exp, provider.getStyledText(connection).getString());
}
use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.
the class OpenShiftExplorerLabelProviderTest method getStyledTextForAConnectionWithoutUserName.
@Test
public void getStyledTextForAConnectionWithoutUserName() throws Exception {
Connection connection = ConnectionTestUtils.createConnection(null, "token", client.getBaseURL().toString());
String exp = String.format("<unknown user> %s", client.getBaseURL().toString());
assertEquals("Exp. a connection to display its base URL", exp, provider.getStyledText(connection).getString());
}
Aggregations