Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/extraplugins')
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/META-INF/MANIFEST.MF1
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/build.properties3
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/plugin.xml13
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/internal/ui/views/tests/ItemProviderFilterRegistryTest.java65
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/ui/tests/AllTests.java8
5 files changed, 87 insertions, 3 deletions
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/META-INF/MANIFEST.MF
index 40a490d8de6..040dd46f587 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/META-INF/MANIFEST.MF
@@ -22,6 +22,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.junit.framework;bundle-version="1.0.1"
Export-Package: org.eclipse.papyrus.cdo.internal.ui.editors.tests;x-internal:=true,
org.eclipse.papyrus.cdo.internal.ui.markers.tests;x-internal:=true,
+ org.eclipse.papyrus.cdo.internal.ui.views.tests;x-internal:=true,
org.eclipse.papyrus.cdo.ui.tests
Bundle-Vendor: %providerName
Bundle-Version: 1.0.1.qualifier
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/build.properties b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/build.properties
index 9de44fbc9f5..5371490a2c7 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/build.properties
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/build.properties
@@ -4,5 +4,6 @@ bin.includes = META-INF/,\
.,\
plugin.properties,\
about.html,\
- resources/
+ resources/,\
+ plugin.xml
src.includes = about.html
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/plugin.xml b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/plugin.xml
new file mode 100644
index 00000000000..118a250b55d
--- /dev/null
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/plugin.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.cdo.ui.repositoryFilters">
+ <itemProviderFilter
+ id="org.eclipse.papyrus.cdo.ui.tests.itemProviderFilter1">
+ <predicate
+ class="org.eclipse.papyrus.cdo.internal.ui.views.tests.ItemProviderFilterRegistryTest$TestFilter"/>
+ </itemProviderFilter>
+ </extension>
+
+</plugin>
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/internal/ui/views/tests/ItemProviderFilterRegistryTest.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/internal/ui/views/tests/ItemProviderFilterRegistryTest.java
new file mode 100644
index 00000000000..f32f763186c
--- /dev/null
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/internal/ui/views/tests/ItemProviderFilterRegistryTest.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.internal.ui.views.tests;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.eclipse.papyrus.cdo.core.tests.AbstractPapyrusCDOTest;
+import org.eclipse.papyrus.cdo.internal.core.PapyrusRepositoryManager;
+import org.eclipse.papyrus.cdo.internal.ui.views.ModelRepositoryItemProvider;
+import org.junit.After;
+import org.junit.Test;
+
+import com.google.common.base.Predicate;
+
+/**
+ * Tests the {@code ItemProviderFilterRegistry} class.
+ */
+public class ItemProviderFilterRegistryTest extends AbstractPapyrusCDOTest {
+
+ public ItemProviderFilterRegistryTest() {
+ super();
+ }
+
+ @Test
+ public void testPredicateFilter() {
+ TestFilter.banned = getPapyrusRepository();
+ ModelRepositoryItemProvider itemProvider = new ModelRepositoryItemProvider(null);
+ itemProvider.inputChanged(null, null, PapyrusRepositoryManager.INSTANCE);
+
+ assertThat(Arrays.asList(itemProvider.getChildren(PapyrusRepositoryManager.INSTANCE)), is(Collections.EMPTY_LIST));
+ }
+
+ //
+ // Test framework
+ //
+
+ @After
+ public void tearDown() {
+ TestFilter.banned = null;
+ }
+
+ public static final class TestFilter implements Predicate<Object> {
+ static Object banned;
+
+ @Override
+ public boolean apply(Object input) {
+ return (banned != null) && (input == banned);
+ }
+ }
+}
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/ui/tests/AllTests.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/ui/tests/AllTests.java
index 4c02a05d91b..ce83603aa4a 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/ui/tests/AllTests.java
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/ui/tests/AllTests.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 443830
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.ui.tests;
@@ -15,6 +17,7 @@ import org.eclipse.papyrus.cdo.internal.ui.editors.tests.BasicEditorTest;
import org.eclipse.papyrus.cdo.internal.ui.editors.tests.DawnEditorAdapterTest;
import org.eclipse.papyrus.cdo.internal.ui.markers.tests.CDOPapyrusMarkerTest;
import org.eclipse.papyrus.cdo.internal.ui.markers.tests.ModelValidationMarkersTest;
+import org.eclipse.papyrus.cdo.internal.ui.views.tests.ItemProviderFilterRegistryTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@@ -24,7 +27,8 @@ import org.junit.runners.Suite.SuiteClasses;
*/
@RunWith(Suite.class)
@SuiteClasses({ BasicEditorTest.class, DawnEditorAdapterTest.class, //
-ModelValidationMarkersTest.class, CDOPapyrusMarkerTest.class })
+ ModelValidationMarkersTest.class, CDOPapyrusMarkerTest.class, //
+ ItemProviderFilterRegistryTest.class })
public class AllTests {
public AllTests() {

Back to the top