当前位置: 首页>>代码示例>>Java>>正文


Java SimpleConstraintParser类代码示例

本文整理汇总了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)");
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:19,代码来源:SimpleConstraintParserTest.java

示例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)");
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:19,代码来源:SimpleConstraintParserTest.java

示例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 */
	}
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:10,代码来源:SimpleConstraintParserTest.java

示例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 */
    }
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:10,代码来源:SimpleConstraintParserTest.java

示例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");
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:10,代码来源:SimpleConstraintParserTest.java

示例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, "");
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:62,代码来源:SimpleConstraintParserTest.java

示例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, "");
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:62,代码来源:SimpleConstraintParserTest.java


注:本文中的eu.atos.sla.evaluation.constraint.simple.SimpleConstraintParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。