Search in sources :

Example 6 with HttpServerCodec

use of org.jboss.netty.handler.codec.http.HttpServerCodec in project databus by linkedin.

the class DummySuccessfulErrorCountingConsumer method setUpClass.

@BeforeClass
public void setUpClass() throws InvalidConfigException {
    //set up logging
    TestUtil.setupLoggingWithTimestampedFile(true, "/tmp/TestDatabusHttpClient_", ".log", Level.INFO);
    InternalLoggerFactory.setDefaultFactory(new Log4JLoggerFactory());
    //initialize relays
    for (int relayN = 0; relayN < RELAY_PORT.length; ++relayN) {
        _dummyServer[relayN] = new SimpleTestServerConnection(_eventFactory.getByteOrder(), SimpleTestServerConnection.ServerType.NIO);
        _dummyServer[relayN].setPipelineFactory(new ChannelPipelineFactory() {

            @Override
            public ChannelPipeline getPipeline() throws Exception {
                return Channels.pipeline(new LoggingHandler(InternalLogLevel.DEBUG), new HttpServerCodec(), new LoggingHandler(InternalLogLevel.DEBUG), new SimpleObjectCaptureHandler());
            }
        });
        _dummyServer[relayN].start(RELAY_PORT[relayN]);
    }
    //create standard client config
    DatabusHttpClientImpl.Config clientCfgBuilder = new DatabusHttpClientImpl.Config();
    clientCfgBuilder.getContainer().setHttpPort(0);
    clientCfgBuilder.getContainer().getJmx().setRmiEnabled(false);
    clientCfgBuilder.getContainer().setReadTimeoutMs(10000000);
    clientCfgBuilder.getConnectionDefaults().getPullerRetries().setInitSleep(10);
    clientCfgBuilder.getRuntime().getBootstrap().setEnabled(false);
    clientCfgBuilder.getCheckpointPersistence().setClearBeforeUse(true);
    for (int i = 0; i < RELAY_PORT.length; ++i) {
        clientCfgBuilder.getRuntime().getRelay(Integer.toString(i)).setHost("localhost");
        clientCfgBuilder.getRuntime().getRelay(Integer.toString(i)).setPort(RELAY_PORT[i]);
        clientCfgBuilder.getRuntime().getRelay(Integer.toString(i)).setSources(SOURCE1_NAME);
    }
    _stdClientCfgBuilder = clientCfgBuilder;
    _stdClientCfg = clientCfgBuilder.build();
    //create standard relay buffer config
    DbusEventBuffer.Config bufCfgBuilder = new DbusEventBuffer.Config();
    bufCfgBuilder.setAllocationPolicy(AllocationPolicy.HEAP_MEMORY.toString());
    bufCfgBuilder.setMaxSize(100000);
    bufCfgBuilder.setScnIndexSize(128);
    bufCfgBuilder.setAverageEventSize(1);
    _bufCfg = bufCfgBuilder.build();
}
Also used : LoggingHandler(org.jboss.netty.handler.logging.LoggingHandler) SimpleTestServerConnection(com.linkedin.databus2.test.container.SimpleTestServerConnection) Checkpoint(com.linkedin.databus.core.Checkpoint) InvalidConfigException(com.linkedin.databus.core.util.InvalidConfigException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) DatabusClientException(com.linkedin.databus.client.pub.DatabusClientException) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) DbusEventBuffer(com.linkedin.databus.core.DbusEventBuffer) SimpleObjectCaptureHandler(com.linkedin.databus2.test.container.SimpleObjectCaptureHandler) HttpServerCodec(org.jboss.netty.handler.codec.http.HttpServerCodec) Log4JLoggerFactory(org.jboss.netty.logging.Log4JLoggerFactory) ChannelPipelineFactory(org.jboss.netty.channel.ChannelPipelineFactory) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

SimpleTestServerConnection (com.linkedin.databus2.test.container.SimpleTestServerConnection)6 ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)6 ChannelPipelineFactory (org.jboss.netty.channel.ChannelPipelineFactory)6 HttpServerCodec (org.jboss.netty.handler.codec.http.HttpServerCodec)6 Log4JLoggerFactory (org.jboss.netty.logging.Log4JLoggerFactory)6 BeforeClass (org.testng.annotations.BeforeClass)6 InvalidConfigException (com.linkedin.databus.core.util.InvalidConfigException)5 SimpleObjectCaptureHandler (com.linkedin.databus2.test.container.SimpleObjectCaptureHandler)5 LoggingHandler (org.jboss.netty.handler.logging.LoggingHandler)5 DatabusHttpClientImpl (com.linkedin.databus.client.DatabusHttpClientImpl)4 DbusEventBuffer (com.linkedin.databus.core.DbusEventBuffer)4 DbusEventV2Factory (com.linkedin.databus.core.DbusEventV2Factory)4 IOException (java.io.IOException)3 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)3 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)3 DatabusClientException (com.linkedin.databus.client.pub.DatabusClientException)2 StaticConfig (com.linkedin.databus.client.pub.ClusterCheckpointPersistenceProvider.StaticConfig)1 Checkpoint (com.linkedin.databus.core.Checkpoint)1 InvalidEventException (com.linkedin.databus.core.InvalidEventException)1 OffsetNotFoundException (com.linkedin.databus.core.OffsetNotFoundException)1