Search in sources :

Example 11 with IResource

use of com.openshift.restclient.model.IResource 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 12 with IResource

use of com.openshift.restclient.model.IResource 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)

Example 13 with IResource

use of com.openshift.restclient.model.IResource 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();
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) IResource(com.openshift.restclient.model.IResource) Test(org.junit.Test)

Example 14 with IResource

use of com.openshift.restclient.model.IResource 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]);
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) IReplicationController(com.openshift.restclient.model.IReplicationController) IResource(com.openshift.restclient.model.IResource) Test(org.junit.Test)

Example 15 with IResource

use of com.openshift.restclient.model.IResource 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]);
}
Also used : ServerResourceViewModel(org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel) IDeploymentConfig(com.openshift.restclient.model.IDeploymentConfig) IResource(com.openshift.restclient.model.IResource) Test(org.junit.Test)

Aggregations

IResource (com.openshift.restclient.model.IResource)101 Test (org.junit.Test)32 Connection (org.jboss.tools.openshift.core.connection.Connection)27 IProject (com.openshift.restclient.model.IProject)14 IStatus (org.eclipse.core.runtime.IStatus)12 Collection (java.util.Collection)10 ServerResourceViewModel (org.jboss.tools.openshift.internal.ui.server.ServerResourceViewModel)9 IReplicationController (com.openshift.restclient.model.IReplicationController)8 IService (com.openshift.restclient.model.IService)8 ArrayList (java.util.ArrayList)8 CoreException (org.eclipse.core.runtime.CoreException)8 IDeploymentConfig (com.openshift.restclient.model.IDeploymentConfig)7 Status (org.eclipse.core.runtime.Status)7 ISelection (org.eclipse.jface.viewers.ISelection)7 OpenShiftException (com.openshift.restclient.OpenShiftException)6 ResourceKind (com.openshift.restclient.ResourceKind)6 IPod (com.openshift.restclient.model.IPod)6 List (java.util.List)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 IBuildConfig (com.openshift.restclient.model.IBuildConfig)5