You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2011/06/10 15:23:33 UTC

svn commit: r1134313 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src: main/java/org/apache/myfaces/tobago/example/demo/Navigation.java test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java

Author: lofwyr
Date: Fri Jun 10 13:23:32 2011
New Revision: 1134313

URL: http://svn.apache.org/viewvc?rev=1134313&view=rev
Log:
style, test, import

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java?rev=1134313&r1=1134312&r2=1134313&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java Fri Jun 10 13:23:32 2011
@@ -17,6 +17,7 @@ package org.apache.myfaces.tobago.exampl
  * limitations under the License.
  */
 
+import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.example.demo.jsp.JspFormatter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -82,7 +83,7 @@ public class Navigation implements Seria
     for (Node node : nodes) {
       map.put(node.getBranch(), node);
       String parent = node.getBranch().substring(0, node.getBranch().lastIndexOf('/'));
-      if (! parent.equals("")) { // is root
+      if (!parent.equals("")) { // is root
         map.get(parent).add(node);
       }
     }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java?rev=1134313&r1=1134312&r2=1134313&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java Fri Jun 10 13:23:32 2011
@@ -21,6 +21,7 @@ import org.apache.myfaces.tobago.interna
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -28,28 +29,30 @@ public class NavigationUnitTest extends 
 
   @Test
   public void testFileNames() {
-    List<String> list = Arrays.asList(
+    List<String> list = new ArrayList<String>(Arrays.asList(
         "/content/00/test-1.xhtml",
+// todo        "/content/00/x-bad.xhtml", // x- means excluded
         "/content/00/07/test-2.xhtml",
+        "/content/00/07/x-bad.xhtml", // x- means excluded
         "/content/01/test.xhtml",
         "/content/00/00/test-4.xhtml",
-        "/content/bad.xhtml",
-        "/content/00_00_bad.xhtml"
-    );
+        "/content/bad.jsp",
+        "/content/00_00_bad.gif"
+    ));
     final Navigation navigation = new Navigation(list);
     final Navigation.Node root = navigation.getTree();
     Assert.assertEquals(2, root.getChildCount());
     final Navigation.Node n00 = (Navigation.Node) root.getChildAt(0);
-    Assert.assertEquals("00", n00.getBranch());
+    Assert.assertEquals("/content/00", n00.getBranch());
     Assert.assertEquals("test-1", n00.getName());
     final Navigation.Node n01 = (Navigation.Node) root.getChildAt(1);
-    Assert.assertEquals("01", n01.getBranch());
+    Assert.assertEquals("/content/01", n01.getBranch());
     Assert.assertEquals("test", n01.getName());
     final Navigation.Node n0000 = (Navigation.Node) n00.getChildAt(0);
-    Assert.assertEquals("00/00", n0000.getBranch());
+    Assert.assertEquals("/content/00/00", n0000.getBranch());
     Assert.assertEquals("test-4", n0000.getName());
     final Navigation.Node n0007 = (Navigation.Node) n00.getChildAt(1);
-    Assert.assertEquals("00/07", n0007.getBranch());
+    Assert.assertEquals("/content/00/07", n0007.getBranch());
     Assert.assertEquals("test-2", n0007.getName());
   }
 }