I am writing a Restful service using Scala.
On the server side, it has a interface:
trait ICustomerService {
@GET
@Path("/{id}")
@Produces(Array("application/xml"))
def getCustomer(@PathParam("id") id: Int): StreamingOutput
}
The service works fine and I tested it using web browser.
Now I want to write some automated test to this interface. The way I need to do is to write a RESTEasy client using the same interface:
class CustomerServiceProxy(url : String) {
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
val proxy = ProxyFactory.create(classOf[ICustomerService], url)
def getCustomer(id: Int): Customer = {
val streamingOutput = proxy.getCustomer(id)
<Problem here>
}
}
This code will not work as the streaming output only allow writing.
How do I write this test class so that I can get what the server write into the streamingoutput from the client side?
Many thanks