Search in sources :

Example 61 with IResource

use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.

the class OpenShiftResourceUniqueIdTest method should_return_correct_correct_projectname.

@Test
public void should_return_correct_correct_projectname() {
    // given
    IResource resource = ResourceMocks.PROJECT2_SERVICES[1];
    String uniqueId = OpenShiftResourceUniqueId.get(resource);
    // when
    String projectName = OpenShiftResourceUniqueId.getProjectName(uniqueId);
    // then
    assertThat(projectName).isEqualTo(resource.getProject().getName());
}
Also used : IResource(com.openshift.restclient.model.IResource) Test(org.junit.Test)

Example 62 with IResource

use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.

the class OpenShiftResourceUniqueIdTest method should_return_null_if_resource_has_no_name.

@Test
public void should_return_null_if_resource_has_no_name() {
    // given
    IResource resource = ResourceMocks.createProject(null);
    // when
    String uniqueId = OpenShiftResourceUniqueId.get(resource);
    // then
    assertThat(uniqueId).isNull();
}
Also used : IResource(com.openshift.restclient.model.IResource) Test(org.junit.Test)

Example 63 with IResource

use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.

the class ServerResourceViewModelWithServiceTest method shouldReturnResourceIfResourcesAreLoaded.

@Test
public void shouldReturnResourceIfResourcesAreLoaded() {
    // given
    model.loadResources();
    // when
    IResource resource = model.getResource();
    // then
    assertThat(resource).isEqualTo(selectedService);
}
Also used : IResource(com.openshift.restclient.model.IResource) Test(org.junit.Test)

Example 64 with IResource

use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.

the class ServerSettingsWizardPageModelTest method should_set_server_service_when_updating_server.

@Test
public void should_set_server_service_when_updating_server() throws CoreException {
    // given
    model.setSelectDefaultRoute(true);
    IResource resource = model.getResource();
    assertThat(resource).isNotNull();
    // when
    model.updateServer();
    // then
    verify(server, atLeastOnce()).setAttribute(eq(OpenShiftServerUtils.ATTR_SERVICE), anyString());
    verify(model, atLeastOnce()).updateServer(anyString(), eq(resource), anyString(), anyString(), anyString(), anyString(), anyString(), anyString(), any(org.eclipse.core.resources.IProject.class));
}
Also used : IResource(com.openshift.restclient.model.IResource) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 65 with IResource

use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.

the class ServerSettingsWizardPageModelTest method shouldReturn1stServiceIfNoServiceMatchesGitRemoteOfProjectModelWasInitializedWith.

@Test
public void shouldReturn1stServiceIfNoServiceMatchesGitRemoteOfProjectModelWasInitializedWith() {
    // given
    ServerSettingsWizardPageModel model = createModel(null, null, project1, Arrays.asList(project1, project2, project3, project4), connection);
    // when
    IResource resource = model.getResource();
    // then
    assertThat(resource).isEqualTo(ResourceMocks.PROJECT2_SERVICES[0]);
}
Also used : ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) 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