Yeah, I've got some sample data in both files. I've attached the output of my
mvn call. Perhaps something might stand out. I'll keep looking.
Marshall
Matt Raible <[EMAIL PROTECTED]> wrote:
Did you add sample data to both sample-data.xml files? There's one in
each project. Unfortunately, I haven't figured out a better way to do
this, although you may be able to point the web project's dbunit
configuration to the core project.
Matt
On 5/25/07, marshall wrote:
> Hey Matt;
>
> I've tried comparing my version with the tutorial-spring code and I don't
> see any difference. The java classes are the same. The configs all look good
> too.
> I'm wondering if this is a potential modular issue?
> Your tutorial runs fine with the tests passing.
>
> I've added data to the person table and to the sample-data.xml file and the
> assertion error still occurs. At this point, I'm not sure what else I can do
> to look into the issue. If you've any other ideas, I'd appreciate it.
> Thanks.
>
> Regards;
>
> Marshall
>
> marshall wrote:
>
>
> Hmm;
>
> Matt, this may be where my naivete shows itself. I could add something like
> the following to PersonController's handleRequest method as you suggest
> below:
>
> return new ModelAndView().addAllObjects(personManager.getAll());
>
> I also tested the contents of personManager as follows:
>
> List list = personManager.getAll();
> Iterator i = list.iterator();
> System.out.println("printing personManager's contents: " + list.size());
>
> The list size comes back as zero. I can try setting more breakpoints, but at
> this point I'm feeling that maybe I'm missing some configuration step? My
> config is below. Again, the ApplicationContext.xml is:
>
>
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>
> > class="org.appfuse.service.impl.GenericManagerImpl">
>
> > autowire="byType">
>
>
>
>
>
>
>
> Perhaps I could look at the tutorial example code and try a comparison of
> the files.
>
> Regards;
>
> Marshall
>
> Matt Raible wrote:
> What happens if you use new ModelAndView().addAllObjects() - do you
> get the same error?
>
> Matt
>
> On 5/22/07, marshall wrote:
> > Interestingly, when I debug the ModelMap, the object has null values.
> >
> > Matt Raible wrote:
> > If you print out the contents of ModelMap, what does it have in there?
> > You might try debugging your test and setting a breakpoint to
> > inspect.
> >
> > Matt
> >
> > On 5/22/07, marshall wrote:
> > > Sure;
> > >
> > > Here it is:
> > >
> > > package com.ss.webapp.controller;
> > >
> > >
> > > import javax.servlet.http.HttpServletRequest;
> > > import javax.servlet.http.HttpServletResponse;
> > >
> > > import org.apache.commons.logging.Log;
> > > import org.apache.commons.logging.LogFactory;
> > > import org.appfuse.service.GenericManager;
> > > import com.socialsplendor.relisting.model.Person;
> > >
> > > import org.springframework.web.servlet.ModelAndView;
> > > import org.springframework.web.servlet.mvc.Controller;
> > >
> > >
> > > public class PersonController implements Controller {
> > >
> > > private final Log log = LogFactory.getLog(PersonController.class);
> > > private GenericManager personManager = null;
> > >
> > > public void setPersonManager(GenericManager
> > > personManager) {
> > > this.personManager = personManager;
> > > }
> > >
> > > public ModelAndView handleRequest(HttpServletRequest
> > > request, HttpServletResponse response) throws Exception {
> > > log.debug("entering 'handleRequest' method...");
> > >
> > > return new ModelAndView().addObject(personManager.getAll());
> > > }
> > > }
> > >
> > >
> > > Marshall
> > >
> > >
> > > Matt Raible wrote:
> > > The problem likely occurs in PersonController.java - can you post the
> > > code for that?
> > >
> > > Thanks,
> > >
> > > Matt
> > >
> > > On 5/22/07, marshall wrote:
> > > > Sure Matt;
> > > >
> > > > I'll include a few things just in case, starting with the
> > > > PersonControllerTest class:
> > > >
> > > > package com.ss.webapp.controller;
> > > >
> > > > import java.util.List;
> > > > import
> > > > org.appfuse.webapp.controller.BaseControllerTestCase;
> > > > import org.springframework.ui.ModelMap;
> > > > import org.springframework.web.servlet.ModelAndView;
> > > >
> > > > public class PersonControllerTest extends BaseControllerTestCase {
> > > > private PersonController c;
> > > >
> > > > public void setPersonController(PersonController c) {
> > > > this.c = c;
> > > > }
> > > >
> > > > public void testHandleRequest() throws Exception {
> > > > ModelAndView mav = c.handleRequest(null, null);
> > > > ModelMap m = mav.getModelMap();
> > > > assertNotNull(m.get("personList"));
> > > > assertTrue(((List) m.get("personList")).size() > 0);
> > > > }
> > > > }
> > > >
> > > > and the
> core/src/main/resources/applicationContext.xml
> > > >
> > > >
> > > > >
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > >
> > >
> >
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> > > >
> > >
> >
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
> > > >
> > > > >
> class="org.appfuse.service.impl.GenericManagerImpl">
> > > >
> > > > > autowire="byType">
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > and my dispatcher-servlet.xml configuration for personController:
> > > >
> > > > > class="com.ss.webapp.controller.PersonController">
> > > >
> > > >
> > > >
> > > > I hope this if enough information for you.
> > > >
> > > > thanks;
> > > >
> > > > Marshall
> > > >
> > > > Matt Raible wrote:
> > > > What does the handleRequest() method of your PersonController look
> like?
> > > >
> > > > Matt
> > > >
> > > > On 5/22/07, marshall wrote:
> > > > > Hey all;
> > > > >
> > > > > I'm pretty new to appfuse. I'm going thru the tutorial, using a
> > modular
> > > > > spring MVC archetype. I've created a PersonController and
> > > > > PersonControllerTest in the respective directories in the web/
> > > component.
> > > > > I've also modified the dispatcher-servlet.xml for the proper
> mapping.
> > > > > When I run mvn test -Dtest=PersoncontrollerTest I'm getting an
> > > > > AssertionfailedError on the following line in PersonControllerTest:
> > > > >
> > > > > assertNotNull(m.get("personList"));
> > > > >
> > > > > Is there another configuration setting that I've overlooked?
> > > > >
> > > > > Thanks;
> > > > >
> > > > > Marshall
> > > > >
> > > > > ________________________________
> > > > > Finding fabulous fares is fun.
> > > > > Let Yahoo! FareChase search your favorite travel sites to find
> flight
> > > and
> > > > > hotel bargains.
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > http://raibledesigns.com
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > Park yourself in front of a world of choices in alternative vehicles.
> > > > Visit the Yahoo! Auto Green Center.
> > > >
> > > >
> > >
> > >
> > > --
> > > http://raibledesigns.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> > >
> > > Shape Yahoo! in your own image. Join our Network Research Panel today!
> > >
> >
> http://us.rd.yahoo.com/evt=48517/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
> > > hot CTA = Join our Network Research Panel
> >
> >
> > --
> > http://raibledesigns.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> > ________________________________
> > Looking for a deal? Find great prices on flights and hotels with Yahoo!
> > FareChase.
> >
> >
>
>
> --
> http://raibledesigns.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ________________________________
> Expecting? Get great news right away with email Auto-Check.
> Try the Yahoo! Mail Beta.
>
>
> ________________________________
> Got a little couch potato?
> Check out fun summer activities for kids.
>
>
--
http://raibledesigns.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.I:\development\projects\re\web>mvn -e test -Dtest=PersonControllerTest
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------------
---
[INFO] Building AppFuse Modular Application - Web (Spring MVC)
[INFO] task-segment: [test]
[INFO] -------------------------------------------------------------------------
---
[INFO] [warpath:add-classes {execution: default}]
[INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}]
[INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [dbunit:operation {execution: test-compile}]
[INFO] [surefire:test]
[INFO] Surefire report directory: I:\development\projects\re\web\target\surefire
-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.ss.relisting.webapp.controller.PersonControllerTest
[re] INFO [main] PersonControllerTest.loadContextLocations(51) | Loading additio
nal configuration from: classpath*:/applicationContext-resources.xml,classpath*:
/applicationContext-dao.xml,classpath*:/applicationContext-service.xml,classpath
*:/applicationContext.xml,/WEB-INF/applicationContext*.xml,/WEB-INF/dispatcher-s
ervlet.xml
AbandonedObjectPool is used ([EMAIL PROTECTED])
LogAbandoned: false
RemoveAbandoned: true
RemoveAbandonedTimeout: 60
[re] INFO [main] PersonControllerTest.startNewTransaction(314) | Began transacti
on (1): transaction manager [org.springframework.orm.hibernate3.HibernateTransac
[EMAIL PROTECTED]; default rollback = true
[re] DEBUG [main] PersonController.handleRequest(28) | entering 'handleRequest'
method...
printing personManager's contents: 0
{}
[re] INFO [main] PersonControllerTest.endTransaction(281) | Rolled back transact
ion after test execution
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 9.613 sec <<< FA
ILURE!
Results :
Failed tests:
testHandleRequest(com.ss.relisting.webapp.controller.PersonControl
lerTest)
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: There are test failures.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:560)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:459)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures
.
at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugi
n.java:425)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:443)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:539)
... 16 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24 seconds
[INFO] Finished at: Fri May 25 12:30:07 EDT 2007
[INFO] Final Memory: 14M/25M
[INFO] ------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]