use of net.morimekta.providence.tools.rpc.internal.NoLogging in project providence by morimekta.
the class RPCProvidenceHttpTest method setUp.
@Before
public void setUp() throws Exception {
Log.setLog(new NoLogging());
rc = copyResourceTo("/pvdrc", temp.getRoot());
copyResourceTo("/test.thrift", temp.getRoot());
impl = mock(MyService.Iface.class);
server = new Server(0);
DefaultSerializerProvider provider = new DefaultSerializerProvider();
ServletContextHandler handler = new ServletContextHandler();
handler.addServlet(new ServletHolder(new ProvidenceServlet(new MyService.Processor(impl), provider)), "/" + ENDPOINT);
server.setHandler(handler);
server.start();
port = getExposedPort(server);
Thread.sleep(1);
exitCode = 0;
rpc = new RPC(console.tty()) {
@Override
protected void exit(int i) {
exitCode = i;
}
};
}
use of net.morimekta.providence.tools.rpc.internal.NoLogging in project providence by morimekta.
the class RPCThriftHttpTest method setUp.
@Before
public void setUp() throws Exception {
Log.setLog(new NoLogging());
rc = copyResourceTo("/pvdrc", temp.getRoot());
copyResourceTo("/test.thrift", temp.getRoot());
impl = mock(MyService.Iface.class);
server = new Server(port);
ServletContextHandler handler = new ServletContextHandler();
handler.addServlet(new ServletHolder(new TServlet(new MyService.Processor<>(impl), new TBinaryProtocol.Factory(true, true))), ENDPOINT);
handler.addServlet(new ServletHolder(new HttpServlet() {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setStatus(HttpServletResponse.SC_OK);
resp.getWriter().write(html(head(title("Fail!")), body(h1("Fail!"), span("Truly failure"))).render());
}
}), HTML_ENDPOINT);
handler.addServlet(new ServletHolder(new HttpServlet() {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setStatus(HttpServletResponse.SC_OK);
resp.getWriter().write("{\"error\":\"Fail!\"}");
}
}), JSON_ENDPOINT);
server.setHandler(handler);
server.start();
port = getExposedPort(server);
Thread.sleep(1);
exitCode = 0;
rpc = new RPC(console.tty()) {
@Override
protected void exit(int i) {
exitCode = i;
}
};
}
use of net.morimekta.providence.tools.rpc.internal.NoLogging in project providence by morimekta.
the class RPCThriftSocketTest method setUp.
@Before
public void setUp() throws Exception {
Log.setLog(new NoLogging());
rc = copyResourceTo("/pvdrc", temp.getRoot());
copyResourceTo("/test.thrift", temp.getRoot());
impl = Mockito.mock(MyService.Iface.class);
TServerSocket transport = new TServerSocket(0);
server = new TSimpleServer(new TServer.Args(transport).protocolFactory(new TBinaryProtocol.Factory()).processor(new MyService.Processor<>(impl)));
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.submit(server::serve);
Thread.sleep(1);
port = transport.getServerSocket().getLocalPort();
exitCode = 0;
rpc = new RPC(console.tty()) {
@Override
protected void exit(int i) {
exitCode = i;
}
};
}
Aggregations