use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestPutRpc method executeRuntimeException.
@SuppressWarnings("unchecked")
@Test(expected = RuntimeException.class)
public void executeRuntimeException() throws Exception {
when(tsdb.addPoint(anyString(), anyLong(), anyLong(), (HashMap<String, String>) any())).thenThrow(new RuntimeException("Fail!"));
final PutDataPointRpc put = new PutDataPointRpc();
final Channel chan = NettyMocks.fakeChannel();
put.execute(tsdb, chan, new String[] { "put", "doesnotexist", "1365465600", "42", "host=web01" });
}
use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestPutRpc method execute.
// Socket RPC Tests ------------------------------------
@Test
public void execute() throws Exception {
final PutDataPointRpc put = new PutDataPointRpc();
final Channel chan = NettyMocks.fakeChannel();
assertNotNull(put.execute(tsdb, chan, new String[] { "put", "sys.cpu.nice", "1365465600", "42", "host=web01" }).joinUninterruptibly());
assertEquals(1, requests.get());
assertEquals(0, invalid_values.get());
verify(chan, never()).write(any());
verify(chan, never()).isConnected();
verify(tsdb, never()).getStorageExceptionHandler();
}
use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestPutRpc method executeUnknownMetric.
@Test
public void executeUnknownMetric() throws Exception {
final PutDataPointRpc put = new PutDataPointRpc();
final Channel chan = NettyMocks.fakeChannel();
assertNull(put.execute(tsdb, chan, new String[] { "put", "doesnotexist", "1365465600", "42", "host=web01" }).joinUninterruptibly());
assertEquals(1, requests.get());
assertEquals(0, invalid_values.get());
assertEquals(1, unknown_metrics.get());
verify(chan, times(1)).write(any());
verify(chan, times(1)).isConnected();
verify(tsdb, never()).getStorageExceptionHandler();
}
use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestPutRpc method executeShortArray.
@Test
public void executeShortArray() throws Exception {
final PutDataPointRpc put = new PutDataPointRpc();
final Channel chan = NettyMocks.fakeChannel();
assertNull(put.execute(tsdb, chan, new String[] { "put", "sys.cpu.nice", "1365465600", "42" }).joinUninterruptibly());
assertEquals(1, requests.get());
assertEquals(0, invalid_values.get());
assertEquals(1, illegal_arguments.get());
verify(chan, times(1)).write(any());
verify(chan, times(1)).isConnected();
verify(tsdb, never()).getStorageExceptionHandler();
}
use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestPutRpc method executeNullTSDB.
@Test(expected = NullPointerException.class)
public void executeNullTSDB() throws Exception {
final PutDataPointRpc put = new PutDataPointRpc();
final Channel chan = NettyMocks.fakeChannel();
put.execute(null, chan, new String[] { "put", "sys.cpu.nice", "1365465600", "42", "host=web01" });
}
Aggregations