use of io.airlift.http.server.testing.TestingHttpServerModule in project airlift by airlift.
the class TestMBeanServerResource method setup.
@BeforeMethod
public void setup() throws Exception {
Bootstrap app = new Bootstrap(new TestingNodeModule(), new TestingHttpServerModule(), new JsonModule(), new JmxHttpRpcModule(TheServlet.class), binder -> {
binder.bind(MBeanServer.class).toInstance(platformMBeanServer);
binder.bind(TestMBean.class).in(Scopes.SINGLETON);
});
Injector injector = app.doNotInitializeLogging().initialize();
lifeCycleManager = injector.getInstance(LifeCycleManager.class);
TestingHttpServer server = injector.getInstance(TestingHttpServer.class);
testMBean = injector.getInstance(TestMBean.class);
testMBeanName = new ObjectName(generatedNameOf(TestMBean.class));
MBeanExporter exporter = new MBeanExporter(platformMBeanServer);
exporter.export(testMBeanName.toString(), testMBean);
JMXConnector connect = JMXConnectorFactory.connect(new JMXServiceURL("service:jmx:" + server.getBaseUrl()), ImmutableMap.of(JMXConnector.CREDENTIALS, new String[] { "foo", "bar" }));
mbeanServerConnection = connect.getMBeanServerConnection();
}
use of io.airlift.http.server.testing.TestingHttpServerModule in project airlift by airlift.
the class TestServer method setup.
@BeforeMethod
public void setup() throws Exception {
Bootstrap app = new Bootstrap(new TestingNodeModule(), new TestingHttpServerModule(), new JsonModule(), new JaxrsModule(), new JmxHttpModule(), new JmxModule(), new MainModule());
Injector injector = app.doNotInitializeLogging().initialize();
lifeCycleManager = injector.getInstance(LifeCycleManager.class);
server = injector.getInstance(TestingHttpServer.class);
client = new JettyHttpClient();
}
use of io.airlift.http.server.testing.TestingHttpServerModule in project airlift by airlift.
the class TestServer method setup.
@BeforeMethod
public void setup() {
Bootstrap app = new Bootstrap(new TestingNodeModule(), new InMemoryEventModule(), new TestingHttpServerModule(), new JsonModule(), new JaxrsModule(), new MainModule());
Injector injector = app.doNotInitializeLogging().initialize();
lifeCycleManager = injector.getInstance(LifeCycleManager.class);
server = injector.getInstance(TestingHttpServer.class);
store = injector.getInstance(PersonStore.class);
eventClient = injector.getInstance(InMemoryEventClient.class);
client = new JettyHttpClient();
}
use of io.airlift.http.server.testing.TestingHttpServerModule in project airlift by airlift.
the class TestMBeanResource method setup.
@BeforeClass
public void setup() {
Bootstrap app = new Bootstrap(new TestingNodeModule(), new TestingHttpServerModule(), new JsonModule(), new JaxrsModule(), new JmxHttpModule(), binder -> binder.bind(MBeanServer.class).toInstance(mbeanServer));
Injector injector = app.quiet().initialize();
lifeCycleManager = injector.getInstance(LifeCycleManager.class);
server = injector.getInstance(TestingHttpServer.class);
client = new JettyHttpClient();
}
Aggregations