summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-08-07 08:27:29 (EDT)
committerCarsten Drossel2008-08-07 08:27:29 (EDT)
commit2f29618f2f02784ac49ce87d1c38e1eb2a6d442b (patch)
tree013f41cf4d5e6b74f1a9ee5b4cc7fcd009f435a0
parentf6267c29d64e5822a70ff045e3200dec51ad8f25 (diff)
downloadorg.eclipse.riena-2f29618f2f02784ac49ce87d1c38e1eb2a6d442b.zip
org.eclipse.riena-2f29618f2f02784ac49ce87d1c38e1eb2a6d442b.tar.gz
org.eclipse.riena-2f29618f2f02784ac49ce87d1c38e1eb2a6d442b.tar.bz2
added test for navigate(..) jump to NavigationProcessorTest
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java50
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.xml30
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/TestSecondModuleGroupNodeBuilder.java31
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/TestSecondSubApplicationNodeBuilder.java25
4 files changed, 120 insertions, 16 deletions
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 598f4b1..fbf7628 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
@@ -35,16 +35,22 @@ public class NavigationProcessorTest extends RienaTestCase {
addPluginXml(NavigationProcessorTest.class, "NavigationProcessorTest.xml");
applicationModel = new ApplicationModel();
+ applicationModel.setPresentationId(new NavigationNodeId("org.eclipse.riena.navigation.model.test.application"));
navigationProcessor = new NavigationProcessor();
applicationModel.setNavigationProcessor(navigationProcessor);
subApplication = new SubApplicationNode();
+ subApplication
+ .setPresentationId(new NavigationNodeId("org.eclipse.riena.navigation.model.test.subApplication"));
applicationModel.addChild(subApplication);
moduleGroup = new ModuleGroupNode();
+ moduleGroup.setPresentationId(new NavigationNodeId("org.eclipse.riena.navigation.model.test.moduleGroup"));
subApplication.addChild(moduleGroup);
module = new ModuleNode();
+ module.setPresentationId(new NavigationNodeId("org.eclipse.riena.navigation.model.test.module"));
moduleGroup.addChild(module);
subModule = new SubModuleNode();
+ subModule.setPresentationId(new NavigationNodeId("org.eclipse.riena.navigation.model.test.subModule"));
module.addChild(subModule);
}
@@ -63,4 +69,48 @@ public class NavigationProcessorTest extends RienaTestCase {
assertTrue(subModule.isActivated());
}
+ public void testNavigate() throws Exception {
+
+ subModule.activate();
+
+ assertEquals(1, applicationModel.getChildren().size());
+ assertTrue(subApplication.isActivated());
+
+ subModule.navigate(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModuleGroup"));
+
+ assertEquals(2, applicationModel.getChildren().size());
+ assertFalse(subApplication.isActivated());
+ ISubApplicationNode secondSubApplication = applicationModel.getChild(1);
+ assertEquals(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondSubApplication"),
+ secondSubApplication.getPresentationId());
+ assertTrue(secondSubApplication.isActivated());
+ assertEquals(1, secondSubApplication.getChildren().size());
+ IModuleGroupNode secondModuleGroup = secondSubApplication.getChild(0);
+ assertEquals(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModuleGroup"),
+ secondModuleGroup.getPresentationId());
+ assertTrue(secondModuleGroup.isActivated());
+ IModuleNode secondModule = secondModuleGroup.getChild(0);
+ ISubModuleNode secondSubModule = secondModule.getChild(0);
+ assertTrue(secondSubModule.isActivated());
+
+ secondSubModule.navigateBack();
+
+ assertFalse(secondSubApplication.isActivated());
+ assertFalse(secondSubModule.isActivated());
+ assertTrue(subApplication.isActivated());
+ assertTrue(subModule.isActivated());
+
+ subModule.navigate(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModuleGroup"));
+
+ assertFalse(subApplication.isActivated());
+ assertFalse(subModule.isActivated());
+ assertEquals(2, applicationModel.getChildren().size());
+ assertSame(secondSubApplication, applicationModel.getChild(1));
+ assertTrue(secondSubApplication.isActivated());
+ assertEquals(1, secondSubApplication.getChildren().size());
+ assertSame(secondModuleGroup, secondSubApplication.getChild(0));
+ assertTrue(secondModuleGroup.isActivated());
+ assertTrue(secondSubModule.isActivated());
+ }
+
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.xml b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.xml
index ce08b5a..24888dd 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.xml
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.xml
@@ -2,21 +2,19 @@
<?eclipse version="3.2"?>
<plugin>
<extension
- point="org.eclipse.riena.navigation.WorkAreaPresentation">
- <workAreaPresentation
- presentationId="testSharedViewId"
- view="org.eclipse.riena.navigation.ui.swt.views.TestView"
- viewController="org.eclipse.riena.navigation.ui.controllers.SubModuleController"
- viewShared="true">
- </workAreaPresentation>
- </extension>
+ point="org.eclipse.riena.navigation.NavigationNodePresentation">
+ <navigationNodePresentation
+ presentationId="org.eclipse.riena.navigation.model.test.secondSubApplication"
+ nodeBuilder="org.eclipse.riena.navigation.model.TestSecondSubApplicationNodeBuilder"
+ parentPresentationId="org.eclipse.riena.navigation.model.test.application">
+ </navigationNodePresentation>
+ </extension>
<extension
- point="org.eclipse.riena.navigation.WorkAreaPresentation">
- <workAreaPresentation
- presentationId="testNotSharedViewId"
- view="org.eclipse.riena.navigation.ui.swt.views.TestView"
- viewController="org.eclipse.riena.navigation.ui.controllers.SubModuleController"
- viewShared="false">
- </workAreaPresentation>
- </extension>
+ point="org.eclipse.riena.navigation.NavigationNodePresentation">
+ <navigationNodePresentation
+ presentationId="org.eclipse.riena.navigation.model.test.secondModuleGroup"
+ nodeBuilder="org.eclipse.riena.navigation.model.TestSecondModuleGroupNodeBuilder"
+ parentPresentationId="org.eclipse.riena.navigation.model.test.secondSubApplication">
+ </navigationNodePresentation>
+ </extension>
</plugin>
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/TestSecondModuleGroupNodeBuilder.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/TestSecondModuleGroupNodeBuilder.java
new file mode 100644
index 0000000..c1bc477
--- /dev/null
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/TestSecondModuleGroupNodeBuilder.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.navigation.INavigationNode;
+import org.eclipse.riena.navigation.INavigationNodeBuilder;
+import org.eclipse.riena.navigation.INavigationNodeId;
+
+public class TestSecondModuleGroupNodeBuilder implements INavigationNodeBuilder {
+
+ public INavigationNode<?> buildNode(INavigationNodeId navigationNodeId) {
+ ModuleGroupNode moduleGroup = new ModuleGroupNode();
+ moduleGroup.setPresentationId(navigationNodeId);
+ ModuleNode module = new ModuleNode();
+ module.setPresentationId(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondModule"));
+ moduleGroup.addChild(module);
+ SubModuleNode subModule = new SubModuleNode();
+ subModule.setPresentationId(new NavigationNodeId("org.eclipse.riena.navigation.model.test.secondSubModule"));
+ module.addChild(subModule);
+ return moduleGroup;
+ }
+
+}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/TestSecondSubApplicationNodeBuilder.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/TestSecondSubApplicationNodeBuilder.java
new file mode 100644
index 0000000..f35f644
--- /dev/null
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/TestSecondSubApplicationNodeBuilder.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.navigation.INavigationNode;
+import org.eclipse.riena.navigation.INavigationNodeBuilder;
+import org.eclipse.riena.navigation.INavigationNodeId;
+
+public class TestSecondSubApplicationNodeBuilder implements INavigationNodeBuilder {
+
+ public INavigationNode<?> buildNode(INavigationNodeId navigationNodeId) {
+ SubApplicationNode subApplication = new SubApplicationNode();
+ subApplication.setPresentationId(navigationNodeId);
+ return subApplication;
+ }
+
+}