Hi Alex,
Thanks for testing with beta 23. Actually, you can already test the
Application nearly as you suggest.
Application app = new Application [...];
app.start();
Request req = new Request(Method.GET,
"http://localhost:"+TEST_PORT/blah");
req.setBaseRef("http://localhost:"+TEST_PORT);
app.handle(req, new Response(req));
The API changed in this area for beta 23, now you can do:
Application app = new Application [...];
app.start();
Request req = new Request(Method.GET,
"http://localhost:"+TEST_PORT/blah");
req.getResourceRef().setBaseRef("http://localhost:"+TEST_PORT);
app.handle(req);
In the next release, you will be able to do this (just checked in SVN):
Application app = new Application [...];
app.start();
Reference ref = new Reference("http://localhost:"+TEST_PORT/blah");
ref.setBaseRef("http://localhost:"+TEST_PORT);
app.get(ref);
Best regards,
Jerome
> -----Message d'origine-----
> De : news [mailto:[EMAIL PROTECTED] De la part de Alex Combs
> Envoyé : mercredi 20 décembre 2006 23:25
> À : [email protected]
> Objet : Re: Testing Application problems
>
> Update:
> I've tried it with beta 23, and it seems to work as expected
> now. Looks like
> I'll have to upgrade.
>
> I would like to put in a feature request, though. Ideally, I
> would want to be
> able to do something like the following:
>
> Application app = new Application(new Context()){
> public Restlet createRoot()
> {
> return new Directory(getContext(), "file:///tmp");
> }
> };
> app.start(); //Note: No wrapper Component
> app.get("/blah");
>
> This would allow me to directly test the child Application
> without having to
> stick it inside a dummy Component, which would make testing
> simultaneously
> clearer and more robust.
>
>
>
>
>
>