PolicyDecisionPointImpl implements PolicyDecisionPoint { @Override @Deprecated public XacmlResponse evaluateRequest(PDP pdp, RequestType request, List<Evaluatable> policies, XacmlRequest xacmlRequest) throws AuditException { logger.info("evaluateRequest invoked"); return managePoliciesAndEvaluateRequest(pdp, request, policies, xacmlRequest); } PolicyDecisionPointImpl(PolicyProvider policyProvider,
			RequestGenerator requestGenerator,
			DocumentAccessor documentAccessor,
			DocumentXmlConverter documentXmlConverter, AuditService auditService);  PolicyDecisionPointImpl(RequestGenerator requestGenerator,
			DocumentAccessor documentAccessor,
			DocumentXmlConverter documentXmlConverter); @Override synchronized PdpRequestResponse evaluatePolicyForTrying(
			String xacmlPolicy, String purposeOfUse); @Override @Deprecated XacmlResponse evaluateRequest(PDP pdp, RequestType request,
			List<Evaluatable> policies, XacmlRequest xacmlRequest); @Override @Deprecated XacmlResponse evaluateRequest(PDP pdp, RequestType request,
			XacmlRequest xacmlRequest); @Override @Deprecated XacmlResponse evaluateRequest(RequestType request,
			List<Evaluatable> policies, XacmlRequest xacmlRequest); @Override XacmlResponse evaluateRequest(RequestType request,
			XacmlRequest xacmlRequest); @Override XacmlResponse evaluateRequest(XacmlRequest xacmlRequest);  }
@Test public void testDeployPoliciesListOfEvaluatable_NOT_APPLICABLE() throws AuditException { final LinkedList<Evaluatable> emptyPolicyList = new LinkedList<Evaluatable>(); final XacmlRequest xacmlRequest = new XacmlRequest(); final String decision = pdp.evaluateRequest(request, emptyPolicyList, xacmlRequest).getPdpDecision(); assertEquals("NOT_APPLICABLE", decision); }
@Test public void testDeployPoliciesListOfEvaluatable_PERMIT() throws AuditException, DocumentAccessorException { final XacmlRequest xacmlRequest = new XacmlRequest(); final NodeList nodeListMock = mock(NodeList.class); final Document documentMock = mock(Document.class); when(documentXmlConverterMock.loadDocument(anyString())).thenReturn( documentMock); when(documentAccessorMock.getNodeList(eq(documentMock), anyString())) .thenReturn(nodeListMock); final String decision = pdp.evaluateRequest(simplePDP, request, policies, xacmlRequest).getPdpDecision(); assertEquals("PERMIT", decision); }
@Test public void testEvaluateRequest() throws AuditException { final XacmlRequest xacmlRequest = new XacmlRequest(); pdp.deployPolicies(simplePDP, policies, xacmlRequest, false); assertEquals( "PERMIT", pdp.evaluateRequest(simplePDP, request, new LinkedList<Evaluatable>(), xacmlRequest) .getPdpDecision()); pdp.undeployPolicy(simplePDP, policy); pdp.deployPolicies(simplePDP, policies_invalid, xacmlRequest, false); assertEquals( "DENY", pdp.evaluateRequest(simplePDP, request, new LinkedList<Evaluatable>(), xacmlRequest) .getPdpDecision()); }
@Test public void testDeployPoliciesListOfEvaluatable_NOT_APPLICABLE() throws AuditException { LinkedList<Evaluatable> emptyPolicyList = new LinkedList<Evaluatable>(); XacmlRequest xacmlRequest = new XacmlRequest(); String decision = pdp.evaluateRequest(request, emptyPolicyList, xacmlRequest) .getPdpDecision(); assertEquals("NOT_APPLICABLE", decision); }
@Test public void testDeployPoliciesListOfEvaluatable_PERMIT() throws AuditException, DocumentAccessorException { XacmlRequest xacmlRequest = new XacmlRequest(); NodeList nodeListMock = mock(NodeList.class); Document documentMock = mock(Document.class); when(documentXmlConverterMock.loadDocument(anyString())).thenReturn(documentMock); when(documentAccessorMock.getNodeList(eq(documentMock), anyString())).thenReturn(nodeListMock); String decision = pdp.evaluateRequest(simplePDP, request, policies, xacmlRequest) .getPdpDecision(); assertEquals("PERMIT", decision); }
@Test public void testEvaluateRequest() throws AuditException { XacmlRequest xacmlRequest = new XacmlRequest(); pdp.deployPolicies(simplePDP, policies, xacmlRequest, false); assertEquals( "PERMIT", pdp.evaluateRequest(simplePDP, request, new LinkedList<Evaluatable>(), xacmlRequest).getPdpDecision()); pdp.undeployPolicy(simplePDP, policy); pdp.deployPolicies(simplePDP, policies_invalid, xacmlRequest, false); assertEquals( "DENY", pdp.evaluateRequest(simplePDP, request, new LinkedList<Evaluatable>(), xacmlRequest).getPdpDecision()); }