Search in sources :

Example 1 with ProvidenceServlet

use of net.morimekta.providence.server.ProvidenceServlet 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;
        }
    };
}
Also used : Server(org.eclipse.jetty.server.Server) NoLogging(net.morimekta.providence.tools.rpc.internal.NoLogging) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) MyService(net.morimekta.test.providence.MyService) DefaultSerializerProvider(net.morimekta.providence.serializer.DefaultSerializerProvider) ProvidenceServlet(net.morimekta.providence.server.ProvidenceServlet) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler) Before(org.junit.Before)

Example 2 with ProvidenceServlet

use of net.morimekta.providence.server.ProvidenceServlet in project providence by morimekta.

the class TestApplication method run.

@Override
public void run(TestConfiguration testConfiguration, Environment environment) throws Exception {
    Calculator.Iface impl = new TestCalculator();
    environment.jersey().register(DefaultProvidenceMessageBodyReader.class);
    environment.jersey().register(DefaultProvidenceMessageBodyWriter.class);
    environment.jersey().register(new TestCalculatorResource(impl));
    environment.getApplicationContext().addServlet(new ServletHolder(new ProvidenceServlet(new Calculator.Processor(impl), new DefaultSerializerProvider())), "/test");
}
Also used : ServletHolder(org.eclipse.jetty.servlet.ServletHolder) Calculator(net.morimekta.test.providence.jax.rs.calculator.Calculator) DefaultSerializerProvider(net.morimekta.providence.serializer.DefaultSerializerProvider) ProvidenceServlet(net.morimekta.providence.server.ProvidenceServlet)

Aggregations

DefaultSerializerProvider (net.morimekta.providence.serializer.DefaultSerializerProvider)2 ProvidenceServlet (net.morimekta.providence.server.ProvidenceServlet)2 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)2 NoLogging (net.morimekta.providence.tools.rpc.internal.NoLogging)1 MyService (net.morimekta.test.providence.MyService)1 Calculator (net.morimekta.test.providence.jax.rs.calculator.Calculator)1 Server (org.eclipse.jetty.server.Server)1 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)1 Before (org.junit.Before)1