You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by br...@apache.org on 2013/06/25 13:02:07 UTC
svn commit: r1496409 -
/ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java
Author: bramk
Date: Tue Jun 25 11:02:07 2013
New Revision: 1496409
URL: http://svn.apache.org/r1496409
Log:
[sandbox] Add something to the test jar to work around empty zip bug
Modified:
ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java
Modified: ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java
URL: http://svn.apache.org/viewvc/ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java?rev=1496409&r1=1496408&r2=1496409&view=diff
==============================================================================
--- ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java (original)
+++ ace/sandbox/bramk/org.apache.ace.cli/test/org/apache/ace/cli/deployment/ContinuousDeployerTest.java Tue Jun 25 11:02:07 2013
@@ -39,7 +39,7 @@ public class ContinuousDeployerTest exte
public void testInitialReleaseDeployment() throws Exception {
// an initial released bundle from development
- m_developmentRepo.put(generateBundle("foo.bar", "1.0.0"), null);
+ deployBundle(m_developmentRepo, createBundle("foo.bar", "1.0.0"));
copyResources(m_developmentRepo, m_releaseRepo, "foo.bar", "1.0.0");
// should have receive the correct release version
@@ -148,41 +148,11 @@ public class ContinuousDeployerTest exte
//
// }
- private InputStream generateBundle(final String bsn, final String version, final String... headers) throws Exception {
- final PipedInputStream in = new PipedInputStream();
- final PipedOutputStream out = new PipedOutputStream(in);
- new Thread(
- new Runnable() {
- public void run() {
- Builder b = new Builder();
- try {
- b.setBundleSymbolicName(bsn);
- b.setBundleVersion(version);
- for (int i = 0; i < headers.length; i += 2) {
- b.setProperty(headers[i], headers[i + 1]);
- }
- b.setProperty("-noextraheaders", "true");
- Jar jar = b.build();
- jar.getManifest(); // Not sure whether this is needed...
- jar.write(out);
- out.flush();
- out.close();
- jar.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- finally {
- b.close();
- }
- }
- }).start();
- return in;
- }
-
private File createBundle(final String bsn, final String version, final String... headers) throws Exception {
+
Builder b = new Builder();
try {
+
b.setBundleSymbolicName(bsn);
b.setBundleVersion(version);
for (int i = 0; i < headers.length; i += 2) {
@@ -190,10 +160,18 @@ public class ContinuousDeployerTest exte
}
b.setProperty("-noextraheaders", "true");
Jar jar = b.build();
+
+ // add something to work around empty zip file JVM bug
+ Jar extra = new Jar(new File("generated/org.apache.ace.cli.jar"));
+ jar.addAll(extra);
+
jar.getManifest(); // Not sure whether this is needed...
File tmp = File.createTempFile("tmpbundle", ".jar");
jar.write(tmp);
jar.close();
+
+ // close after the jar has been written
+ extra.close();
return tmp;
}
catch (Exception e) {