@SuppressWarnings("unused")
  public void testMandatoryConformance_TargetMatching_1_through_53() throws Exception {
    TestPDP pdp = null;
    for (int i = 1; i <= 53; i++) {
      System.out.println("Checking TargetMatching_conformance:" + i);
      String fileName = null;
      if (i < 10) fileName = mandatoryBase + "IIB00" + i + "Policy.xml";
      else fileName = mandatoryBase + "IIB0" + i + "Policy.xml";

      String[] policies = new String[] {fileName};
      pdp = new TestPDP(policies);
      pdp.createInternalPDP();

      String requestFile = null;
      if (i < 10) requestFile = mandatoryBase + "IIB00" + i + "Request.xml";
      else requestFile = mandatoryBase + "IIB0" + i + "Request.xml";
      ResponseCtx actualResponse = pdp.evaluate(requestFile);
      assertNotNull("Response for" + i, actualResponse);

      String responseFile = null;
      if (i < 10) responseFile = mandatoryBase + "IIB00" + i + "Response.xml";
      else responseFile = mandatoryBase + "IIB0" + i + "Response.xml";

      InputStream responseStream = new FileInputStream(responseFile);
      if (responseStream == null)
        throw new IllegalStateException("responseStream for IIB0" + i + " is null");
      ResponseCtx expectedResponse = ResponseCtx.getInstance(responseStream);

      Result actualResult = (Result) actualResponse.getResults().iterator().next();
      Result expectedResult = (Result) expectedResponse.getResults().iterator().next();
      assertEquals("IIB0" + i, expectedResult.getDecision(), actualResult.getDecision());
    }
  }
  @SuppressWarnings("unused")
  public void testMandatoryConformance_FunctionEvaluation_1_through_232() throws Exception {
    TestPDP pdp = null;
    for (int i = 1; i <= 232; i++) {
      System.out.println("Checking FunctionEvaluation_conformance:" + i);
      if (i == 3 || i == 14 || i == 12) // Policy/request errors
      {
        System.out.println("Ignoring FunctionEvaluation_conformance:" + i);
        continue;
      }

      if (i == 23 || i == 54 || i == 55 || i == 88 || i == 89 || i == 92 || i == 93 || i == 98
          || i == 99) // Test is not present
      continue;

      String fileName = null;

      if (i < 10) fileName = mandatoryBase + "IIC00" + i + "Policy.xml";
      else if (i < 100) fileName = mandatoryBase + "IIC0" + i + "Policy.xml";
      else fileName = mandatoryBase + "IIC" + i + "Policy.xml";

      String[] policies = new String[] {fileName};
      pdp = new TestPDP(policies);
      pdp.createInternalPDP();

      String requestFile = null;
      if (i < 10) requestFile = mandatoryBase + "IIC00" + i + "Request.xml";
      else if (i < 100) requestFile = mandatoryBase + "IIC0" + i + "Request.xml";
      else requestFile = mandatoryBase + "IIC" + i + "Request.xml";

      ResponseCtx actualResponse = pdp.evaluate(requestFile);
      assertNotNull("Response for" + i, actualResponse);

      String responseFile = null;
      if (i < 10) responseFile = mandatoryBase + "IIC00" + i + "Response.xml";
      else if (i < 100) responseFile = mandatoryBase + "IIC0" + i + "Response.xml";
      else responseFile = mandatoryBase + "IIC" + i + "Response.xml";

      InputStream responseStream = new FileInputStream(responseFile);
      if (responseStream == null)
        throw new IllegalStateException("responseStream for IIC0" + i + " is null");
      ResponseCtx expectedResponse = ResponseCtx.getInstance(responseStream);

      Result actualResult = (Result) actualResponse.getResults().iterator().next();
      Result expectedResult = (Result) expectedResponse.getResults().iterator().next();
      assertEquals("IIC0" + i, expectedResult.getDecision(), actualResult.getDecision());
    }
  }
 protected static final boolean denyBiasedAuthz(Set<Result> set) {
   int nPermits = 0; // explicit permit returned
   int nDenies = 0; // explicit deny returned
   int nNotApplicables = 0; // no targets matched
   int nIndeterminates = 0; // for targets matched, no rules matched
   int nWrongs = 0; // none of the above, i.e., unreported failure, should not happen
   Iterator<Result> it = set.iterator();
   while (it.hasNext()) {
     Result result = it.next();
     int decision = result.getDecision();
     switch (decision) {
       case Result.DECISION_PERMIT:
         nPermits++;
         break;
       case Result.DECISION_DENY:
         nDenies++;
         break;
       case Result.DECISION_INDETERMINATE:
         nIndeterminates++;
         break;
       case Result.DECISION_NOT_APPLICABLE:
         nNotApplicables++;
         break;
       default:
         nWrongs++;
         break;
     }
   }
   if (logger.isDebugEnabled()) {
     logger.debug(
         "AUTHZ:  permits="
             + nPermits
             + " denies="
             + nDenies
             + " indeterminates="
             + nIndeterminates
             + " notApplicables="
             + nNotApplicables
             + " unexpecteds="
             + nWrongs);
   }
   return nPermits >= 1
       && nDenies == 0
       && nIndeterminates == 0
       && nWrongs == 0; // don't care about NotApplicables
 }
  @SuppressWarnings("unused")
  public void testMandatoryConformance_AttributeReferences_01_through_21() throws Exception {
    TestPDP pdp = null;
    for (int i = 1; i <= 21; i++) {
      System.out.println("Checking AttributeReferences_conformance:" + i);

      if (i == 4 || i == 5 || i == 12) // policy or request has an error
      {
        System.out.println("Ignoring AttributeReferences_conformance:" + i);
        continue;
      }

      String fileName = null;

      if (i < 10) fileName = mandatoryBase + "IIA00" + i + "Policy.xml";
      else fileName = mandatoryBase + "IIA0" + i + "Policy.xml";
      String[] policies = new String[] {fileName};
      pdp = new TestPDP(policies);

      if (i == 2) pdp.addAttributeFinderModule(new TestAttributeFinderModule());

      pdp.createInternalPDP();

      String requestFile = null;
      if (i < 10) requestFile = mandatoryBase + "IIA00" + i + "Request.xml";
      else requestFile = mandatoryBase + "IIA0" + i + "Request.xml";
      ResponseCtx actualResponse = pdp.evaluate(requestFile);
      assertNotNull("Response for" + i, actualResponse);

      String responseFile = null;
      if (i < 10) responseFile = mandatoryBase + "IIA00" + i + "Response.xml";
      else responseFile = mandatoryBase + "IIA0" + i + "Response.xml";
      InputStream responseStream = new FileInputStream(responseFile);
      if (responseStream == null)
        throw new IllegalStateException("responseStream for IIA00" + i + " is null");
      ResponseCtx expectedResponse = ResponseCtx.getInstance(responseStream);

      Result actualResult = (Result) actualResponse.getResults().iterator().next();
      Result expectedResult = (Result) expectedResponse.getResults().iterator().next();
      assertEquals("IIA00" + i, expectedResult.getDecision(), actualResult.getDecision());
    }
  }