summaryrefslogtreecommitdiffstats
path: root/ajde
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-03-17 12:25:49 +0000
committeracolyer <acolyer>2004-03-17 12:25:49 +0000
commit34dbb0c41b3e324e3c7fc5a150c314fbecfd5e6e (patch)
treeb1150ee6eda37e251eb161a87492f9cdde0ac6aa /ajde
parent90fbe5d804038002cc651421a5bc94a2b20f7e70 (diff)
downloadaspectj-34dbb0c41b3e324e3c7fc5a150c314fbecfd5e6e.tar.gz
aspectj-34dbb0c41b3e324e3c7fc5a150c314fbecfd5e6e.zip
fix for Bugzilla Bug 47910
ajc -outjar jarfile does not contain MANIFEST.MF
Diffstat (limited to 'ajde')
-rw-r--r--ajde/testdata/JarManifestTest/noweave.lst3
-rw-r--r--ajde/testdata/JarManifestTest/src/Logging.aj13
-rw-r--r--ajde/testdata/JarManifestTest/src/Main.java25
-rw-r--r--ajde/testdata/JarManifestTest/weave.lst2
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AjdeTests.java1
-rw-r--r--ajde/testsrc/org/aspectj/ajde/InpathTestcase.java15
-rw-r--r--ajde/testsrc/org/aspectj/ajde/JarManifestTest.java86
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java3
8 files changed, 140 insertions, 8 deletions
diff --git a/ajde/testdata/JarManifestTest/noweave.lst b/ajde/testdata/JarManifestTest/noweave.lst
new file mode 100644
index 000000000..814b7c8ee
--- /dev/null
+++ b/ajde/testdata/JarManifestTest/noweave.lst
@@ -0,0 +1,3 @@
+src/Main.java
+src/Logging.aj
+-noweave \ No newline at end of file
diff --git a/ajde/testdata/JarManifestTest/src/Logging.aj b/ajde/testdata/JarManifestTest/src/Logging.aj
new file mode 100644
index 000000000..3ef6ef0e8
--- /dev/null
+++ b/ajde/testdata/JarManifestTest/src/Logging.aj
@@ -0,0 +1,13 @@
+public aspect Logging {
+
+ pointcut methods () :
+ execution(* *..*(..)) && !within(Logging);
+
+ before () : methods () {
+ System.err.println("> " + thisJoinPoint.getSignature().toLongString());
+ }
+
+ after () : methods () {
+ System.err.println("< " + thisJoinPoint.getSignature().toLongString());
+ }
+}
diff --git a/ajde/testdata/JarManifestTest/src/Main.java b/ajde/testdata/JarManifestTest/src/Main.java
new file mode 100644
index 000000000..94369dd8e
--- /dev/null
+++ b/ajde/testdata/JarManifestTest/src/Main.java
@@ -0,0 +1,25 @@
+import java.io.IOException;
+
+/*
+ * Created on 30-Jul-03
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+
+/**
+ * @author websterm
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class Main {
+
+ public void println () {
+ System.out.println("Main.");
+ }
+
+ public static void main(String[] args) throws IOException {
+ new Main().println();
+ }
+}
diff --git a/ajde/testdata/JarManifestTest/weave.lst b/ajde/testdata/JarManifestTest/weave.lst
new file mode 100644
index 000000000..0ad7a8a9a
--- /dev/null
+++ b/ajde/testdata/JarManifestTest/weave.lst
@@ -0,0 +1,2 @@
+src/Main.java
+src/Logging.aj
diff --git a/ajde/testsrc/org/aspectj/ajde/AjdeTests.java b/ajde/testsrc/org/aspectj/ajde/AjdeTests.java
index 06ead0b2c..ecd8471ce 100644
--- a/ajde/testsrc/org/aspectj/ajde/AjdeTests.java
+++ b/ajde/testsrc/org/aspectj/ajde/AjdeTests.java
@@ -35,6 +35,7 @@ public class AjdeTests extends TestCase {
suite.addTestSuite(ResourceCopyTestCase.class);
suite.addTestSuite(ModelPerformanceTest.class);
suite.addTestSuite(SavedModelConsistencyTest. class);
+ suite.addTestSuite(JarManifestTest.class);
//$JUnit-END$
return suite;
diff --git a/ajde/testsrc/org/aspectj/ajde/InpathTestcase.java b/ajde/testsrc/org/aspectj/ajde/InpathTestcase.java
index ce7b3e5f3..e65b2441d 100644
--- a/ajde/testsrc/org/aspectj/ajde/InpathTestcase.java
+++ b/ajde/testsrc/org/aspectj/ajde/InpathTestcase.java
@@ -15,6 +15,7 @@ package org.aspectj.ajde;
import java.io.*;
import java.util.*;
+import java.util.jar.JarInputStream;
import java.util.zip.*;
import org.aspectj.util.FileUtil;
@@ -244,13 +245,13 @@ public class InpathTestcase extends AjdeTestCase {
public int fetchFromJar(File outjarFile, String filename) {
int ret = -1;
try {
- ZipInputStream outjar;
+ JarInputStream outjar;
outjar =
- new ZipInputStream(new java.io.FileInputStream(outjarFile));
+ new JarInputStream(new java.io.FileInputStream(outjarFile));
ZipEntry entry;
- while (null != (entry = outjar.getNextEntry())) {
+ while (null != (entry = (ZipEntry)outjar.getNextEntry())) {
String zipentryname = entry.getName();
if (zipentryname.equals(filename)) {
byte[] filedata = FileUtil.readAsByteArray(outjar);
@@ -285,8 +286,8 @@ public class InpathTestcase extends AjdeTestCase {
// Go through the output jar file, for each element, remove it from
// the expectedOutputJarContents - when we finish, the expectedOutputJarContents
// set should be empty!
- ZipInputStream outjar =
- new ZipInputStream(new java.io.FileInputStream(outjarFile));
+ JarInputStream outjar =
+ new JarInputStream(new java.io.FileInputStream(outjarFile));
ZipEntry entry;
while (null != (entry = outjar.getNextEntry())) {
String fileName = entry.getName();
@@ -319,8 +320,8 @@ public class InpathTestcase extends AjdeTestCase {
try {
- ZipInputStream outjar =
- new ZipInputStream(new java.io.FileInputStream(outjarFile));
+ JarInputStream outjar =
+ new JarInputStream(new java.io.FileInputStream(outjarFile));
ZipEntry entry;
while (null != (entry = outjar.getNextEntry())) {
String fileName = entry.getName();
diff --git a/ajde/testsrc/org/aspectj/ajde/JarManifestTest.java b/ajde/testsrc/org/aspectj/ajde/JarManifestTest.java
new file mode 100644
index 000000000..6583dae49
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/JarManifestTest.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on 16-Mar-2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.aspectj.ajde;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
+
+import org.aspectj.util.FileUtil;
+
+/**
+ * @author websterm
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class JarManifestTest extends AjdeTestCase {
+
+ public static final String PROJECT_DIR = "JarManifestTest";
+ public static final String srcDir = PROJECT_DIR + "/src";
+ public static final String binDir = "bin";
+
+ public static final String outjarName = "/bin/output.jar";
+
+ /**
+ * Constructor for JarResourceCopyTestCase.
+ * @param arg0
+ */
+ public JarManifestTest (String arg0) {
+ super(arg0);
+ }
+
+ /*
+ * Ensure the output directpry in clean
+ */
+ protected void setUp() throws Exception {
+ super.setUp(PROJECT_DIR);
+ FileUtil.deleteContents(openFile(binDir));
+ }
+
+ public void testWeave () {
+ File outjar = openFile(outjarName);
+ ideManager.getProjectProperties().setOutJar(outjar.getAbsolutePath());
+ assertTrue("Build failed",doSynchronousBuild("weave.lst"));
+ assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
+ checkManifest(outjar);
+ }
+
+ public void testNoweave () {
+ File outjar = openFile(outjarName);
+ ideManager.getProjectProperties().setOutJar(outjar.getAbsolutePath());
+ assertTrue("Build failed",doSynchronousBuild("noweave.lst"));
+ assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
+ checkManifest(outjar);
+ }
+
+ private void checkManifest (File outjarFile) {
+ Manifest manifest = null;
+
+ try {
+ JarInputStream outjar = new JarInputStream(new FileInputStream(outjarFile));
+ manifest = outjar.getManifest();
+ outjar.close();
+ assertNotNull("'" + outjarFile.getCanonicalPath() + "' should contain a manifest",manifest);
+ }
+ catch (IOException ex) {
+ fail(ex.toString());
+ }
+ }
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java b/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java
index bd02c18db..cb7ca236d 100644
--- a/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java
+++ b/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java
@@ -14,6 +14,7 @@ package org.aspectj.ajde;
import java.io.*;
import java.util.*;
+import java.util.jar.JarInputStream;
import java.util.zip.*;
import org.aspectj.util.FileUtil;
@@ -164,7 +165,7 @@ public class ResourceCopyTestCase extends AjdeTestCase {
try {
- ZipInputStream outjar = new ZipInputStream(new java.io.FileInputStream(outjarFile));
+ ZipInputStream outjar = new JarInputStream(new java.io.FileInputStream(outjarFile));
ZipEntry entry;
while (null != (entry = outjar.getNextEntry())) {
String fileName = entry.getName();