How can I run server initialization code in a GwtTestCase?
Hi, I'm using GWT 2.4 and writing some integration test cases using GwtTestCase. How can I run some initialization code on the server side before the test cases kick off? I tried defining a servlet in my module's .gwt.xml file and writing some code in the init method, but it seems that alone is not enough (the init method is never getting called). Thanks for additional tips, - Dave -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How can I run server initialization code in a GwtTestCase?
On Wed, Feb 1, 2012 at 4:12 AM, laredotornado laredotorn...@zipmail.comwrote: Hi, I'm using GWT 2.4 and writing some integration test cases using GwtTestCase. How can I run some initialization code on the server side before the test cases kick off? I tried defining a servlet in my module's .gwt.xml file and writing some code in the init method, but it seems that alone is not enough (the init method is never getting called). Thanks for additional tips, - Dave In Gwt i used to communicate with server via RPC please try RPC for your server side communication. and its configuration must be done in web.xml -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Server initialization
where you define your servlet in web.xml add load-on-startup1/load- on-startup servlet servlet-nameMyAppServiceImpl/servlet-name servlet-classmy.package.app.MyAppServiceImpl/servlet-class load-on-startup1/load-on-startup /servlet On Jun 10, 6:29 pm, Jamie jamiesharbor-sou...@yahoo.com wrote: You might try using the servlet configuration 'load-on-startup' setting in your web.xml servlet definition. You could also define your own base class and derive your servlets from that so you at least have the code in one place... Jamie. --- Search for analog and digital television broadcast antennas in your area:http://www.antennamap.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Server initialization
Personally I would say use a ServletContextListener if the structures you are creating will be shared by several of your Servlets. That way the init is finished before any of your Servlets are created. Load-on-startup always feels like a bit of a hack to me ;) Just my 2c Steve wrote: where you define your servlet in web.xml add load-on-startup1/load- on-startup servlet servlet-nameMyAppServiceImpl/servlet-name servlet-classmy.package.app.MyAppServiceImpl/servlet-class load-on-startup1/load-on-startup /servlet On Jun 10, 6:29 pm, Jamie jamiesharbor-sou...@yahoo.com wrote: You might try using the servlet configuration 'load-on-startup' setting in your web.xml servlet definition. You could also define your own base class and derive your servlets from that so you at least have the code in one place... Jamie. --- Search for analog and digital television broadcast antennas in your area:http://www.antennamap.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Server initialization
Yup. That does the ticket! Here's the code if anyone's interested... The listener... package com.inexas.test.server; import javax.servlet.*; public class AppStarter implements ServletContextListener { public void contextInitialized(ServletContextEvent event) { ServletContext sc = event.getServletContext(); System.out.println(sc.getServerInfo()) ; } public void contextDestroyed(ServletContextEvent event) { System.out.println(Bye!); } } In the web.xml file... web-app listener listener-class com.inexas.test.server.AppStarter /listener-class /listener ... On Jun 11, 2009, at 11:21 AM, Jason Morris wrote: Personally I would say use a ServletContextListener if the structures you are creating will be shared by several of your Servlets. That way the init is finished before any of your Servlets are created. Load-on-startup always feels like a bit of a hack to me ;) Just my 2c --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Server initialization
Anyone know of a nice way of initializing the server before the client gets busy. The only thing I can think of is overriding init() in every *.serverXServerImpl and have it call my initialization stuff, e.g. @Override public void init() throws ServletException { super.init(); BootstrapLoader.checkLoaded(); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Server initialization
Well, that is what I am doing. I open resources like database in init method and close in destroy. Peter 2009/6/10, Keith Whittingham kwhitting...@gmail.com: Anyone know of a nice way of initializing the server before the client gets busy. The only thing I can think of is overriding init() in every *.serverXServerImpl and have it call my initialization stuff, e.g. @Override public void init() throws ServletException { super.init(); BootstrapLoader.checkLoaded(); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Server initialization
You might try using the servlet configuration 'load-on-startup' setting in your web.xml servlet definition. You could also define your own base class and derive your servlets from that so you at least have the code in one place... Jamie. --- Search for analog and digital television broadcast antennas in your area: http://www.antennamap.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---