Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
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)
@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
| Field | Original Value | New Value |
|---|---|---|
| Fix Version/s | 2.1 [ 10031 ] |
| Fix Version/s | 2.1.0-M2 [ 10210 ] | |
| Fix Version/s | 2.1.0-M1 [ 10031 ] |
| Priority | Major [ 3 ] | Minor [ 4 ] |
| Fix Version/s | 2.1.0 [ 10211 ] | |
| Fix Version/s | 2.1.0-M2 [ 10210 ] |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
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.