本文整理汇总了Java中eu.atos.sla.evaluation.constraint.simple.SimpleConstraintParser类的典型用法代码示例。如果您正苦于以下问题:Java SimpleConstraintParser类的具体用法?Java SimpleConstraintParser怎么用?Java SimpleConstraintParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleConstraintParser类属于eu.atos.sla.evaluation.constraint.simple包,在下文中一共展示了SimpleConstraintParser类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testParseException
import eu.atos.sla.evaluation.constraint.simple.SimpleConstraintParser; //导入依赖的package包/类
@Test
public void testParseException() {
SimpleConstraintParser parser = new SimpleConstraintParser();
checkException(parser, "m1 TG 1");
checkException(parser, "1 GT m1");
checkException(parser, "1");
checkException(parser, "1 GT");
checkException(parser, "1 GT 2 3");
checkException(parser, "val BETWEEN (1)");
checkException(parser, "val BETWEEN (1,2,3)");
checkException(parser, "val EXISTS (1)");
checkException(parser, "val EXISTS ()");
checkException(parser, "val EXISTS (1, 2)");
checkException(parser, "val NOT_EXISTS (1)");
checkException(parser, "val NOT_EXISTS ()");
checkException(parser, "val NOT_EXISTS (1, 2)");
}
示例2: testParseException
import eu.atos.sla.evaluation.constraint.simple.SimpleConstraintParser; //导入依赖的package包/类
@Test
public void testParseException() {
SimpleConstraintParser parser = new SimpleConstraintParser();
checkException(parser, "m1 TG 1");
checkException(parser, "1 GT m1");
checkException(parser, "1");
checkException(parser, "1 GT");
checkException(parser, "1 GT 2 3");
checkException(parser, "val BETWEEN (1)");
checkException(parser, "val BETWEEN (1,2,3)");
checkException(parser, "val EXISTS (1)");
checkException(parser, "val EXISTS ()");
checkException(parser, "val EXISTS (1, 2)");
checkException(parser, "val NOT_EXISTS (1)");
checkException(parser, "val NOT_EXISTS ()");
checkException(parser, "val NOT_EXISTS (1, 2)");
}
示例3: checkException
import eu.atos.sla.evaluation.constraint.simple.SimpleConstraintParser; //导入依赖的package包/类
private void checkException(SimpleConstraintParser parser, String constraint) {
try {
parser.parse(constraint);
fail("constraint [" + constraint + "] should have failed");
} catch (IllegalArgumentException e) {
/* does nothing */
}
}
示例4: checkException
import eu.atos.sla.evaluation.constraint.simple.SimpleConstraintParser; //导入依赖的package包/类
private void checkException(SimpleConstraintParser parser, String constraint) {
try {
parser.parse(constraint);
fail("constraint [" + constraint + "] should have failed");
} catch (IllegalArgumentException e) {
/* does nothing */
}
}
示例5: testParseWithExtendedNamesShouldPass
import eu.atos.sla.evaluation.constraint.simple.SimpleConstraintParser; //导入依赖的package包/类
@Test
public void testParseWithExtendedNamesShouldPass() {
SimpleConstraintParser parser = new SimpleConstraintParser();
check(parser.parse("analytics_time LT 1"), "analytics_time", Operator.LT, "1");
check(parser.parse("nuro.analytics LT 1"), "nuro.analytics", Operator.LT, "1");
check(parser.parse("nuro.analytics_time LT 1"), "nuro.analytics_time", Operator.LT, "1");
check(parser.parse("a.b.c LT 1"), "a.b.c", Operator.LT, "1");
}
示例6: testParse
import eu.atos.sla.evaluation.constraint.simple.SimpleConstraintParser; //导入依赖的package包/类
@Test
public void testParse() {
SimpleConstraintParser parser = new SimpleConstraintParser();
/*
* All simple operators
*/
check(parser.parse("m1 GT 1"), "m1", Operator.GT, "1");
check(parser.parse("m1 GT (1)"), "m1", Operator.GT, "1");
check(parser.parse("m2 GE 2"), "m2", Operator.GE, "2");
check(parser.parse("m2 GE (2)"), "m2", Operator.GE, "2");
check(parser.parse("m3 EQ 3"), "m3", Operator.EQ, "3");
check(parser.parse("m3 EQ (3)"), "m3", Operator.EQ, "3");
check(parser.parse("m4 LT 4"), "m4", Operator.LT, "4");
check(parser.parse("m4 LT (4)"), "m4", Operator.LT, "4");
check(parser.parse("m5 LE 5"), "m5", Operator.LE, "5");
check(parser.parse("m5 LE (5)"), "m5", Operator.LE, "5");
check(parser.parse("m6 NE 6"), "m6", Operator.NE, "6");
check(parser.parse("m6 NE (6)"), "m6", Operator.NE, "6");
/*
* Float value
*/
check(parser.parse("latency LT 0.5"), "latency", Operator.LT, "0.5");
check(parser.parse("latency LT (0.5)"), "latency", Operator.LT, "0.5");
/*
* In
*/
check(parser.parse("val IN 1"), "val", Operator.IN, "1");
check(parser.parse("val IN (1)"), "val", Operator.IN, "1");
check(parser.parse("val IN (1,2)"), "val", Operator.IN, "1,2");
check(parser.parse("val IN (1,2,3)"), "val", Operator.IN, "1,2,3");
/*
* Between
*/
check(parser.parse("val BETWEEN (1,2)"), "val", Operator.BETWEEN, "1,2");
/*
* Exists
*/
check(parser.parse("val EXISTS"), "val", Operator.EXISTS, "");
/*
* Not exists
*/
check(parser.parse("val NOT_EXISTS"), "val", Operator.NOT_EXISTS, "");
/*
* Remove spaces
*/
check(parser.parse("val BETWEEN 1,2"), "val", Operator.BETWEEN, "1,2");
check(parser.parse("val BETWEEN 1,2 "), "val", Operator.BETWEEN, "1,2");
check(parser.parse("val BETWEEN 1 ,2"), "val", Operator.BETWEEN, "1,2");
check(parser.parse("val BETWEEN 1, 2"), "val", Operator.BETWEEN, "1,2");
check(parser.parse("val IN 1 , 2 , 3 "), "val", Operator.IN, "1,2,3");
check(parser.parse("val EXISTS "), "val", Operator.EXISTS, "");
check(parser.parse("val NOT_EXISTS "), "val", Operator.NOT_EXISTS, "");
}
示例7: testParse
import eu.atos.sla.evaluation.constraint.simple.SimpleConstraintParser; //导入依赖的package包/类
@Test
public void testParse() {
SimpleConstraintParser parser = new SimpleConstraintParser();
/*
* All simple operators
*/
check(parser.parse("m1 GT 1"), "m1", Operator.GT, "1");
check(parser.parse("m1 GT (1)"), "m1", Operator.GT, "1");
check(parser.parse("m2 GE 2"), "m2", Operator.GE, "2");
check(parser.parse("m2 GE (2)"), "m2", Operator.GE, "2");
check(parser.parse("m3 EQ 3"), "m3", Operator.EQ, "3");
check(parser.parse("m3 EQ (3)"), "m3", Operator.EQ, "3");
check(parser.parse("m4 LT 4"), "m4", Operator.LT, "4");
check(parser.parse("m4 LT (4)"), "m4", Operator.LT, "4");
check(parser.parse("m5 LE 5"), "m5", Operator.LE, "5");
check(parser.parse("m5 LE (5)"), "m5", Operator.LE, "5");
check(parser.parse("m6 NE 6"), "m6", Operator.NE, "6");
check(parser.parse("m6 NE (6)"), "m6", Operator.NE, "6");
/*
* Float value
*/
check(parser.parse("latency LT 0.5"), "latency", Operator.LT, "0.5");
check(parser.parse("latency LT (0.5)"), "latency", Operator.LT, "0.5");
/*
* In
*/
check(parser.parse("val IN 1"), "val", Operator.IN, "1");
check(parser.parse("val IN (1)"), "val", Operator.IN, "1");
check(parser.parse("val IN (1,2)"), "val", Operator.IN, "1,2");
check(parser.parse("val IN (1,2,3)"), "val", Operator.IN, "1,2,3");
/*
* Between
*/
check(parser.parse("val BETWEEN (1,2)"), "val", Operator.BETWEEN, "1,2");
/*
* Exists
*/
check(parser.parse("val EXISTS"), "val", Operator.EXISTS, "");
/*
* Not exists
*/
check(parser.parse("val NOT_EXISTS"), "val", Operator.NOT_EXISTS, "");
/*
* Remove spaces
*/
check(parser.parse("val BETWEEN 1,2"), "val", Operator.BETWEEN, "1,2");
check(parser.parse("val BETWEEN 1,2 "), "val", Operator.BETWEEN, "1,2");
check(parser.parse("val BETWEEN 1 ,2"), "val", Operator.BETWEEN, "1,2");
check(parser.parse("val BETWEEN 1, 2"), "val", Operator.BETWEEN, "1,2");
check(parser.parse("val IN 1 , 2 , 3 "), "val", Operator.IN, "1,2,3");
check(parser.parse("val EXISTS "), "val", Operator.EXISTS, "");
check(parser.parse("val NOT_EXISTS "), "val", Operator.NOT_EXISTS, "");
}