Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordbranekov2012-12-21 18:14:47 +0000
committerdbranekov2012-12-21 18:14:47 +0000
commit30b3262169cebef2372aa29384005e3601e0bf04 (patch)
tree417b580c957af27d63fc6bbe1d9f319356abc936
parentecfcbd502c1ff39400d1e604a177dabc5d540788 (diff)
downloadorg.eclipse.e4.search-30b3262169cebef2372aa29384005e3601e0bf04.tar.gz
org.eclipse.e4.search-30b3262169cebef2372aa29384005e3601e0bf04.tar.xz
org.eclipse.e4.search-30b3262169cebef2372aa29384005e3601e0bf04.zip
[bug 396928] test destination button is disabled when configuratorI20130103-2200I20130102-1000I20130101-2200I20121227-2200I20121226-1000I20121225-2200
provides no tester
-rw-r--r--bundles/org.eclipse.platform.discovery.destprefs/src/org/eclipse/platform/discovery/destprefs/internal/prefpage/ui/DestinationConfiguratorsPresenter.java12
-rw-r--r--tests/org.eclipse.platform.discovery.destprefs.test.unit/src/org/eclipse/platform/discovery/destprefs/test/unit/prefpage/DestinationConfiguratorsPresenterTest.java26
2 files changed, 16 insertions, 22 deletions
diff --git a/bundles/org.eclipse.platform.discovery.destprefs/src/org/eclipse/platform/discovery/destprefs/internal/prefpage/ui/DestinationConfiguratorsPresenter.java b/bundles/org.eclipse.platform.discovery.destprefs/src/org/eclipse/platform/discovery/destprefs/internal/prefpage/ui/DestinationConfiguratorsPresenter.java
index 32dc6b2..e51ad4e 100644
--- a/bundles/org.eclipse.platform.discovery.destprefs/src/org/eclipse/platform/discovery/destprefs/internal/prefpage/ui/DestinationConfiguratorsPresenter.java
+++ b/bundles/org.eclipse.platform.discovery.destprefs/src/org/eclipse/platform/discovery/destprefs/internal/prefpage/ui/DestinationConfiguratorsPresenter.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2012 SAP AG 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:
- * SAP AG - initial API and implementation
- *******************************************************************************/
package org.eclipse.platform.discovery.destprefs.internal.prefpage.ui;
import java.util.ArrayList;
@@ -92,7 +82,7 @@ public class DestinationConfiguratorsPresenter implements IDestinationConfigurat
view.setAddEnabled(true);
view.setEditEnabled(true);
view.setRemoveEnabled(true);
- view.setTestEnabled(true);
+ view.setTestEnabled(getConfigDescription(destinationProviderId).createConfigurator().getSearchDestinationTester()!=null);
}
}
diff --git a/tests/org.eclipse.platform.discovery.destprefs.test.unit/src/org/eclipse/platform/discovery/destprefs/test/unit/prefpage/DestinationConfiguratorsPresenterTest.java b/tests/org.eclipse.platform.discovery.destprefs.test.unit/src/org/eclipse/platform/discovery/destprefs/test/unit/prefpage/DestinationConfiguratorsPresenterTest.java
index 3c487a9..ac06d8a 100644
--- a/tests/org.eclipse.platform.discovery.destprefs.test.unit/src/org/eclipse/platform/discovery/destprefs/test/unit/prefpage/DestinationConfiguratorsPresenterTest.java
+++ b/tests/org.eclipse.platform.discovery.destprefs.test.unit/src/org/eclipse/platform/discovery/destprefs/test/unit/prefpage/DestinationConfiguratorsPresenterTest.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2012 SAP AG 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:
- * SAP AG - initial API and implementation
- *******************************************************************************/
package org.eclipse.platform.discovery.destprefs.test.unit.prefpage;
import java.util.ArrayList;
@@ -104,7 +94,9 @@ public class DestinationConfiguratorsPresenterTest {
Mockito.verify(view).setAddEnabled(Mockito.eq(true));
Mockito.verify(view).setEditEnabled(Mockito.eq(true));
Mockito.verify(view).setRemoveEnabled(Mockito.eq(true));
- Mockito.verify(view).setAddEnabled(Mockito.eq(true));
+
+ //test is disabled if get
+ Mockito.verify(view).setTestEnabled(Mockito.eq(false));
}
@Test
@@ -151,6 +143,18 @@ public class DestinationConfiguratorsPresenterTest {
}
@Test
+ public void testEnablementWhenHasTester() {
+ presenter.selectionChanged(new DestinationConfiguratorSelection(fixture.DEST_PROVIDER_CAT1_1, null));
+ @SuppressWarnings("unchecked")
+ ISearchDestinationTester<ISearchDestination> tester = Mockito.mock(ISearchDestinationTester.class);
+ Mockito.when(fixture.configurator_1_1.getSearchDestinationTester()).thenReturn(tester);
+ presenter.selectionChanged(new DestinationConfiguratorSelection(fixture.DEST_PROVIDER_CAT1_1, fixture.destination1));
+
+ Mockito.verify(view).setTestEnabled(Mockito.eq(true));
+
+ }
+
+ @Test
public void edit() {
presenter.selectionChanged(new DestinationConfiguratorSelection(fixture.DEST_PROVIDER_CAT1_1, fixture.destination1));

Back to the top