use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class ResourceUtilsTest method routeServiceNameShouldMatchServiceInName.
@Test
public void routeServiceNameShouldMatchServiceInName() {
// given
// when
IRoute route = getRouteFor(SERVICE_42, Arrays.asList(ROUTES));
// then
assertThat(route).isEqualTo(ROUTES[1]);
}
use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class OpenShiftDebugModeTest method shouldAddRouteTimeoutIfDoesntExist.
@Test
public void shouldAddRouteTimeoutIfDoesntExist() throws CoreException {
// given
IRoute route = createRouteFor(dc, project, connection);
doReturn(null).when(server).getAttribute(eq(OpenShiftServerUtils.ATTR_DEBUG_ROUTE_TIMEOUT), anyString());
context.setDebugEnabled(true);
// when
debugMode.execute(new NullProgressMonitor());
// then
verify(route, atLeastOnce()).setAnnotation(eq(OpenShiftAPIAnnotations.TIMEOUT), anyString());
// send updated dc
verify(debugMode, times(1)).send(eq(route), eq(connection), any(IProgressMonitor.class));
}
use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class ServerSettingsWizardPageModelTest method should_return_valid_route_if_initialized_with_invalid_route.
@Test
public void should_return_valid_route_if_initialized_with_invalid_route() {
// given
ServerSettingsWizardPageModel model = createModel(ResourceMocks.PROJECT2_SERVICES[1], ResourceMocks.PROJECT3_ROUTES[0], null, Arrays.asList(project1, project3, project4), connection);
// when
IRoute route = model.getRoute();
// then
assertThat(route).isEqualTo(ResourceMocks.PROJECT2_ROUTES[1]);
}
use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class ServerSettingsWizardPageModelTest method shouldNotifyRoutesMatchingSelectedService.
@Test
public void shouldNotifyRoutesMatchingSelectedService() {
// given
List<IRoute> notifiedRoutes = new ArrayList<>();
model.addPropertyChangeListener(new PropertyChangeListener() {
@SuppressWarnings("unchecked")
@Override
public void propertyChange(PropertyChangeEvent event) {
if (ServerSettingsWizardPageModel.PROPERTY_ROUTES.equals(event.getPropertyName())) {
assertThat(event.getNewValue()).isInstanceOf(List.class);
notifiedRoutes.addAll((List<IRoute>) event.getNewValue());
}
}
});
// when
model.setResource(ResourceMocks.PROJECT3_SERVICES[1]);
// then
assertThat(notifiedRoutes).containsOnly(ResourceMocks.PROJECT3_ROUTES[1]);
}
use of com.openshift.restclient.model.route.IRoute in project jbosstools-openshift by jbosstools.
the class ServerSettingsWizardPageModelTest method should_not_set_route_if_setSelecteDefaultRoute_is_false_when_updating_server.
@Test
public void should_not_set_route_if_setSelecteDefaultRoute_is_false_when_updating_server() throws CoreException {
// given
model.setSelectDefaultRoute(false);
IRoute route = model.getRoute();
assertThat(route).isNotNull();
// when
model.updateServer();
// then
verify(server, atLeastOnce()).setAttribute(eq(OpenShiftServerUtils.ATTR_ROUTE), isNull(String.class));
verify(model, atLeastOnce()).updateServer(anyString(), any(IService.class), anyString(), anyString(), anyString(), anyString(), anyString(), isNull(String.class), any(org.eclipse.core.resources.IProject.class));
}
Aggregations