Search in sources :

Example 21 with ServerResourceViewModel

use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.

the class ServerResourceViewModelWithReplicationControllerTest method setUp.

@Before
public void setUp() {
    this.connection = ResourceMocks.create3ProjectsConnection();
    ConnectionsRegistrySingleton.getInstance().add(connection);
    this.model = new ServerResourceViewModel(this.selectedReplicationController = ResourceMocks.PROJECT5_REPLICATINCONTROLLERS[0], connection);
    model.loadResources();
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) Before(org.junit.Before)

Example 22 with ServerResourceViewModel

use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.

the class ServerResourceViewModelWithServiceTest method shouldNotLoadResourcesBeforeBeingToldTo.

@Test
public void shouldNotLoadResourcesBeforeBeingToldTo() {
    // given
    Connection connection = ResourceMocks.createConnection("http://10.1.2.2:8443", "dev@paas.redhat.com");
    new ServerResourceViewModel(connection);
    // when
    // then
    verify(connection, never()).getResources(any());
    verify(connection, never()).getResources(any(), any());
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) Connection(org.jboss.tools.openshift.core.connection.Connection) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection) Test(org.junit.Test)

Example 23 with ServerResourceViewModel

use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.

the class ServerResourceViewModelWithServiceTest method setUp.

@Before
public void setUp() {
    this.connection = ResourceMocks.create3ProjectsConnection();
    ConnectionsRegistrySingleton.getInstance().add(connection);
    this.model = new ServerResourceViewModel(this.selectedService = ResourceMocks.PROJECT2_SERVICES[1], connection);
    model.loadResources();
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) Before(org.junit.Before)

Example 24 with ServerResourceViewModel

use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.

the class ServerResourceViewModelWithServiceTest method shouldSetNewConnectionIfLoadResourcesWithConnection.

@Test
public void shouldSetNewConnectionIfLoadResourcesWithConnection() {
    // given
    ServerResourceViewModel model = new ServerResourceViewModel(null);
    model.loadResources();
    assertThat(model.getConnection()).isNull();
    // when
    model.loadResources(connection);
    // then
    assertThat(model.getConnection()).isEqualTo(connection);
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) Test(org.junit.Test)

Aggregations

ServerResourceViewModel (org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel)24 Test (org.junit.Test)21 IResource (com.openshift.restclient.model.IResource)9 IConnection (org.jboss.tools.openshift.common.core.connection.IConnection)6 Connection (org.jboss.tools.openshift.core.connection.Connection)6 Before (org.junit.Before)3 IDeploymentConfig (com.openshift.restclient.model.IDeploymentConfig)1 IReplicationController (com.openshift.restclient.model.IReplicationController)1 IService (com.openshift.restclient.model.IService)1