summaryrefslogtreecommitdiffstats
path: root/ajde/testsrc
diff options
context:
space:
mode:
authoraclement <aclement>2004-08-02 15:47:02 +0000
committeraclement <aclement>2004-08-02 15:47:02 +0000
commit2b8fa314f21eddf8551715fdd571da2b611411d0 (patch)
treeb1d79b311bdd55ff5a6c5fb205c77896dc5222b5 /ajde/testsrc
parent7f19ab47a3df5327c6246420354089d1db1c765f (diff)
downloadaspectj-2b8fa314f21eddf8551715fdd571da2b611411d0.tar.gz
aspectj-2b8fa314f21eddf8551715fdd571da2b611411d0.zip
Fix for Bugzilla Bug 57666
duplicate manifests cause resource-copying to gack (Contributed by Matthew Webster)
Diffstat (limited to 'ajde/testsrc')
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AjdeTests.java1
-rw-r--r--ajde/testsrc/org/aspectj/ajde/DuplicateManifestTest.java69
2 files changed, 70 insertions, 0 deletions
diff --git a/ajde/testsrc/org/aspectj/ajde/AjdeTests.java b/ajde/testsrc/org/aspectj/ajde/AjdeTests.java
index b66c019ed..e70619504 100644
--- a/ajde/testsrc/org/aspectj/ajde/AjdeTests.java
+++ b/ajde/testsrc/org/aspectj/ajde/AjdeTests.java
@@ -37,6 +37,7 @@ public class AjdeTests extends TestCase {
suite.addTestSuite(SavedModelConsistencyTest. class);
suite.addTestSuite(BuildCancellingTest.class);
suite.addTestSuite(JarManifestTest.class);
+ suite.addTestSuite(DuplicateManifestTest.class);
//$JUnit-END$
return suite;
diff --git a/ajde/testsrc/org/aspectj/ajde/DuplicateManifestTest.java b/ajde/testsrc/org/aspectj/ajde/DuplicateManifestTest.java
new file mode 100644
index 000000000..38c82bb42
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/DuplicateManifestTest.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster - initial implementation
+ *******************************************************************************/
+package org.aspectj.ajde;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+public class DuplicateManifestTest extends AjdeTestCase {
+
+
+ public static final String PROJECT_DIR = "DuplicateManifestTest";
+
+ public static final String injarName = "injar.jar";
+ public static final String aspectjarName = "aspectjar.jar";
+ public static final String outjarName = "outjar.jar";
+
+
+ /*
+ * Ensure the output directpry in clean
+ */
+ protected void setUp() throws Exception {
+ super.setUp(PROJECT_DIR);
+ }
+
+ public void testWeave () {
+ Set injars = new HashSet();
+ injars.add(openFile(injarName));
+ ideManager.getProjectProperties().setInJars(injars);
+ Set aspectpath = new HashSet();
+ aspectpath.add(openFile(aspectjarName));
+ ideManager.getProjectProperties().setAspectPath(aspectpath);
+ File outjar = openFile(outjarName);
+ ideManager.getProjectProperties().setOutJar(outjar.getAbsolutePath());
+ assertTrue("Build failed", doSynchronousBuild("build.lst"));
+ assertTrue(
+ "Build warnings",
+ ideManager.getCompilationSourceLineTasks().isEmpty());
+ compareManifests(openFile(injarName),openFile(outjarName));
+ }
+
+ private void compareManifests (File inFile, File outFile) {
+
+ try {
+ JarFile inJar = new JarFile(inFile);
+ Manifest inManifest = inJar.getManifest();
+ inJar.close();
+ JarFile outJar = new JarFile(outFile);
+ Manifest outManifest = outJar.getManifest();
+ outJar.close();
+ assertTrue("The manifests in '" + inFile.getCanonicalPath() + "' and '" + outFile.getCanonicalPath() + "' sould be the same",inManifest.equals(outManifest));
+ }
+ catch (IOException ex) {
+ fail(ex.toString());
+ }
+ }
+
+}