public static ConfigModule forTesting() { return new ConfigModule(Config.getEmptyConfig()); }
@Override public Config getConfig() { return Config.getEmptyConfig(); }
@Test public void testEmptyConfigOverride() { // Fails in ness-cache <= 2.1.0 Config.getOverriddenConfig(Config.getEmptyConfig(), new MapConfiguration(Collections.<String, String>emptyMap())); } }
@Test public void testSimple() { final Config config = Config.getEmptyConfig(); Guice.createInjector(Stage.PRODUCTION, new LifecycleModule(), new ConfigModule(config), new BasicGalaxyServerModule(config)); } }
@Before public void setUp() throws Exception { Injector injector = Guice.createInjector(new ConfigModule(Config.getEmptyConfig()), new NessJacksonModule()); NessEventDispatcher eventDispatcherStub = new NessEventDispatcher() { @Override public void dispatch(@Nonnull NessEvent event) { LOG.debug("Event: %s", event); } }; eventReceiver = new JmsEventReceiver( null, eventDispatcherStub, injector.getInstance(ObjectMapper.class) ); }
@Test public void testDisabledByDefault() { final Config config = Config.getEmptyConfig(); final Injector inj = Guice.createInjector(Stage.PRODUCTION, disableStuff(), new LogFieldsModule(), new FileRequestLogModule(config)); Assert.assertNull(inj.getExistingBinding(Key.get(FileRequestLog.class))); }
@Test public void testDisabledByDefault() { final Config config = Config.getEmptyConfig(); final Injector inj = Guice.createInjector(Stage.PRODUCTION, disableStuff(), new LogFieldsModule(), new SyslogRequestLogModule(config)); Assert.assertNull(inj.getExistingBinding(Key.get(SyslogRequestLog.class))); }
@Test public void testEmpty() { final Config emptyConfig = Config.getEmptyConfig(); Assert.assertNotNull(emptyConfig); Assert.assertFalse(emptyConfig.getConfiguration().getKeys().hasNext()); } }
@Test public void testLog4jLoggerDisabledByDefault() { final Config config = Config.getEmptyConfig(); final Injector inj = Guice.createInjector(Stage.PRODUCTION, disableStuff(), new LogFieldsModule(), new Log4jRequestLogModule(config)); Assert.assertNull(inj.getExistingBinding(Key.get(Log4jRequestLog.class))); }
@Test public void testSimple() { final Config config = Config.getEmptyConfig(); Guice.createInjector(Stage.PRODUCTION, getPlumbing(config), new LifecycleModule(), new ConfigModule(config), new BasicDiscoveryServerModule(config)); }
@Test public void testDefault() { final Config config = Config.getEmptyConfig(); final JmsConfig jmsConfig = config.getBean(JmsConfig.class); Assert.assertTrue(jmsConfig.isEnabled()); }
@Before public void setUp() { config = Config.getEmptyConfig(); server = new TestingMBeanServer(); exporter = new ConfigJmxExporter(config); exporter.setMBeanServer(server); provider = (ConfigProvider<MyBean>) ConfigProvider.of(MyBean.class); }
@Test public void testSpinupDisabled() { doInjection(Config.getEmptyConfig()); Assert.assertNotNull(eventConfig); Assert.assertFalse(eventConfig.isEnabled()); }
@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);
@Test public void testSpinup() { final Config config = Config.getEmptyConfig(); final Injector inj = Guice.createInjector(Stage.PRODUCTION, new ConfigModule(config), new HttpServerModule(config), new JmxModule(), new LifecycleModule(ServiceDiscoveryLifecycle.class), Modules.override(new DiscoveryClientModule()).with(new AbstractModule() { @Override public void configure() { bindConstant().annotatedWith(DiscoveryClientModule.ZOOKEEPER_CONNECT_NAMED).to("1.1.1.1:2345"); bind(new TypeLiteral<Map<Integer, InetSocketAddress>>() {}).annotatedWith(DiscoveryClientModule.ZOOKEEPER_CONNECT_NAMED).toInstance(ImmutableMap.of(1, new InetSocketAddress("1.1.1.1", 2345))); } }), new GalaxyAnnouncementModule("my-service", "my-type")); Assert.assertNotNull(inj); final GalaxyAnnouncer announcer = inj.getInstance(GalaxyAnnouncer.class); Assert.assertNotNull(announcer); } }
@Override protected void configure() { install (new ConfigModule(Config.getEmptyConfig())); install (new NessJacksonModule()); JacksonSerializerBinder.builderOf(binder(), Integer.class).bind(); JacksonSerializerBinder.builderOf(binder(), Integer.class).bind(); } });
@Test public void testSpinup() throws Exception { final StandaloneServer server = new DemoServer(Config.getEmptyConfig()); server.startServer(); try { Assert.assertNotNull(server); Assert.assertTrue(server.isStarted()); Assert.assertFalse(server.isStopped()); } finally { server.stopServer(); Assert.assertTrue(server.isStarted()); Assert.assertTrue(server.isStopped()); } }
@Test public void testAnnouncingSpinup() throws Exception { final AnnouncingStandaloneServer server = new AnnouncingDemoServer(Config.getEmptyConfig()); server.startServer(); try { Assert.assertNotNull(server); Assert.assertTrue(server.isStarted()); Assert.assertFalse(server.isStopped()); } finally { server.stopServer(); Assert.assertTrue(server.isStarted()); Assert.assertTrue(server.isStopped()); } } }