You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Douglas Ferguson <do...@douglasferguson.us> on 2010/05/18 08:24:56 UTC
wicket tester failing in CI but not locally
My tests are running fine from eclipse but I get this when they are kicked off in hudson..
testLoadPanel_AddNewPerson(com.conducive.wicketTester.PersonAddOrEditTest_Wicket) Time elapsed: 0.001 sec <<< ERROR!
org.apache.wicket.WicketRuntimeException: There is no application attached to current thread org.junit.runners.Suite
at org.apache.wicket.Application.get(Application.java:179)
at org.apache.wicket.injection.web.InjectorHolder.getInjector(InjectorHolder.java:67)
at com.conducive.wicket.PRManagerRequestCycle.<init>(PRManagerRequestCycle.java:57)
at com.conducive.wicket.PRManagerApplication.newRequestCycle(PRManagerApplication.java:539)
at org.apache.wicket.protocol.http.MockWebApplication.createRequestCycle(MockWebApplication.java:652)
at org.apache.wicket.protocol.http.MockWebApplication.setupRequestAndResponse(MockWebApplication.java:687)
at org.apache.wicket.protocol.http.MockWebApplication.setupRequestAndResponse(MockWebApplication.java:706)
at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:424)
at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:410)
at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:306)
at com.conducive.wicketTester.PRManagerTestBase.loginUser(PRManagerTestBase.java:138)
at com.conducive.wicketTester.PRManagerTestBase.loginUser(PRManagerTestBase.java:153)
at com.conducive.wicketTester.PersonAddOrEditTest_Wicket.testLoadPanel_AddNewPerson(PersonAddOrEditTest_Wicket.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.jdogma.junit.NonBlockingAsynchronousRunner$1.call(NonBlockingAsynchronousRunner.java:59)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket tester failing in CI but not locally
Posted by Per Newgro <pe...@gmx.ch>.
Upps, sorry. Didn't recognized guice.
I would try to add it appropriatly to this way
public class MyApplicationextends WebApplication{
protected void init() {
addComponentInstantiationListener(
new GuiceComponentInjector(this, getModule())
);
}
private Module getModule() {
return new Module() {
public void configure(Binder binder) {
binder.bind(IService.class).to(Service.class);
}
};
}
}
Cheers
Per
Re: wicket tester failing in CI but not locally
Posted by Igor Vaynberg <ig...@gmail.com>.
if you want the tests to run in parallel you have to create a wicket
tester inside every test method instead of just once per class. that
way the threadlocal is set into every thread.
-igor
On Tue, May 18, 2010 at 1:49 AM, Douglas Ferguson
<do...@douglasferguson.us> wrote:
> The problem is not a hudson problem.
>
> The problem is that wicket tester tests do not want to be run in parallel.
>
> D/
>
> On May 18, 2010, at 2:38 AM, Per Newgro wrote:
>
>> Sorry but more i can't do. Im not an hudson user.
>>
>> Cheers
>> Per
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket tester failing in CI but not locally
Posted by Douglas Ferguson <do...@douglasferguson.us>.
The problem is not a hudson problem.
The problem is that wicket tester tests do not want to be run in parallel.
D/
On May 18, 2010, at 2:38 AM, Per Newgro wrote:
> Sorry but more i can't do. Im not an hudson user.
>
> Cheers
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket tester failing in CI but not locally
Posted by Per Newgro <pe...@gmx.ch>.
Sorry but more i can't do. Im not an hudson user.
Cheers
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket tester failing in CI but not locally
Posted by Douglas Ferguson <do...@douglasferguson.us>.
No.. I realized that the tests are running in parallel on hudson but from eclipse.
Since the application is bound to a thread local, then it fails.
D/
On May 18, 2010, at 2:18 AM, Per Newgro wrote:
> Is it the working solution?
>
> Cheers
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket tester failing in CI but not locally
Posted by Per Newgro <pe...@gmx.ch>.
Is it the working solution?
Cheers
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket tester failing in CI but not locally
Posted by Douglas Ferguson <do...@douglasferguson.us>.
I just did this:
tester.getApplication().addComponentInstantiationListener(new GuiceComponentInjector(tester.getApplication()));
On May 18, 2010, at 2:01 AM, Douglas Ferguson wrote:
> I'm not using spring. Would I still use that injector?
>
> I'm using guice..
>
> D/
>
>
> On May 18, 2010, at 1:46 AM, Per Newgro wrote:
>
>> Someone seems to change this, but i dodn't found an example how to solve
>> it correctly until now.
>>
>> Kim had the problem some days ago to. Seems that yoiu have to add
>> ComponentInstListener to TestApplication to.
>> Why this was working before and not anymore - i don't know.
>> Here is what he wrote
>>
>> Okay,
>>
>> Got my test green:-)
>>
>>
>> Here it is:
>>
>> package be.thomascook.ui.pages.admin;
>>
>> import be.thomascook.wicket.component.WicketFilter;
>> import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
>> import org.apache.wicket.util.tester.WicketTester;
>> import org.springframework.beans.factory.annotation.Autowired;
>> import org.springframework.context.ApplicationContext;
>> import org.springframework.test.context.ContextConfiguration;
>> import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
>> import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
>> import org.springframework.transaction.annotation.Transactional;
>> import org.testng.annotations.Test;
>>
>> /**
>> * @author Compi
>> * @since 10-mei-2010
>> */
>> @ContextConfiguration(locations = {
>> "/applicationContext-dao.xml",
>> "/applicationContext-service.xml",
>> "/applicationContext-database.xml"})
>> @Transactional
>> public class UserListPageTest extends AbstractTransactionalTestNGSpringContextTests {
>>
>> @Autowired
>> private ApplicationContext applicationContext;
>> @Autowired
>> protected WicketFilter wicketApplication;
>>
>> @Test
>> public void labelContainsHelloWorld() {
>> WicketTester tester=new WicketTester();
>> tester.getApplication().addComponentInstantiationListener(new SpringComponentInjector(tester.getApplication(), applicationContext, true ));
>>
>>
>> tester.startPage(UserListPage.class);
>> tester.assertNoErrorMessage();
>> tester.assertLabel("title", "Users List");
>> }
>> }
>>
>>
>> Kind regards,
>> Kim
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket tester failing in CI but not locally
Posted by Douglas Ferguson <do...@douglasferguson.us>.
I'm not using spring. Would I still use that injector?
I'm using guice..
D/
On May 18, 2010, at 1:46 AM, Per Newgro wrote:
> Someone seems to change this, but i dodn't found an example how to solve
> it correctly until now.
>
> Kim had the problem some days ago to. Seems that yoiu have to add
> ComponentInstListener to TestApplication to.
> Why this was working before and not anymore - i don't know.
> Here is what he wrote
>
> Okay,
>
> Got my test green:-)
>
>
> Here it is:
>
> package be.thomascook.ui.pages.admin;
>
> import be.thomascook.wicket.component.WicketFilter;
> import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
> import org.apache.wicket.util.tester.WicketTester;
> import org.springframework.beans.factory.annotation.Autowired;
> import org.springframework.context.ApplicationContext;
> import org.springframework.test.context.ContextConfiguration;
> import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
> import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
> import org.springframework.transaction.annotation.Transactional;
> import org.testng.annotations.Test;
>
> /**
> * @author Compi
> * @since 10-mei-2010
> */
> @ContextConfiguration(locations = {
> "/applicationContext-dao.xml",
> "/applicationContext-service.xml",
> "/applicationContext-database.xml"})
> @Transactional
> public class UserListPageTest extends AbstractTransactionalTestNGSpringContextTests {
>
> @Autowired
> private ApplicationContext applicationContext;
> @Autowired
> protected WicketFilter wicketApplication;
>
> @Test
> public void labelContainsHelloWorld() {
> WicketTester tester=new WicketTester();
> tester.getApplication().addComponentInstantiationListener(new SpringComponentInjector(tester.getApplication(), applicationContext, true ));
>
>
> tester.startPage(UserListPage.class);
> tester.assertNoErrorMessage();
> tester.assertLabel("title", "Users List");
> }
> }
>
>
> Kind regards,
> Kim
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket tester failing in CI but not locally
Posted by Per Newgro <pe...@gmx.ch>.
Someone seems to change this, but i dodn't found an example how to solve
it correctly until now.
Kim had the problem some days ago to. Seems that yoiu have to add
ComponentInstListener to TestApplication to.
Why this was working before and not anymore - i don't know.
Here is what he wrote
Okay,
Got my test green:-)
Here it is:
package be.thomascook.ui.pages.admin;
import be.thomascook.wicket.component.WicketFilter;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.apache.wicket.util.tester.WicketTester;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
import org.springframework.transaction.annotation.Transactional;
import org.testng.annotations.Test;
/**
* @author Compi
* @since 10-mei-2010
*/
@ContextConfiguration(locations = {
"/applicationContext-dao.xml",
"/applicationContext-service.xml",
"/applicationContext-database.xml"})
@Transactional
public class UserListPageTest extends AbstractTransactionalTestNGSpringContextTests {
@Autowired
private ApplicationContext applicationContext;
@Autowired
protected WicketFilter wicketApplication;
@Test
public void labelContainsHelloWorld() {
WicketTester tester=new WicketTester();
tester.getApplication().addComponentInstantiationListener(new SpringComponentInjector(tester.getApplication(), applicationContext, true ));
tester.startPage(UserListPage.class);
tester.assertNoErrorMessage();
tester.assertLabel("title", "Users List");
}
}
Kind regards,
Kim
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org