use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithReplicationControllerTest 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());
}
use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithDeploymentConfigTest method setUp.
@Before
public void setUp() {
this.connection = ResourceMocks.create3ProjectsConnection();
ConnectionsRegistrySingleton.getInstance().add(connection);
this.model = new ServerResourceViewModel(this.selectedDeploymentConfig = ResourceMocks.PROJECT4_DEPLOYMENTCONFIGS[0], connection);
model.loadResources();
}
use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithDeploymentConfigTest 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 ServerResourceViewModelWithServiceTest 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);
}
use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithServiceTest method shouldReturn1stServiceInListIfInitializedServiceIsNotInListOfAllServices.
@Test
public void shouldReturn1stServiceInListIfInitializedServiceIsNotInListOfAllServices() {
// given
IService otherService = ResourceMocks.createResource(IService.class, ResourceKind.SERVICE);
ServerResourceViewModel model = new ServerResourceViewModel(otherService, connection);
model.loadResources();
// when
IResource service = model.getResource();
// then
assertThat(service).isEqualTo(ResourceMocks.PROJECT2_SERVICES[0]);
}
Aggregations