You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by or...@apache.org on 2004/12/09 01:59:45 UTC

cvs commit: incubator-myfaces/src/cactus/web Bug1049792CactusTest.jsp

oros        2004/12/08 16:59:45

  Added:       src/cactus/org/apache/myfaces/cactus JspBasedTestCase.java
               src/cactus/org/apache/myfaces/renderkit/html
                        Bug1049792CactusTest.java
               src/cactus/web Bug1049792CactusTest.jsp
  Log:
  fix #1049792: rendered attribute enabled for commandNavigation
  
  Revision  Changes    Path
  1.1                  incubator-myfaces/src/cactus/org/apache/myfaces/cactus/JspBasedTestCase.java
  
  Index: JspBasedTestCase.java
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed 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.
   */
  package org.apache.myfaces.cactus;
  
  import javax.servlet.RequestDispatcher;
  
  import org.apache.cactus.ServletTestCase;
  
  
  /**
   * This is a convenient base class for cactus tests based on a JSP. The jsp filename is extracted from the
   * class name.
   * @author <a href="mailto:oliver@rossmueller.com">Oliver Rossmueller</a>
   */
  public class JspBasedTestCase extends ServletTestCase
  {
  
      public JspBasedTestCase(String string)
      {
          super(string);
      }
  
  
      public void testBug() throws Exception
      {
          String className = getClass().getName();
          int index = className.lastIndexOf('.');
          String jspName = className.substring(index + 1);
          RequestDispatcher rd = config.getServletContext().getRequestDispatcher("/" + jspName + ".jsf");
          // render the page for the first time
          rd.forward(request, response);
      }
  }
  
  
  
  1.1                  incubator-myfaces/src/cactus/org/apache/myfaces/renderkit/html/Bug1049792CactusTest.java
  
  Index: Bug1049792CactusTest.java
  ===================================================================
  /*
   * Copyright 2002,2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  package org.apache.myfaces.renderkit.html;
  
  import javax.servlet.RequestDispatcher;
  
  import org.apache.cactus.ServletTestCase;
  import org.apache.myfaces.cactus.JspBasedTestCase;
  
  import com.meterware.httpunit.WebResponse;
  
  
  /**
   * @author <a href="mailto:oliver@rossmueller.com">Oliver Rossmueller</a>
   */
  public class Bug1049792CactusTest
      extends JspBasedTestCase
  {
  
      public Bug1049792CactusTest(String string)
      {
          super(string);
      }
  
  
      public void endBug(WebResponse response)
          throws Exception
      {
          assertTrue(response.getText().indexOf("id=\"nav_3\"") == -1);
      }
  }
  
  
  
  1.1                  incubator-myfaces/src/cactus/web/Bug1049792CactusTest.jsp
  
  Index: Bug1049792CactusTest.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  
  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
  <%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>
  
  <html>
  <body>
  <f:view>
  
  <x:panelNavigation id="nav"
                styleClass="navigation"
                separatorClass="navseparator"
                itemClass="navitem"
                activeItemClass="navitem_active"
                openItemClass="navitem_open"   >
      <x:commandNavigation id="nav_1" value="#{example_messages['nav_Home']}" action="go_home" />
      <x:commandNavigation id="nav_2" value="#{example_messages['nav_Examples']}" >
          <x:commandNavigation id="nav_2_1" value="#{example_messages['nav_Sample_1']}" action="go_sample1" />
          <x:commandNavigation id="nav_2_2" value="#{example_messages['nav_Sample_2']}" action="go_sample2" />
          <x:commandNavigation id="nav_2_3" value="#{example_messages['nav_Validate']}" action="go_validate" />
          <x:commandNavigation id="nav_2_4" value="#{example_messages['nav_Components']}" >
              <x:commandNavigation id="nav_2_4_1" value="#{example_messages['nav_aliasBean']}" action="go_aliasBean" />
              <x:commandNavigation id="nav_2_4_2" value="#{example_messages['nav_dataTable']}" action="go_dataTable" />
              <x:commandNavigation id="nav_2_4_3" value="#{example_messages['nav_sortTable']}" action="go_sortTable" />
              <x:commandNavigation id="nav_2_4_4" value="#{example_messages['nav_Selectbox']}" action="go_selectbox" />
              <x:commandNavigation id="nav_2_4_5" value="#{example_messages['nav_FileUpload']}" action="go_fileupload" />
              <x:commandNavigation id="nav_2_4_6" value="#{example_messages['nav_TabbedPane']}" action="go_tabbedPane"/>
              <x:commandNavigation id="nav_2_4_7" value="#{example_messages['nav_Calendar']}" action="go_calendar" />
              <x:commandNavigation id="nav_2_4_71" value="#{example_messages['nav_Popup']}" action="go_popup" />
              <x:commandNavigation id="nav_2_4_8" value="#{example_messages['nav_Date']}" action="go_date" />
              <x:commandNavigation id="nav_2_4_81" value="#{example_messages['nav_HtmlEditor']}" action="go_htmlEditor" />
              <x:commandNavigation id="nav_2_4_9" value="#{example_messages['nav_dataList']}" action="go_dataList" />
              <x:commandNavigation id="nav_2_4_10" value="#{example_messages['nav_tree']}" action="go_tree" />
              <x:commandNavigation id="nav_2_4_11" value="#{example_messages['nav_treeTable']}" action="go_treeTable"/>
              <x:commandNavigation id="nav_2_4_12" value="#{example_messages['nav_rssTicker']}" action="go_rssticker" />
              <x:commandNavigation id="nav_2_4_13" value="#{example_messages['nav_dataScroller']}" action="go_datascroller" />
              <x:commandNavigation id="nav_2_4_14" value="#{example_messages['nav_panelstack']}" action="go_panelstack" />
              <x:commandNavigation id="nav_2_4_15" value="#{example_messages['nav_css']}" action="go_css" />
              <x:commandNavigation id="nav_2_4_16" value="#{example_messages['nav_newspaperTable']}" action="go_newspaperTable" />
          </x:commandNavigation>
      </x:commandNavigation>
      <x:commandNavigation id="nav_3" value="#{example_messages['nav_Documentation']}" rendered="false">
          <x:commandNavigation id="nav_3_1" value="#{example_messages['nav_Features']}" action="go_features"/>
      </x:commandNavigation>
      <x:commandNavigation id="nav_4" value="#{example_messages['nav_Options']}" action="go_options" />
      <f:verbatim>&nbsp;</f:verbatim>
      <x:commandNavigation id="nav_5" value="#{example_messages['nav_Info']}" >
          <x:commandNavigation id="nav_5_1" value="#{example_messages['nav_Contact']}" action="go_contact" />
          <x:commandNavigation id="nav_5_2" value="#{example_messages['nav_Copyright']}" action="go_copyright" />
      </x:commandNavigation>
  </x:panelNavigation>
  
  </f:view>
  </body>
  </html>