Package com.proofpoint.bootstrap

Examples of com.proofpoint.bootstrap.Bootstrap


    public static void main(String[] args)
            throws Exception
    {
        try {
            Bootstrap app = bootstrapApplication("skeleton")
                    .withModules(
                            new NodeModule(),
                            new DiscoveryModule(),
                            new HttpServerModule(),
                            new JsonModule(),
                            explicitJaxrsModule(),
                            new MBeanModule(),
                            new JmxModule(),
                            new JmxHttpModule(),
                            new LogJmxModule(),
                            new HttpEventModule(),
                            new ReportingModule(),
                            new ReportingClientModule(),
                            new TraceTokenModule(),
                            new MainModule()
                    );

            Injector injector = app.initialize();
            injector.getInstance(Announcer.class).start();
        }
        catch (Throwable e) {
            log.error(e);
            System.exit(1);
View Full Code Here


    @Test
    public void testExecutorShutdown()
            throws Exception
    {
        Bootstrap app = bootstrapApplication("test-application")
                .doNotInitializeLogging()
                .withModules(
                        new JsonModule(),
                        new TestingNodeModule(),
                        new DiscoveryModule(),
                        new ReportingModule(),
                        new TestingMBeanModule()
                );

        Injector injector = app.initialize();

        ExecutorService executor = injector.getInstance(Key.get(ScheduledExecutorService.class, ForDiscoveryClient.class));
        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);

        assertFalse(executor.isShutdown());
View Full Code Here

    public static void main(String[] args)
            throws Exception
    {
        try {
            Bootstrap app = bootstrapApplication("sample-server")
                    .withModules(
                            new NodeModule(),
                            new DiscoveryModule(),
                            new HttpServerModule(),
                            new JsonModule(),
                            explicitJaxrsModule(),
                            new MBeanModule(),
                            new JmxModule(),
                            new JmxHttpModule(),
                            new LogJmxModule(),
                            new HttpEventModule(),
                            new ReportingModule(),
                            new ReportingClientModule(),
                            new TraceTokenModule(),
                            new MainModule()
                    );

            Injector injector = app.initialize();
            injector.getInstance(Announcer.class).start();
        }
        catch (Throwable e) {
            log.error(e);
            System.exit(1);
View Full Code Here

    @BeforeMethod
    public void setup()
            throws Exception
    {
        Bootstrap app = bootstrapApplication("test-application")
                .doNotInitializeLogging()
                .withModules(
                        new TestingNodeModule(),
                        new TestingHttpServerModule(),
                        new JsonModule(),
                        explicitJaxrsModule(),
                        new JmxHttpModule(),
                        new ReportingModule(),
                        new TestingMBeanModule(),
                        new MainModule()
                );

        Injector injector = app
                .initialize();

        lifeCycleManager = injector.getInstance(LifeCycleManager.class);
        server = injector.getInstance(TestingHttpServer.class);
        client = new JettyHttpClient();
View Full Code Here

    public void testGuiceInjectionWithoutFilters()
            throws Exception
    {
        final DummyServlet servlet = new DummyServlet();

        Bootstrap app = bootstrapApplication("test-application")
                .doNotInitializeLogging()
                .withModules(
                        new TestingNodeModule(),
                        new TestingHttpServerModule(),
                        new Module()
                        {
                            @Override
                            public void configure(Binder binder)
                            {
                                binder.bind(Servlet.class).annotatedWith(TheServlet.class).toInstance(servlet);
                                binder.bind(new TypeLiteral<Map<String, String>>()
                                {
                                }).annotatedWith(TheServlet.class).toInstance(ImmutableMap.<String, String>of());
                            }
                        });

        Injector injector = app.initialize();

        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
        TestingHttpServer server = injector.getInstance(TestingHttpServer.class);

        try (HttpClient client = new JettyHttpClient(new HttpClientConfig().setConnectTimeout(new Duration(1, SECONDS)))) {
View Full Code Here

            throws Exception
    {
        final DummyServlet servlet = new DummyServlet();
        final DummyFilter filter = new DummyFilter();

        Bootstrap app = bootstrapApplication("test-application")
                .doNotInitializeLogging()
                .withModules(
                        new TestingNodeModule(),
                        new TestingHttpServerModule(),
                        new Module()
                        {
                            @Override
                            public void configure(Binder binder)
                            {
                                binder.bind(Servlet.class).annotatedWith(TheServlet.class).toInstance(servlet);
                                binder.bind(new TypeLiteral<Map<String, String>>()
                                {
                                }).annotatedWith(TheServlet.class).toInstance(ImmutableMap.<String, String>of());
                                newSetBinder(binder, Filter.class, TheServlet.class).addBinding().toInstance(filter);
                            }
                        });

        Injector injector = app.initialize();

        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
        TestingHttpServer server = injector.getInstance(TestingHttpServer.class);

        try (HttpClient client = new JettyHttpClient(new HttpClientConfig().setConnectTimeout(new Duration(1, SECONDS)))) {
View Full Code Here

    public void testGuiceInjectionWithResources()
            throws Exception
    {
        final DummyServlet servlet = new DummyServlet();

        Bootstrap app = bootstrapApplication("test-application")
                .doNotInitializeLogging()
                .withModules(
                        new TestingNodeModule(),
                        new TestingHttpServerModule(),
                        new Module()
                        {
                            @Override
                            public void configure(Binder binder)
                            {
                                binder.bind(Servlet.class).annotatedWith(TheServlet.class).toInstance(servlet);
                                binder.bind(new TypeLiteral<Map<String, String>>()
                                {
                                }).annotatedWith(TheServlet.class).toInstance(ImmutableMap.<String, String>of());
                                httpServerBinder(binder).bindResource("/", "webapp/user").withWelcomeFile("user-welcome.txt");
                                httpServerBinder(binder).bindResource("/", "webapp/user2");
                                httpServerBinder(binder).bindResource("path", "webapp/user").withWelcomeFile("user-welcome.txt");
                                httpServerBinder(binder).bindResource("path", "webapp/user2");
                            }
                        });

        Injector injector = app.initialize();

        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
        TestingHttpServer server = injector.getInstance(TestingHttpServer.class);

        try (HttpClient client = new JettyHttpClient(new HttpClientConfig().setConnectTimeout(new Duration(1, SECONDS)))) {
View Full Code Here

    @BeforeMethod
    public void setup()
            throws Exception
    {
        Bootstrap app = bootstrapApplication("test-application")
                .doNotInitializeLogging()
                .withModules(
                        new TestingNodeModule(),
                        new InMemoryEventModule(),
                        new TestingHttpServerModule(),
                        new JsonModule(),
                        explicitJaxrsModule(),
                        new ReportingModule(),
                        new TestingMBeanModule(),
                        new MainModule()
                );

        Injector injector = app
                .initialize();

        lifeCycleManager = injector.getInstance(LifeCycleManager.class);

        server = injector.getInstance(TestingHttpServer.class);
View Full Code Here

TOP

Related Classes of com.proofpoint.bootstrap.Bootstrap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.