.add(new MBeanModule()) .add(new TestingJmxModule()) .add(new EventModule()) .add(new TraceTokenModule()) .add(new ServerSecurityModule())
public static void start(Module... extraModules) { Bootstrap app = new Bootstrap(ImmutableList.<Module>builder() .add(new NodeModule()) .add(new HttpServerModule()) .add(new JsonModule()) .add(new JaxrsModule(true)) .add(new MBeanModule()) .add(new JmxModule()) .add(new LogJmxModule()) .add(new TraceTokenModule()) .add(new EventModule()) .add(new ProxyModule()) .add(extraModules) .build()); Logger log = Logger.get(PrestoProxy.class); try { app.strictConfig().initialize(); log.info("======== SERVER STARTED ========"); } catch (Throwable t) { log.error(t); System.exit(1); } }
new EventModule(), new MBeanModule(), new JsonModule(),
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(InMemoryEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(InMemoryEventClient.class)).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(InMemoryEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(InMemoryEventClient.class)).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(InMemoryEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(InMemoryEventClient.class)).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(InMemoryEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(InMemoryEventClient.class)).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(JsonEventWriter.class).in(Scopes.SINGLETON); binder.bind(HttpEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(HttpEventClient.class)).in(Scopes.SINGLETON); newExporter(binder).export(EventClient.class).withGeneratedName(); discoveryBinder(binder).bindHttpSelector("collector"); // bind the http client httpClientBinder(binder).bindHttpClient("event", ForEventClient.class); // Kick off the binding of Set<EventTypeMetadata> in case no events are bound newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {}); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(JsonEventWriter.class).in(Scopes.SINGLETON); binder.bind(HttpEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(HttpEventClient.class)).in(Scopes.SINGLETON); newExporter(binder).export(EventClient.class).withGeneratedName(); discoveryBinder(binder).bindHttpSelector("collector"); // bind the http client httpClientBinder(binder).bindHttpClient("event", ForEventClient.class); // Kick off the binding of Set<EventTypeMetadata> in case no events are bound newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {}); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(JsonEventWriter.class).in(Scopes.SINGLETON); binder.bind(HttpEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(HttpEventClient.class)).in(Scopes.SINGLETON); newExporter(binder).export(EventClient.class).withGeneratedName(); discoveryBinder(binder).bindHttpSelector("collector"); // bind the http client httpClientBinder(binder).bindHttpClient("event", ForEventClient.class); // Kick off the binding of Set<EventTypeMetadata> in case no events are bound newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {}); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(JsonEventWriter.class).in(Scopes.SINGLETON); binder.bind(HttpEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(HttpEventClient.class)).in(Scopes.SINGLETON); newExporter(binder).export(EventClient.class).withGeneratedName(); discoveryBinder(binder).bindHttpSelector("collector"); // bind the http client httpClientBinder(binder).bindAsyncHttpClient("event", ForEventClient.class); // Kick off the binding of Set<EventTypeMetadata> in case no events are bound newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {}); } }
public static void start(Module... extraModules) { Bootstrap app = new Bootstrap(ImmutableList.<Module>builder() .add(new NodeModule()) .add(new HttpServerModule()) .add(new JsonModule()) .add(new JaxrsModule(true)) .add(new MBeanModule()) .add(new JmxModule()) .add(new LogJmxModule()) .add(new TraceTokenModule()) .add(new EventModule()) .add(new ProxyModule()) .add(extraModules) .build()); Logger log = Logger.get(PrestoProxy.class); try { app.strictConfig().initialize(); log.info("======== SERVER STARTED ========"); } catch (Throwable t) { log.error(t); System.exit(1); } }
@Test public void testCanConstructServer() throws Exception { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("node.environment", "test") .put("http-server.http.port", "0") .put("http-server.log.path", new File(tempDir, "http-request.log").getAbsolutePath()) .build(); ConfigurationFactory configFactory = new ConfigurationFactory(properties); Injector injector = Guice.createInjector(new HttpServerModule(), new TestingNodeModule(), new ConfigurationModule(configFactory), new EventModule(), binder -> binder.bind(Servlet.class).annotatedWith(TheServlet.class).to(DummyServlet.class)); HttpServer server = injector.getInstance(HttpServer.class); assertNotNull(server); }
@Test public void testCanConstructServer() throws Exception { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("node.environment", "test") .put("http-server.http.port", "0") .put("http-server.log.path", new File(tempDir, "http-request.log").getAbsolutePath()) .build(); ConfigurationFactory configFactory = new ConfigurationFactory(properties); Injector injector = Guice.createInjector(new HttpServerModule(), new NodeModule(), new ConfigurationModule(configFactory), new EventModule(), new Module() { @Override public void configure(Binder binder) { binder.bind(Servlet.class).annotatedWith(TheServlet.class).to(DummyServlet.class); } }); HttpServer server = injector.getInstance(HttpServer.class); assertNotNull(server); }
new TestingNodeModule(), new ConfigurationModule(configFactory), new EventModule(), binder -> binder.bind(Servlet.class).annotatedWith(TheServlet.class).to(DummyServlet.class));
new NodeModule(), new ConfigurationModule(configFactory), new EventModule(), new Module()
@BeforeClass public void startServer() throws Exception { tempDir = createTempDir("agent"); Map<String, String> properties = ImmutableMap.<String, String>builder() .put("agent.id", UUID.randomUUID().toString()) .put("agent.coordinator-uri", "http://localhost:9999/") .put("agent.slots-dir", tempDir.getAbsolutePath()) .put("discovery.uri", "fake://server") .build(); Injector injector = Guice.createInjector( new TestingDiscoveryModule(), new TestingNodeModule(), new JsonModule(), new TestingHttpServerModule(), new JaxrsModule(), new EventModule(), new AgentMainModule(), new ConfigurationModule(new ConfigurationFactory(properties))); server = injector.getInstance(TestingHttpServer.class); agent = injector.getInstance(Agent.class); server.start(); client = new JettyHttpClient(); installationHelper = new InstallationHelper(); appleInstallation = installationHelper.getAppleInstallation(); bananaInstallation = installationHelper.getBananaInstallation(); }
@BeforeClass public void startServer() throws Exception { tempDir = createTempDir("agent"); Map<String, String> properties = ImmutableMap.<String, String>builder() .put("agent.id", UUID.randomUUID().toString()) .put("agent.coordinator-uri", "http://localhost:9999/") .put("agent.slots-dir", tempDir.getAbsolutePath()) .put("discovery.uri", "fake://server") .build(); Injector injector = Guice.createInjector( new TestingDiscoveryModule(), new TestingNodeModule(), new JsonModule(), new TestingHttpServerModule(), new JaxrsModule(), new EventModule(), new AgentMainModule(), new ConfigurationModule(new ConfigurationFactory(properties))); server = injector.getInstance(TestingHttpServer.class); agent = injector.getInstance(Agent.class); server.start(); client = new ApacheHttpClient(); installationHelper = new InstallationHelper(); appleInstallation = installationHelper.getAppleInstallation(); bananaInstallation = installationHelper.getBananaInstallation(); }
public void start() throws Exception { Map<String, String> agentProperties = ImmutableMap.<String, String>builder() .put("node.environment", "test") .put("node.id", instance.getInstanceId()) .put("node.location", instance.getLocation()) .put("agent.slots-dir", new File(tempDir, "slots").getAbsolutePath()) .put("agent.resources-file", resourcesFile.getAbsolutePath()) .build(); Injector agentInjector = Guice.createInjector(new NodeModule(), new TestingHttpServerModule(), new TestingDiscoveryModule(), new JsonModule(), new JaxrsModule(), new EventModule(), new AgentMainModule(), new ConfigurationModule(new ConfigurationFactory(agentProperties))); agentServer = agentInjector.getInstance(TestingHttpServer.class); agent = agentInjector.getInstance(Agent.class); agentServer.start(); // update instance URIs to new http server instance = new Instance(instance.getInstanceId(), instance.getInstanceType(), instance.getLocation(), agentServer.getBaseUrl(), agentServer.getBaseUrl()); }
new JsonModule(), new JaxrsModule(), new EventModule(), new CoordinatorMainModule(), new StaticProvisionerModule(),