use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class ResourceUtilsTest method nullRouteShouldBeReturnedIfNullServiceIsGiven.
@Test
public void nullRouteShouldBeReturnedIfNullServiceIsGiven() {
// when
IRoute route = getRouteFor((IService) null, Arrays.asList(ROUTES));
// then
assertThat(route).isNull();
}
use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class ResourceUtilsTest method testGetRouteForService.
@Test
public void testGetRouteForService() {
// when
IRoute route = getRouteFor(ResourceMocks.createResource(IService.class, ResourceKind.SERVICE, service -> when(service.getName()).thenReturn("0")), Arrays.asList(ROUTES));
// then
assertThat(route).isNull();
}
use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class ResourceUtilsTest method nullRouteShouldBeReturnedIfNullRouteIsGiven.
@Test
public void nullRouteShouldBeReturnedIfNullRouteIsGiven() {
// when
IRoute route = getRouteFor(SERVICE_42, null);
// then
assertThat(route).isNull();
}
use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class ResourceUtilsTest method serviceAndRouteWithDifferentNameShouldNotBeRelated.
public void serviceAndRouteWithDifferentNameShouldNotBeRelated() {
// given
IRoute route = mock(IRoute.class);
when(route.getServiceName()).thenReturn("42");
IService service = mock(IService.class);
when(service.getName()).thenReturn("24");
// when
// then
assertThat(areRelated(route, service)).isFalse();
}
use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class OpenShiftDebugModeTest method shouldRemoveRouteTimeoutWhenStoppingDebuggingIfNoneExistedBefore.
@Test
public void shouldRemoveRouteTimeoutWhenStoppingDebuggingIfNoneExistedBefore() throws CoreException {
// given
IRoute route = createRouteFor(dc, project, connection);
doReturn(null).when(server).getAttribute(eq(OpenShiftServerUtils.ATTR_DEBUG_ROUTE_TIMEOUT), anyString());
doReturn(RouteTimeout.ROUTE_DEBUG_TIMEOUT).when(route).getAnnotation(eq(OpenShiftAPIAnnotations.TIMEOUT));
// when
context.setDebugEnabled(false);
debugMode.execute(new NullProgressMonitor());
// then
verify(route, atLeastOnce()).removeAnnotation(eq(OpenShiftAPIAnnotations.TIMEOUT));
// send updated dc
verify(debugMode, times(1)).send(eq(route), eq(connection), any(IProgressMonitor.class));
// dont remove inexistant backup
verify(serverWorkingCopy, never()).setAttribute(OpenShiftServerUtils.ATTR_DEBUG_ROUTE_TIMEOUT, (String) null);
}
Aggregations