Re: Question about Unit Testing with custom Session

2011-02-09 Thread Dmitriy Neretin
Thank you for reply, yes! And I get then another exception :) Cannot resolve ServletContextResource without ServletContext Does andybody know how can I get/set the servletContext? Dmitriy On 8 February 2011 18:01, Igor Vaynberg igor.vaynb...@gmail.com wrote: did you call context.refresh() ?

Re: Question about Unit Testing with custom Session

2011-02-09 Thread Attila Király
Hi, Try this in your application's #init() method (before calling #refresh() on ctx) ctx.setServletContext(getServletContext()); Attila 2011/2/9 Dmitriy Neretin dmitriy.nere...@googlemail.com Thank you for reply, yes! And I get then another exception :) Cannot resolve

Re: Question about Unit Testing with custom Session

2011-02-09 Thread Dmitriy Neretin
Hi, thank you! Now I know how to get the ServletContext :) But it didn't solve the main problem. This time I got following exception: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open

Re: Question about Unit Testing with custom Session

2011-02-09 Thread Attila Király
The problem is that your test is not actualy running in a servlet container, only in a wicket mocked servlet context. To access webapp resources in the test you have to specify in the second parameter of WicketTester constructor where your web app's root is. Like this (in a maven project):

Re: Question about Unit Testing with custom Session

2011-02-09 Thread Dmitriy Neretin
Thank you it finally works! :) But what I still don't understand: the problem appeared after I inserted following in the custom session constructor: InjectorHolder.getInjector().inject(this); And why it worked with only one WicketTester constructor parameter (new MyApplication)? And after

Re: Question about Unit Testing with custom Session

2011-02-09 Thread Attila Király
Hi, 2011/2/9 Dmitriy Neretin dmitriy.nere...@googlemail.com Thank you it finally works! :) Great! But what I still don't understand: the problem appeared after I inserted following in the custom session constructor: InjectorHolder.getInjector().inject(this); And why it worked with

Re: Question about Unit Testing with custom Session

2011-02-08 Thread Dmitriy Neretin
Hi, my complete setUp looks like this: @Before public void setUp() { MworldWicketApplication wicketWebApp = new MworldWicketApplication() { ApplicationContext ctx = new XmlWebApplicationContext(); @Override public void init() {

Re: Question about Unit Testing with custom Session

2011-02-08 Thread Igor Vaynberg
did you call context.refresh() ? like the error message said? -igor On Tue, Feb 8, 2011 at 1:31 AM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Hi, my complete setUp looks like this: @Before    public void setUp() {        MworldWicketApplication wicketWebApp = new

Question about Unit Testing with custom Session

2011-02-07 Thread Dmitriy Neretin
Hello everybody, After integration with spring I have following problem: if I add following to my CustomSession: InjectorHolder.getInjector().inject(this); (because I store some spring beans in the custom session) My WicketTester doesn't work anymore. I get this exception: BeanFactory not

Re: Question about Unit Testing with custom Session

2011-02-07 Thread Pedro Santos
I guess the problem is on the ApplicationContext object. Debug its creation and see if it has all your beans. You can use another implementation for tests, ex: FileSystemXmlApplicationContext On Mon, Feb 7, 2011 at 11:10 AM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Hello

Re: Question about Unit Testing with custom Session

2011-02-07 Thread Martijn Dashorst
Did you provide the application to the wicket tester? WicketTester tester = new WicketTester(myapp); Martijn On Mon, Feb 7, 2011 at 2:10 PM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Hello everybody, After integration with spring I have following problem: if I add following to

Re: Question about Unit Testing with custom Session

2011-02-07 Thread Dmitriy Neretin
Hi, of course. The point is if I delete this: InjectorHolder.getInjector().inject(this); from my session class everything works fine :( On 7 February 2011 15:27, Martijn Dashorst martijn.dasho...@gmail.comwrote: Did you provide the application to the wicket tester? WicketTester tester =

Re: Question about Unit Testing with custom Session

2011-02-07 Thread Igor Vaynberg
make sure your setup() code runs before wicket tester instance is created. -igor On Mon, Feb 7, 2011 at 7:41 AM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Hi, of course. The point is if I delete this: InjectorHolder.getInjector().inject(this); from my session class everything