Search in sources :

Example 11 with TreeRule

use of net.opentsdb.tree.TreeRule in project opentsdb by OpenTSDB.

the class TestTreeRule method storeRuleInvalidMissingFieldTagkCustom.

@Test(expected = IllegalArgumentException.class)
public void storeRuleInvalidMissingFieldTagkCustom() throws Exception {
    setupStorage();
    final TreeRule rule = new TreeRule(1);
    rule.setLevel(1);
    rule.setOrder(0);
    rule.setType(TreeRuleType.TAGK_CUSTOM);
    rule.setNotes("Just some notes");
    rule.syncToStorage(storage.getTSDB(), false).joinUninterruptibly();
}
Also used : TreeRule(net.opentsdb.tree.TreeRule) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 12 with TreeRule

use of net.opentsdb.tree.TreeRule in project opentsdb by OpenTSDB.

the class TestTreeRule method storeRuleNoChanges.

@Test(expected = IllegalStateException.class)
public void storeRuleNoChanges() throws Exception {
    setupStorage();
    final TreeRule rule = TreeRule.fetchRule(storage.getTSDB(), 1, 2, 1).joinUninterruptibly();
    rule.syncToStorage(storage.getTSDB(), false);
}
Also used : TreeRule(net.opentsdb.tree.TreeRule) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 13 with TreeRule

use of net.opentsdb.tree.TreeRule in project opentsdb by OpenTSDB.

the class TestTreeRule method storeRuleInvalidMissingCustomFieldMetricCustom.

@Test(expected = IllegalArgumentException.class)
public void storeRuleInvalidMissingCustomFieldMetricCustom() throws Exception {
    setupStorage();
    final TreeRule rule = new TreeRule(1);
    rule.setLevel(1);
    rule.setOrder(0);
    rule.setType(TreeRuleType.METRIC_CUSTOM);
    rule.setNotes("Just some notes");
    rule.setField("foo");
    rule.syncToStorage(storage.getTSDB(), false).joinUninterruptibly();
}
Also used : TreeRule(net.opentsdb.tree.TreeRule) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 14 with TreeRule

use of net.opentsdb.tree.TreeRule in project opentsdb by OpenTSDB.

the class TestTreeRule method storeRule.

@Test
public void storeRule() throws Exception {
    setupStorage();
    final TreeRule rule = new TreeRule(1);
    rule.setLevel(1);
    rule.setOrder(0);
    rule.setType(TreeRuleType.METRIC);
    rule.setNotes("Just some notes");
    assertTrue(rule.syncToStorage(storage.getTSDB(), false).joinUninterruptibly());
    assertEquals(3, storage.numColumns(TREE_TABLE, new byte[] { 0, 1 }));
}
Also used : TreeRule(net.opentsdb.tree.TreeRule) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 15 with TreeRule

use of net.opentsdb.tree.TreeRule in project opentsdb by OpenTSDB.

the class TestTreeRule method storeRuleBadID0.

@Test(expected = IllegalArgumentException.class)
public void storeRuleBadID0() throws Exception {
    setupStorage();
    final TreeRule rule = new TreeRule(0);
    rule.syncToStorage(storage.getTSDB(), false);
}
Also used : TreeRule(net.opentsdb.tree.TreeRule) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

TreeRule (net.opentsdb.tree.TreeRule)22 Test (org.junit.Test)17 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)17 DeferredGroupException (com.stumbleupon.async.DeferredGroupException)2 IOException (java.io.IOException)2 PatternSyntaxException (java.util.regex.PatternSyntaxException)2 Tree (net.opentsdb.tree.Tree)2 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1 TSDB (net.opentsdb.core.TSDB)1 MockBase (net.opentsdb.storage.MockBase)1 Branch (net.opentsdb.tree.Branch)1 Leaf (net.opentsdb.tree.Leaf)1 TestTree (net.opentsdb.tree.TestTree)1 Config (net.opentsdb.utils.Config)1 Before (org.junit.Before)1