You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2015/12/08 19:09:21 UTC

svn commit: r1718660 - /manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/fuzzyml/TestFuzzyML.java

Author: kwright
Date: Tue Dec  8 18:09:21 2015
New Revision: 1718660

URL: http://svn.apache.org/viewvc?rev=1718660&view=rev
Log:
Add test for unquoted attribute with trailing slash

Modified:
    manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/fuzzyml/TestFuzzyML.java

Modified: manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/fuzzyml/TestFuzzyML.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/fuzzyml/TestFuzzyML.java?rev=1718660&r1=1718659&r2=1718660&view=diff
==============================================================================
--- manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/fuzzyml/TestFuzzyML.java [UTF-8] (original)
+++ manifoldcf/trunk/framework/connector-common/src/test/java/org/apache/manifoldcf/connectorcommon/fuzzyml/TestFuzzyML.java [UTF-8] Tue Dec  8 18:09:21 2015
@@ -181,6 +181,43 @@ public class TestFuzzyML
 ;
 
   @Test
+  public void testTags()
+    throws IOException, ManifoldCFException
+  {
+    org.apache.manifoldcf.core.system.Logging.misc = org.apache.log4j.Logger.getLogger("test");
+    InputStream is = new ByteArrayInputStream("<href a=/hello/out/there/>".getBytes(StandardCharsets.UTF_8));
+    Parser p = new Parser();
+    TestParseState x = new TestParseState();
+    p.parseWithCharsetDetection(null,is,x);
+    Assert.assertTrue(x.lastTagName != null);
+    Assert.assertTrue(x.lastTagName.equals("href"));
+    Assert.assertTrue(x.lastTagAttributes.size() == 1);
+    Assert.assertTrue(x.lastTagAttributes.get(0).getName().equals("a"));
+    Assert.assertTrue(x.lastTagAttributes.get(0).getValue().equals("/hello/out/there/"));
+  }
+  
+  protected static class TestParseState extends TagParseState
+  {
+    public String lastTagName = null;
+    public List<AttrNameValue> lastTagAttributes = null;
+    
+    public TestParseState()
+    {
+      super();
+    }
+    
+    @Override
+    protected boolean noteTag(String tagName, List<AttrNameValue> attributes)
+      throws ManifoldCFException
+    {
+      lastTagName = tagName;
+      lastTagAttributes = attributes;
+      return super.noteTag(tagName, attributes);
+    }
+
+  }
+
+  @Test
   public void testFailure()
     throws IOException, ManifoldCFException
   {