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/03/21 15:27:11 UTC

svn commit: r1083801 - in /myfaces/tobago/trunk: tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ tobago-example/tobago-example-test/src/main/webapp/ tobago-example/tobago-example-test/src/main/webapp/WEB-INF/ to...

Author: lofwyr
Date: Mon Mar 21 14:27:11 2011
New Revision: 1083801

URL: http://svn.apache.org/viewvc?rev=1083801&view=rev
Log:
sample files may have 4 type:
 - to ignore: like .svn or WEB-INF
 - normal to test
 - disabled (have technical reasons, like fragments or the menu)
 - todo (the test fails in the moment, but the reason in known in the moment)

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/style/
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/style/style.css
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DirectoryBrowser.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/PageItem.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/tobago-config.xml
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DirectoryBrowser.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DirectoryBrowser.java?rev=1083801&r1=1083800&r2=1083801&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DirectoryBrowser.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DirectoryBrowser.java Mon Mar 21 14:27:11 2011
@@ -35,7 +35,7 @@ public class DirectoryBrowser {
   private PageItem current;
 
   public DirectoryBrowser() {
-    tree = new PageItem("/");
+    tree = new PageItem("/", false, false);
     ServletContext servletContext
         = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
 
@@ -69,13 +69,13 @@ public class DirectoryBrowser {
             if (LOG.isDebugEnabled()) {
               LOG.debug("childPath dir " + childPath);
             }
-            list.add(new PageItem(childPath));
+            list.add(new PageItem(childPath, Filter.isDisabled(childPath), Filter.isTodo(childPath)));
           }
         }
       } else {
         if (Filter.isValid(childPath)) {
           LOG.info("add resc " + childPath);
-          list.add(new PageItem(childPath));
+          list.add(new PageItem(childPath, Filter.isDisabled(childPath), Filter.isTodo(childPath)));
         }
       }
     }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java?rev=1083801&r1=1083800&r2=1083801&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Filter.java Mon Mar 21 14:27:11 2011
@@ -37,26 +37,37 @@ public class Filter {
       ".*\\.html"
   );
 
