use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_createOperatorExecutorTest method testCreateUnaryOperator_tooFewArguments_assertExecption.
public void testCreateUnaryOperator_tooFewArguments_assertExecption() throws Exception {
StackMachine stMachine = new StackMachine();
boolean exceptionOccured = false;
try {
stMachine.createOperatorExecutor(PolicyOperator.LOGICAL_NOT);
} catch (PolicyProcessException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_uriValidate_validUri_assertTrue.
public void testEvaluate_uriValidate_validUri_assertTrue() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("http://www.cerner.com/CPS")));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.URI_VALIDATE));
final StackMachine stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_notEnoughParamsForBinaryOperation_assertException.
public void testEvaluate_notEnoughParamsForBinaryOperation_assertException() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_OR));
boolean exceptionOccured = false;
final StackMachine stMachine = new StackMachine();
try {
stMachine.evaluate(stuffToProcess);
} catch (IllegalStateException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_bitwiseAndBitSetOnNeither_assertEquals.
public void testEvaluate_bitwiseAndBitSetOnNeither_assertEquals() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.BITWISE_AND));
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.EQUALS));
final StackMachine stMachine = new StackMachine();
assertTrue(stMachine.evaluate(stuffToProcess));
}
use of org.nhindirect.policy.impl.machine.StackMachine in project nhin-d by DirectProject.
the class StackMachine_evaluateTest method testEvaluate_uriValidate_notFoundUri_assertFalse.
public void testEvaluate_uriValidate_notFoundUri_assertFalse() throws Exception {
final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("http://www.google.com/333333")));
stuffToProcess.add(new StackMachineEntry(PolicyOperator.URI_VALIDATE));
final StackMachine stMachine = new StackMachine();
assertFalse(stMachine.evaluate(stuffToProcess));
}
Aggregations