use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithReplicationControllerTest 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 shouldReturn1stServiceInListIfInitializedServiceIsNotInListOfAllReplicationControllers.
@Test
public void shouldReturn1stServiceInListIfInitializedServiceIsNotInListOfAllReplicationControllers() {
// given
IReplicationController otherReplicationController = ResourceMocks.createResource(IReplicationController.class, ResourceKind.REPLICATION_CONTROLLER);
ServerResourceViewModel model = new ServerResourceViewModel(otherReplicationController, connection);
model.loadResources();
// when
IResource service = model.getResource();
// then
assertThat(service).isEqualTo(ResourceMocks.PROJECT2_SERVICES[0]);
}
use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithDeploymentConfigTest 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 ServerResourceViewModelWithDeploymentConfigTest method shouldReturn1stServiceInListIfInitializedServiceIsNotInListOfAllDeploymentConfigs.
@Test
public void shouldReturn1stServiceInListIfInitializedServiceIsNotInListOfAllDeploymentConfigs() {
// given
IDeploymentConfig otherDeploymentConfig = ResourceMocks.createResource(IDeploymentConfig.class, ResourceKind.DEPLOYMENT_CONFIG);
ServerResourceViewModel model = new ServerResourceViewModel(otherDeploymentConfig, connection);
model.loadResources();
// when
IResource service = model.getResource();
// then
assertThat(service).isEqualTo(ResourceMocks.PROJECT2_SERVICES[0]);
}
use of org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithReplicationControllerTest 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);
}
Aggregations