use of org.nhindirect.policy.Compiler in project nhin-d by DirectProject.
the class DefaultPolicyFilter_isCompliantTest method testIsCompliant_engineReturnsCompliant_assertTrue.
@SuppressWarnings("unchecked")
public void testIsCompliant_engineReturnsCompliant_assertTrue() throws Exception {
final Compiler compiler = mock(Compiler.class);
final ExecutionEngine engine = mock(ExecutionEngine.class);
final PolicyExpression expression = mock(PolicyExpression.class);
final X509Certificate cert = mock(X509Certificate.class);
when(engine.evaluate((Vector<Opcode>) any())).thenReturn(true);
final DefaultPolicyFilter filter = new DefaultPolicyFilter();
filter.setCompiler(compiler);
filter.setExecutionEngine(engine);
assertTrue(filter.isCompliant(cert, expression));
}
use of org.nhindirect.policy.Compiler in project nhin-d by DirectProject.
the class DefaultPolicyFilter_isCompliantTest method testIsCompliant_parse_engineReturnsCompliant_assertTrue.
@SuppressWarnings("unchecked")
public void testIsCompliant_parse_engineReturnsCompliant_assertTrue() throws Exception {
final InputStream inStream = FileUtils.openInputStream(new File("./src/test/resources/policies/dataEnciphermentOnlyRequired.xml"));
final Compiler compiler = mock(Compiler.class);
final ExecutionEngine engine = mock(ExecutionEngine.class);
final X509Certificate cert = mock(X509Certificate.class);
when(engine.evaluate((Vector<Opcode>) any())).thenReturn(true);
final DefaultPolicyFilter filter = new DefaultPolicyFilter();
filter.setCompiler(compiler);
filter.setExecutionEngine(engine);
assertTrue(filter.isCompliant(cert, inStream, PolicyLexicon.XML));
}
use of org.nhindirect.policy.Compiler in project nhin-d by DirectProject.
the class DefaultPolicyFilter_isCompliantTest method testIsCompliant_engineReturnsNotCompliant_assertFalse.
@SuppressWarnings("unchecked")
public void testIsCompliant_engineReturnsNotCompliant_assertFalse() throws Exception {
final Compiler compiler = mock(Compiler.class);
final ExecutionEngine engine = mock(ExecutionEngine.class);
final PolicyExpression expression = mock(PolicyExpression.class);
final X509Certificate cert = mock(X509Certificate.class);
when(engine.evaluate((Vector<Opcode>) any())).thenReturn(false);
final DefaultPolicyFilter filter = new DefaultPolicyFilter();
filter.setCompiler(compiler);
filter.setExecutionEngine(engine);
assertFalse(filter.isCompliant(cert, expression));
}
Aggregations