summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorwisberg <wisberg>2005-10-14 05:05:32 +0000
committerwisberg <wisberg>2005-10-14 05:05:32 +0000
commit2a5c822a59d80966e59c20de6585c68ca9db6397 (patch)
treed18b72f728e78a7f4d86380404d0ed30ce3385db /build
parent3d013831856669ebf70bcf8fe204069ce16275fd (diff)
downloadaspectj-2a5c822a59d80966e59c20de6585c68ca9db6397.tar.gz
aspectj-2a5c822a59d80966e59c20de6585c68ca9db6397.zip
test - fix dup entries for target when assembling
Diffstat (limited to 'build')
-rw-r--r--build/testsrc/org/aspectj/internal/build/BuildModuleTest.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/build/testsrc/org/aspectj/internal/build/BuildModuleTest.java b/build/testsrc/org/aspectj/internal/build/BuildModuleTest.java
index ed2f81e0f..babb6f81c 100644
--- a/build/testsrc/org/aspectj/internal/build/BuildModuleTest.java
+++ b/build/testsrc/org/aspectj/internal/build/BuildModuleTest.java
@@ -15,9 +15,14 @@
package org.aspectj.internal.build;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Enumeration;
import java.util.Iterator;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
import junit.framework.TestCase;
@@ -97,6 +102,9 @@ public class BuildModuleTest extends TestCase {
protected void tearDown() throws Exception {
super.tearDown();
if (debugging() && !REMOVE_JARS_AFTER_DEBUGGING) {
+ if (0 < tempFiles.size()) {
+ System.err.println("debugging files left: " + tempFiles);
+ }
return;
}
deleteTempFiles();
@@ -169,6 +177,14 @@ public class BuildModuleTest extends TestCase {
// System.out.println("results: " + Arrays.asList(results));
// deleteTempFiles();
// }
+ public void testNoDuplicates() {
+ File weaverAllJar = doTask("weaver",true, true, true);
+ String dupError = duplicateEntryError(weaverAllJar);
+ weaverAllJar.delete();
+ if (null != dupError) {
+ fail(dupError);
+ }
+ }
public void testAjbrowser() {
checkBuild("ajbrowser",
"org.aspectj.tools.ajbrowser.Main",
@@ -320,6 +336,36 @@ public class BuildModuleTest extends TestCase {
private static boolean debugging() {
return ((null != DEBUGS) && (0 < DEBUGS.length));
}
+ private static String duplicateEntryError(File weaverAllJar) {
+ ZipFile zipFile = null;
+ try {
+ zipFile = new ZipFile(weaverAllJar);
+ Enumeration e = zipFile.entries();
+ ArrayList entryNames = new ArrayList();
+ while (e.hasMoreElements()) {
+ ZipEntry entry = (ZipEntry) e.nextElement();
+ String name = entry.getName();
+ if (entryNames.contains(name)) {
+ return "duplicate entry: " + name;
+ }
+ entryNames.add(name);
+ }
+ } catch (ZipException e) {
+ return "ZipException " + e;
+ } catch (IOException e) {
+ return "IOException " + e;
+ } finally {
+ if (null != zipFile) {
+ try {
+ zipFile.close();
+ } catch (IOException e) {
+ return "IOException closing " + zipFile + ": " + e;
+ }
+ }
+ }
+ return null;
+ }
+
private static String name(String module, boolean trimTesting, boolean assemble) {
return module + (trimTesting?"":"-test") + (assemble?"-all":"");
}