Search in sources :

Example 26 with StackMachineEntry

use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.

the class StackMachine_evaluateTest method testEvaluate_logicalNotTrueValue_assertFalse.

public void testEvaluate_logicalNotTrueValue_assertFalse() throws Exception {
    final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
    stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_NOT));
    final StackMachine stMachine = new StackMachine();
    assertFalse(stMachine.evaluate(stuffToProcess));
}
Also used : StackMachine(org.nhindirect.policy.impl.machine.StackMachine) StackMachineEntry(org.nhindirect.policy.impl.machine.StackMachineEntry) Opcode(org.nhindirect.policy.Opcode) Vector(java.util.Vector)

Example 27 with StackMachineEntry

use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.

the class StackMachine_evaluateTest method testEvaluate_greater_bottomOfStockIsGreater_assertTrue.

public void testEvaluate_greater_bottomOfStockIsGreater_assertTrue() throws Exception {
    final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(1)));
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(0)));
    stuffToProcess.add(new StackMachineEntry(PolicyOperator.GREATER));
    final StackMachine stMachine = new StackMachine();
    assertTrue(stMachine.evaluate(stuffToProcess));
}
Also used : StackMachine(org.nhindirect.policy.impl.machine.StackMachine) StackMachineEntry(org.nhindirect.policy.impl.machine.StackMachineEntry) Opcode(org.nhindirect.policy.Opcode) Vector(java.util.Vector)

Example 28 with StackMachineEntry

use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.

the class StackMachine_evaluateTest method testEvaluate_logicalAndBothFalse_assertFalse.

public void testEvaluate_logicalAndBothFalse_assertFalse() throws Exception {
    final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
    stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_AND));
    final StackMachine stMachine = new StackMachine();
    assertFalse(stMachine.evaluate(stuffToProcess));
}
Also used : StackMachine(org.nhindirect.policy.impl.machine.StackMachine) StackMachineEntry(org.nhindirect.policy.impl.machine.StackMachineEntry) Opcode(org.nhindirect.policy.Opcode) Vector(java.util.Vector)

Example 29 with StackMachineEntry

use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.

the class StackMachine_evaluateTest method testEvaluate_singleBooleanEntry_assertTrue.

public void testEvaluate_singleBooleanEntry_assertTrue() throws Exception {
    final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
    final StackMachine stMachine = new StackMachine();
    assertTrue(stMachine.evaluate(stuffToProcess));
}
Also used : StackMachine(org.nhindirect.policy.impl.machine.StackMachine) StackMachineEntry(org.nhindirect.policy.impl.machine.StackMachineEntry) Opcode(org.nhindirect.policy.Opcode) Vector(java.util.Vector)

Example 30 with StackMachineEntry

use of org.nhindirect.policy.impl.machine.StackMachineEntry in project nhin-d by DirectProject.

the class StackMachine_evaluateTest method testEvaluate_logicalAndOneTrue_assertFalse.

public void testEvaluate_logicalAndOneTrue_assertFalse() throws Exception {
    Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
    stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_AND));
    StackMachine stMachine = new StackMachine();
    assertFalse(stMachine.evaluate(stuffToProcess));
    stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
    stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_AND));
    stMachine = new StackMachine();
    assertFalse(stMachine.evaluate(stuffToProcess));
}
Also used : StackMachine(org.nhindirect.policy.impl.machine.StackMachine) StackMachineEntry(org.nhindirect.policy.impl.machine.StackMachineEntry) Opcode(org.nhindirect.policy.Opcode) Vector(java.util.Vector)

Aggregations

Vector (java.util.Vector)40 Opcode (org.nhindirect.policy.Opcode)40 StackMachine (org.nhindirect.policy.impl.machine.StackMachine)40 StackMachineEntry (org.nhindirect.policy.impl.machine.StackMachineEntry)40 X509Certificate (java.security.cert.X509Certificate)3 LiteralPolicyExpression (org.nhindirect.policy.LiteralPolicyExpression)3 OperationPolicyExpression (org.nhindirect.policy.OperationPolicyExpression)3 PolicyExpression (org.nhindirect.policy.PolicyExpression)3 StackMachineCompiler (org.nhindirect.policy.impl.machine.StackMachineCompiler)3 ExtendedKeyUsageExtensionField (org.nhindirect.policy.x509.ExtendedKeyUsageExtensionField)3 KeyUsageExtensionField (org.nhindirect.policy.x509.KeyUsageExtensionField)3