Author: dan.j.allen
Date: 2008-11-15 16:54:51 -0500 (Sat, 15 Nov 2008)
New Revision: 9568
Added:
trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptorTest.java
Removed:
trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptionsTest.java
Modified:
trunk/src/main/org/jboss/seam/navigation/Page.java
trunk/src/test/unit/org/jboss/seam/test/unit/testng.xml
Log:
JBSEAM-3705
Modified: trunk/src/main/org/jboss/seam/navigation/Page.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Page.java 2008-11-15 05:14:30 UTC (rev 9567)
+++ trunk/src/main/org/jboss/seam/navigation/Page.java 2008-11-15 21:54:51 UTC (rev 9568)
@@ -73,6 +73,10 @@
this.viewId = viewId;
if (viewId!=null)
{
+ if (viewId.equals("/debug.xhtml"))
+ {
+ switchEnabled = false;
+ }
int loc = viewId.lastIndexOf('.');
if ( loc>0 && viewId.startsWith("/") )
{
Deleted: trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptionsTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptionsTest.java 2008-11-15
05:14:30 UTC (rev 9567)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptionsTest.java 2008-11-15
21:54:51 UTC (rev 9568)
@@ -1,45 +0,0 @@
-package org.jboss.seam.test.unit;
-
-import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.navigation.Pages;
-import org.testng.annotations.Test;
-
-/**
- * This test verifies that the descriptions returned by the Pages component are based on
the matching
- * Page definition as well as any matching wild-card pages in the page stack.
- *
- */
-public class PageDescriptionsTest extends AbstractPageTest
-{
- /**
- * Verify that the Pages component determines when a description exists in the Page
stack and when
- * it does not.
- */
- @Test(enabled = true)
- public void testHasDescription()
- {
- Pages pages = Pages.instance();
-
- assert pages.hasDescription("/action-test01b.xhtml");
- assert pages.hasDescription("/action-test01a.xhtml");
- assert !pages.hasDescription("/action-test02.xhtml");
- }
-
- /**
- * Verify that the description can be retrieved from the page stack when a wild-card
view-id
- * description has been specified. Also verifies that a description specific to a
page overrides
- * the wild-card description.
- */
- @Test(enabled = true)
- public void testGetAndResolveDescription()
- {
- Pages pages = Pages.instance();
- String fineDescription = "fine-description";
- Contexts.getEventContext().set("fineDescription", fineDescription);
-
- assert
"coarse-description".equals(pages.getDescription("/action-test01a.xhtml"))
:
- "Expecting the wild-card description to be returned as no description was
provided for the view-id";
- assert
fineDescription.equals(pages.renderDescription("/action-test01b.xhtml")) :
- "Expecting the description for the view-id to be returned";
- }
-}
Copied: trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptorTest.java (from rev
9559, trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptionsTest.java)
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptorTest.java
(rev 0)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptorTest.java 2008-11-15
21:54:51 UTC (rev 9568)
@@ -0,0 +1,58 @@
+package org.jboss.seam.test.unit;
+
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.navigation.Pages;
+import org.testng.annotations.Test;
+
+/**
+ * This test verifies that the page descriptor is parsed correctly and that the
+ * Page instance returned by the Pages component are based on the matching Page
+ * definition as well as any matching wild-card pages in the page stack.
+ */
+public class PageDescriptorTest extends AbstractPageTest
+{
+ /**
+ * Verify that the switch enabled flag is true by default, but false
+ * for the debug page.
+ */
+ @Test(enabled = true)
+ public void testSwitchEnabledFlag()
+ {
+ Pages pages = Pages.instance();
+
+ assert pages.getPage("/action-test01a.xhtml").isSwitchEnabled();
+ assert !pages.getPage("/debug.xhtml").isSwitchEnabled();
+ }
+
+ /**
+ * Verify that the Pages component determines when a description exists in the Page
stack and when
+ * it does not.
+ */
+ @Test(enabled = true)
+ public void testHasDescription()
+ {
+ Pages pages = Pages.instance();
+
+ assert pages.hasDescription("/action-test01b.xhtml");
+ assert pages.hasDescription("/action-test01a.xhtml");
+ assert !pages.hasDescription("/action-test02.xhtml");
+ }
+
+ /**
+ * Verify that the description can be retrieved from the page stack when a wild-card
view-id
+ * description has been specified. Also verifies that a description specific to a
page overrides
+ * the wild-card description.
+ */
+ @Test(enabled = true)
+ public void testGetAndResolveDescription()
+ {
+ Pages pages = Pages.instance();
+ String fineDescription = "fine-description";
+ Contexts.getEventContext().set("fineDescription", fineDescription);
+
+ assert
"coarse-description".equals(pages.getDescription("/action-test01a.xhtml"))
:
+ "Expecting the wild-card description to be returned as no description was
provided for the view-id";
+ assert
fineDescription.equals(pages.renderDescription("/action-test01b.xhtml")) :
+ "Expecting the description for the view-id to be returned";
+ }
+}
Property changes on: trunk/src/test/unit/org/jboss/seam/test/unit/PageDescriptorTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/testng.xml
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/testng.xml 2008-11-15 05:14:30 UTC (rev
9567)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/testng.xml 2008-11-15 21:54:51 UTC (rev
9568)
@@ -29,7 +29,7 @@
<test name="Seam Unit Tests: Pages dot xml">
<classes>
<class name="org.jboss.seam.test.unit.PageActionsTest" />
- <class name="org.jboss.seam.test.unit.PageDescriptionsTest" />
+ <class name="org.jboss.seam.test.unit.PageDescriptorTest" />
<class name="org.jboss.seam.test.unit.PageParamTest" />
</classes>
</test>