com.netflix.archaius.guice.ArchaiusModule Java Examples
The following examples show how to use
com.netflix.archaius.guice.ArchaiusModule.
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: EmbeddedTitusFederation.java From titus-control-plane with Apache License 2.0 | 6 votes |
public EmbeddedTitusFederation boot() { logger.info("Starting Titus Federation"); injector = InjectorBuilder.fromModules( new EmbeddedJettyModule(httpPort), new ArchaiusModule() { @Override protected void configureArchaius() { // We can set some properties only after the gateway is started.ł config.setProperty("titus.federation.cells", buildCellString()); bindApplicationConfigurationOverride().toInstance(config); } }, new TitusFederationModule() ).createInjector(); return this; }
Example #2
Source File: HealthModuleTest.java From runtime-health with Apache License 2.0 | 6 votes |
@Test public void testMultipleInstancesOfHealthModuleInstalled() throws InterruptedException, ExecutionException { LifecycleInjector injector = InjectorBuilder.fromModules(new HealthModule() { @Override protected void configureHealth() { bindAdditionalHealthIndicator().toInstance(healthy); } }, new HealthModule() { @Override protected void configureHealth() { bindAdditionalHealthIndicator().toInstance(unhealthy); } }, new ArchaiusModule()).createInjector(); HealthCheckAggregator aggregator = injector.getInstance(HealthCheckAggregator.class); assertNotNull(aggregator); HealthCheckStatus healthCheckStatus = aggregator.check().get(); assertFalse(healthCheckStatus.isHealthy()); assertEquals(2, healthCheckStatus.getHealthResults().size()); }
Example #3
Source File: EmbeddedCloudModule.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Override protected void configure() { install(new ArchaiusModule()); bind(Registry.class).toInstance(new DefaultRegistry()); install(new SimulatedCloudEndpointModule()); install(new EmbeddedJerseyModule()); bind(SimulatedCloud.class).asEagerSingleton(); }
Example #4
Source File: TitusFederationMain.java From titus-control-plane with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { InjectorBuilder.fromModules( new TitusFederationModule(), new Archaius2JettyModule(), new ArchaiusModule() { @Override protected void configureArchaius() { bindApplicationConfigurationOverrideResource("laptop"); } }) .createInjector() .awaitTermination(); }
Example #5
Source File: ServerModule.java From conductor with Apache License 2.0 | 5 votes |
@Override protected void configure() { install(new CoreModule()); install(new ValidationModule()); install(new ArchaiusModule()); install(new HealthModule()); install(new JettyModule()); install(new GRPCModule()); bindInterceptor(Matchers.any(), Matchers.annotatedWith(Service.class), new ServiceInterceptor(getProvider(Validator.class))); bind(Configuration.class).to(SystemPropertiesDynomiteConfiguration.class); bind(ExecutorService.class).toProvider(ExecutorServiceProvider.class).in(Scopes.SINGLETON); bind(WorkflowSweeper.class).asEagerSingleton(); bind(WorkflowMonitor.class).asEagerSingleton(); }
Example #6
Source File: HealthModuleTest.java From runtime-health with Apache License 2.0 | 5 votes |
@Test public void testNoIndicators() throws InterruptedException, ExecutionException { LifecycleInjector injector = InjectorBuilder.fromModules(new HealthModule(), new ArchaiusModule()).createInjector(); HealthCheckAggregator aggregator = injector.getInstance(HealthCheckAggregator.class); assertNotNull(aggregator); HealthCheckStatus healthCheckStatus = aggregator.check().get(); assertTrue(healthCheckStatus.isHealthy()); assertEquals(0, healthCheckStatus.getHealthResults().size()); }
Example #7
Source File: HealthModuleTest.java From runtime-health with Apache License 2.0 | 5 votes |
@Test public void testConfiguringIndicatorsByExtendingHealthModule() throws InterruptedException, ExecutionException { LifecycleInjector injector = InjectorBuilder.fromModules(new HealthModule() { @Override protected void configureHealth() { bindAdditionalHealthIndicator().toInstance(healthy); } }, new ArchaiusModule()).createInjector(); HealthCheckAggregator aggregator = injector.getInstance(HealthCheckAggregator.class); assertNotNull(aggregator); HealthCheckStatus healthCheckStatus = aggregator.check().get(); assertTrue(healthCheckStatus.isHealthy()); assertEquals(1, healthCheckStatus.getHealthResults().size()); }
Example #8
Source File: DIBase.java From EVCache with Apache License 2.0 | 5 votes |
@BeforeSuite public void setupEnv() { Properties props = getProps(); try { LifecycleInjectorBuilder builder = LifecycleInjector.builder(); builder.withModules( new EurekaClientModule(), new EVCacheModule(), new DIConnectionModule(), new SpectatorModule(), new ArchaiusModule() { protected void configureArchaius() { bindApplicationConfigurationOverride().toInstance(MapConfig.from(props)); }; } ); injector = builder.build().createInjector(); lifecycleManager = injector.getInstance(LifecycleManager.class); lifecycleManager.start(); injector.getInstance(ApplicationInfoManager.class); final EVCacheModule lib = injector.getInstance(EVCacheModule.class); manager = injector.getInstance(EVCacheClientPoolManager.class); } catch (Throwable e) { e.printStackTrace(); log.error(e.getMessage(), e); } }
Example #9
Source File: EmbeddedTitusGateway.java From titus-control-plane with Apache License 2.0 | 4 votes |
public EmbeddedTitusGateway boot() { Stopwatch timer = Stopwatch.createStarted(); logger.info("Starting Titus Gateway"); injector = InjectorBuilder.fromModules( newJettyModule(), new ArchaiusModule() { @Override protected void configureArchaius() { config.setProperty("titus.masterClient.masterIp", masterGrpcHost); if (embeddedTitusMaster == null) { config.setProperty("titus.masterClient.masterGrpcPort", masterGrpcPort); config.setProperty("titus.masterClient.masterHttpPort", masterHttpPort); } else { // In the embedded mode, master cannot run jetty, so we set only GRPC port. config.setProperty("titus.masterClient.masterGrpcPort", embeddedTitusMaster.getGrpcPort()); config.setProperty("titus.masterClient.masterHttpPort", "0"); } bindApplicationConfigurationOverride().toInstance(config); } }, Modules.override(new TitusGatewayModule(enableREST, false)).with(new AbstractModule() { @Override protected void configure() { if (store != null) { bind(JobStore.class).toInstance(store); } bind(new TypeLiteral<AdmissionValidator<JobDescriptor>>() { }).toInstance(validator); } @Provides @Singleton public AdmissionSanitizer<JobDescriptor> getJobSanitizer(TitusValidatorConfiguration configuration) { return new AggregatingSanitizer(configuration, Collections.singletonList(jobSanitizer)); } }) ).createInjector(); logger.info("Embedded TitusGateway started in {}ms", timer.elapsed(TimeUnit.MILLISECONDS)); return this; }
Example #10
Source File: ArchaiusHealthStatusFilterModuleTest.java From runtime-health with Apache License 2.0 | 4 votes |
@Before public void init() { injector = InjectorBuilder.fromModules(new ArchaiusModule(), new ArchaiusHealthStatusFilterModule()).createInjector(); config = injector.getInstance(Key.get(SettableConfig.class, RuntimeLayer.class)); matcher = injector.getInstance(IndicatorMatcher.class); }