use of com.mozilla.bagheera.metrics.HttpMetric in project bagheera by mozilla-metrics.
the class DummyProducer method setup.
@Before
public void setup() {
validator = Mockito.mock(Validator.class);
producer = new DummyProducer();
channelGroup = Mockito.mock(ChannelGroup.class);
manager = Mockito.mock(MetricsManager.class);
HttpMetric metric = Mockito.mock(HttpMetric.class);
Mockito.when(manager.getGlobalHttpMetric()).thenReturn(metric);
Mockito.when(manager.getHttpMetricForNamespace(Mockito.anyString())).thenReturn(metric);
mockChannelBuffer = Mockito.mock(ChannelBuffer.class);
Mockito.when(mockChannelBuffer.readable()).thenReturn(true);
Mockito.when(mockChannelBuffer.readableBytes()).thenReturn(1);
Mockito.when(mockChannelBuffer.toByteBuffer()).thenReturn(ByteBuffer.allocate(1));
mockChannel = Mockito.mock(Channel.class);
mockFuture = Mockito.mock(ChannelFuture.class);
Mockito.when(mockChannel.getRemoteAddress()).thenReturn(new InetSocketAddress("localhost", 8080));
Mockito.when(mockChannel.write(Mockito.any())).thenReturn(mockFuture);
// We get a NoClassDefFoundError without this.
if (!new File("./target/classes/com/mozilla/bagheera/BagheeraProto.class").exists()) {
fail("You must run 'mvn compile' before the tests will run properly from Eclipse");
}
}
Aggregations