Re: wicket tester failing in CI but not locally

2010-05-18 Thread Per Newgro
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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Douglas Ferguson
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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Douglas Ferguson
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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Per Newgro

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

2010-05-18 Thread Per Newgro

Is it the working solution?

Cheers
Per

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Douglas Ferguson
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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Per Newgro

Sorry but more i can't do. Im not an hudson user.

Cheers
Per

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Douglas Ferguson
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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Igor Vaynberg
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
doug...@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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org