// Path: src/main/java/com/ning/metrics/collector/guice/EventCollectorModule.java
// public class EventCollectorModule implements Module
// {
//     @Override
//     public void configure(final Binder binder)
//     {
//         // JMX exporter
//         final ExportBuilder builder = MBeanModule.newExporter(binder);
// 
//         binder.bind(EventSpoolDispatcher.class).asEagerSingleton();
// 
//         binder.bind(WriterStats.class).asEagerSingleton();
//         builder.export(WriterStats.class).as("com.ning.metrics.collector:name=WriterQueueStats");
// 
//         binder.bind(EventCollector.class).asEagerSingleton();
//         builder.export(EventCollector.class).as("com.ning.metrics.collector:name=EventCollector");
//     }
// }
// 
// Path: src/main/java/com/ning/metrics/collector/hadoop/writer/HdfsModule.java
// public class HdfsModule implements Module
// {
//     @Override
//     public void configure(final Binder binder)
//     {
//         final ExportBuilder builder = MBeanModule.newExporter(binder);
// 
//         binder.bind(PersistentWriterFactory.class).to(HadoopWriterFactory.class);
//         builder.export(HadoopWriterFactory.class).as("com.ning.metrics.collector:name=HDFSWriter");
// 
//         // HDFS raw access
//         binder.bind(FileSystemAccess.class).toProvider(FileSystemAccessProvider.class).asEagerSingleton();
//     }
// }
// 
// Path: src/test/java/com/ning/metrics/collector/realtime/RealTimeQueueTestModule.java
// public class RealTimeQueueTestModule extends AbstractModule
// {
//     private final Lock sessionLock = new ReentrantLock();
//     @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
//     private final Collection<Object> sentEvents = new CopyOnWriteArrayList<Object>();
// 
//     @Override
//     protected void configure()
//     {
//         bind(Lock.class).annotatedWith(Names.named("amqSessionLock")).toInstance(sessionLock);
//         bind(Collection.class).annotatedWith(Names.named("sentEvents")).toInstance(sentEvents);
// 
//         bind(GlobalEventQueueStats.class).asEagerSingleton();
//         ConfigurationObjectFactory configFactory = new CollectorConfigurationObjectFactory(System.getProperties());
//         bind(ConfigurationObjectFactory.class).toInstance(configFactory);
// 
//         final EventQueueConnectionFactory factory = new EventQueueConnectionFactory()
//         {
//             @Override
//             public EventQueueConnection createConnection()
//             {
//                 return new TestEventQueueConnection();
//             }
//         };
//         bind(EventQueueConnectionFactory.class).toInstance(factory);
// 
//         bind(EventQueueProcessor.class).to(EventQueueProcessorImpl.class).asEagerSingleton();
//     }
// 
//     private class TestEventQueueConnection implements EventQueueConnection
//     {
//         @Override
//         public void reconnect() { }
// 
//         @Override
//         public EventQueueSession getSessionFor(final String type, CollectorConfig config)
//         {
//             return new TestEventQueueSession(config);
//         }
// 
//         @Override
//         public void close() { }
// 
//         private class TestEventQueueSession implements EventQueueSession
//         {
//             private final CollectorConfig config;
//             
//             public TestEventQueueSession(CollectorConfig config)
//             {
//                 this.config = config;
//             }
//             
//             @Override
//             public void send(final Object event)
//             {
//                 sessionLock.lock();
//                 try {
//                     sentEvents.add(event);
//                 }
//                 finally {
//                     sessionLock.unlock();
//                 }
//             }
// 
//             @Override
//             public void close() { }
// 
//             @Override
//             public CollectorConfig getConfig() { return config; }
//         }
// 
//         @Override
//         public void setUseBytesMessage(boolean state) { }
//     }
// }


