[java-metadata-aggregator COMMIT] in /trunk/aggregator-pipeline/src/test: java/net/shibboleth/metadata/dom/XSLValidat...
noreply at shibboleth.net
noreply at shibboleth.net
Sun Oct 13 16:01:17 EDT 2013
Author: iay
Date: Sun Oct 13 16:01:17 2013
New Revision: 273
URL: http://svn.shibboleth.net/view/java-metadata-aggregator?rev=273&view=rev
Log:
MDA-82: refactor unit test data by class
Added:
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/XSLValidationStage-input.xml (with props)
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/XSLValidationStage-mda45.xsl
- copied unchanged from r259, trunk/aggregator-pipeline/src/test/resources/data/mda45.xsl
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/XSLValidationStage-validator.xsl
- copied unchanged from r259, trunk/aggregator-pipeline/src/test/resources/data/xslValidator.xsl
Modified:
trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java
trunk/aggregator-pipeline/src/test/resources/data/mda45.xsl
trunk/aggregator-pipeline/src/test/resources/data/xslValidator.xsl
Modified: trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java?rev=273&r1=272&r2=273&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java (original)
+++ trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java Sun Oct 13 16:01:17 2013
@@ -30,10 +30,16 @@
import net.shibboleth.utilities.java.support.xml.XMLParserException;
import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
public class XSLValidationStageTest extends BaseDOMTest {
+
+ @BeforeClass
+ private void init() {
+ setTestingClass(XSLValidationStage.class);
+ }
/**
* Utility method to grab our standard input file and turn it into a {@link DOMElementItem}.
@@ -41,7 +47,7 @@
* @throws XMLParserException
*/
private DOMElementItem makeInput() throws XMLParserException {
- Element testInput = readXmlData("xsltStageInput.xml");
+ Element testInput = readXmlData("input.xml");
DOMElementItem metadata = new DOMElementItem(testInput);
// add a TestInfo so that we can check it is preserved by the stage.
Assert.assertEquals(metadata.getItemMetadata().get(TestInfo.class).size(), 0);
@@ -58,9 +64,10 @@
final List<DOMElementItem> mdCol = new ArrayList<>();
mdCol.add(makeInput());
- Resource transform = new ClasspathResource("data/xslValidator.xsl");
+ final Resource transform =
+ new ClasspathResource(classRelativeResource("validator.xsl").substring(1));
- XSLValidationStage stage = new XSLValidationStage();
+ final XSLValidationStage stage = new XSLValidationStage();
stage.setId("test");
stage.setXSLResource(transform);
stage.initialize();
@@ -69,10 +76,10 @@
// The input element should still be the only thing in the collection
Assert.assertEquals(mdCol.size(), 1);
- DOMElementItem result = mdCol.get(0);
+ final DOMElementItem result = mdCol.get(0);
// The XML should be unchanged
- Element expected = readXmlData("xsltStageInput.xml");
+ final Element expected = readXmlData("input.xml");
assertXmlIdentical(expected, result.unwrap());
// It should have been processed by the appropriate stage
@@ -106,9 +113,10 @@
final List<DOMElementItem> mdCol = new ArrayList<>();
mdCol.add(makeInput());
- Resource transform = new ClasspathResource("data/mda45.xsl");
+ final Resource transform =
+ new ClasspathResource(classRelativeResource("mda45.xsl").substring(1));
- XSLValidationStage stage = new XSLValidationStage();
+ final XSLValidationStage stage = new XSLValidationStage();
stage.setId("test");
stage.setXSLResource(transform);
stage.initialize();
@@ -117,7 +125,7 @@
// The input element should still be the only thing in the collection
Assert.assertEquals(mdCol.size(), 1);
- DOMElementItem result = mdCol.get(0);
+ final DOMElementItem result = mdCol.get(0);
// verify the presence of the InfoStatus on the output
List<InfoStatus> infos = result.getItemMetadata().get(InfoStatus.class);
More information about the commits
mailing list