AppFuse
  1. AppFuse
  2. APF-1088

If class name has embedded capitals, AppGen code fails UI tests, and generated hyperlinks are incorrect.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.1.0
    • Component/s: Tools - AppGen
    • Labels:
      None
    • Environment:
      WinXP/Pro/SP2, Maven 2.0.9, Java 1.6.0_05

      Description

      Using appfuse:gen -Dentity=TestCase creates code that doesn't work, due to the embedded uppercase letter in the class name.

      (see also forum http://www.nabble.com/problem-in-filenames-with-appfuse%3Agen-and-mixed-case-class-name-td18883094s2369.html)

      "mvn" fails during the UI test phase; after all the "User" UI tests complete OK, and FlushCache and FileUpload, then I get this:

      SearchTestCases:
      [INFO] [talledLocalContainer] [LStst4] WARN [http-8081-13] PageNotFound.noHandlerFound(1068) | No mapping found for HTTP request with URI [/LStst4-1.0-SNAPSHOT/testCases.html] in DispatcherServlet with name 'dispatcher'
      ...

      Note that /testcases.html does work; and /testcaseform.html works, also. However, the edit and Add links on testcases.html are to /testCaseform.html (capital C), so they fail. (And the main menu link is to /testCases.html, so that fails.)

      ...and poking around some more, i found in web-tests.xml:
      <webtest name="searchTestCases">
      &config;
      <steps>
      &login;
      <invoke description="click View TestCase link" url="/testCases.html"/>

      I think the problem is a conflict between the controller mapping (ControllerClassNameHandlerMapping), which lower-cases the whole name, and the names used by the gen process, which keeps embedded capitals, e.g., testCases.jsp.

      The source for TestCase.java:
      package com.LStst.app.model;
      import javax.persistence.*;
      import static javax.persistence.GenerationType.IDENTITY;

      @Entity
      @Table(name = "test_case")
      public class TestCase implements java.io.Serializable {
      static final long serialVersionUID = 1L;
      private Integer id;
      private String name;

      public TestCase() {
      }
      public TestCase(String name)

      { this.name = name; }

      @Id
      @GeneratedValue(strategy = IDENTITY)
      @Column(name = "Id", unique = true, nullable = false)
      public Integer getId() { return this.id; }
      public void setId(Integer id) { this.id = id; }

      @Column(name = "Name", length = 50)
      public String getName() { return this.name; }
      public void setName(String name) { this.name = name; }

      }

      gen added this applicationContext.xml entry:
      <!-TestCaseManager-START->
      <bean id="testCaseManager" class="org.appfuse.service.impl.GenericManagerImpl">
      <constructor-arg>
      <bean class="org.appfuse.dao.hibernate.GenericDaoHibernate">
      <constructor-arg value="com.LStst.app.model.TestCase"/>
      <property name="sessionFactory" ref="sessionFactory"/>
      </bean>
      </constructor-arg>
      </bean>
      <!-TestCaseManager-END->

      gen added this to dispatcher-servlet.xml:
      <!-TestCase-START->
      <bean id="testCaseController" class="com.LStst.app.webapp.controller.TestCaseController">
      <property name="testCaseManager" ref="testCaseManager"/>
      </bean>

      <bean id="testCaseFormController" class="com.LStst.app.webapp.controller.TestCaseFormController">
      <property name="validator" ref="beanValidator"/>
      <property name="successView" value="redirect:testCases.html"/>
      <property name="testCaseManager" ref="testCaseManager"/>
      </bean>
      <!-TestCase-END->

      gen added this menu-config.xml entry:
      <Menu name="TestCaseMenu" title="testCaseList.title" page="/testCases.html"/>

      gen added this to validation.xml:
      <!-TestCase-START->
      <form name="testCase">
      </form>
      <!-TestCase-END->

      but that failed XML validation - "missing (field)+", so I added a field entry:
      <form name="testCase">
      <field property="name" depends="required">
      <arg0 key="testCase.name"/>
      </field>
      </form>

      gen also created
      LStst4\src\main\webapp\WEB-INF\pages\testCases.jsp
      LStst4\src\main\webapp\WEB-INF\pages\testCaseform.jsp

        Activity

        Hide
        Enrique Jes?s Cardona Cebri?n added a comment -

        A temporary fix to this issue in 2.0.2 version.

        The thing you have to do is get "/WEB-INF/dispatcher-servlet.xml" file and edit "ControllerClassNameHandlerMapping" entry like this:

        <bean
        class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
        <property name="order" value="1" />
        <!-- Fixes JIRA APF-1088 -->
        <property name="caseSensitive" value="true" />
        </bean>

        That worked for me.

        Show
        Enrique Jes?s Cardona Cebri?n added a comment - A temporary fix to this issue in 2.0.2 version. The thing you have to do is get "/WEB-INF/dispatcher-servlet.xml" file and edit "ControllerClassNameHandlerMapping" entry like this: <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"> <property name="order" value="1" /> <!-- Fixes JIRA APF-1088 --> <property name="caseSensitive" value="true" /> </bean> That worked for me.
        Hide
        Enrique Jes?s Cardona Cebri?n added a comment -

        Sorry about my last comment. It solves this concrete problem but generates lots of other problems in other parts of the code.

        Don't use it. I'll have to wait next AppFuse release.

        Show
        Enrique Jes?s Cardona Cebri?n added a comment - Sorry about my last comment. It solves this concrete problem but generates lots of other problems in other parts of the code. Don't use it. I'll have to wait next AppFuse release.

          People

          • Assignee:
            Matt Raible
            Reporter:
            Dwight Harn
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development