@Test public void run_adds_tasks() throws Exception { final Task task = mock(Task.class); final Class<TestTask> taskClass = TestTask.class; Application application = buildApplication( new AbstractPlugin() { @Override protected void configure() { bindTask(task); bindTask(taskClass); } } ); new Platform(application).run(configuration, environment); verify(adminEnvironment).addTask(eq(task)); verify(adminEnvironment).addTask(isA(TestTask.class)); }
@Override public void run(PlatformConfiguration configuration, Environment environment) throws Exception { dropwizardModule.setup(configuration, environment); for (Configurator configurator : wrapper.getConfigurators()) { configurator.configure(configuration, environment); LOGGER.debug("Registered Configurator: {}", configurator.getClass().getCanonicalName()); } for (Object jerseyComponent : wrapper.getJerseyComponents()) { environment.jersey().register(jerseyComponent); LOGGER.debug("Registered Jersey Component: {}", jerseyComponent.getClass().getCanonicalName()); } for (Managed managed : wrapper.getManaged()) { environment.lifecycle().manage(managed); LOGGER.debug("Registered Managed Object: {}", managed.getClass().getCanonicalName()); } for (HealthCheck healthCheck : wrapper.getHealthChecks()) { environment.healthChecks().register(healthCheck.toString(), healthCheck); LOGGER.debug("Registered Health Check: {}", healthCheck.getClass().getCanonicalName()); } for (Task task : wrapper.getTasks()) { environment.admin().addTask(task); LOGGER.debug("Registered Task: {}", task.getClass().getCanonicalName()); } for (FilterSpec filterSpec : wrapper.getFilterSpecs()) { registerFilterSpec(environment, filterSpec); LOGGER.debug("Registered Filter {}: {}", filterSpec.getName(), filterSpec.getFilter().getClass().getCanonicalName()); } }
Platform extends io.dropwizard.Application<PlatformConfiguration> { @Override public void run(PlatformConfiguration configuration, Environment environment) throws Exception { dropwizardModule.setup(configuration, environment); for (Configurator configurator : wrapper.getConfigurators()) { configurator.configure(configuration, environment); LOGGER.debug("Registered Configurator: {}", configurator.getClass().getCanonicalName()); } for (Object jerseyComponent : wrapper.getJerseyComponents()) { environment.jersey().register(jerseyComponent); LOGGER.debug("Registered Jersey Component: {}", jerseyComponent.getClass().getCanonicalName()); } for (Managed managed : wrapper.getManaged()) { environment.lifecycle().manage(managed); LOGGER.debug("Registered Managed Object: {}", managed.getClass().getCanonicalName()); } for (HealthCheck healthCheck : wrapper.getHealthChecks()) { environment.healthChecks().register(healthCheck.toString(), healthCheck); LOGGER.debug("Registered Health Check: {}", healthCheck.getClass().getCanonicalName()); } for (Task task : wrapper.getTasks()) { environment.admin().addTask(task); LOGGER.debug("Registered Task: {}", task.getClass().getCanonicalName()); } for (FilterSpec filterSpec : wrapper.getFilterSpecs()) { registerFilterSpec(environment, filterSpec); LOGGER.debug("Registered Filter {}: {}", filterSpec.getName(), filterSpec.getFilter().getClass().getCanonicalName()); } } }
Platform extends io.dropwizard.Application<PlatformConfiguration> { @Override public void run(PlatformConfiguration configuration, Environment environment) throws Exception { dropwizardModule.setup(configuration, environment); for (Configurator configurator : wrapper.getConfigurators()) { configurator.configure(configuration, environment); LOGGER.debug("Registered Configurator: {}", configurator.getClass().getCanonicalName()); } for (Object jerseyComponent : wrapper.getJerseyComponents()) { environment.jersey().register(jerseyComponent); LOGGER.debug("Registered Jersey Component: {}", jerseyComponent.getClass().getCanonicalName()); } for (Managed managed : wrapper.getManaged()) { environment.lifecycle().manage(managed); LOGGER.debug("Registered Managed Object: {}", managed.getClass().getCanonicalName()); } for (HealthCheck healthCheck : wrapper.getHealthChecks()) { environment.healthChecks().register(healthCheck.toString(), healthCheck); LOGGER.debug("Registered Health Check: {}", healthCheck.getClass().getCanonicalName()); } for (Task task : wrapper.getTasks()) { environment.admin().addTask(task); LOGGER.debug("Registered Task: {}", task.getClass().getCanonicalName()); } for (FilterSpec filterSpec : wrapper.getFilterSpecs()) { registerFilterSpec(environment, filterSpec); LOGGER.debug("Registered Filter {}: {}", filterSpec.getName(), filterSpec.getFilter().getClass().getCanonicalName()); } } Platform(Application application); }
Platform extends io.dropwizard.Application<PlatformConfiguration> { @Override public void run(PlatformConfiguration configuration, Environment environment) throws Exception { dropwizardModule.setup(configuration, environment); for (Configurator configurator : wrapper.getConfigurators()) { configurator.configure(configuration, environment); LOGGER.debug("Registered Configurator: {}", configurator.getClass().getCanonicalName()); } for (Object jerseyComponent : wrapper.getJerseyComponents()) { environment.jersey().register(jerseyComponent); LOGGER.debug("Registered Jersey Component: {}", jerseyComponent.getClass().getCanonicalName()); } for (Managed managed : wrapper.getManaged()) { environment.lifecycle().manage(managed); LOGGER.debug("Registered Managed Object: {}", managed.getClass().getCanonicalName()); } for (HealthCheck healthCheck : wrapper.getHealthChecks()) { environment.healthChecks().register(healthCheck.toString(), healthCheck); LOGGER.debug("Registered Health Check: {}", healthCheck.getClass().getCanonicalName()); } for (Task task : wrapper.getTasks()) { environment.admin().addTask(task); LOGGER.debug("Registered Task: {}", task.getClass().getCanonicalName()); } for (FilterSpec filterSpec : wrapper.getFilterSpecs()) { registerFilterSpec(environment, filterSpec); LOGGER.debug("Registered Filter {}: {}", filterSpec.getName(), filterSpec.getFilter().getClass().getCanonicalName()); } } Platform(Application application); static Platform forApplication(Application application); void start(String[] args); @Override void initialize(Bootstrap<PlatformConfiguration> bootstrap); @Override void run(PlatformConfiguration configuration, Environment environment); }
Platform extends io.dropwizard.Application<PlatformConfiguration> { @Override public void run(PlatformConfiguration configuration, Environment environment) throws Exception { dropwizardModule.setup(configuration, environment); for (Configurator configurator : wrapper.getConfigurators()) { configurator.configure(configuration, environment); LOGGER.debug("Registered Configurator: {}", configurator.getClass().getCanonicalName()); } for (Object jerseyComponent : wrapper.getJerseyComponents()) { environment.jersey().register(jerseyComponent); LOGGER.debug("Registered Jersey Component: {}", jerseyComponent.getClass().getCanonicalName()); } for (Managed managed : wrapper.getManaged()) { environment.lifecycle().manage(managed); LOGGER.debug("Registered Managed Object: {}", managed.getClass().getCanonicalName()); } for (HealthCheck healthCheck : wrapper.getHealthChecks()) { environment.healthChecks().register(healthCheck.toString(), healthCheck); LOGGER.debug("Registered Health Check: {}", healthCheck.getClass().getCanonicalName()); } for (Task task : wrapper.getTasks()) { environment.admin().addTask(task); LOGGER.debug("Registered Task: {}", task.getClass().getCanonicalName()); } for (FilterSpec filterSpec : wrapper.getFilterSpecs()) { registerFilterSpec(environment, filterSpec); LOGGER.debug("Registered Filter {}: {}", filterSpec.getName(), filterSpec.getFilter().getClass().getCanonicalName()); } } Platform(Application application); static Platform forApplication(Application application); void start(String[] args); @Override void initialize(Bootstrap<PlatformConfiguration> bootstrap); @Override void run(PlatformConfiguration configuration, Environment environment);  }