summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2010-10-13 03:13:35 (EDT)
committerSteffen Kriese2010-10-13 03:13:35 (EDT)
commita0ece727a7e655e2ea420964e267a72f99a848b1 (patch)
tree0642195f51ceaedf986cf0c404d57c25a8e84fa7
parent7879983d69955e9bf64201d45d56eaf9e2544d91 (diff)
downloadorg.eclipse.riena-a0ece727a7e655e2ea420964e267a72f99a848b1.zip
org.eclipse.riena-a0ece727a7e655e2ea420964e267a72f99a848b1.tar.gz
org.eclipse.riena-a0ece727a7e655e2ea420964e267a72f99a848b1.tar.bz2
Separated NavigationProcessorTest in manual and nonuitests so most of the tests can run on the buildserver again.
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorManualTest.java159
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java87
2 files changed, 168 insertions, 78 deletions
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorManualTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorManualTest.java
new file mode 100644
index 0000000..c861d09
--- /dev/null
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorManualTest.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 compeople 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.navigation.model;
+
+import org.eclipse.riena.internal.core.test.RienaTestCase;
+import org.eclipse.riena.internal.core.test.collect.ManualTestCase;
+import org.eclipse.riena.navigation.IApplicationNode;
+import org.eclipse.riena.navigation.IModuleGroupNode;
+import org.eclipse.riena.navigation.IModuleNode;
+import org.eclipse.riena.navigation.INavigationNode;
+import org.eclipse.riena.navigation.ISubApplicationNode;
+import org.eclipse.riena.navigation.ISubModuleNode;
+import org.eclipse.riena.navigation.NavigationNodeId;
+import org.eclipse.riena.navigation.model.NavigationProcessorTest.TestSubModuleNode;
+
+/**
+ * Manual Tests for the NavigationProcessor that use addPluginXml.
+ */
+@ManualTestCase
+public class NavigationProcessorManualTest extends RienaTestCase {
+
+ /**
+ *
+ */
+ private static final String TARGET_MODULE_GROUP = "org.eclipse.riena.navigation.model.test.moduleGroup.2";
+ private NavigationProcessor navigationProcessor;
+ private IApplicationNode applicationNode;
+ private ISubApplicationNode subApplication;
+ private IModuleGroupNode moduleGroup;
+ private IModuleNode module;
+ private ISubModuleNode subModule1;
+ private ISubModuleNode subModule2;
+ private ISubModuleNode subModule3;
+ private TestSubModuleNode subModule4;
+
+ private ModuleGroupNode moduleGroup2;
+ private ModuleNode module2;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ initializeNavigationStructure();
+ }
+
+ private void initializeNavigationStructure() {
+ applicationNode = new ApplicationNode(new NavigationNodeId(
+ "org.eclipse.riena.navigation.model.test.application"));
+ navigationProcessor = new NavigationProcessor();
+ applicationNode.setNavigationProcessor(navigationProcessor);
+
+ subApplication = new SubApplicationNode(new NavigationNodeId(
+ "org.eclipse.riena.navigation.model.test.subApplication"));
+ applicationNode.addChild(subApplication);
+ moduleGroup = new ModuleGroupNode(new NavigationNodeId("org.eclipse.riena.navigation.model.test.moduleGroup"));
+ subApplication.addChild(moduleGroup);
+ moduleGroup2 = new ModuleGroupNode(new NavigationNodeId(TARGET_MODULE_GROUP));
+ subApplication.addChild(moduleGroup2);
+
+ module = new ModuleNode(new NavigationNodeId("org.eclipse.riena.navigation.model.test.module"));
+ moduleGroup.addChild(module);
+ module2 = new ModuleNode(new NavigationNodeId("org.eclipse.riena.navigation.model.test.module.2"));
+ moduleGroup.addChild(module2);
+ subModule1 = new SubModuleNode(new NavigationNodeId("org.eclipse.riena.navigation.model.test.subModule"));
+ module.addChild(subModule1);
+ subModule2 = new SubModuleNode(new NavigationNodeId("org.eclipse.riena.navigation.model.test.subModule2"));
+ module.addChild(subModule2);
+ subModule3 = new SubModuleNode(new NavigationNodeId("org.eclipse.riena.navigation.model.test.subModule3"));
+ module.addChild(subModule3);
+ subModule4 = new TestSubModuleNode(new NavigationNodeId("org.eclipse.riena.navigation.model.test.subModule4"));
+ module2.addChild(subModule4);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ applicationNode = null;
+ super.tearDown();
+ }
+
+ public void testNavigate() throws Exception {
+
+ subModule1.activate();
+
+ System.err.println("NODE: " + applicationNode);
+
+ assertEquals(1, applicationNode.getChildren().size());
+ assertTrue(subApplication.isActivated());
+
+ addPluginXml(NavigationProcessorManualTest.class, "NavigationProcessorTest.xml", 500);
+
+ try {
+ subModule1.navigate(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModuleGroup"));
+
+ assertEquals(2, applicationNode.getChildren().size());
+ assertFalse(subApplication.isActivated());
+ final ISubApplicationNode secondSubApplication = applicationNode.getChild(1);
+ assertEquals(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondSubApplication"),
+ secondSubApplication.getNodeId());
+ assertTrue(secondSubApplication.isActivated());
+ assertEquals(1, secondSubApplication.getChildren().size());
+ final IModuleGroupNode secondModuleGroup = secondSubApplication.getChild(0);
+ assertEquals(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModuleGroup"),
+ secondModuleGroup.getNodeId());
+ assertTrue(secondModuleGroup.isActivated());
+ final IModuleNode secondModule = secondModuleGroup.getChild(0);
+ final ISubModuleNode secondSubModule = secondModule.getChild(0);
+ assertTrue(secondSubModule.isActivated());
+
+ secondSubModule.navigateBack();
+
+ assertFalse(secondSubApplication.isActivated());
+ assertFalse(secondSubModule.isActivated());
+ assertTrue(subApplication.isActivated());
+ assertTrue(subModule1.isActivated());
+
+ subModule1.navigate(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModuleGroup"));
+
+ assertFalse(subApplication.isActivated());
+ assertFalse(subModule1.isActivated());
+ assertEquals(2, applicationNode.getChildren().size());
+ assertSame(secondSubApplication, applicationNode.getChild(1));
+ assertTrue(secondSubApplication.isActivated());
+ assertEquals(1, secondSubApplication.getChildren().size());
+ assertSame(secondModuleGroup, secondSubApplication.getChild(0));
+ assertTrue(secondModuleGroup.isActivated());
+ assertTrue(secondSubModule.isActivated());
+ } finally {
+ removeExtension("navigation.processor.test");
+ }
+ }
+
+ /**
+ * Tests the method {@code create}.
+ */
+ public void testCreate() throws Exception {
+
+ INavigationNode<?> targetNode = navigationProcessor.create(module, new NavigationNodeId(
+ "org.eclipse.riena.navigation.model.test.subModule"), null);
+ assertEquals(subModule1, targetNode);
+
+ addPluginXml(NavigationProcessorManualTest.class, "NavigationProcessorTest.xml", 1000);
+
+ try {
+ targetNode = navigationProcessor.create(module, new NavigationNodeId(
+ "org.eclipse.riena.navigation.model.test.secondModuleGroup"), null);
+ assertEquals("org.eclipse.riena.navigation.model.test.secondModuleGroup", targetNode.getNodeId()
+ .getTypeId());
+ } finally {
+ removeExtension("navigation.processor.test");
+ }
+ }
+}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java
index ce0d10c..116852a 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java
@@ -18,7 +18,7 @@ import org.easymock.EasyMock;
import org.eclipse.riena.core.marker.IMarker;
import org.eclipse.riena.core.util.ReflectionUtils;
import org.eclipse.riena.internal.core.test.RienaTestCase;
-import org.eclipse.riena.internal.core.test.collect.ManualTestCase;
+import org.eclipse.riena.internal.core.test.collect.NonUITestCase;
import org.eclipse.riena.navigation.IApplicationNode;
import org.eclipse.riena.navigation.IJumpTargetListener;
import org.eclipse.riena.navigation.IModuleGroupNode;
@@ -37,10 +37,14 @@ import org.eclipse.riena.ui.core.marker.OutputMarker;
import org.eclipse.riena.ui.ridgets.IRidget;
/**
- * Tests for the NavigationProcessor.
+ * Tests for the NavigationProcessor. Contains all tests for the
+ * NavigationProcessor that don't use addPluginXml() and can be run on the
+ * buildserver.
+ * <p>
+ * FIXME move all tests from {@link NavigationProcessorManualTest} over here
+ * again, when the addPluginXml() issue is fixed.
*/
-//@NonUITestCase FIXME when addPluginXml works again
-@ManualTestCase
+@NonUITestCase
public class NavigationProcessorTest extends RienaTestCase {
/**
@@ -169,58 +173,6 @@ public class NavigationProcessorTest extends RienaTestCase {
}
- public void testNavigate() throws Exception {
-
- subModule1.activate();
-
- System.err.println("NODE: " + applicationNode);
-
- assertEquals(1, applicationNode.getChildren().size());
- assertTrue(subApplication.isActivated());
-
- addPluginXml(NavigationProcessorTest.class, "NavigationProcessorTest.xml");
-
- try {
- subModule1.navigate(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModuleGroup"));
-
- assertEquals(2, applicationNode.getChildren().size());
- assertFalse(subApplication.isActivated());
- final ISubApplicationNode secondSubApplication = applicationNode.getChild(1);
- assertEquals(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondSubApplication"),
- secondSubApplication.getNodeId());
- assertTrue(secondSubApplication.isActivated());
- assertEquals(1, secondSubApplication.getChildren().size());
- final IModuleGroupNode secondModuleGroup = secondSubApplication.getChild(0);
- assertEquals(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModuleGroup"),
- secondModuleGroup.getNodeId());
- assertTrue(secondModuleGroup.isActivated());
- final IModuleNode secondModule = secondModuleGroup.getChild(0);
- final ISubModuleNode secondSubModule = secondModule.getChild(0);
- assertTrue(secondSubModule.isActivated());
-
- secondSubModule.navigateBack();
-
- assertFalse(secondSubApplication.isActivated());
- assertFalse(secondSubModule.isActivated());
- assertTrue(subApplication.isActivated());
- assertTrue(subModule1.isActivated());
-
- subModule1.navigate(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModuleGroup"));
-
- assertFalse(subApplication.isActivated());
- assertFalse(subModule1.isActivated());
- assertEquals(2, applicationNode.getChildren().size());
- assertSame(secondSubApplication, applicationNode.getChild(1));
- assertTrue(secondSubApplication.isActivated());
- assertEquals(1, secondSubApplication.getChildren().size());
- assertSame(secondModuleGroup, secondSubApplication.getChild(0));
- assertTrue(secondModuleGroup.isActivated());
- assertTrue(secondSubModule.isActivated());
- } finally {
- removeExtension("navigation.processor.test");
- }
- }
-
class DummyJumpTargetListener implements IJumpTargetListener {
IJumpTargetListener.JumpTargetState jumpTargetState;
@@ -719,27 +671,6 @@ public class NavigationProcessorTest extends RienaTestCase {
}
/**
- * Tests the method {@code create}.
- */
- public void testCreate() throws Exception {
-
- INavigationNode<?> targetNode = navigationProcessor.create(module, new NavigationNodeId(
- "org.eclipse.riena.navigation.model.test.subModule"), null);
- assertEquals(subModule1, targetNode);
-
- addPluginXml(NavigationProcessorTest.class, "NavigationProcessorTest.xml");
-
- try {
- targetNode = navigationProcessor.create(module, new NavigationNodeId(
- "org.eclipse.riena.navigation.model.test.secondModuleGroup"), null);
- assertEquals("org.eclipse.riena.navigation.model.test.secondModuleGroup", targetNode.getNodeId()
- .getTypeId());
- } finally {
- removeExtension("navigation.processor.test");
- }
- }
-
- /**
* Tests the method {@code move}.
*/
public void testMove() throws Exception {
@@ -930,7 +861,7 @@ public class NavigationProcessorTest extends RienaTestCase {
return targetModuleGroup;
}
- private static class TestSubModuleNode extends SubModuleNode {
+ public static class TestSubModuleNode extends SubModuleNode {
private boolean allowsActivate;
private boolean allowsDeactivate;