Im trying todo some integration tests and not component testing. I completely agree if it's unit testing then you should mock it up..

James Carman wrote:
I would say that if you're trying to test your components, you should
try to do that without a database (whether its an in-memory HSQLDB
database or not).  The only thing I usually actually use a database
for is when I'm trying to test my queries (and inserts/deletes, etc.)
in my repository implementation classes.

On Thu, Oct 30, 2008 at 8:35 AM, Nino Saturnino Martinez Vazquez Wael
<[EMAIL PROTECTED]> wrote:
Is this the general consensus that this are the way todo stuff?

BTW I think I got away with the error before because I ran in an extended
persistence context, but this approach has unwanted effects on performance
etc..

James Carman wrote:
IMHO, you shouldn't really be using real hibernate with wicket tester.
 You should be using mock objects.

On Thu, Oct 30, 2008 at 6:37 AM, Nino Saturnino Martinez Vazquez Wael
<[EMAIL PROTECTED]> wrote:

Hi I am doing this:

  applicationContext = new ClassPathXmlApplicationContext(
         "classpath*:/META-INF/beans.xml");

         final WicketApplication application = new WicketApplication();

         application.setApplicationContext(applicationContext);
         wicketTester = new WicketTester(application);
                   wicketTester.startPage(HomePage.class);
         wicketTester.assertRenderedPage(HomePage.class);

And my application are running fine in deployment... I seem to have run
into
this before but I just cant remember what I did to fix it.. I've tried
with
AnnotApplicationContextMock, same result..


Hibernate: select country0_.id as id22_, country0_.name as name22_ from
Country country0_
[EMAIL PROTECTED]:28:48 ERROR (LazyInitializationException)     - failed to 
lazily
initialize a collection of role: zeuzgroup.domain.entity.Country.cities,
no
session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a
collection of role: zeuzgroup.domain.entity.Country.cities, no session or
session was closed
 at

org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
 at

org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
 at

org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
 at

org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
 at
org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:249)
 at zeuzgroup.web.page.HomePage.<init>(HomePage.java:46)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at

sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
 at

org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:153)
 at

org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:58)
 at

org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:282)
 at

org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:304)
 at

org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:223)
 at

org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
 at

org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1169)
 at org.apache.wicket.RequestCycle.step(RequestCycle.java:1246)
 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1347)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:543)
 at

org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:462)
 at

org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:368)
 at

org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:300)
 at

zeuzgroup.domain.IntegrationTestDomain.testCountryCityEvent(IntegrationTestDomain.java:34)
...

--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to