You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/03/12 11:23:50 UTC
[1/21] git commit: WICKET-4439
Updated Branches:
refs/heads/master 38a500a45 -> 8f476c6bb
WICKET-4439
Count all packages but the explicitly blacklisted ones.
Add more debug info if there is a clash
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/8f476c6b
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/8f476c6b
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/8f476c6b
Branch: refs/heads/master
Commit: 8f476c6bb651ec0ae1ae29b4486b6f4f24e2b815
Parents: e82a1e8
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Mar 7 12:26:19 2012 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Mar 12 12:22:25 2012 +0200
----------------------------------------------------------------------
.../wicket/osgi/OsgiClashingPackagesTest.java | 39 +++++++++++++--
1 files changed, 35 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/8f476c6b/testing/common-tests/src/test/java/org/apache/wicket/osgi/OsgiClashingPackagesTest.java
----------------------------------------------------------------------
diff --git a/testing/common-tests/src/test/java/org/apache/wicket/osgi/OsgiClashingPackagesTest.java b/testing/common-tests/src/test/java/org/apache/wicket/osgi/OsgiClashingPackagesTest.java
index 5e9cefe..90e5e35 100644
--- a/testing/common-tests/src/test/java/org/apache/wicket/osgi/OsgiClashingPackagesTest.java
+++ b/testing/common-tests/src/test/java/org/apache/wicket/osgi/OsgiClashingPackagesTest.java
@@ -1,6 +1,7 @@
package org.apache.wicket.osgi;
import java.io.IOException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
@@ -63,10 +64,24 @@ public class OsgiClashingPackagesTest extends Assert
private void fail(Entry<String, List<Project>> entry) {
StringBuilder builder = new StringBuilder();
- builder.append("Package '").append(entry.getKey()).append("' has classes in two or more modules: ");
+ String packageName = entry.getKey();
+ builder.append("Package '").append(packageName).append("' has files in two or more modules: ");
for (Project conflict : entry.getValue()) {
builder.append(conflict.getName()).append(", ");
}
+ try
+ {
+ builder.append("\nResources:\n");
+ Enumeration<URL> resources = getClass().getClassLoader().getResources(packageName);
+ while (resources.hasMoreElements())
+ {
+ URL resource = resources.nextElement();
+ builder.append("\n\t").append(resource.toExternalForm());
+ }
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
fail(builder.toString());
}
@@ -107,10 +122,10 @@ public class OsgiClashingPackagesTest extends Assert
while (entries.hasMoreElements())
{
JarEntry jarEntry = entries.nextElement();
- String className = jarEntry.getName();
- if (className.endsWith(".class"))
+ String entryName = jarEntry.getName();
+ if (shouldCollect(entryName))
{
- String packageName = Strings.beforeLast(className, '/');
+ String packageName = Strings.beforeLast(entryName, '/');
packagesWithContent.add(packageName);
}
}
@@ -127,6 +142,22 @@ public class OsgiClashingPackagesTest extends Assert
"name='" + name + '\'' +
'}';
}
+
+ private boolean shouldCollect(final String entryName)
+ {
+ if (
+ // all modules have META-INF {MANIFEST.MF, Maven stuff, ..}
+ entryName.startsWith("META-INF/") ||
+
+ // ignore Wicket's IInitializer conf files
+ (entryName.startsWith("wicket") && entryName.endsWith(".properties"))
+ )
+ {
+ return false;
+ }
+
+ return true;
+ }
}
}