According to the code (i took a quick peek) the path is only used for
resource loading. it does not parse web.xml.
You have 3 options:
1 override getHiveKey in the application you pass to WicketTester to
return a fixed string.
2 override WicketTester.newServletContext to return a custom context
where you manually parse the web.xml
3 file an rfe and wait till someone has time to implement this.

I strongly recommend option 1 :)

Maurice

On Wed, May 28, 2008 at 1:35 PM, RUMikeP <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> Is there any way making sure WicketTester loads my application's web.xml?
>
> Have searched the archives and seen some suggestions about setting the path
> in the WicketTester constructor, but unless I missed something while
> debugging, it correctly sets the path to the "WAR base" for loading
> resources, but does not actually load the web.xml and therefore setup
> parameters (in my instance the SWARM HIVE key) are not available.
>
> Am I missing something?  (or should that read, what am I missing ;-)
>
> My Tester
> import junit.framework.TestCase;
>
> import org.apache.wicket.util.tester.WicketTester;
>
> import absa.wicket.referenceapplication.IndexPage;
> import absa.wicket.referenceapplication.WicketReferenceApplication;
>
> public class TestCore extends TestCase
> {
>        private WicketTester tester;
>
>        public void setUp()
>        {
>                // for newsgroup readability
>                String webDir = System.getProperty("user.dir") + 
> "/src/main/webapp";
>                tester = new WicketTester(new WicketReferenceApplication(), 
> webDir);
>        }
>
>        public void testRenderMyPage()
>        {
>                //start and render the test page
>                 tester.startPage(IndexPage.class);
>
>                //assert rendered page class
>                tester.assertRenderedPage(IndexPage.class);
>
>        }
>
> }
>
>
> Which fails when my getHiveKey in my SWARM Application gets called:
>
>        protected String getHiveKey() {
>                String key = (String) 
> getServletContext().getInitParameter("hivekey");
>                if (key == null) {
>                        logger.logp(Level.SEVERE, className, "getHiveKey", 
> "Unable to locate
> hivekey in web.xml");
>                        throw new RuntimeException("Unable to locate hivekey 
> in web.xml");
>                }
>                return key;
>        }
>
> Thanks
> --
> View this message in context: 
> http://www.nabble.com/WicketTester-not-picking-up-web.xml--tp17510667p17510667.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to