-  public static final Set<String> FORBIDDEN = new HashSet<String>(Arrays.asList(
+  public static final Set<String> HIDDEN = new HashSet<String>(Arrays.asList(
       "/META-INF.*",
       "/WEB-INF.*",
       "/org/.*",
       "/src/.*",
-      "/try/.*",
-      ".*/\\.svn/.*",
-      ".*-fragment\\.xhtml",
-
-      "/index.html",
-      "/navigation.xhtml",
-
-      "/meta-test/meta-1.*",
-      "/meta-test/meta-2.*\\.jspx",
-      "/meta-test/meta-3.*\\.xhtml",
-      "/meta-test/meta-4.*",
+      ".*/\\.svn/.*"
+  ));
+
+  /**
+   * Internal pages and pages that are impossible to run.
+   */
+  public static final Set<String> DISABLED = new HashSet<String>(Arrays.asList(
+      ".*-fragment\\.xhtml", // intern
+
+      "/index.html", // intern
+      "/navigation.*", // intern
+
+      "/meta-test/meta-1.*", // meta test
+      "/meta-test/meta-2.*\\.jspx", // meta test
+      "/meta-test/meta-3.*\\.xhtml", // meta test
+      "/meta-test/meta-4.*", // meta test
 
       "/tc/attribute/mode-valueIfSet.jspx", // set id="${id}" not possible with JSP.
-      "/tc/button/plain.html",
-      "/tc/button/plain_de.html",
+      "/tc/button/plain.html", // intern
+      "/tc/button/plain_de.html" // intern
+  ));
+
+  /**
+   * Switched off temporary.
+   */
+  public static final Set<String> TODO = new HashSet<String>(Arrays.asList(
       "/tc/gridLayout/horizontal-600px-default-300px.*",
       "/tc/gridLayout/horizontal-default-default-600px.*"
   ));
@@ -83,8 +94,8 @@ public class Filter {
 
     // 3rd the negative check
 
-    for (String forbidden : FORBIDDEN) {
-      if (name.matches(forbidden)) {
+    for (String hidden : HIDDEN) {
+      if (name.matches(hidden)) {
         return false;
       }
     }
@@ -92,4 +103,24 @@ public class Filter {
     return true;
   }
 
+  public static boolean isDisabled(String name) {
+    for (String disabled : DISABLED) {
+      if (name.matches(disabled)) {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+  public static boolean isTodo(String name) {
+    for (String todo : TODO) {
+      if (name.matches(todo)) {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/PageItem.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/PageItem.java?rev=1083801&r1=1083800&r2=1083801&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/PageItem.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/PageItem.java Mon Mar 21 14:27:11 2011
@@ -17,6 +17,7 @@ package org.apache.myfaces.tobago.exampl
  * limitations under the License.
  */
 
+import org.apache.myfaces.tobago.context.Markup;
 import org.apache.myfaces.tobago.util.VariableResolverUtils;
 
 import javax.faces.context.FacesContext;
@@ -30,8 +31,10 @@ public class PageItem extends DefaultMut
   private boolean jsfResource;
   private String label;
   private boolean folder;
+  private boolean disabled;
+  private boolean todo;
 
-  public PageItem(String name) {
+  public PageItem(String name, boolean disabled, boolean todo) {
     this.name = name;
     resource = name.substring(1);
     jsfResource = name.endsWith(".xhtml") || name.endsWith(".jspx");
@@ -43,6 +46,8 @@ public class PageItem extends DefaultMut
     }
     label = label.substring(label.lastIndexOf("/") + 1);
 //    label = label.replaceAll("_", "__");
+    this.disabled = disabled;
+    this.todo = todo;
   }
 
   public String getName() {
@@ -69,6 +74,18 @@ public class PageItem extends DefaultMut
     return folder;
   }
 
+  public boolean isDisabled() {
+    return disabled;
+  }
+
+  public Markup getMarkup() {
+    if (todo) {
+      return Markup.valueOf("todo");
+    } else {
+      return null;
+    }
+  }
+
   public String navigate() {
     DirectoryBrowser browser =
         (DirectoryBrowser) VariableResolverUtils.resolveVariable(FacesContext.getCurrentInstance(), "browser");

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/tobago-config.xml?rev=1083801&r1=1083800&r2=1083801&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/tobago-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/tobago-config.xml Mon Mar 21 14:27:11 2011
@@ -28,4 +28,14 @@
     <supported-theme>richmond</supported-theme>
     <supported-theme>charlotteville</supported-theme>
   </theme-config>
+
+  <renderers>
+    <renderer>
+      <name>TreeCommand</name>
+      <supported-markup>
+        <markup>disabled</markup>
+        <markup>todo</markup>
+      </supported-markup>
+    </renderer>
+  </renderers>
 </tobago-config>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml?rev=1083801&r1=1083800&r2=1083801&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml Mon Mar 21 14:27:11 2011
@@ -47,11 +47,11 @@
 
       <tc:tree>
         <tc:treeData value="#{browser.tree}" var="node">
-          <tc:treeNode expanded="#{node.level lt 2}">
+          <tc:treeNode expanded="#{node.level lt 2}" disabled="#{node.disabled}">
             <tc:treeIndent/>
             <tc:treeIcon/>
             <tc:treeCommand link="#{node.resource}" label="#{node.label}" target="page:content"
-                            rendered="#{node.childCount == 0}"/>
+                            rendered="#{node.childCount == 0}" markup="#{node.markup}"/>
             <tc:treeLabel value="#{node.label}" rendered="#{node.childCount > 0}"/>
           </tc:treeNode>
         </tc:treeData>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/style/style.css?rev=1083801&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/style/style.css (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/style/style.css Mon Mar 21 14:27:11 2011
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.tobago-treeNode .tobago-treeCommand-markup-todo {
+  color: #ff0000;
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java?rev=1083801&r1=1083800&r2=1083801&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/AutomaticSeleniumTest.java Mon Mar 21 14:27:11 2011
@@ -88,7 +88,7 @@ public class AutomaticSeleniumTest exten
         continue;
       }
 
-      if (Filter.isValid(path)) {
+      if (Filter.isValid(path) && !Filter.isDisabled(path) && !Filter.isTodo(path)) {
         result.add(path);
       }
     }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java?rev=1083801&r1=1083800&r2=1083801&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/FilterUnitTest.java Mon Mar 21 14:27:11 2011
@@ -35,7 +35,9 @@ public class FilterUnitTest {
     Assert.assertFalse(Filter.isValid("/NETA-INF"));
     Assert.assertFalse(Filter.isValid("/META-INF/"));
 
-    Assert.assertFalse(Filter.isValid("/navigation.xhtml"));
+    Assert.assertTrue(Filter.isValid("/navigation.xhtml"));
     Assert.assertTrue(Filter.isValid("/nav.xhtml"));
+
+    Assert.assertTrue(Filter.isDisabled("/navigation.xhtml"));
   }
 }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml?rev=1083801&r1=1083800&r2=1083801&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml Mon Mar 21 14:27:11 2011
@@ -273,8 +273,21 @@
       </supported-markup>
     </renderer>
     <renderer>
+      <name>TreeCommand</name>
+      <supported-markup>
+        <markup>disabled</markup>
+      </supported-markup>
+    </renderer>
+    <renderer>
+      <name>TreeLabel</name>
+      <supported-markup>
+        <markup>disabled</markup>
+      </supported-markup>
+    </renderer>
+    <renderer>
       <name>TreeNode</name>
       <supported-markup>
+        <markup>disabled</markup>
         <markup>strong</markup> <!--XXX has to be in label and command ? -->
         <markup>marked</markup>
         <markup>folder</markup>
@@ -283,6 +296,7 @@
     <renderer>
       <name>TreeMenuNode</name>
       <supported-markup>
+        <markup>disabled</markup>
         <markup>strong</markup> <!--XXX has to be in label and command ? -->
         <markup>marked</markup>
         <markup>folder</markup>