Class XacmlXmlPdpTest
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.testutil.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 Summary
Fields Modifier and Type Field Description static String
EXPECTED_RESPONSE_FILENAME
Expected XACML response filenamestatic String
PDP_CONF_FILENAME
PDP Configuration file namestatic String
PDP_EXTENSION_XSD_LOCATION
PDP extensions schemastatic 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)IdReferencestatic String
REQUEST_FILENAME
XACML request filenamestatic String
ROOT_POLICY_FILENAME
XACML policy filename used by default when no PDP configuration file found, i.e.static String
XML_CATALOG_LOCATION
Spring-supported location to XML catalog (may be prefixed with classpath:, etc.)
-
Constructor Summary
Constructors Constructor Description XacmlXmlPdpTest(Path testDirectoryPath, boolean ignoreStatusMessageAndDetail)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Collection<Object[]>
params(Path testResourcesRootDirectoryPath)
Initialize test parameters for each test.void
test()
-
-
-
Field Detail
-
PDP_CONF_FILENAME
public static final String PDP_CONF_FILENAME
PDP Configuration file name- See Also:
- Constant Field Values
-
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
-
REQUEST_FILENAME
public static final String REQUEST_FILENAME
XACML request filename- 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 locatedignoreStatusMessageAndDetail
- 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
- iftestResourcesRootDirectoryPath
is no valid file path
-
test
public void test() throws IllegalArgumentException, IOException, javax.xml.bind.JAXBException
- Throws:
IllegalArgumentException
IOException
javax.xml.bind.JAXBException
-
-