use of net.opentsdb.core.TSDB in project opentsdb by OpenTSDB.
the class NettyMocks method getMockedHTTPTSDB.
/**
* Sets up a TSDB object for HTTP RPC tests that has a Config object
* @return A TSDB mock
*/
public static TSDB getMockedHTTPTSDB() {
final TSDB tsdb = mock(TSDB.class);
final Config config = mock(Config.class);
HashMap<String, String> properties = new HashMap<String, String>();
properties.put("tsd.http.show_stack_trace", "true");
Whitebox.setInternalState(config, "properties", properties);
when(tsdb.getConfig()).thenReturn(config);
return tsdb;
}
use of net.opentsdb.core.TSDB in project opentsdb by OpenTSDB.
the class TestAnnotationRpc method before.
@Before
public void before() throws Exception {
final Config config = new Config(false);
tsdb = new TSDB(client, config);
storage = new MockBase(tsdb, client, true, true, true, true);
// add a global
storage.addColumn(global_row_key, new byte[] { 1, 0, 0 }, ("{\"startTime\":1328140800,\"endTime\":1328140801,\"description\":" + "\"Description\",\"notes\":\"Notes\",\"custom\":{\"owner\":" + "\"ops\"}}").getBytes(MockBase.ASCII()));
storage.addColumn(global_row_key, new byte[] { 1, 0, 1 }, ("{\"startTime\":1328140801,\"endTime\":1328140803,\"description\":" + "\"Global 2\",\"notes\":\"Nothing\"}").getBytes(MockBase.ASCII()));
// add a local
storage.addColumn(tsuid_row_key, new byte[] { 1, 0x0A, 0x02 }, ("{\"tsuid\":\"000001000001000001\",\"startTime\":1388450562," + "\"endTime\":1419984000,\"description\":\"Hello!\",\"notes\":" + "\"My Notes\",\"custom\":{\"owner\":\"ops\"}}").getBytes(MockBase.ASCII()));
storage.addColumn(tsuid_row_key, new byte[] { 1, 0x0A, 0x03 }, ("{\"tsuid\":\"000001000001000001\",\"startTime\":1388450563," + "\"endTime\":1419984000,\"description\":\"Note2\",\"notes\":" + "\"Nothing\"}").getBytes(MockBase.ASCII()));
// add some data points too
storage.addColumn(tsuid_row_key, new byte[] { 0x50, 0x10 }, new byte[] { 1 });
storage.addColumn(tsuid_row_key, new byte[] { 0x50, 0x18 }, new byte[] { 2 });
}
use of net.opentsdb.core.TSDB in project opentsdb by OpenTSDB.
the class TestTreeRule method before.
@Before
public void before() throws Exception {
final Config config = new Config(false);
tsdb = new TSDB(client, config);
rule = new TreeRule();
}
use of net.opentsdb.core.TSDB in project opentsdb by OpenTSDB.
the class TestTree method before.
@Before
public void before() throws Exception {
final Config config = new Config(false);
config.overrideConfig("tsd.storage.enable_compaction", "false");
tsdb = new TSDB(client, config);
}
use of net.opentsdb.core.TSDB in project opentsdb by OpenTSDB.
the class TestRpcManager method loadRpcPlugin.
@Test
public void loadRpcPlugin() throws Exception {
Config config = mock(Config.class);
when(config.hasProperty("tsd.rpc.plugins")).thenReturn(true);
when(config.getString("tsd.rpc.plugins")).thenReturn("net.opentsdb.tsd.DummyRpcPlugin");
when(config.hasProperty("tsd.rpcplugin.DummyRPCPlugin.hosts")).thenReturn(true);
when(config.getString("tsd.rpcplugin.DummyRPCPlugin.hosts")).thenReturn("blah");
when(config.getInt("tsd.rpcplugin.DummyRPCPlugin.port")).thenReturn(1000);
when(config.getString("tsd.core.enable_api")).thenReturn("true");
when(config.getString("tsd.core.enable_ui")).thenReturn("true");
when(config.getString("tsd.no_diediedie")).thenReturn("false");
TSDB tsdb = mock(TSDB.class);
when(tsdb.getConfig()).thenReturn(config);
PluginLoader.loadJAR("plugin_test.jar");
mgr_under_test = RpcManager.instance(tsdb);
assertFalse(mgr_under_test.getRpcPlugins().isEmpty());
}
Aggregations