import java.util.ArrayList;
import java.util.List;
import com.ning.metrics.collector.guice.EventCollectorModule;
import com.ning.metrics.collector.hadoop.writer.HdfsModule;
import com.ning.metrics.collector.realtime.RealTimeQueueTestModule;
import com.ning.metrics.serialization.event.Event;
import com.ning.metrics.serialization.event.ThriftEnvelopeEvent;
import com.ning.metrics.serialization.thrift.ThriftEnvelope;
import com.ning.metrics.serialization.thrift.ThriftField;
import com.google.inject.Inject;
import org.joda.time.DateTime;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
/*
 * Copyright 2010-2011 Ning, Inc.
 *
 * Ning licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package com.ning.metrics.collector.hadoop.processing;




@Guice(modules = {ConfigTestModule.class, EventCollectorModule.class, HdfsModule.class, RealTimeQueueTestModule.class})
public class TestSizeThresholdEventSpoolDispatcher
{
    @Inject
// Path: src/main/java/com/ning/metrics/collector/guice/EventCollectorModule.java
// public class EventCollectorModule implements Module
// {
//     @Override
//     public void configure(final Binder binder)
//     {
//         // JMX exporter
//         final ExportBuilder builder = MBeanModule.newExporter(binder);
// 
//         binder.bind(EventSpoolDispatcher.class).asEagerSingleton();
// 
//         binder.bind(WriterStats.class).asEagerSingleton();
//         builder.export(WriterStats.class).as("com.ning.metrics.collector:name=WriterQueueStats");
// 
//         binder.bind(EventCollector.class).asEagerSingleton();
//         builder.export(EventCollector.class).as("com.ning.metrics.collector:name=EventCollector");
//     }
// }
// 
// Path: src/main/java/com/ning/metrics/collector/hadoop/writer/HdfsModule.java
// public class HdfsModule implements Module
// {
//     @Override
//     public void configure(final Binder binder)
//     {
//         final ExportBuilder builder = MBeanModule.newExporter(binder);
// 
//         binder.bind(PersistentWriterFactory.class).to(HadoopWriterFactory.class);
//         builder.export(HadoopWriterFactory.class).as("com.ning.metrics.collector:name=HDFSWriter");
// 
//         // HDFS raw access
//         binder.bind(FileSystemAccess.class).toProvider(FileSystemAccessProvider.class).asEagerSingleton();
//     }
// }
// 
// Path: src/test/java/com/ning/metrics/collector/realtime/RealTimeQueueTestModule.java
// public class RealTimeQueueTestModule extends AbstractModule
// {
//     private final Lock sessionLock = new ReentrantLock();
//     @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
//     private final Collection<Object> sentEvents = new CopyOnWriteArrayList<Object>();
// 
//     @Override
//     protected void configure()
//     {
//         bind(Lock.class).annotatedWith(Names.named("amqSessionLock")).toInstance(sessionLock);
//         bind(Collection.class).annotatedWith(Names.named("sentEvents")).toInstance(sentEvents);
// 
//         bind(GlobalEventQueueStats.class).asEagerSingleton();
//         ConfigurationObjectFactory configFactory = new CollectorConfigurationObjectFactory(System.getProperties());
//         bind(ConfigurationObjectFactory.class).toInstance(configFactory);
// 
//         final EventQueueConnectionFactory factory = new EventQueueConnectionFactory()
//         {
//             @Override
//             public EventQueueConnection createConnection()
//             {
//                 return new TestEventQueueConnection();
//             }
//         };
//         bind(EventQueueConnectionFactory.class).toInstance(factory);
// 
//         bind(EventQueueProcessor.class).to(EventQueueProcessorImpl.class).asEagerSingleton();
//     }
// 
//     private class TestEventQueueConnection implements EventQueueConnection
//     {
//         @Override
//         public void reconnect() { }
// 
//         @Override
//         public EventQueueSession getSessionFor(final String type, CollectorConfig config)
//         {
//             return new TestEventQueueSession(config);
//         }
// 
//         @Override
//         public void close() { }
// 
//         private class TestEventQueueSession implements EventQueueSession
//         {
//             private final CollectorConfig config;
//             
//             public TestEventQueueSession(CollectorConfig config)
//             {
//                 this.config = config;
//             }
//             
//             @Override
//             public void send(final Object event)
//             {
//                 sessionLock.lock();
//                 try {
//                     sentEvents.add(event);
//                 }
//                 finally {
//                     sessionLock.unlock();
//                 }
//             }
// 
//             @Override
//             public void close() { }
// 
//             @Override
//             public CollectorConfig getConfig() { return config; }
//         }
// 
//         @Override
//         public void setUseBytesMessage(boolean state) { }
//     }
// }


// Path: src/test/java/com/ning/metrics/collector/hadoop/processing/TestSizeThresholdEventSpoolDispatcher.java
import java.util.ArrayList;
import java.util.List;
import com.ning.metrics.collector.guice.EventCollectorModule;
import com.ning.metrics.collector.hadoop.writer.HdfsModule;
import com.ning.metrics.collector.realtime.RealTimeQueueTestModule;
import com.ning.metrics.serialization.event.Event;
import com.ning.metrics.serialization.event.ThriftEnvelopeEvent;
import com.ning.metrics.serialization.thrift.ThriftEnvelope;
import com.ning.metrics.serialization.thrift.ThriftField;
import com.google.inject.Inject;
import org.joda.time.DateTime;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;

/*
 * Copyright 2010-2011 Ning, Inc.
 *
 * Ning licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package com.ning.metrics.collector.hadoop.processing;




@Guice(modules = {ConfigTestModule.class, EventCollectorModule.class, HdfsModule.class, RealTimeQueueTestModule.class})
public class TestSizeThresholdEventSpoolDispatcher
{
    @Inject
    EventSpoolDispatcher dispatcher;