Search in sources :

Example 46 with StackMachine

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

the class StackMachine_evaluateTest method testEvaluate_logicalOrBothTrue_assertTrue.

public void testEvaluate_logicalOrBothTrue_assertTrue() throws Exception {
    final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(true)));
    stuffToProcess.add(new StackMachineEntry(PolicyOperator.LOGICAL_OR));
    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 47 with StackMachine

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

the class StackMachine_evaluateTest method testEvaluate_uriValidate_noHostURI_assertFalse.

public void testEvaluate_uriValidate_noHostURI_assertFalse() throws Exception {
    final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("http://bogus.unit.test.ccc")));
    stuffToProcess.add(new StackMachineEntry(PolicyOperator.URI_VALIDATE));
    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 48 with StackMachine

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

the class StackMachine_evaluateTest method testEvaluate_notEqualsDifferentStringValues_assertTrue.

public void testEvaluate_notEqualsDifferentStringValues_assertTrue() throws Exception {
    final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("12345")));
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("22345")));
    stuffToProcess.add(new StackMachineEntry(PolicyOperator.NOT_EQUALS));
    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 49 with StackMachine

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

the class StackMachine_evaluateTest method testEvaluate_singleBooleanEntry_assertFalse.

public void testEvaluate_singleBooleanEntry_assertFalse() throws Exception {
    final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance(false)));
    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 50 with StackMachine

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

the class StackMachine_evaluateTest method testEvaluate_equalsSameStringValues_assertTrue.

public void testEvaluate_equalsSameStringValues_assertTrue() throws Exception {
    final Vector<Opcode> stuffToProcess = new Vector<Opcode>();
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("12345")));
    stuffToProcess.add(new StackMachineEntry(PolicyValueFactory.getInstance("12345")));
    stuffToProcess.add(new StackMachineEntry(PolicyOperator.EQUALS));
    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)

Aggregations

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