Author: julien(a)jboss.com
Date: 2007-03-26 15:48:25 -0400 (Mon, 26 Mar 2007)
New Revision: 6834
Added:
trunk/common/src/main/org/jboss/portal/common/jar/
trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java
trunk/common/src/main/org/jboss/portal/common/jar/JarInfo.java
Removed:
trunk/common/src/main/org/jboss/portal/common/util/Jar.java
Modified:
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/common/net/URLNavigationProvider.java
trunk/common/src/main/org/jboss/portal/common/net/URLNavigator.java
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java
trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java
trunk/common/src/main/org/jboss/portal/test/common/JarTestCase.java
trunk/common/src/main/org/jboss/portal/test/common/URLNavigatorTestCase.java
Log:
JBPORTAL-746 : Enhance URLVisitor interface
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-03-26 17:01:46 UTC (rev 6833)
+++ trunk/common/build.xml 2007-03-26 19:48:25 UTC (rev 6834)
@@ -210,6 +210,7 @@
</x-sysproperty>
<x-test>
+<!--
<test todir="${test.reports}"
name="org.jboss.portal.test.common.BundleNameIteratorTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.BundleNameParserTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.ComplexResourceBundleFactoryTestCase"/>
@@ -229,8 +230,10 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.common.TemporaryHashTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.HexTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.StringTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.common.JarTestCase"/>
+-->
+ <!--<test todir="${test.reports}"
name="org.jboss.portal.test.common.JarTestCase"/>-->
<test todir="${test.reports}"
name="org.jboss.portal.test.common.URLNavigatorTestCase"/>
+<!--
<test todir="${test.reports}"
name="org.jboss.portal.test.common.PathTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.JavaBeanModelMBeanBuilderTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.ParameterMapTestCase"/>
@@ -243,6 +246,7 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.common.ToolsTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.ModifierTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.IteratorStatusTestCase"/>
+-->
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Added: trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java 2007-03-26
19:48:25 UTC (rev 6834)
@@ -0,0 +1,230 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.jar;
+
+import java.util.jar.JarEntry;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * Enhance jar entry object by adding more info.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JarEntryInfo implements Comparable
+{
+
+ /** The real jar entry. */
+ private final JarEntry entry;
+
+ /** . */
+ private final List names;
+
+ public JarEntryInfo(JarEntry entry)
+ {
+ if (entry == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ String entryName = entry.getName();
+ ArrayList atoms = new ArrayList();
+ int previous = -1;
+ while (true)
+ {
+ int current = entryName.indexOf('/', previous + 1);
+ if (current == -1)
+ {
+ current = entryName.length();
+ }
+ if (current >= entryName.length() - 1)
+ {
+ if (current - previous > 1)
+ {
+ atoms.add(entryName.substring(previous + 1, current));
+ }
+ break;
+ }
+ if (current - previous > 1)
+ {
+ atoms.add(entryName.substring(previous + 1, current));
+ }
+ previous = current;
+ }
+
+ //
+ this.entry = entry;
+ this.names = Collections.unmodifiableList(atoms);
+ }
+
+ public JarEntry getEntry()
+ {
+ return entry;
+ }
+
+ public boolean isDirectory()
+ {
+ return entry.isDirectory();
+ }
+
+ public int size()
+ {
+ return names.size();
+ }
+
+ public List getNames()
+ {
+ return names;
+ }
+
+ public String getName(int index)
+ {
+ return (String)names.get(index);
+ }
+
+ public boolean isChildOf(JarEntryInfo parent) throws IllegalArgumentException
+ {
+ if (parent == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!parent.isDirectory())
+ {
+ return false;
+ }
+ if (parent.size() + 1 != names.size())
+ {
+ return false;
+ }
+ return parent.names.equals(parent.names.subList(0, names.size() - 1));
+ }
+
+ public boolean isDescendantOf(JarEntryInfo ancestor) throws IllegalArgumentException
+ {
+ if (ancestor == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!ancestor.isDirectory())
+ {
+ return false;
+ }
+ if (ancestor.names.size() >= names.size())
+ {
+ return false;
+ }
+ return ancestor.names.equals(names.subList(0, ancestor.size()));
+ }
+
+ public URL toURL(URL jarURL) throws IllegalArgumentException, IllegalStateException,
MalformedURLException
+ {
+ if (jarURL == null)
+ {
+ throw new IllegalArgumentException("No null jarURL");
+ }
+ if (isDirectory())
+ {
+ throw new IllegalStateException("Cannot create dir URL");
+ }
+ StringBuffer tmp = new StringBuffer(jarURL.toString()).append("!/");
+ for (int i = 0; i < names.size(); i++)
+ {
+ String atom = (String)names.get(i);
+ tmp.append(i > 0 ? "/" : "").append(atom);
+ }
+ return new URL("jar", "", tmp.toString());
+ }
+
+ public String toString()
+ {
+ StringBuffer tmp = new StringBuffer();
+ for (int i = 0; i < names.size(); i++)
+ {
+ String atom = (String)names.get(i);
+ tmp.append(i > 0 ? "/" : "").append(atom);
+ }
+ if (entry.isDirectory())
+ {
+ tmp.append("/");
+ }
+ return tmp.toString();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof JarEntryInfo)
+ {
+ return compareTo(obj) == 0;
+ }
+ return false;
+ }
+
+ public int compareTo(Object obj)
+ {
+ JarEntryInfo that = (JarEntryInfo)obj;
+ Iterator i1 = this.getNames().iterator();
+ Iterator i2 = that.getNames().iterator();
+ while (true)
+ {
+ if (i1.hasNext())
+ {
+ Object o = i1.next();
+ String s1 = (String)o;
+ if (i2.hasNext())
+ {
+ String s2 = (String)i2.next();
+ int res = s1.compareTo(s2);
+ if (res != 0)
+ {
+ return res;
+ }
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ if (i2.hasNext())
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/common/jar/JarInfo.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/jar/JarInfo.java
(rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/jar/JarInfo.java 2007-03-26 19:48:25 UTC
(rev 6834)
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.jar;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarEntry;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class JarInfo
+{
+
+ /** . */
+ private SortedSet entries;
+
+ public JarInfo(JarFile file)
+ {
+ if (file == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ entries = new TreeSet();
+ for (Enumeration e = file.entries();e.hasMoreElements();)
+ {
+ JarEntry entry = (JarEntry)e.nextElement();
+ JarEntryInfo info = new JarEntryInfo(entry);
+ entries.add(info);
+ }
+ }
+
+ public JarInfo(JarInputStream in) throws IOException
+ {
+ if (in == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ entries = new TreeSet();
+ for (JarEntry entry = in.getNextJarEntry();entry !=null;entry =
in.getNextJarEntry())
+ {
+ JarEntryInfo info = new JarEntryInfo(entry);
+ entries.add(info);
+ }
+ }
+
+ public Iterator entries()
+ {
+ return entries.iterator();
+ }
+}
Modified: trunk/common/src/main/org/jboss/portal/common/net/URLNavigationProvider.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/net/URLNavigationProvider.java 2007-03-26
17:01:46 UTC (rev 6833)
+++
trunk/common/src/main/org/jboss/portal/common/net/URLNavigationProvider.java 2007-03-26
19:48:25 UTC (rev 6834)
@@ -38,8 +38,9 @@
*
* @param url the target url
* @param visitor the visitor
+ * @param filter the filter
* @throws IllegalArgumentException if an argument is null or if the url is not
accepted
* @throws IOException
s */
- void visit(URL url, URLVisitor visitor) throws IllegalArgumentException, IOException;
+ void visit(URL url, URLVisitor visitor, URLFilter filter) throws
IllegalArgumentException, IOException;
}
Modified: trunk/common/src/main/org/jboss/portal/common/net/URLNavigator.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/net/URLNavigator.java 2007-03-26
17:01:46 UTC (rev 6833)
+++ trunk/common/src/main/org/jboss/portal/common/net/URLNavigator.java 2007-03-26
19:48:25 UTC (rev 6834)
@@ -41,10 +41,10 @@
private static final URLNavigationProvider jarNav = new JarURLNavigationProvider();
- public static void visit(URL url, URLVisitor visitor) throws IllegalArgumentException,
IOException
+ public static void visit(URL url, URLVisitor visitor, URLFilter filter) throws
IllegalArgumentException, IOException
{
URLNavigationProvider provider = getProvider(url);
- provider.visit(url, visitor);
+ provider.visit(url, visitor, filter);
}
/**
Modified:
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java 2007-03-26
17:01:46 UTC (rev 6833)
+++
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java 2007-03-26
19:48:25 UTC (rev 6834)
@@ -24,6 +24,7 @@
import org.jboss.portal.common.net.URLNavigationProvider;
import org.jboss.portal.common.net.URLVisitor;
+import org.jboss.portal.common.net.URLFilter;
import org.apache.log4j.Logger;
import java.util.Arrays;
@@ -44,13 +45,13 @@
/** Trace. */
private boolean trace = log.isDebugEnabled();
- public void visit(URL url, URLVisitor visitor) throws IllegalArgumentException,
IOException
+ public void visit(URL url, URLVisitor visitor, URLFilter filter) throws
IllegalArgumentException, IOException
{
File file = new File(url.getFile()).getCanonicalFile();
- visit(file, visitor);
+ visit(file, visitor, filter);
}
- private void visit(File file, URLVisitor visitor) throws IllegalArgumentException,
IOException
+ private void visit(File file, URLVisitor visitor, URLFilter filter) throws
IllegalArgumentException, IOException
{
String name = file.getName();
if (file.isDirectory())
@@ -59,19 +60,24 @@
{
log.debug("entering directory" + file.getAbsolutePath());
}
- visitor.startDir(file.toURL(), name);
- File[] childrenFiles = file.listFiles();
- Arrays.sort(childrenFiles);
- for (int i = 0; i < childrenFiles.length; i++)
+ URL url = file.toURL();
+ boolean visit = filter == null || filter.acceptDir(url);
+ if (visit)
{
- File childFile = childrenFiles[i];
- visit(childFile, visitor);
+ visitor.startDir(url, name);
+ File[] childrenFiles = file.listFiles();
+ Arrays.sort(childrenFiles);
+ for (int i = 0; i < childrenFiles.length; i++)
+ {
+ File childFile = childrenFiles[i];
+ visit(childFile, visitor, filter);
+ }
+ visitor.endDir(file.toURL(), name);
+ if (trace)
+ {
+ log.debug("leaving directory" + file.getAbsolutePath());
+ }
}
- visitor.endDir(file.toURL(), name);
- if (trace)
- {
- log.debug("leaving directory" + file.getAbsolutePath());
- }
}
else
{
Modified:
trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java 2007-03-26
17:01:46 UTC (rev 6833)
+++
trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java 2007-03-26
19:48:25 UTC (rev 6834)
@@ -24,14 +24,15 @@
import org.jboss.portal.common.net.URLNavigationProvider;
import org.jboss.portal.common.net.URLVisitor;
-import org.jboss.portal.common.util.Jar;
+import org.jboss.portal.common.net.URLFilter;
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.jar.JarEntryInfo;
+import org.jboss.portal.common.jar.JarInfo;
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -45,7 +46,7 @@
public class JarURLNavigationProvider implements URLNavigationProvider
{
- public void visit(URL url, URLVisitor visitor) throws IllegalArgumentException,
IOException
+ public void visit(URL url, URLVisitor visitor, URLFilter filter) throws
IllegalArgumentException, IOException
{
if (url == null)
{
@@ -56,160 +57,198 @@
throw new IllegalArgumentException("Only jar URL are accepted, not " +
url.getProtocol());
}
JarURLConnection conn = (JarURLConnection)url.openConnection();
- visit(conn, visitor);
+ visit(conn, visitor, filter);
}
- private void visit(JarURLConnection conn, URLVisitor visitor) throws IOException
+ private void visit(JarURLConnection conn, URLVisitor visitor, URLFilter filter) throws
IOException
{
JarFile jarFile = conn.getJarFile();
URL jarURL = conn.getJarFileURL();
JarEntry rootEntry = conn.getJarEntry();
+ //
if (rootEntry == null)
{
- throw new UnsupportedOperationException("The code for exact jar url has not
been implemented");
+ throw new NotYetImplemented("The code for exact jar url has not been
implemented");
}
// Get the root entry
- Jar.EntryInfo root = new Jar.EntryInfo(rootEntry);
+ JarEntryInfo rootEntryInfo = new JarEntryInfo(rootEntry);
// The entries we will browse
- List entries = new ArrayList();
+ JarInfo jarInfo = new JarInfo(jarFile);
- // Add the root first
- entries.add(root);
+ boolean enabled = true;
- // Add all the other entries under the root to the list
- for (Iterator i = Jar.iterator(jarFile); i.hasNext();)
- {
- Jar.EntryInfo current = (Jar.EntryInfo)i.next();
- if (current.isDescendantOf(root))
- {
- entries.add(current);
- }
- }
-
- // Sort the list of entries
- Collections.sort(entries, Jar.EntryInfo.COMPARATOR);
-
//
- Stack stack = new Stack(jarURL, root);
- for (Iterator i = entries.iterator(); i.hasNext();)
+ Stack stack = new Stack(jarURL, rootEntryInfo);
+ for (Iterator i = jarInfo.entries(); i.hasNext();)
{
- Jar.EntryInfo info = (Jar.EntryInfo)i.next();
+ JarEntryInfo entryInfo = (JarEntryInfo)i.next();
- // The relative path from the root
- List relPath = info.getAtoms().subList(root.size() - 1, info.size());
+ // Only consider descendant of the root or root itself
+ if (entryInfo.equals(rootEntryInfo) || entryInfo.isDescendantOf(rootEntryInfo))
+ {
+ // The relative path from the root
+ List relPath = entryInfo.getNames().subList(rootEntryInfo.size() - 1,
entryInfo.size());
- //
- if (stack.size() < relPath.size() - 1)
- {
- while (stack.size() < relPath.size() - 1)
+ // Enter intermediate dirs
+ while (stack.size() < relPath.size() - 1 && enabled)
{
- String atom = (String)relPath.get(stack.size());
- stack.push(atom);
+ String name = (String)relPath.get(stack.size());
+ stack.push(name, true);
+ URL url = stack.getURL();
+ boolean visit = filter == null || filter.acceptDir(url);
+ if (visit)
+ {
+ visitor.startDir(url, name);
+ }
+ else
+ {
+ enabled = false;
+ }
+ }
- visitor.startDir(stack.getURL(true), atom);
- }
- }
- else if (stack.size() > relPath.size() - 1)
- {
+ // Leave intermediate dirs
while (stack.size() > relPath.size() - 1)
{
- URL url = stack.getURL(true);
- String atom = stack.pop();
- visitor.endDir(url, atom);
+ URL url = stack.getURL();
+ Stack.Entry entry = stack.pop();
+ if (enabled)
+ {
+ String name = entry.name;
+ visitor.endDir(url, name);
+ }
+ enabled = true;
}
- }
- //
- if (info.isDirectory())
- {
- String atom = (String)relPath.get(relPath.size() - 1);
- stack.push(atom);
- visitor.startDir(stack.getURL(true), atom);
+ //
+ if (enabled)
+ {
+ if (entryInfo.isDirectory())
+ {
+ String name = (String)relPath.get(relPath.size() - 1);
+ stack.push(name, true);
+ URL url = stack.getURL();
+ boolean visit = filter == null || filter.acceptDir(url);
+ if (visit)
+ {
+ visitor.startDir(url, name);
+ }
+ else
+ {
+ enabled = false;
+ }
+ }
+ else
+ {
+ String name = (String)relPath.get(relPath.size() - 1);
+ stack.push(name, false);
+ URL url = stack.getURL();
+ visitor.file(url, name);
+ stack.pop();
+ }
+ }
}
- else
- {
- String atom = (String)relPath.get(relPath.size() - 1);
- stack.push(atom);
- visitor.file(stack.getURL(false), atom);
- stack.pop();
- }
}
+ //
while (stack.size() > 0)
{
- URL url = stack.getURL(true);
- String atom = stack.pop();
- visitor.endDir(url, atom);
+ URL url = stack.getURL();
+ Stack.Entry entry = stack.pop();
+ if (enabled)
+ {
+ String name = entry.name;
+ visitor.endDir(url, name);
+ }
+ enabled = true;
}
}
private static class Stack
{
+
// The jar URL
final URL jarURL;
// The root entry
- final Jar.EntryInfo root;
+ final JarEntryInfo root;
- // The list of atoms relative to the root entry
- final LinkedList atoms;
+ // The list of names relative to the root entry
+ final LinkedList entries;
- public Stack(URL jarURL, Jar.EntryInfo root)
+ //
+ boolean enabled;
+
+ public Stack(URL jarURL, JarEntryInfo root)
{
this.jarURL = jarURL;
this.root = root;
- this.atoms = new LinkedList();
+ this.entries = new LinkedList();
}
int size()
{
- return atoms.size();
+ return entries.size();
}
- void push(String atom)
+ void push(String name, boolean dir)
{
- atoms.addLast(atom);
+ entries.addLast(new Entry(name, dir));
}
- String pop()
+ Entry pop()
{
- return (String)atoms.removeLast();
+ return (Entry)entries.removeLast();
}
- URL getURL(boolean dir) throws MalformedURLException
+ Entry peek()
{
+ return (Entry)entries.getLast();
+ }
+
+ /**
+ * Generate the full URL for the current entry.
+ *
+ * @return
+ * @throws MalformedURLException
+ */
+ URL getURL() throws MalformedURLException
+ {
StringBuffer tmp = new StringBuffer(jarURL.toString()).append("!");
for (int i = 0; i < root.size() - 1; i++)
{
- String atom = root.get(i);
- tmp.append("/").append(atom);
+ String name = root.getName(i);
+ tmp.append("/").append(name);
}
- for (int i = 0; i < atoms.size(); i++)
+ for (int i = 0; i < entries.size(); i++)
{
- String atom = (String)atoms.get(i);
- tmp.append("/").append(atom);
+ Entry entry = (Entry)entries.get(i);
+ String name = entry.name;
+ tmp.append("/").append(name);
}
- if (dir)
+ Entry entry = peek();
+ if (entry.dir)
{
tmp.append('/');
}
return new URL("jar", "", tmp.toString());
}
- }
- private static class Node
- {
- final String name;
- final ArrayList children;
+ static class Entry
+ {
+ /** The entry name. */
+ final String name;
- public Node(String name)
- {
- this.name = name;
- this.children = new ArrayList();
+ /** Whether the name represents a dir or not. */
+ final boolean dir;
+
+ public Entry(String name, boolean dir)
+ {
+ this.name = name;
+ this.dir = dir;
+ }
}
}
-
}
Deleted: trunk/common/src/main/org/jboss/portal/common/util/Jar.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/Jar.java 2007-03-26 17:01:46 UTC
(rev 6833)
+++ trunk/common/src/main/org/jboss/portal/common/util/Jar.java 2007-03-26 19:48:25 UTC
(rev 6834)
@@ -1,267 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.common.util;
-
-import java.util.Iterator;
-import java.util.Comparator;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.jar.JarInputStream;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.io.IOException;
-import java.net.URL;
-import java.net.MalformedURLException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class Jar
-{
-
- public static Iterator iterator(JarFile file) throws IOException,
IllegalArgumentException
- {
- if (file == null)
- {
- throw new IllegalArgumentException();
- }
- SortedSet set = new TreeSet(EntryInfo.COMPARATOR);
- for (Enumeration e = file.entries();e.hasMoreElements();)
- {
- JarEntry entry = (JarEntry)e.nextElement();
- EntryInfo info = new EntryInfo(entry);
- set.add(info);
- }
- return set.iterator();
- }
-
- public static Iterator iterator(JarInputStream in) throws IOException,
IllegalArgumentException
- {
- if (in == null)
- {
- throw new IllegalArgumentException();
- }
- SortedSet set = new TreeSet(EntryInfo.COMPARATOR);
- for (JarEntry entry = in.getNextJarEntry();entry !=null;entry =
in.getNextJarEntry())
- {
- Jar.EntryInfo info = new EntryInfo(entry);
- set.add(info);
- }
- return set.iterator();
- }
-
- /**
- * Enhance jar entry object by adding more info.
- */
- public static class EntryInfo
- {
-
- private final JarEntry entry;
- private final List atoms;
- /**
- * Compares jar entries.
- */
- public static final Comparator COMPARATOR = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- EntryInfo e1 = (EntryInfo)o1;
- EntryInfo e2 = (EntryInfo)o2;
- Iterator i1 = e1.iterator();
- Iterator i2 = e2.iterator();
- while (true)
- {
- if (i1.hasNext())
- {
- Object o = i1.next();
- String s1 = (String)o;
- if (i2.hasNext())
- {
- String s2 = (String)i2.next();
- int res = s1.compareTo(s2);
- if (res != 0)
- {
- return res;
- }
- }
- else
- {
- return 1;
- }
- }
- else
- {
- if (i2.hasNext())
- {
- return -1;
- }
- else
- {
- return 0;
- }
- }
- }
- }
- };
-
- public EntryInfo(JarEntry entry)
- {
- if (entry == null)
- {
- throw new IllegalArgumentException();
- }
- this.entry = entry;
- String name = entry.getName();
- ArrayList atoms = new ArrayList();
- int previous = -1;
- while (true)
- {
- int current = name.indexOf('/', previous + 1);
- if (current == -1)
- {
- current = name.length();
- }
- if (current >= name.length() - 1)
- {
- if (current - previous > 1)
- {
- atoms.add(name.substring(previous + 1, current));
- }
- break;
- }
- if (current - previous > 1)
- {
- atoms.add(name.substring(previous + 1, current));
- }
- previous = current;
- }
- this.atoms = Collections.unmodifiableList(atoms);
- }
-
- public Iterator iterator()
- {
- return atoms.iterator();
- }
-
- public JarEntry getEntry()
- {
- return entry;
- }
-
- public boolean isDirectory()
- {
- return entry.isDirectory();
- }
-
- public int size()
- {
- return atoms.size();
- }
-
- public List getAtoms()
- {
- return atoms;
- }
-
- public String get(int index)
- {
- return (String)atoms.get(index);
- }
-
- public boolean isChildOf(EntryInfo parent) throws IllegalArgumentException
- {
- if (parent == null)
- {
- throw new IllegalArgumentException();
- }
- if (!parent.isDirectory())
- {
- return false;
- }
- if (parent.size() + 1 != atoms.size())
- {
- return false;
- }
- return parent.atoms.equals(parent.atoms.subList(0, atoms.size() - 1));
- }
-
- public boolean isDescendantOf(EntryInfo ancestor) throws IllegalArgumentException
- {
- if (ancestor == null)
- {
- throw new IllegalArgumentException();
- }
- if (!ancestor.isDirectory())
- {
- return false;
- }
- if (ancestor.atoms.size() >= atoms.size())
- {
- return false;
- }
- return ancestor.atoms.equals(atoms.subList(0, ancestor.size()));
- }
-
- public URL toURL(URL jarURL) throws IllegalArgumentException,
IllegalStateException, MalformedURLException
- {
- if (jarURL == null)
- {
- throw new IllegalArgumentException("No null jarURL");
- }
- if (isDirectory())
- {
- throw new IllegalStateException("Cannot create dir URL");
- }
- StringBuffer tmp = new StringBuffer(jarURL.toString()).append("!/");
- for (int i = 0; i < atoms.size(); i++)
- {
- String atom = (String)atoms.get(i);
- tmp.append(i > 0 ? "/" : "").append(atom);
- }
- return new URL("jar", "", tmp.toString());
- }
-
- public String toString()
- {
- StringBuffer tmp = new StringBuffer();
- for (int i = 0; i < atoms.size(); i++)
- {
- String atom = (String)atoms.get(i);
- tmp.append(i > 0 ? "/" : "").append(atom);
- }
- if (entry.isDirectory())
- {
- tmp.append("/");
- }
- return tmp.toString();
- }
- }
-
-
-
-}
Modified: trunk/common/src/main/org/jboss/portal/test/common/JarTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/JarTestCase.java 2007-03-26
17:01:46 UTC (rev 6833)
+++ trunk/common/src/main/org/jboss/portal/test/common/JarTestCase.java 2007-03-26
19:48:25 UTC (rev 6834)
@@ -34,11 +34,10 @@
import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.io.OutputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedInputStream;
-import org.jboss.portal.common.util.Jar;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.jar.JarEntryInfo;
+import org.jboss.portal.common.jar.JarInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -54,32 +53,32 @@
public void testJarEntryInfo()
{
- Jar.EntryInfo info1 = new Jar.EntryInfo(new JarEntry("a"));
- assertEquals(Arrays.asList(new String[]{"a"}), info1.getAtoms());
+ JarEntryInfo info1 = new JarEntryInfo(new JarEntry("a"));
+ assertEquals(Arrays.asList(new String[]{"a"}), info1.getNames());
- Jar.EntryInfo info2 = new Jar.EntryInfo(new JarEntry("a/"));
- assertEquals(Arrays.asList(new String[]{"a"}), info2.getAtoms());
+ JarEntryInfo info2 = new JarEntryInfo(new JarEntry("a/"));
+ assertEquals(Arrays.asList(new String[]{"a"}), info2.getNames());
- Jar.EntryInfo info3 = new Jar.EntryInfo(new JarEntry("/"));
- assertEquals(Arrays.asList(new String[]{}), info3.getAtoms());
+ JarEntryInfo info3 = new JarEntryInfo(new JarEntry("/"));
+ assertEquals(Arrays.asList(new String[]{}), info3.getNames());
- Jar.EntryInfo info4 = new Jar.EntryInfo(new JarEntry("a/b"));
- assertEquals(Arrays.asList(new String[]{"a","b"}),
info4.getAtoms());
+ JarEntryInfo info4 = new JarEntryInfo(new JarEntry("a/b"));
+ assertEquals(Arrays.asList(new String[]{"a","b"}),
info4.getNames());
- Jar.EntryInfo info5 = new Jar.EntryInfo(new JarEntry("a/b/"));
- assertEquals(Arrays.asList(new String[]{"a","b"}),
info5.getAtoms());
+ JarEntryInfo info5 = new JarEntryInfo(new JarEntry("a/b/"));
+ assertEquals(Arrays.asList(new String[]{"a","b"}),
info5.getNames());
- Jar.EntryInfo info6 = new Jar.EntryInfo(new JarEntry("/a"));
- assertEquals(Arrays.asList(new String[]{"a"}), info6.getAtoms());
+ JarEntryInfo info6 = new JarEntryInfo(new JarEntry("/a"));
+ assertEquals(Arrays.asList(new String[]{"a"}), info6.getNames());
- Jar.EntryInfo info7 = new Jar.EntryInfo(new JarEntry("/a/"));
- assertEquals(Arrays.asList(new String[]{"a"}), info7.getAtoms());
+ JarEntryInfo info7 = new JarEntryInfo(new JarEntry("/a/"));
+ assertEquals(Arrays.asList(new String[]{"a"}), info7.getNames());
- Jar.EntryInfo info8 = new Jar.EntryInfo(new JarEntry("/a/b"));
- assertEquals(Arrays.asList(new String[]{"a","b"}),
info8.getAtoms());
+ JarEntryInfo info8 = new JarEntryInfo(new JarEntry("/a/b"));
+ assertEquals(Arrays.asList(new String[]{"a","b"}),
info8.getNames());
- Jar.EntryInfo info9 = new Jar.EntryInfo(new JarEntry("/a/b/"));
- assertEquals(Arrays.asList(new String[]{"a","b"}),
info9.getAtoms());
+ JarEntryInfo info9 = new JarEntryInfo(new JarEntry("/a/b/"));
+ assertEquals(Arrays.asList(new String[]{"a","b"}),
info9.getNames());
}
public void testEntryComparator() throws IOException
@@ -103,7 +102,7 @@
jarFile.deleteOnExit();
JarInputStream jarIn = new JarInputStream(Tools.safeBufferedWrapper(new
FileInputStream(jarFile)));
- Iterator i = Jar.iterator(jarIn);
+ Iterator i = new JarInfo(jarIn).entries();
while (i.hasNext())
{
Object o = i.next();
@@ -114,14 +113,14 @@
public void testIsChildOf()
{
- assertFalse(new Jar.EntryInfo(new JarEntry("a")).isChildOf(new
Jar.EntryInfo(new JarEntry(""))));
- assertFalse(new Jar.EntryInfo(new JarEntry("/a")).isChildOf(new
Jar.EntryInfo(new JarEntry(""))));
- assertTrue(new Jar.EntryInfo(new JarEntry("a")).isChildOf(new
Jar.EntryInfo(new JarEntry("/"))));
- assertTrue(new Jar.EntryInfo(new JarEntry("/a")).isChildOf(new
Jar.EntryInfo(new JarEntry("/"))));
- assertFalse(new Jar.EntryInfo(new JarEntry("a/b")).isChildOf(new
Jar.EntryInfo(new JarEntry("a"))));
- assertFalse(new Jar.EntryInfo(new JarEntry("/a/b")).isChildOf(new
Jar.EntryInfo(new JarEntry("a"))));
- assertTrue(new Jar.EntryInfo(new JarEntry("a/b")).isChildOf(new
Jar.EntryInfo(new JarEntry("a/"))));
- assertTrue(new Jar.EntryInfo(new JarEntry("/a/b")).isChildOf(new
Jar.EntryInfo(new JarEntry("a/"))));
+ assertFalse(new JarEntryInfo(new JarEntry("a")).isChildOf(new
JarEntryInfo(new JarEntry(""))));
+ assertFalse(new JarEntryInfo(new JarEntry("/a")).isChildOf(new
JarEntryInfo(new JarEntry(""))));
+ assertTrue(new JarEntryInfo(new JarEntry("a")).isChildOf(new
JarEntryInfo(new JarEntry("/"))));
+ assertTrue(new JarEntryInfo(new JarEntry("/a")).isChildOf(new
JarEntryInfo(new JarEntry("/"))));
+ assertFalse(new JarEntryInfo(new JarEntry("a/b")).isChildOf(new
JarEntryInfo(new JarEntry("a"))));
+ assertFalse(new JarEntryInfo(new JarEntry("/a/b")).isChildOf(new
JarEntryInfo(new JarEntry("a"))));
+ assertTrue(new JarEntryInfo(new JarEntry("a/b")).isChildOf(new
JarEntryInfo(new JarEntry("a/"))));
+ assertTrue(new JarEntryInfo(new JarEntry("/a/b")).isChildOf(new
JarEntryInfo(new JarEntry("a/"))));
}
}
Modified: trunk/common/src/main/org/jboss/portal/test/common/URLNavigatorTestCase.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/URLNavigatorTestCase.java 2007-03-26
17:01:46 UTC (rev 6833)
+++
trunk/common/src/main/org/jboss/portal/test/common/URLNavigatorTestCase.java 2007-03-26
19:48:25 UTC (rev 6834)
@@ -28,9 +28,11 @@
import java.net.URL;
import java.util.List;
import java.util.ArrayList;
+import java.util.Iterator;
import org.jboss.portal.common.net.URLVisitor;
import org.jboss.portal.common.net.URLNavigator;
+import org.jboss.portal.common.net.URLFilter;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -47,11 +49,27 @@
private List expectedAtoms1;
private List expectedAtoms2;
private List expectedAtoms3;
+ private List expectedAtoms4;
+ private List expectedAtoms5;
+ private List expectedAtoms6;
+ private List expectedAtoms7;
private List expectedURLs1;
private List expectedURLs2;
private List expectedURLs3;
+ private List expectedURLs4;
+ private List expectedURLs5;
+ private List expectedURLs6;
+ private List expectedURLs7;
+ private List filterValues1;
+ private List filterValues2;
+ private List filterValues3;
+ private List filterValues4;
+ private List filterValues5;
+ private List filterValues6;
+ private List filterValues7;
+
protected void setUp() throws Exception
{
expectedAtoms1 = new ArrayList();
@@ -61,8 +79,6 @@
expectedAtoms1.add("</c1>");
expectedAtoms1.add("c1.txt");
expectedAtoms1.add("</b1>");
-
- //
expectedURLs1 = new ArrayList();
expectedURLs1.add("/a1/b1/");
expectedURLs1.add("/a1/b1/c1/");
@@ -70,6 +86,9 @@
expectedURLs1.add("/a1/b1/c1/");
expectedURLs1.add("/a1/b1/c1.txt");
expectedURLs1.add("/a1/b1/");
+ filterValues1 = new ArrayList();
+ filterValues1.add(Boolean.TRUE);
+ filterValues1.add(Boolean.TRUE);
//
expectedAtoms2 = new ArrayList();
@@ -80,11 +99,11 @@
expectedAtoms2.add("</c1>");
expectedAtoms2.add("c1.txt");
expectedAtoms2.add("</b1>");
+ expectedAtoms2.add("<b1->");
+ expectedAtoms2.add("</b1->");
expectedAtoms2.add("b1.txt");
expectedAtoms2.add("b2.txt");
expectedAtoms2.add("</a1>");
-
- //
expectedURLs2 = new ArrayList();
expectedURLs2.add("/a1/");
expectedURLs2.add("/a1/b1/");
@@ -93,24 +112,93 @@
expectedURLs2.add("/a1/b1/c1/");
expectedURLs2.add("/a1/b1/c1.txt");
expectedURLs2.add("/a1/b1/");
+ expectedURLs2.add("/a1/b1-/");
+ expectedURLs2.add("/a1/b1-/");
expectedURLs2.add("/a1/b1.txt");
expectedURLs2.add("/a1/b2.txt");
expectedURLs2.add("/a1/");
+ filterValues2 = new ArrayList();
+ filterValues2.add(Boolean.TRUE);
+ filterValues2.add(Boolean.TRUE);
+ filterValues2.add(Boolean.TRUE);
+ filterValues2.add(Boolean.TRUE);
//
expectedAtoms3 = new ArrayList();
expectedAtoms3.add("d1.txt");
+ expectedURLs3 = new ArrayList();
+ expectedURLs3.add("/a1/b1/c1/d1.txt");
+ filterValues3 = new ArrayList();
//
- expectedURLs3 = new ArrayList();
- expectedURLs3.add("/a1/b1/c1/d1.txt");
+ expectedAtoms4 = new ArrayList();
+ expectedAtoms4.add("<b1>");
+ expectedAtoms4.add("c1.txt");
+ expectedAtoms4.add("</b1>");
+ expectedURLs4 = new ArrayList();
+ expectedURLs4.add("/a1/b1/");
+ expectedURLs4.add("/a1/b1/c1.txt");
+ expectedURLs4.add("/a1/b1/");
+ filterValues4 = new ArrayList();
+ filterValues4.add(Boolean.TRUE);
+ filterValues4.add(Boolean.FALSE);
+
+ //
+ expectedAtoms5 = new ArrayList();
+ expectedURLs5 = new ArrayList();
+ filterValues5 = new ArrayList();
+ filterValues5.add(Boolean.FALSE);
+
+ //
+ expectedAtoms6 = new ArrayList();
+ expectedAtoms6.add("<a1>");
+ expectedAtoms6.add("<b1>");
+ expectedAtoms6.add("c1.txt");
+ expectedAtoms6.add("</b1>");
+ expectedAtoms6.add("<b1->");
+ expectedAtoms6.add("</b1->");
+ expectedAtoms6.add("b1.txt");
+ expectedAtoms6.add("b2.txt");
+ expectedAtoms6.add("</a1>");
+ expectedURLs6 = new ArrayList();
+ expectedURLs6.add("/a1/");
+ expectedURLs6.add("/a1/b1/");
+ expectedURLs6.add("/a1/b1/c1.txt");
+ expectedURLs6.add("/a1/b1/");
+ expectedURLs6.add("/a1/b1-/");
+ expectedURLs6.add("/a1/b1-/");
+ expectedURLs6.add("/a1/b1.txt");
+ expectedURLs6.add("/a1/b2.txt");
+ expectedURLs6.add("/a1/");
+ filterValues6 = new ArrayList();
+ filterValues6.add(Boolean.TRUE);
+ filterValues6.add(Boolean.TRUE);
+ filterValues6.add(Boolean.FALSE);
+ filterValues6.add(Boolean.TRUE);
+
+ //
+ expectedAtoms7 = new ArrayList();
+ expectedAtoms7.add("<a1>");
+ expectedAtoms7.add("<b1->");
+ expectedAtoms7.add("</b1->");
+ expectedAtoms7.add("b1.txt");
+ expectedAtoms7.add("b2.txt");
+ expectedAtoms7.add("</a1>");
+ expectedURLs7 = new ArrayList();
+ expectedURLs7.add("/a1/");
+ expectedURLs7.add("/a1/b1-/");
+ expectedURLs7.add("/a1/b1-/");
+ expectedURLs7.add("/a1/b1.txt");
+ expectedURLs7.add("/a1/b2.txt");
+ expectedURLs7.add("/a1/");
+ filterValues7 = new ArrayList();
+ filterValues7.add(Boolean.TRUE);
+ filterValues7.add(Boolean.FALSE);
+ filterValues7.add(Boolean.TRUE);
}
protected void tearDown() throws Exception
{
- expectedAtoms1 = null;
- expectedAtoms2 = null;
- expectedAtoms3 = null;
}
public void testJar() throws Exception
@@ -127,15 +215,19 @@
//
URL jarURL1 = new URL("jar", "", jarFile.toURL() +
"!" + "/a1/b1/");
- doTestJar(expectedAtoms1, expectedURLs1, jarURL1);
+ doTest(jarURL1, expectedAtoms1, expectedURLs1, filterValues1.iterator());
+ doTest(jarURL1, expectedAtoms4, expectedURLs4, filterValues4.iterator());
+ doTest(jarURL1, expectedAtoms5, expectedURLs5, filterValues5.iterator());
//
URL jarURL2 = new URL("jar", "", jarFile.toURL() +
"!" + "/a1/");
- doTestJar(expectedAtoms2, expectedURLs2, jarURL2);
+ doTest(jarURL2, expectedAtoms2, expectedURLs2, filterValues2.iterator());
+ doTest(jarURL2, expectedAtoms6, expectedURLs6, filterValues6.iterator());
+ doTest(jarURL2, expectedAtoms7, expectedURLs7, filterValues7.iterator());
//
URL jarURL3 = new URL("jar", "", jarFile.toURL() +
"!" + "/a1/b1/c1/d1.txt");
- doTestJar(expectedAtoms3, expectedURLs3, jarURL3);
+ doTest(jarURL3, expectedAtoms3, expectedURLs3, filterValues3.iterator());
}
public void testFile() throws Exception
@@ -150,24 +242,28 @@
assertTrue(f1.exists());
assertTrue(f1.isDirectory());
URL dirURL1 = f1.toURL();
- doTestJar(expectedAtoms1, expectedURLs1, dirURL1);
+ doTest(dirURL1, expectedAtoms1, expectedURLs1, filterValues1.iterator());
+ doTest(dirURL1, expectedAtoms4, expectedURLs4, filterValues4.iterator());
+ doTest(dirURL1, expectedAtoms5, expectedURLs5, filterValues5.iterator());
//
File f2 = new File(resourcesDir, "test/test-jar/a1/");
assertTrue(f2.exists());
assertTrue(f2.isDirectory());
URL dirURL2 = f2.toURL();
- doTestJar(expectedAtoms2, expectedURLs2, dirURL2);
+ doTest(dirURL2, expectedAtoms2, expectedURLs2, filterValues2.iterator());
+ doTest(dirURL2, expectedAtoms6, expectedURLs6, filterValues6.iterator());
+ doTest(dirURL2, expectedAtoms7, expectedURLs7, filterValues7.iterator());
//
File f3 = new File(resourcesDir, "test/test-jar/a1/b1/c1/d1.txt");
assertTrue(f3.exists());
assertFalse(f3.isDirectory());
URL dirURL3 = f3.toURL();
- doTestJar(expectedAtoms3, expectedURLs3, dirURL3);
+ doTest(dirURL3, expectedAtoms3, expectedURLs3, filterValues3.iterator());
}
- private void doTestJar(List expectedAtoms, List expectedURLs, URL url) throws
Exception
+ private void doTest(URL url, List expectedAtoms, List expectedURLs, final Iterator
filterBehavior) throws Exception
{
final List atoms = new ArrayList();
final List urls = new ArrayList();
@@ -188,24 +284,39 @@
atoms.add(name);
urls.add(url);
}
+ }, new URLFilter()
+ {
+ public boolean acceptFile(URL url)
+ {
+ throw new UnsupportedOperationException();
+ }
+ public boolean acceptDir(URL url)
+ {
+ return Boolean.TRUE.equals(filterBehavior.next());
+ }
});
+ //
if (urls.size() != expectedURLs.size())
{
fail("URLs size does not match " + urls.size() + "!=" +
expectedURLs.size());
}
+ //
+ assertEquals(expectedAtoms, atoms);
+
+ //
for (int i = 0;i < urls.size();i++)
{
URL entryURL = (URL)urls.get(i);
String suffix = (String)expectedURLs.get(i);
if (!entryURL.getPath().endsWith(suffix))
{
- fail("URL " + entryURL + " does not end with the suffix "
+ suffix);
+ fail("URL " + entryURL + " does not end with the suffix "
+ suffix + " at index " + i);
}
}
//
- assertEquals(expectedAtoms, atoms);
+ assertFalse(filterBehavior.hasNext());
}
}