Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Muskalla2014-02-10 07:09:36 -0500
committerBenjamin Muskalla2014-02-10 10:51:16 -0500
commitb8fcbca33a9b308885ffb1f8ff7f2b137907758e (patch)
tree26bad0d3774f9942c967c57a5e57fafee2205de7 /org.eclipse.mylyn.tasks.ui.tests
parent4ef9f9a67d1156d86b3c82cbc26b4e3473319512 (diff)
downloadorg.eclipse.mylyn.tasks-b8fcbca33a9b308885ffb1f8ff7f2b137907758e.tar.gz
org.eclipse.mylyn.tasks-b8fcbca33a9b308885ffb1f8ff7f2b137907758e.tar.xz
org.eclipse.mylyn.tasks-b8fcbca33a9b308885ffb1f8ff7f2b137907758e.zip
Changing proxy port should trigger validation
Change-Id: Ic5f84821152145ff649d54a8e75270516291abcb Signed-off-by: Benjamin Muskalla <benjamin.muskalla@tasktop.com>
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui.tests')
-rw-r--r--org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java71
2 files changed, 75 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF
index bd0e75a54..f9a867559 100644
--- a/org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.ui.tests/META-INF/MANIFEST.MF
@@ -11,6 +11,8 @@ Require-Bundle: org.junit;bundle-version="4.8.2",
org.objenesis;bundle-version="[1.0.0,2.0.0)",
org.hamcrest;bundle-version="[1.0.0,2.0.0)",
org.eclipse.equinox.security,
- org.eclipse.mylyn.tasks.core
+ org.eclipse.mylyn.tasks.core,
+ org.eclipse.mylyn.tasks.tests
Export-Package: org.eclipse.mylyn.internal.tasks.ui.editors;x-internal:=true,
- org.eclipse.mylyn.tasks.ui.editors;x-internal:=true
+ org.eclipse.mylyn.tasks.ui.editors;x-internal:=true,
+ org.eclipse.mylyn.tasks.ui.wizards;x-internal:=true
diff --git a/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java
new file mode 100644
index 000000000..96281a19c
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.ui.wizards;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.junit.Test;
+
+public class RepositorySettingsPageTest {
+
+ public static class TestRepositorySettingsPage extends AbstractRepositorySettingsPage {
+
+ public TestRepositorySettingsPage() {
+ super("Title", "Description", new TaskRepository("mock", "url"), MockRepositoryConnector.getDefault());
+ setNeedsProxy(true);
+ }
+
+ @Override
+ protected Validator getValidator(TaskRepository repository) {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public String getConnectorKind() {
+ return MockRepositoryConnector.CONNECTOR_KIND;
+ }
+
+ @Override
+ protected void createAdditionalControls(Composite parent) {
+ // ignore
+ }
+ }
+
+ @Test
+ public void proxyPortTriggersValidation() throws Exception {
+ TestRepositorySettingsPage page = new TestRepositorySettingsPage();
+ IWizardContainer container = applyWizardContainer(page);
+ page.createControl(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ verify(container, times(1)).updateButtons();
+
+ page.proxyPortEditor.setStringValue("123");
+ verify(container, times(2)).updateButtons();
+ }
+
+ private IWizardContainer applyWizardContainer(TestRepositorySettingsPage page) {
+ IWizard wizard = mock(IWizard.class);
+ IWizardContainer container = mock(IWizardContainer.class);
+ when(wizard.getContainer()).thenReturn(container);
+ page.setWizard(wizard);
+ return container;
+ }
+}

Back to the top