use of net.morimekta.providence.serializer.DefaultSerializerProvider in project providence by morimekta.
the class DropWizardIT method testProvidenceServlet.
@Test
public void testProvidenceServlet() throws IOException, CalculateException {
// This test is just to prove that the providence servlet can be used in dropwizard too.
Calculator.Iface client = new Calculator.Client(new HttpClientHandler(() -> new GenericUrl(uri("test")), factory(), new DefaultSerializerProvider()));
Operand result = client.calculate(new Operation(Operator.ADD, list(withNumber(52d), withImaginary(new Imaginary(1d, -1d)), withNumber(15d))));
assertThat(debugString(result), is(equalTo("{\n" + " imaginary = {\n" + " v = 68\n" + " i = -1\n" + " }\n" + "}")));
}
use of net.morimekta.providence.serializer.DefaultSerializerProvider 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");
}
Aggregations