Class XacmlXmlPdpTest


  • public abstract class XacmlXmlPdpTest
    extends Object
    PDP test class. There should be a folder for test data of each issue. Each test folder is expected to be in one of these two configurations:

    Configuration 1 for minimal/basic PDP configuration:

    • "policy.xml": root policy filename used by the PDP
    • "policies": (optional) directory containing files of XACML Policy(Set) that can be referred to from root policy "policy.xml" via Policy(Set)IdReference; required only if there is any Policy(Set)IdReference in "policy.xml" to resolve.
    • "request.xml": (optional) XACML request file sent to the PDP for evaluation. If not present, the test is considered as a static policy test, i.e. test for invalid policy detection, such as invalid syntax, circular reference, etc.
    • "response.xml": (optional) expected XACML response from the PDP, to be compared with the actual response. Required only if "request.xml" is present.

    Configuration 2 for advanced/custom PDP configuration:

    • "pdp.xml": PDP configuration file
    • "classpath:pdp-ext.xsd": (optional) PDP extensions schema location, required iff custom PDP extensions are required
    • "request.xml": (optional) XACML request file sent to the PDP for evaluation. If not present, the test is considered as a static policy test, i.e. test for invalid policy detection, such as invalid syntax, circular reference, etc.
    • "response.xml": (optional) expected XACML response from the PDP, to be compared with the actual response. Required only if "request.xml" is present.
    • "policies": (optional) directory containing files of XACML Policy(Set) that can be referred to from root policy "policy.xml" via Policy(Set)IdReference; required only if there is any Policy(Set)IdReference in "policy.xml" to resolve.
    • Policy files matching locations defined in "pdp.xml".

    • Field Detail

      • ROOT_POLICY_FILENAME

        public static final String ROOT_POLICY_FILENAME
        XACML policy filename used by default when no PDP configuration file found, i.e. no file named "pdp.xml" exists in the test directory
        See Also:
        Constant Field Values
      • POLICIES_DIR_NAME

        public static final String POLICIES_DIR_NAME
        Name of directory containing files of XACML Policy(Set) that can be referred to from root policy "policy.xml" via Policy(Set)IdReference
        See Also:
        Constant Field Values
      • EXPECTED_RESPONSE_FILENAME

        public static final String EXPECTED_RESPONSE_FILENAME
        Expected XACML response filename
        See Also:
        Constant Field Values
      • XML_CATALOG_LOCATION

        public static final String XML_CATALOG_LOCATION
        Spring-supported location to XML catalog (may be prefixed with classpath:, etc.)
        See Also:
        Constant Field Values
      • PDP_EXTENSION_XSD_LOCATION

        public static final String PDP_EXTENSION_XSD_LOCATION
        PDP extensions schema
        See Also:
        Constant Field Values
    • Constructor Detail

      • XacmlXmlPdpTest

        public XacmlXmlPdpTest​(Path testDirectoryPath,
                               boolean ignoreStatusMessageAndDetail)
        Parameters:
        testDirectoryPath - directory where test data are located
        ignoreStatusMessageAndDetail - ignore StatusMessage/StatusDetail in response comparison
    • Method Detail

      • params

        public static Collection<Object[]> params​(Path testResourcesRootDirectoryPath)
                                           throws IOException
        Initialize test parameters for each test. To be called by method with Parameters annotation in subclasses.
        Parameters:
        testResourcesRootDirectoryPath - File path (e.g. classpath:...) of root directory that contains test resources for each test
        Returns:
        collection of test dataset
        Throws:
        IOException - if testResourcesRootDirectoryPath is no valid file path