Search in sources :

Example 26 with Connection

use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.

the class OpenShiftServerUtilsTest method should_not_return_connection_from_server_given_malformed_url.

@Test
public void should_not_return_connection_from_server_given_malformed_url() {
    // given
    doReturn("htt:/bogus").when(server).getAttribute(eq(OpenShiftServerUtils.ATTR_CONNECTIONURL), anyString());
    // when
    Connection connection = OpenShiftServerUtils.getConnection(server);
    // then
    assertThat(connection).isNull();
}
Also used : Connection(org.jboss.tools.openshift.core.connection.Connection) Test(org.junit.Test)

Example 27 with Connection

use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.

the class OpenShiftServerUtilsTest method should_not_return_connection_from_server_given_non_registered_connection.

@Test
public void should_not_return_connection_from_server_given_non_registered_connection() {
    // given
    ConnectionsRegistrySingleton.getInstance().clear();
    // when
    Connection connection = OpenShiftServerUtils.getConnection(server);
    // then
    assertThat(connection).isNull();
}
Also used : Connection(org.jboss.tools.openshift.core.connection.Connection) Test(org.junit.Test)

Example 28 with Connection

use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.

the class OpenShiftExplorerContentProviderTest method modelShouldNotifyConnectionAddedInRegistry.

@Test
public void modelShouldNotifyConnectionAddedInRegistry() throws InterruptedException, MalformedURLException {
    // given
    Connection connection2 = ConnectionTestUtils.createConnection("anotherUser", "654321", "https://127.0.0.1:8181");
    IElementListener listener = spy(new VoidElementListener());
    model.addListener(listener);
    // when
    registry.add(connection2);
    // then
    verify(listener, timeout(10 * 1000)).elementChanged(any());
}
Also used : IElementListener(org.jboss.tools.openshift.internal.ui.models.IElementListener) Connection(org.jboss.tools.openshift.core.connection.Connection) Test(org.junit.Test)

Example 29 with Connection

use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.

the class DeployImageWizardModelTest method should_load_resources_if_were_not_loaded_yet_and_same_connection_is_set_again.

@Test
public void should_load_resources_if_were_not_loaded_yet_and_same_connection_is_set_again() {
    // JBIDE-24499
    // given
    Connection connection2 = mock(Connection.class);
    TestableDeployImageWizardModel model = createModel(project, connection2, dockerConnection);
    // not loaded yet
    verify(connection2, never()).getResources(ResourceKind.PROJECT);
    // set same connection
    model.setConnection(connection2);
    // when
    model.loadResources();
    // then
    // still load resources
    verify(connection2, times(1)).getResources(ResourceKind.PROJECT);
}
Also used : Connection(org.jboss.tools.openshift.core.connection.Connection) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) Test(org.junit.Test)

Example 30 with Connection

use of org.jboss.tools.openshift.core.connection.Connection in project jbosstools-openshift by jbosstools.

the class DeployImageWizardModelTest method should_reload_resources_if_connection_was_changed.

@Test
public void should_reload_resources_if_connection_was_changed() {
    // given
    Connection connection2 = mock(Connection.class);
    model.setConnection(connection2);
    // when
    model.loadResources();
    // then
    verify(connection2, times(1)).getResources(ResourceKind.PROJECT);
}
Also used : Connection(org.jboss.tools.openshift.core.connection.Connection) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) Test(org.junit.Test)

Aggregations

Connection (org.jboss.tools.openshift.core.connection.Connection)110 Test (org.junit.Test)48 IConnection (org.jboss.tools.openshift.common.core.connection.IConnection)30 IResource (com.openshift.restclient.model.IResource)27 IProject (com.openshift.restclient.model.IProject)18 IService (com.openshift.restclient.model.IService)11 IStatus (org.eclipse.core.runtime.IStatus)11 IDeploymentConfig (com.openshift.restclient.model.IDeploymentConfig)9 Collection (java.util.Collection)8 List (java.util.List)8 ISelection (org.eclipse.jface.viewers.ISelection)8 IPod (com.openshift.restclient.model.IPod)7 ArrayList (java.util.ArrayList)7 CoreException (org.eclipse.core.runtime.CoreException)7 OpenShiftException (com.openshift.restclient.OpenShiftException)6 ResourceKind (com.openshift.restclient.ResourceKind)6 IRoute (com.openshift.restclient.model.route.IRoute)6 MultiValidator (org.eclipse.core.databinding.validation.MultiValidator)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 Status (org.eclipse.core.runtime.Status)6