[java-metadata-aggregator COMMIT] in /trunk/aggregator-pipeline/src/test: java/net/shibboleth/metadata/dom/saml/SetCa...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Nov 29 12:33:09 EST 2013
Author: iay
Date: Fri Nov 29 12:33:09 2013
New Revision: 305
URL: http://svn.shibboleth.net/view/java-metadata-aggregator?rev=305&view=rev
Log:
MDA-82: refactor unit test data by class
Added:
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/saml/SetCacheDurationStage-in.xml
- copied unchanged from r296, trunk/aggregator-pipeline/src/test/resources/data/samlMetadata.xml
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/saml/SetValidUntilStage-in.xml (with props)
Modified:
trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetCacheDurationStageTest.java
trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetValidUntilStageTest.java
trunk/aggregator-pipeline/src/test/resources/data/invalidSamlMetadata.xml
trunk/aggregator-pipeline/src/test/resources/data/samlMetadata.xml
Modified: trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetCacheDurationStageTest.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetCacheDurationStageTest.java?rev=305&r1=304&r2=305&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetCacheDurationStageTest.java (original)
+++ trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetCacheDurationStageTest.java Fri Nov 29 12:33:09 2013
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import net.shibboleth.metadata.Item;
+import net.shibboleth.metadata.dom.BaseDOMTest;
import net.shibboleth.metadata.dom.DOMElementItem;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.xml.AttributeSupport;
@@ -27,13 +28,19 @@
import net.shibboleth.utilities.java.support.xml.ElementSupport;
import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/** Unit test for {@link SetCacheDurationStage}. */
-public class SetCacheDurationStageTest {
+public class SetCacheDurationStageTest extends BaseDOMTest {
+
+ @BeforeClass
+ private void init() {
+ setTestingClass(SetCacheDurationStage.class);
+ }
/**
* Tests that the duration is properly set on an element when it doesn't already contain a duration.
@@ -42,10 +49,7 @@
*/
@Test
public void testWithoutExistingCacheDuration() throws Exception {
- BasicParserPool parserPool = new BasicParserPool();
- parserPool.initialize();
- Element entitiesDescriptor = parserPool.parse(
- SetCacheDurationStageTest.class.getResourceAsStream("/data/samlMetadata.xml")).getDocumentElement();
+ final Element entitiesDescriptor = readXmlData("in.xml");
Assert.assertTrue(AttributeSupport.getAttribute(entitiesDescriptor, SAMLMetadataSupport.CACHE_DURATION_ATTRIB_NAME) == null);
@@ -73,10 +77,8 @@
*/
@Test
public void testWithExistingCacheDuration() throws Exception {
- BasicParserPool parserPool = new BasicParserPool();
- parserPool.initialize();
- Element entitiesDescriptor = parserPool.parse(
- SetCacheDurationStageTest.class.getResourceAsStream("/data/samlMetadata.xml")).getDocumentElement();
+ final Element entitiesDescriptor = readXmlData("in.xml");
+
AttributeSupport.appendDurationAttribute(entitiesDescriptor, SAMLMetadataSupport.CACHE_DURATION_ATTRIB_NAME, 987654);
Assert.assertTrue(AttributeSupport.getAttribute(entitiesDescriptor, SAMLMetadataSupport.CACHE_DURATION_ATTRIB_NAME) != null);
Modified: trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetValidUntilStageTest.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetValidUntilStageTest.java?rev=305&r1=304&r2=305&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetValidUntilStageTest.java (original)
+++ trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/saml/SetValidUntilStageTest.java Fri Nov 29 12:33:09 2013
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import net.shibboleth.metadata.Item;
+import net.shibboleth.metadata.dom.BaseDOMTest;
import net.shibboleth.metadata.dom.DOMElementItem;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.xml.AttributeSupport;
@@ -27,13 +28,19 @@
import net.shibboleth.utilities.java.support.xml.ElementSupport;
import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
[... 37 lines stripped ...]
More information about the commits
mailing list