Java Code Examples for io.dropwizard.setup.Bootstrap#addCommand()
The following examples show how to use
io.dropwizard.setup.Bootstrap#addCommand() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TodoListApplication.java From dropwizard-experiment with MIT License | 6 votes |
@Override public void initialize(Bootstrap<TodoListConfiguration> bootstrap) { ebeanBundle = new EbeanBundle(); //rabbitMqBundle = new RabbitMQBundle(); // This outputs xDateTimes as ISO strings rather than an array of numbers in JSON. bootstrap.getObjectMapper().disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); bootstrap.addBundle(new Java8Bundle()); bootstrap.addBundle(ebeanBundle); //bootstrap.addBundle(rabbitMqBundle); bootstrap.addBundle(new OAuth2Bundle(ebeanBundle)); bootstrap.addBundle(new TodoClientBundle()); bootstrap.addBundle(new MigrationsBundle<TodoListConfiguration>() { @Override public DataSourceFactory getDataSourceFactory(TodoListConfiguration configuration) { return configuration.getDatabaseConfig(); } }); // The anonymous subclass seems to be needed for the config type to be picked up correctly. bootstrap.addCommand(new WorkersCommand<TodoListConfiguration>(TodoListApplication.this) {}); bootstrap.addCommand(new DbDiffCommand<TodoListConfiguration>() {}); }
Example 2
Source File: AbstractCommandTest.java From dropwizard-flyway with Apache License 2.0 | 6 votes |
@BeforeEach public void setUp() throws Exception { // Setup necessary mock final JarLocation location = mock(JarLocation.class); when(location.getVersion()).thenReturn(Optional.of("1.0.0")); final DatabaseConfiguration dbConfiguration = mock(DatabaseConfiguration.class); when(dbConfiguration.getDataSourceFactory(any())).thenReturn(mock(PooledDataSourceFactory.class)); final FlywayConfiguration flywayConfiguration = mock(FlywayConfiguration.class); mockFlywayFactory = mock(FlywayFactory.class); when(flywayConfiguration.getFlywayFactory(any())).thenReturn(mockFlywayFactory); mockFlyway = mock(Flyway.class); when(mockFlywayFactory.build(any())).thenReturn(mockFlyway); // Add commands you want to test final Bootstrap<TestConfiguration> bootstrap = new Bootstrap<>(new TestApplication()); bootstrap.addCommand(new DbCommand<TestConfiguration>("db", dbConfiguration, flywayConfiguration, TestConfiguration.class)); // Build what'll run the command and interpret arguments cli = new Cli(location, bootstrap, System.out, System.err); }
Example 3
Source File: RobeApplication.java From robe with GNU Lesser General Public License v3.0 | 6 votes |
/** * Adds * Hibernate bundle for PROVIDER connection * Asset bundle for io.robe.admin screens and * Class scanners for * <ul> * <li>Entities</li> * <li>HealthChecks</li> * <li>Providers</li> * <li>InjectableProviders</li> * <li>Resources</li> * <li>Tasks</li> * <li>Managed objects</li> * </ul> * * @param bootstrap */ @Override public void initialize(Bootstrap<T> bootstrap) { T config = loadConfiguration(bootstrap); RobeHibernateBundle<T> hibernateBundle = RobeHibernateBundle.createInstance( config.getHibernate().getScanPackages(), config.getHibernate().getEntities()); List<Module> modules = new LinkedList<>(); modules.add(new HibernateModule(hibernateBundle)); bootstrap.addBundle(new GuiceBundle<T>(modules, bootstrap.getApplication().getConfigurationClass())); bootstrap.addBundle(hibernateBundle); bootstrap.addBundle(new TokenAuthBundle<T>()); bootstrap.addCommand(new InitializeCommand(this, hibernateBundle)); bootstrap.addBundle(new QuartzBundle<T>()); bootstrap.addBundle(new MailBundle<T>()); bootstrap.addBundle(new AdvancedAssetBundle<T>()); }
Example 4
Source File: VerifyServiceProviderApplication.java From verify-service-provider with MIT License | 5 votes |
@Override public void initialize(Bootstrap<VerifyServiceProviderConfiguration> bootstrap) { // Enable variable substitution with environment variables bootstrap.setConfigurationSourceProvider( new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false) ) ); IdaSamlBootstrap.bootstrap(); bootstrap.getObjectMapper().setDateFormat(StdDateFormat.getInstance()); bootstrap.addBundle(hubMetadataBundle); bootstrap.addBundle(msaMetadataBundle); bootstrap.addCommand(new ComplianceToolMode(bootstrap.getObjectMapper(), bootstrap.getValidatorFactory().getValidator(), this)); bootstrap.addBundle(new LogstashBundle()); }
Example 5
Source File: MapMatchingApplication.java From map-matching with Apache License 2.0 | 5 votes |
@Override public void initialize(Bootstrap<MapMatchingServerConfiguration> bootstrap) { bootstrap.addBundle(new GraphHopperBundle()); bootstrap.addCommand(new ImportCommand()); bootstrap.addCommand(new MatchCommand()); bootstrap.addCommand(new GetBoundsCommand()); bootstrap.addCommand(new MeasurementCommand()); bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/mapmatching-webapp/", "/app/", "index.html")); }
Example 6
Source File: FoxtrotServer.java From foxtrot with Apache License 2.0 | 5 votes |
@Override public void initialize(Bootstrap<FoxtrotServerConfiguration> bootstrap) { bootstrap.setConfigurationSourceProvider( new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false))); bootstrap.addBundle(new AssetsBundle("/console/echo/", "/", "browse-events.htm", "console")); bootstrap.addBundle(new OorBundle<FoxtrotServerConfiguration>() { public boolean withOor() { return false; } }); final SwaggerBundleConfiguration swaggerBundleConfiguration = getSwaggerBundleConfiguration(); bootstrap.addBundle(new SwaggerBundle<FoxtrotServerConfiguration>() { @Override protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(FoxtrotServerConfiguration configuration) { return swaggerBundleConfiguration; } }); bootstrap.addBundle(GuiceBundle.<FoxtrotServerConfiguration>builder() .enableAutoConfig("com.flipkart.foxtrot") .modules( new FoxtrotModule()) .useWebInstallers() .printDiagnosticInfo() .build(Stage.PRODUCTION)); bootstrap.addCommand(new InitializerCommand()); configureObjectMapper(bootstrap.getObjectMapper()); }
Example 7
Source File: StartErrorJupiterTest.java From dropwizard-guicey with MIT License | 5 votes |
@Override public void initialize(Bootstrap<TestConfiguration> bootstrap) { bootstrap.addBundle(GuiceBundle.builder() .modules(new ErrorModule()) .build() ); bootstrap.addCommand(new DummyCommand(bootstrap.getApplication())); }
Example 8
Source File: KeywhizService.java From keywhiz with Apache License 2.0 | 5 votes |
@Override public void initialize(Bootstrap<KeywhizConfig> bootstrap) { customizeObjectMapper(bootstrap.getObjectMapper()); logger.debug("Registering commands"); bootstrap.addCommand(new PreviewMigrateCommand()); bootstrap.addCommand(new MigrateCommand()); bootstrap.addCommand(new DbSeedCommand()); bootstrap.addCommand(new GenerateAesKeyCommand()); bootstrap.addCommand(new AddUserCommand()); bootstrap.addCommand(new DropDeletedSecretsCommand()); }
Example 9
Source File: KeystoreApplication.java From dcos-commons with Apache License 2.0 | 5 votes |
@Override public void initialize(Bootstrap<KeystoreConfiguration> bootstrap) { // Enable variable substitution with environment variables bootstrap.setConfigurationSourceProvider( new SubstitutingSourceProvider( bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false) ) ); bootstrap.addCommand(new TLSTruststoreTestCommand<>(this)); }
Example 10
Source File: EmoService.java From emodb with Apache License 2.0 | 5 votes |
@Override public void initialize(Bootstrap<EmoConfiguration> bootstrap) { bootstrap.addCommand(new CreateKeyspacesCommand()); bootstrap.addCommand(new RegisterCassandraCommand()); bootstrap.addCommand(new ListCassandraCommand()); bootstrap.addCommand(new UnregisterCassandraCommand()); bootstrap.addCommand(new PurgeDatabusEventsCommand()); bootstrap.addCommand(new AllTablesReportCommand()); bootstrap.addCommand(new EncryptConfigurationApiKeyCommand()); EmoServiceObjectMapperFactory.configure(bootstrap.getObjectMapper()); bootstrap.getMetricRegistry().register("jvm.gc.totals", new EmoGarbageCollectorMetricSet()); }
Example 11
Source File: App.java From jobson with Apache License 2.0 | 5 votes |
public void initialize(Bootstrap<ApplicationConfig> configurationBootstrap) { configurationBootstrap.addCommand(new NewCommand()); configurationBootstrap.addCommand(new GenerateCommand()); configurationBootstrap.addCommand(new UsersCommand()); configurationBootstrap.addCommand(new ValidateCommand()); configurationBootstrap.addCommand(new RunCommand()); }
Example 12
Source File: CaApplication.java From java-certificate-authority with Apache License 2.0 | 4 votes |
@Override public void initialize(final Bootstrap<CaConfiguration> bootstrap) { bootstrap.addCommand(new CreateSelfSignedCertificate()); bootstrap.addCommand(new CreateCertificate()); }
Example 13
Source File: MacroBaseApplication.java From macrobase with Apache License 2.0 | 4 votes |
@Override public void initialize(Bootstrap<MacroBaseConf> bootstrap) { bootstrap.addCommand(new MacroBasePipelineCommand()); }
Example 14
Source File: KTSDApplication.java From kudu-ts with Apache License 2.0 | 4 votes |
@Override public void initialize(Bootstrap<KTSDConfiguration> bootstrap) { super.initialize(bootstrap); bootstrap.addCommand(new PutBench(this)); }
Example 15
Source File: NewtsService.java From newts with Apache License 2.0 | 4 votes |
@Override public void initialize(Bootstrap<NewtsConfig> bootstrap) { bootstrap.addCommand(new InitCommand()); bootstrap.addBundle(new AssetsBundle("/app", UI_URL_PATH, "index.html")); }
Example 16
Source File: FlywayBundle.java From dropwizard-flyway with Apache License 2.0 | 4 votes |
@Override public final void initialize(final Bootstrap<?> bootstrap) { final Class<T> klass = Generics.getTypeParameter(getClass(), Configuration.class); bootstrap.addCommand(new DbCommand<T>(name(), this, this, klass)); }
Example 17
Source File: IronTestApplication.java From irontest with Apache License 2.0 | 4 votes |
@Override public void initialize(Bootstrap<IronTestConfiguration> bootstrap) { bootstrap.addCommand(new UpgradeCommand()); bootstrap.addBundle(new AssetsBundle("/assets/app", "/ui", "index.htm", "ui")); bootstrap.addBundle(new AssetsBundle("/META-INF/resources/webjars", "/ui/lib", null, "lib")); bootstrap.addBundle(new AssetsBundle("/assets/mockserver", "/ui/mockserver", "mockserver.htm", "mockserver")); bootstrap.addBundle(new AssetsBundle("/assets/common", "/ui/common", null, "common")); bootstrap.addBundle(jaxWsBundle); bootstrap.addBundle(new MultiPartBundle()); bootstrap.addBundle(new ViewBundle<IronTestConfiguration>(){ @Override public Map<String, Map<String, String>> getViewConfiguration(IronTestConfiguration config) { return config.getViewRendererConfiguration(); } }); Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new JacksonJsonProvider(); private final MappingProvider mappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); // configure the Jackson ObjectMapper used by JAX-RS (Jersey) ObjectMapper objectMapper = bootstrap.getObjectMapper(); objectMapper.disable(MapperFeature.DEFAULT_VIEW_INCLUSION); IronTestUtils.addMixInsForWireMock(objectMapper); }
Example 18
Source File: BuildToolApplication.java From dropwizard-experiment with MIT License | 4 votes |
@Override public void initialize(Bootstrap<BuildToolConfiguration> bootstrap) { bootstrap.addCommand(new HealthCheckCommand()); }