use of net.opentsdb.tree.TreeRule in project opentsdb by OpenTSDB.
the class TestTreeRule method storeRuleInvalidType.
@Test(expected = IllegalArgumentException.class)
public void storeRuleInvalidType() throws Exception {
setupStorage();
final TreeRule rule = new TreeRule(1);
rule.setLevel(1);
rule.setOrder(0);
rule.setNotes("Just some notes");
rule.syncToStorage(storage.getTSDB(), false).joinUninterruptibly();
}
use of net.opentsdb.tree.TreeRule in project opentsdb by OpenTSDB.
the class TestTreeRule method copyConstructor.
@Test
public void copyConstructor() {
rule = new TreeRule(1);
rule.setCustomField("Custom");
rule.setDescription("Hello World!");
rule.setDisplayFormat("Display");
rule.setField("Field");
rule.setLevel(1);
rule.setNotes("Notes");
rule.setOrder(2);
rule.setRegexGroupIdx(4);
rule.setSeparator("\\.");
final TreeRule copy = new TreeRule(rule);
assertEquals(1, copy.getTreeId());
assertEquals("Custom", copy.getCustomField());
assertEquals("Hello World!", copy.getDescription());
assertEquals("Display", copy.getDisplayFormat());
assertEquals("Field", copy.getField());
assertEquals(1, copy.getLevel());
assertEquals("Notes", copy.getNotes());
assertEquals(2, copy.getOrder());
assertEquals(4, copy.getRegexGroupIdx());
assertEquals("\\.", copy.getSeparator());
}
use of net.opentsdb.tree.TreeRule in project opentsdb by OpenTSDB.
the class TestTreeRule method storeRuleInvalidRegexIdx.
@Test(expected = IllegalArgumentException.class)
public void storeRuleInvalidRegexIdx() throws Exception {
setupStorage();
final TreeRule rule = new TreeRule(1);
rule.setLevel(1);
rule.setOrder(0);
rule.setType(TreeRuleType.TAGK);
rule.setRegex("^.*$");
rule.setRegexGroupIdx(-1);
rule.syncToStorage(storage.getTSDB(), false).joinUninterruptibly();
}
use of net.opentsdb.tree.TreeRule 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.tree.TreeRule in project opentsdb by OpenTSDB.
the class TestTreeRule method fetchRuleDoesNotExist.
@Test
public void fetchRuleDoesNotExist() throws Exception {
setupStorage();
final TreeRule rule = TreeRule.fetchRule(storage.getTSDB(), 1, 2, 2).joinUninterruptibly();
assertNull(rule);
}
Aggregations