I've only briefly search the history...but, I can't imagine I'm the first
one to try and do this.
I have a ReST application that processes an incoming URL and returns a
generic status on the incoming URL-fetch. I'd like to be able to harness
the remote fetch locally via a test setup of a static file. Here's what I
think I want to do:
@BeforeClass
public static void setUpServer() throws Exception {
// Create a new Component.
component = new Component();
// Add a new HTTP server listening on port 8182.
component.getServers().add(Protocol.HTTP, 8182);
// Attach the sample application.
component.getDefaultHost().attach(
new AutomagicApplication(component.getContext()));
// Create an application
Application test = new Application(component.getContext()) {
@Override
public Restlet createRoot() {
return new
Directory(getContext(),"file:///./src/test/resources/");
}
};
component.getDefaultHost().attach("test", test);
// Start the component.
component.start();
...
Then in my test code I retrieve a file from that directory. I'm definitely
not sure about not having an absolute path for the ROOT_URI. I don't want
to have to go to the root, because every dever's machine or integration
environment is different. Any insight? Thoughts?
TIA,
Kit