[java-metadata-aggregator] 01/02: MDA-218 - Test for DOMResourceSourceStage should not fetch from google.com

Ian Young ian at iay.org.uk
Wed Feb 27 11:49:07 EST 2019


This is an automated email from the git hooks/post-receive script.

iay pushed a commit to branch maint-0.9
in repository java-metadata-aggregator.

View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=aedd612cff411662d56f461eb1730d779bd5ab8f

commit aedd612cff411662d56f461eb1730d779bd5ab8f
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Wed Feb 27 16:40:16 2019 +0000

    MDA-218 - Test for DOMResourceSourceStage should not fetch from google.com
---
 .../java/net/shibboleth/metadata/dom/DOMResourceSourceTest.java    | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/DOMResourceSourceTest.java b/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/DOMResourceSourceTest.java
index 51c3969..b8686da 100644
--- a/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/DOMResourceSourceTest.java
+++ b/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/DOMResourceSourceTest.java
@@ -34,7 +34,6 @@ import org.w3c.dom.Element;
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.pipeline.StageProcessingException;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
 import net.shibboleth.utilities.java.support.xml.BasicParserPool;
 
 public class DOMResourceSourceTest {
@@ -61,8 +60,8 @@ public class DOMResourceSourceTest {
         Assert.assertEquals(metadataCollection.size(), 1);
     }
 
-    @Test public void testSuccessfulFetchAndFailedParse() throws Exception {
-        Resource mdResource = new UrlResource("http://www.google.com/intl/en/images/about_logo.gif");
+    @Test public void testFailedParse() throws Exception {
+        Resource mdResource = new ByteArrayResource("this is not valid XML".getBytes("UTF-8"));
 
         DOMResourceSourceStage source = new DOMResourceSourceStage();
         final String stageIdentifier = "testStage";
@@ -74,7 +73,7 @@ public class DOMResourceSourceTest {
         try {
             final ArrayList<Item<Element>> metadataCollection = new ArrayList<>();
             source.execute(metadataCollection);
-            throw new ConstraintViolationException("Invalid URL marked as parsed");
+            Assert.fail("Invalid resource reported as parsed");
         } catch (StageProcessingException e) {
             // expected this
             final String message = e.getMessage();

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list