Search in sources :

Example 31 with IService

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

the class ResourceUtilsTest method shouldReturnDeploymentConfigForServiceByRCAndPodGivenServiceHasNoDCNameSelector.

@Test
public void shouldReturnDeploymentConfigForServiceByRCAndPodGivenServiceHasNoDCNameSelector() throws CoreException {
    // given
    Connection connection = ResourceMocks.create3ProjectsConnection();
    IService service = ResourceMocks.PROJECT2_SERVICES[2];
    // when
    IDeploymentConfig dc = ResourceUtils.getDeploymentConfigFor(service, connection);
    // then
    assertThat(dc).isEqualTo(ResourceMocks.PROJECT2_DEPLOYMENTCONFIGS[0]);
}
Also used : Connection(org.jboss.tools.openshift.core.connection.Connection) IDeploymentConfig(com.openshift.restclient.model.IDeploymentConfig) IService(com.openshift.restclient.model.IService) Test(org.junit.Test)

Example 32 with IService

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

the class ResourceUtilsTest method serviceAndRouteWithSameNameShouldBeRelated.

public void serviceAndRouteWithSameNameShouldBeRelated() {
    // given
    IRoute route = mock(IRoute.class);
    when(route.getServiceName()).thenReturn("42");
    IService service = mock(IService.class);
    when(service.getName()).thenReturn("42");
    // when
    // then
    assertThat(areRelated(route, service)).isTrue();
}
Also used : IRoute(com.openshift.restclient.model.route.IRoute) IService(com.openshift.restclient.model.IService)

Aggregations

IService (com.openshift.restclient.model.IService)32 Test (org.junit.Test)15 Connection (org.jboss.tools.openshift.core.connection.Connection)10 IResource (com.openshift.restclient.model.IResource)9 IRoute (com.openshift.restclient.model.route.IRoute)8 IDeploymentConfig (com.openshift.restclient.model.IDeploymentConfig)6 IProject (com.openshift.restclient.model.IProject)5 ResourceKind (com.openshift.restclient.ResourceKind)4 IBuildConfig (com.openshift.restclient.model.IBuildConfig)4 IPod (com.openshift.restclient.model.IPod)4 IReplicationController (com.openshift.restclient.model.IReplicationController)4 Collection (java.util.Collection)4 HashMap (java.util.HashMap)4 List (java.util.List)4 Map (java.util.Map)3 CoreException (org.eclipse.core.runtime.CoreException)3 ResourceUtils (org.jboss.tools.openshift.internal.core.util.ResourceUtils)3 IClient (com.openshift.restclient.IClient)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2