Search in sources :

Example 1 with ServerResourceViewModel

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

the class ServerResourceViewModelWithReplicationControllerTest method shouldReturnNullServiceIfNoConnectionIsSet.

@Test
public void shouldReturnNullServiceIfNoConnectionIsSet() {
    // given
    ServerResourceViewModel model = new ServerResourceViewModel(null);
    model.loadResources();
    // when
    IResource resource = model.getResource();
    // then
    assertThat(resource).isNull();
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) IResource(com.openshift.restclient.model.IResource) Test(org.junit.Test)

Example 2 with ServerResourceViewModel

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

the class ServerResourceViewModelWithServiceTest method shouldReturnNullResourceIfResourcesNotLoaded.

@Test
public void shouldReturnNullResourceIfResourcesNotLoaded() {
    // given
    ServerResourceViewModel model = new ServerResourceViewModel(null);
    // when
    IResource resource = model.getResource();
    // then
    assertThat(resource).isNull();
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) IResource(com.openshift.restclient.model.IResource) Test(org.junit.Test)

Example 3 with ServerResourceViewModel

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

the class ServerResourceViewModelWithServiceTest method shouldLoadResourcesWhenToldTo.

@Test
public void shouldLoadResourcesWhenToldTo() {
    // given
    Connection connection = ResourceMocks.createConnection("http://10.1.2.2:8443", "dev@paas.redhat.com");
    ServerResourceViewModel model = new ServerResourceViewModel(connection);
    model.loadResources();
    // when
    // then
    verify(connection, atLeastOnce()).getResources(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 4 with ServerResourceViewModel

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

the class ServerResourceViewModelWithDeploymentConfigTest 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 5 with ServerResourceViewModel

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

the class ServerResourceViewModelWithDeploymentConfigTest method shouldReturnNullServiceIfNoConnectionIsSet.

@Test
public void shouldReturnNullServiceIfNoConnectionIsSet() {
    // given
    ServerResourceViewModel model = new ServerResourceViewModel(null);
    model.loadResources();
    // when
    IResource resource = model.getResource();
    // then
    assertThat(resource).isNull();
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) IResource(com.openshift.restclient.model.IResource) 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