use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithServiceTest method shouldReturnNullServiceIfNoConnectionIsSet.
@Test
public void shouldReturnNullServiceIfNoConnectionIsSet() {
// given
ServerResourceViewModel model = new ServerResourceViewModel(null);
model.loadResources();
// when
IResource resource = model.getResource();
// then
assertThat(resource).isNull();
}
use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithDeploymentConfigTest 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);
}
use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithDeploymentConfigTest method shouldReturnNullResourceIfResourcesNotLoaded.
@Test
public void shouldReturnNullResourceIfResourcesNotLoaded() {
// given
ServerResourceViewModel model = new ServerResourceViewModel(null);
// when
IResource resource = model.getResource();
// then
assertThat(resource).isNull();
}
use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithReplicationControllerTest 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());
}
use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithReplicationControllerTest method shouldSetNewConnectionIfLoadingWithConnection.
@Test
public void shouldSetNewConnectionIfLoadingWithConnection() {
// given
ServerResourceViewModel model = new ServerResourceViewModel(null);
model.loadResources();
assertThat(model.getConnection()).isNull();
// when
model.loadResources(connection);
// then
assertThat(model.getConnection()).isEqualTo(connection);
}
Aggregations