本文整理汇总了Java中org.apache.geode.LogWriter.error方法的典型用法代码示例。如果您正苦于以下问题:Java LogWriter.error方法的具体用法?Java LogWriter.error怎么用?Java LogWriter.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.geode.LogWriter
的用法示例。
在下文中一共展示了LogWriter.error方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: oganizedOperandsSingleRangeJunctionCreation
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the creation of a single RangeJunction if the CompiledJunction only contains same index
* condition with or without iter operand
*/
private OrganizedOperands oganizedOperandsSingleRangeJunctionCreation(int junctionType,
CompiledValue[] operandsForCJ, ExecutionContext context) {
LogWriter logger = CacheUtils.getCache().getLogger();
OrganizedOperands oo = null;
try {
CompiledJunction cj = new CompiledJunction(operandsForCJ, junctionType);
context.addDependencies(new CompiledID("dummy"), cj.computeDependencies(context));
cj.getPlanInfo(context);
oo = cj.testOrganizedOperands(context);
return oo;
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
return oo;
}
示例2: testOrganizedOperandsOfSingleRangeJunctionWithNoIterOperandForAND_1
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the functionality of organizedOperands function of a RangeJunction which is an AND with
* no IterOperand. If the RangeJunction boils down to a single condition which can be evalauted as
* a CompiledComparison then the filter operand will be a CompiledComparison
*
*/
@Test
public void testOrganizedOperandsOfSingleRangeJunctionWithNoIterOperandForAND_1() {
LogWriter logger = CacheUtils.getCache().getLogger();
try {
CompiledComparison cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
cv = new CompiledComparison[3];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_LT);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertNotNull("OrganizedOperand object is null", oo);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
assertEquals(cv.length, rj.getOperands().size());
OrganizedOperands oo1 = rj.organizeOperands(context);
assertNotNull(oo1);
assertNull(oo1.iterateOperand);
assertNotNull(oo1.filterOperand);
assertEquals(oo1.filterOperand, cv[2]);
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例3: testOrganizedOperandsOfSingleRangeJunctionWithNoIterOperandForAND_2
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the functionality of organizedOperands function of a RangeJunction which is an AND with
* no IterOperand but where the operator needs reflection. as the condition is Key > Path ( which
* means Path less than Key) If the RangeJunction boils down toa single condition which can be
* evalauted as a CompiledComparison then the filter operand will be a CompiledComparison
*
*/
@Test
public void testOrganizedOperandsOfSingleRangeJunctionWithNoIterOperandForAND_2() {
LogWriter logger = CacheUtils.getCache().getLogger();
try {
CompiledComparison cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
cv = new CompiledComparison[3];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[2] = new CompiledComparison(new CompiledLiteral(new Integer(2)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GT);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertNotNull("OrganizedOperand object is null", oo);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
assertEquals(cv.length, rj.getOperands().size());
OrganizedOperands oo1 = rj.organizeOperands(context);
assertNotNull(oo1);
assertNull(oo1.iterateOperand);
assertNotNull(oo1.filterOperand);
assertEquals(oo1.filterOperand, cv[2]);
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例4: testOrganizedOperandsOfSingleRangeJunctionWithIterOperandForAND_1
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the functionality of organizedOperands function of a RangeJunction which is an AND with a
* IterOperand but where the operator needs reflection. as the condition is Key > Path ( which
* means Path less than Key) The RangeJunction boils down to a single condition which can be
* evalauted as a CompiledComparison so the filter operand will be a CompiledComparison. Thus the
* organizdeOperand's filter operand will be a CompiledComparison while its Iteroperand will be a
* CompiledComparison
*
*/
@Test
public void testOrganizedOperandsOfSingleRangeJunctionWithIterOperandForAND_1() {
LogWriter logger = CacheUtils.getCache().getLogger();
try {
CompiledComparison cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
cv = new CompiledComparison[4];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[2] = new CompiledComparison(new CompiledLiteral(new Integer(2)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GT);
cv[3] = new CompiledComparison(new CompiledLiteral(new Integer(2)),
new CompiledPath(new CompiledID("p"), "createTime"), OQLLexerTokenTypes.TOK_GT);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertNotNull("OrganizedOperand object is null", oo);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
assertEquals(cv.length, rj.getOperands().size());
OrganizedOperands oo1 = rj.organizeOperands(context);
assertNotNull(oo1);
assertEquals(cv[3], oo1.iterateOperand);
assertEquals(oo1.filterOperand, cv[2]);
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例5: testOrganizedOperandsOfSingleRangeJunctionWithTwoIterOperandsForAND_2
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the functionality of organizedOperands function of a RangeJunction which is an AND with
* two IterOperands but where the operator needs reflection. as the condition is Key > Path (
* which means Path less than Key) The RangeJunction boils down to a single condition which can be
* evalauted as a CompiledComparison so the filter operand will be a CompiledComparison. Thus the
* organizdeOperand's filter operand will be a CompiledComparison while its Iteroperand will be a
* CompiledJunction
*
*/
@Test
public void testOrganizedOperandsOfSingleRangeJunctionWithTwoIterOperandsForAND_2() {
LogWriter logger = CacheUtils.getCache().getLogger();
try {
CompiledComparison cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
cv = new CompiledComparison[5];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[2] = new CompiledComparison(new CompiledLiteral(new Integer(2)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GT);
cv[3] = new CompiledComparison(new CompiledLiteral(new Integer(2)),
new CompiledPath(new CompiledID("p"), "createTime"), OQLLexerTokenTypes.TOK_GT);
cv[4] = new CompiledComparison(new CompiledLiteral(new String("xyz")),
new CompiledPath(new CompiledID("p"), "getPk"), OQLLexerTokenTypes.TOK_GT);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertNotNull("OrganizedOperand object is null", oo);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
assertEquals(cv.length, rj.getOperands().size());
OrganizedOperands oo1 = rj.organizeOperands(context);
assertNotNull(oo1);
assertTrue(oo1.iterateOperand instanceof CompiledJunction);
assertTrue(oo1.iterateOperand.getChildren().size() == 2);
assertTrue(oo1.iterateOperand.getChildren().get(0) == cv[3]);
assertTrue(oo1.iterateOperand.getChildren().get(1) == cv[4]);
assertEquals(oo1.filterOperand, cv[2]);
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例6: testNotEqualCoupledWithUndefinedAndNotNull
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* If possible , in case where RangeJunction contains something like a != 7 and a != undefined & a
* != null, since undefined & null are not groupable , the a != 7 is also evaluated individually.
* In such case, it makes sense not to create an Object of
* rangeJunction.NotEqualConditionEvaluator for evaluating a !=7 , which however is the case now.
* May be at some point, we should either try to club null & undefined as a part of
* RangeJunctionEvaluator or we should not create an object of NotEqualConditionEvaluator.
*
*/
@Ignore
@Test
public void testNotEqualCoupledWithUndefinedAndNotNull() {
LogWriter logger = CacheUtils.getLogger();
try {
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
// Case 2 : a != 7 and a != null and a != undefined
CompiledValue[] cv1 = new CompiledValue[3];
cv1[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE);
cv1[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(null), OQLLexerTokenTypes.TOK_NE);
cv1[2] = new CompiledUndefined(new CompiledPath(new CompiledID("p"), "ID"), false);
OrganizedOperands oo = this.oganizedOperandsSingleRangeJunctionCreation(
OQLLexerTokenTypes.LITERAL_and, cv1, context);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
OrganizedOperands oo1 = rj.organizeOperands(context);
assertTrue(oo1.filterOperand instanceof GroupJunction);
CompiledValue[] ops = ((GroupJunction) oo1.filterOperand)._operands;
assertTrue(cv1[0] == ops[0] || cv1[0] == ops[1] || cv1[0] == ops[2]);
assertTrue(cv1[1] == ops[0] || cv1[1] == ops[1] || cv1[1] == ops[2]);
assertTrue(cv1[2] == ops[0] || cv1[2] == ops[1] || cv1[2] == ops[2]);
} catch (Exception e) {
logger.error(e.toString());
fail(e.toString());
}
}
示例7: testOrganizeOpsOfRangeJunctionForNonRangeEvaluatableOperand
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
@Test
public void testOrganizeOpsOfRangeJunctionForNonRangeEvaluatableOperand() {
LogWriter logger = CacheUtils.getLogger();
try {
CompiledValue cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
// Case 1 : a != null and a != null and a != undefined
cv = new CompiledValue[3];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(null), OQLLexerTokenTypes.TOK_NE);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(null), OQLLexerTokenTypes.TOK_NE);
cv[2] = new CompiledUndefined(new CompiledPath(new CompiledID("p"), "ID"), false);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
OrganizedOperands oo1 = rj.organizeOperands(context);
assertTrue(oo1.filterOperand instanceof GroupJunction);
CompiledValue[] ops = ((GroupJunction) oo1.filterOperand)._operands;
assertTrue(ops[0] == cv[0] || ops[0] == cv[1] || ops[0] == cv[2]);
assertTrue(ops[1] == cv[0] || ops[1] == cv[1] || ops[1] == cv[2]);
assertTrue(ops[2] == cv[0] || ops[2] == cv[1] || ops[2] == cv[2]);
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例8: testOrganizedOperandsSingleRangeJunctionCreationWithNoIterOperandForAND
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the creation of a single RangeJunction if the CompiledJunction only contains same index
* condition without iter operand for AND
*/
@Test
public void testOrganizedOperandsSingleRangeJunctionCreationWithNoIterOperandForAND() {
LogWriter logger = CacheUtils.getLogger();
try {
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
CompiledComparison cv[] = null;
cv = new CompiledComparison[12];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_EQ);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GT);
cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GE);
cv[5] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE);
cv[6] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_EQ);
cv[7] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[8] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[9] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GT);
cv[10] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GE);
cv[11] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertNotNull("OrganizedOperand object is null", oo);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
assertEquals(cv.length, rj.getOperands().size());
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例9: testOrganizedOperandsSingleRangeJunctionCreationWithIterOperandForAND
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the creation of a single RangeJunction if the CompiledJunction only contains same index
* condition and an iter operand for AND
*/
@Test
public void testOrganizedOperandsSingleRangeJunctionCreationWithIterOperandForAND() {
LogWriter logger = CacheUtils.getCache().getLogger();
try {
CompiledComparison cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
cv = new CompiledComparison[13];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_EQ);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GT);
cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GE);
cv[5] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE);
cv[6] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_EQ);
cv[7] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[8] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[9] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GT);
cv[10] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GE);
cv[11] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE);
cv[12] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "createTime"),
new CompiledLiteral(new Long(7)), OQLLexerTokenTypes.TOK_NE);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertNotNull("OrganizedOperand object is null", oo);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
assertEquals(cv.length, rj.getOperands().size());
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例10: testOrganizedOperandsSingleRangeJunctionCreationWithNoIterOperandForOR
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the creation of a single RangeJunction if the CompiledJunction only contains same index
* condition without iter operand for OR
*/
@Ignore
@Test
public void testOrganizedOperandsSingleRangeJunctionCreationWithNoIterOperandForOR() {
LogWriter logger = CacheUtils.getLogger();
try {
CompiledComparison cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
cv = new CompiledComparison[12];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_EQ);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GT);
cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GE);
cv[5] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE);
cv[6] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(2)), OQLLexerTokenTypes.TOK_EQ);
cv[7] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[8] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[9] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GT);
cv[10] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GE);
cv[11] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_or, cv, context);
assertNotNull("OrganizedOperand object is null", oo);
assertTrue("Filter Openad of OrganizedOperand is not of type CompiledJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
assertEquals(cv.length, rj.getOperands().size());
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例11: testOrganizedOperandsOfSingleRangeJunctionWithTwoIterOperandsForAND_3
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the functionality of organizedOperands function of a RangeJunction which is an AND with
* two IterOperands but where the operator needs reflection. as the condition is Key > Path (
* which means Path less than Key) The RangeJunction boils down to a condition and a NOT EQUAL
* which will be evalauted as a SingleCondnEvaluator so the filter operand will be a
* SingleCondnEvaluator. Its Iter operand will be a CompiledJunction
*
*/
@Test
public void testOrganizedOperandsOfSingleRangeJunctionWithTwoIterOperandsForAND_3() {
LogWriter logger = CacheUtils.getCache().getLogger();
try {
CompiledComparison cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
// case1: a <7 and a<=5 and 2>a and 2> createTime and "xyz" > pid
// and 100 != a and 200 !=a and 1 != a
cv = new CompiledComparison[8];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_LT);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_LE);
cv[2] = new CompiledComparison(new CompiledLiteral(new Integer(2)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_GT);
cv[3] = new CompiledComparison(new CompiledLiteral(new Integer(2)),
new CompiledPath(new CompiledID("p"), "createTime"), OQLLexerTokenTypes.TOK_GT);
cv[4] = new CompiledComparison(new CompiledLiteral(new String("xyz")),
new CompiledPath(new CompiledID("p"), "getPk"), OQLLexerTokenTypes.TOK_GT);
cv[5] = new CompiledComparison(new CompiledLiteral(new Integer(100)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_NE);
cv[6] = new CompiledComparison(new CompiledLiteral(new Integer(200)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_NE);
cv[7] = new CompiledComparison(new CompiledLiteral(new Integer(1)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_NE);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertNotNull("OrganizedOperand object is null", oo);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
assertEquals(cv.length, rj.getOperands().size());
OrganizedOperands oo1 = rj.organizeOperands(context);
assertNotNull(oo1);
assertTrue(oo1.iterateOperand instanceof CompiledJunction);
assertTrue(oo1.iterateOperand.getChildren().size() == 2);
assertTrue(oo1.iterateOperand.getChildren().get(0) == cv[3]);
assertTrue(oo1.iterateOperand.getChildren().get(1) == cv[4]);
assertTrue(RangeJunction.isInstanceOfSingleCondnEvaluator(oo1.filterOperand));
Set keysToRemove = RangeJunction.getKeysToBeRemoved(oo1.filterOperand);
assertEquals(1, keysToRemove.size());
assertTrue(keysToRemove.contains(new Integer(1)));
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例12: testOrganizedOperandsOfSingleRangeJunctionWithTwoIterOperandsForAND_4
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the functionality of organizedOperands function of a RangeJunction which is an AND with
* two IterOperands but where the operator needs reflection. as the condition is Key <= Path (
* which means Path less than Key) The RangeJunction boils down to a condition and a NOT EQUAL
* which will be evalauted as a SingleCondnEvaluator so the filter operand will be a
* SingleCondnEvaluator. Its Iter operand will be a CompiledJunction. This checks for the
* SingleCondnEvaluator with > operator
*
*/
@Test
public void testOrganizedOperandsOfSingleRangeJunctionWithTwoIterOperandsForAND_4() {
LogWriter logger = CacheUtils.getCache().getLogger();
try {
CompiledComparison cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
cv = new CompiledComparison[7];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_GT);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_GT);
cv[2] = new CompiledComparison(new CompiledLiteral(new Integer(2)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_LT);
cv[3] = new CompiledComparison(new CompiledLiteral(new Integer(2)),
new CompiledPath(new CompiledID("p"), "createTime"), OQLLexerTokenTypes.TOK_GT);
cv[4] = new CompiledComparison(new CompiledLiteral(new String("xyz")),
new CompiledPath(new CompiledID("p"), "getPk"), OQLLexerTokenTypes.TOK_GT);
cv[5] = new CompiledComparison(new CompiledLiteral(new Integer(100)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_NE);
cv[6] = new CompiledComparison(new CompiledLiteral(new Integer(200)),
new CompiledPath(new CompiledID("p"), "ID"), OQLLexerTokenTypes.TOK_NE);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertNotNull("OrganizedOperand object is null", oo);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
assertEquals(cv.length, rj.getOperands().size());
OrganizedOperands oo1 = rj.organizeOperands(context);
assertNotNull(oo1);
assertTrue(oo1.iterateOperand instanceof CompiledJunction);
assertTrue(oo1.iterateOperand.getChildren().size() == 2);
assertTrue(oo1.iterateOperand.getChildren().get(0) == cv[3]);
assertTrue(oo1.iterateOperand.getChildren().get(1) == cv[4]);
assertTrue(RangeJunction.isInstanceOfSingleCondnEvaluator(oo1.filterOperand));
Set keysToRemove = RangeJunction.getKeysToBeRemoved(oo1.filterOperand);
assertEquals(2, keysToRemove.size());
assertTrue(keysToRemove.contains(new Integer(100)));
assertTrue(keysToRemove.contains(new Integer(200)));
} catch (Exception e) {
logger.error(e);
fail(e.toString());
}
}
示例13: testNotEqualConditionEvaluator_AND
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Tests the correct creation of NotEqualConditionEvaluator For AND junction
*
*/
@Test
public void testNotEqualConditionEvaluator_AND() {
LogWriter logger = CacheUtils.getLogger();
try {
CompiledComparison cv[] = null;
ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
this.bindIteratorsAndCreateIndex(context);
/**
* ******************For all LESS THAN OR LESS THAN EQUAL To ********************
*/
// Case 1 : a != 7 and a !=4 and a != 5 and a != 5
cv = new CompiledComparison[4];
cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE);
cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(4)), OQLLexerTokenTypes.TOK_NE);
cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_NE);
cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(5)), OQLLexerTokenTypes.TOK_NE);
OrganizedOperands oo = this
.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
RangeJunction rj = (RangeJunction) oo.filterOperand;
OrganizedOperands oo1 = rj.organizeOperands(context);
assertTrue(RangeJunction.isInstanceOfNotEqualConditionEvaluator(oo1.filterOperand));
Set keysRemove = RangeJunction.getKeysToBeRemoved(oo1.filterOperand);
assertTrue(keysRemove.size() == 3);
assertTrue(keysRemove.contains(new Integer(5)));
assertTrue(keysRemove.contains(new Integer(7)));
assertTrue(keysRemove.contains(new Integer(4)));
// Case 2 : a != 7 and a != null and a != undefined
CompiledValue[] cv1 = new CompiledValue[3];
cv1[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(new Integer(7)), OQLLexerTokenTypes.TOK_NE);
cv1[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
new CompiledLiteral(null), OQLLexerTokenTypes.TOK_NE);
cv1[2] = new CompiledUndefined(new CompiledPath(new CompiledID("p"), "ID"), false);
oo = this.oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv1,
context);
assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
oo.filterOperand instanceof RangeJunction);
rj = (RangeJunction) oo.filterOperand;
oo1 = rj.organizeOperands(context);
assertTrue(oo1.filterOperand instanceof GroupJunction);
CompiledValue[] ops = ((GroupJunction) oo1.filterOperand)._operands;
// assertTrue(cv1[0] == ops[0] || cv1[0] == ops[1] || cv1[0] == ops[2]);
if (RangeJunction.isInstanceOfNotEqualConditionEvaluator(ops[0])) {
assertTrue(
RangeJunction.getKeysToBeRemoved(ops[0]).iterator().next().equals(new Integer(7)));
} else if (RangeJunction.isInstanceOfNotEqualConditionEvaluator(ops[1])) {
assertTrue(
RangeJunction.getKeysToBeRemoved(ops[1]).iterator().next().equals(new Integer(7)));
} else if (RangeJunction.isInstanceOfNotEqualConditionEvaluator(ops[2])) {
assertTrue(
RangeJunction.getKeysToBeRemoved(ops[2]).iterator().next().equals(new Integer(7)));
} else {
fail("NotEqualConditionEvaluator not found");
}
assertTrue(cv1[1] == ops[0] || cv1[1] == ops[1] || cv1[1] == ops[2]);
assertTrue(cv1[2] == ops[0] || cv1[2] == ops[1] || cv1[2] == ops[2]);
} catch (Exception e) {
logger.error(e.toString());
fail(e.toString());
}
}