public static ConfigModule forTesting() { return new ConfigModule(Config.getEmptyConfig()); }
@Override public void configure(final Binder binder) { // This allows us to later ask an injector what it is named. binder.bindConstant().annotatedWith(Names.named("SERVICE")).to(entry.getKey()); for (TweakedModule tweakedModule : tweakedModules) { binder.install(tweakedModule.getServiceModule(serviceConfig)); } binder.install(new ConfigModule(serviceConfig)); binder.install(entry.getValue().getServiceModule(serviceConfig)); } };
@Override public void configure(final Binder binder) { // This allows us to later ask an injector what it is named. binder.bindConstant().annotatedWith(Names.named("SERVICE")).to(entry.getKey()); for (TweakedModule tweakedModule : tweakedModules) { binder.install(tweakedModule.getServiceModule(serviceConfig)); } binder.install(new ConfigModule(serviceConfig)); binder.install(entry.getValue().getModule(serviceConfigTweaks)); } };
@Override public void configure(final Binder binder) { for (TweakedModule tweakedModule : tweakedModules) { binder.install(tweakedModule.getTestCaseModule(testCaseConfig)); } binder.install(new ConfigModule(testCaseConfig)); binder.install(testCaseModule); } };
@Test(expected=CreationException.class) public void testNoEmptyUri() { final Config config = Config.getFixedConfig(ImmutableMap.of("ness.jms.enabled", "true")); Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new JmsModule(config, "test")); }
@Test(expected=CreationException.class) public void testNamedNoEmptyUri() { Config config = Config.getFixedConfig(ImmutableMap.of("ness.jms.enabled", "true")); Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new JmsModule(config, "test")); }
@Before public void setUp() { final Config config = Config.getFixedConfig(ImmutableMap.of("ness.jms.test.enabled", "true", "ness.jms.test.connection-url", BROKER_URI)); final Injector injector = Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new JmsModule(config, "test")); injector.injectMembers(this); Assert.assertNotNull(topicRunnableFactory); }
@Before public void setUp() { final Config config = Config.getFixedConfig(ImmutableMap.of("ness.jms.test.enabled", "true", "ness.jms.test.connection-url", "failover:(tcp://127.0.0.1:65534?daemon=true)?maxReconnectAttempts=10"));; final Injector injector = Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new JmsModule(config, "test")); injector.injectMembers(this); Assert.assertNotNull(topicRunnableFactory); }
@Before public void setUp() { final Config config = Config.getFixedConfig(ImmutableMap.of("ness.jms.test.enabled", "true", "ness.jms.test.connection-url", "vm://testbroker?broker.persistent=false")); final Injector injector = Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new JmsModule(config, "test")); injector.injectMembers(this); Assert.assertNotNull(topicRunnableFactory); }
@Before public void setUp() { final Config config = Config.getFixedConfig(ImmutableMap.of("ness.jms.test.enabled", "true", "ness.jms.test.connection-url", BROKER_URI)); final Injector injector = Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new JmsModule(config, "test")); injector.injectMembers(this); Assert.assertNotNull(queueRunnableFactory); }
@Test(expected=CreationException.class) public void testNamedNoEmptyUri() { Config config = Config.getFixedConfig(ImmutableMap.of("ness.amqp.enabled", "true")); Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new NessJacksonModule(), new AmqpModule(config, "test")); }
@Test public void testNamedWorksGlobalDisabled() { final Config config = Config.getFixedConfig(ImmutableMap.of("ness.jms.enabled", "false")); final Injector injector = Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new JmsModule(config, "test")); final JmsConfig jmsConfig = injector.getInstance(Key.get(JmsConfig.class, Names.named("test"))); Assert.assertNotNull(jmsConfig); Assert.assertFalse(jmsConfig.isEnabled()); Assert.assertNull(injector.getExistingBinding(Key.get(ConnectionFactory.class, Names.named("test")))); }
@Test(expected=CreationException.class) public void testNoEmptyUri() { final Config config = Config.getFixedConfig(ImmutableMap.of("ness.amqp.enabled", "true")); Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new NessJacksonModule(), new AmqpModule(config, "test")); }
@Test public void testWorksGlobalDisabled() { final Config config = Config.getFixedConfig(ImmutableMap.of("ness.jms.enabled", "false")); final Injector injector = Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new JmsModule(config, "test")); final JmsConfig jmsConfig = injector.getInstance(Key.get(JmsConfig.class, Names.named("test"))); Assert.assertNotNull(jmsConfig); Assert.assertFalse(jmsConfig.isEnabled()); Assert.assertNull(injector.getExistingBinding(Key.get(ConnectionFactory.class))); }
@Test public void testSimple() { final Config config = Config.getEmptyConfig(); Guice.createInjector(Stage.PRODUCTION, new LifecycleModule(), new ConfigModule(config), new BasicGalaxyServerModule(config)); } }
@Test public void testSimple() { final Config config = Config.getEmptyConfig(); Guice.createInjector(Stage.PRODUCTION, getPlumbing(config), new LifecycleModule(), new ConfigModule(config), new BasicDiscoveryServerModule(config)); }
@Override public void configure(final Binder binder) { binder.install(new ConfigModule(config)); binder.install(getLifecycleModule()); binder.install(new JmxModule()); binder.install(new JmxStarterModule(config)); binder.install(new JmxLoggingModule(getServerType())); binder.install(new JvmPauseAlarmModule()); } };
@Override protected void configure() { install (new ConfigModule(Config.getEmptyConfig())); install (new NessJacksonModule()); JacksonSerializerBinder.builderOf(binder(), Integer.class) .bind(); } }).injectMembers(this);
@Override protected void configure() { install (new ConfigModule(Config.getEmptyConfig())); install (new NessJacksonModule()); JacksonSerializerBinder.builderOf(binder(), Integer.class) .bind(); } }).injectMembers(this);
@Override protected void configure() { install (new ConfigModule(Config.getEmptyConfig())); install (new NessJacksonModule()); JacksonSerializerBinder.builderOf(binder(), Integer.class).bind(); JacksonSerializerBinder.builderOf(binder(), Integer.class).bind(); } });