public abstract class BaseTest extends Object
| Modifier and Type | Field and Description |
|---|---|
private String |
baseClassPath
Base path for class-relative test resource references.
|
private String |
basePackagePath
Base path for package-relative test resource references.
|
private net.shibboleth.utilities.java.support.xml.BasicParserPool |
parserPool
Initialized parser pool used to parser data.
|
protected Class<?> |
testingClass
Class being tested.
|
private Package |
testingPackage
Package for the class being tested.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BaseTest(Class<?> clazz)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertXMLIdentical(Node expected,
Node actual)
Checks whether two nodes are identical based on
Diff.identical(). |
protected boolean |
canTestECC()
Is it worth testing Elliptic Curve signatures?
|
protected File |
classRelativeFile(String which)
Returns a test resource
File with a name related to the class under test. |
protected String |
classRelativeResource(String which)
Makes a resource reference relative to the class being tested.
|
net.shibboleth.utilities.java.support.xml.ParserPool |
getParserPool()
Gets an initialized parser pool.
|
protected File |
getSchemaDirectory()
Returns the local test directory containing a useful collection of schema files.
|
protected org.opensaml.security.x509.X509Credential |
getSigningCredential(String which)
Acquire a class-local signing credential consisting of a certificate and key.
|
protected org.opensaml.security.x509.X509Credential |
getSigningCredential(String which,
String algorithm,
Class<?> clazz)
Acquire a class-local signing credential consisting of a certificate and key.
|
private String |
nameToPath(String name)
Converts the "."-separated name of a class or package into an
absolute path.
|
protected File |
packageRelativeFile(String which)
Returns a test resource
File from the package directory. |
protected String |
packageRelativeResource(String which)
Makes a resource reference relative to the package of the class being tested.
|
Document |
readXMLDocument(String path)
Reads in an XML file, parses it, and returns the parsed document.
|
void |
setUp()
Setup test class.
|
protected String |
simpleClassRelativeName(String which) |
protected void |
zapSignatureValues(Document doc)
Set all SignatureValues elements to have the value "zap".
|
protected void |
zapSignatureValues(Element root,
String value)
Set all SignatureValue elements to have the given value.
|
protected final Class<?> testingClass
private final String baseClassPath
private final Package testingPackage
private final String basePackagePath
private net.shibboleth.utilities.java.support.xml.BasicParserPool parserPool
protected BaseTest(Class<?> clazz)
private String nameToPath(String name)
name - name to be convertedprotected String classRelativeResource(String which)
which - class-relative resource nameprotected File classRelativeFile(String which)
File with a name related to the class under test.which - class-local name of the fileFile, or nullprotected String packageRelativeResource(String which)
which - package-relative resource nameprotected File packageRelativeFile(String which)
File from the package directory.which - package-local name of the fileFile, or nullprotected File getSchemaDirectory()
public void setUp()
throws net.shibboleth.utilities.java.support.component.ComponentInitializationException,
org.opensaml.core.config.InitializationException
net.shibboleth.utilities.java.support.component.ComponentInitializationException - if there is a problem initializing the parser poolorg.opensaml.core.config.InitializationException - if OpenSAML initialization failspublic net.shibboleth.utilities.java.support.xml.ParserPool getParserPool()
public Document readXMLDocument(String path) throws net.shibboleth.utilities.java.support.xml.XMLParserException
path - classpath path to the data file, never nullDocument, never nullnet.shibboleth.utilities.java.support.xml.XMLParserException - thrown if the file does not exist or there is a problem parsing itpublic void assertXMLIdentical(Node expected, Node actual)
Diff.identical().expected - the expected node against which the actual node will be tested, never nullactual - the actual node tested against the expected node, never nullprotected void zapSignatureValues(@Nonnull Element root, @Nonnull String value)
root - root DOM Element below which values should be replacedvalue - new value to place into all SignatureValue elementsprotected void zapSignatureValues(@Nonnull Document doc)
doc - Document to operate onprotected boolean canTestECC()
true if we can test Elliptic Curve signaturesprotected org.opensaml.security.x509.X509Credential getSigningCredential(String which) throws KeyException, CertificateException
which - name of the credential to acquireKeyException - if the key cannot be acquiredCertificateException - if the certificate cannot be acquiredprotected org.opensaml.security.x509.X509Credential getSigningCredential(String which, String algorithm, Class<?> clazz) throws KeyException, CertificateException
which - name of the credential to acquirealgorithm - required public key algorithmclazz - required public key class or interfaceKeyException - if the key cannot be acquiredCertificateException - if the certificate cannot be acquiredCopyright © 2011–2016. All rights reserved.