use of java.util.jar.JarOutputStream in project fabric8 by jboss-fuse.
the class MavenProxyServletSupportTest method testWarUploadNoMvnPath.
@Test(timeout = 30000)
public void testWarUploadNoMvnPath() throws Exception {
String warPath = "acme-ui-1.0.war";
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JarOutputStream jas = new JarOutputStream(baos);
addEntry(jas, "WEB-INF/web.xml", "<web/>".getBytes());
jas.close();
byte[] contents = baos.toByteArray();
testUpload(warPath, contents, true);
}
use of java.util.jar.JarOutputStream in project fabric8 by jboss-fuse.
the class MavenProxyServletSupportTest method testJarUploadWithMvnPom.
@Test(timeout = 30000)
public void testJarUploadWithMvnPom() throws Exception {
String jarPath = "org.acme/acme-core/1.0/acme-core-1.0.jar";
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JarOutputStream jas = new JarOutputStream(baos);
addEntry(jas, "hello.txt", "Hello!".getBytes());
addPom(jas, "org.acme", "acme-core", "1.0");
jas.close();
byte[] contents = baos.toByteArray();
testUpload(jarPath, contents, false);
}
use of java.util.jar.JarOutputStream in project fabric8 by jboss-fuse.
the class MavenProxyServletSupportTest method testWarUploadFullMvnPath.
@Test(timeout = 30000)
public void testWarUploadFullMvnPath() throws Exception {
String warPath = "org.acme/acme-ui/1.0/acme-ui-1.0.war";
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JarOutputStream jas = new JarOutputStream(baos);
addEntry(jas, "WEB-INF/web.xml", "<web/>".getBytes());
jas.close();
byte[] contents = baos.toByteArray();
testUpload(warPath, contents, false);
}
use of java.util.jar.JarOutputStream in project fabric8 by jboss-fuse.
the class MavenProxyServletSupportTest method testJarUploadNoMvnPath.
@Test(timeout = 30000)
public void testJarUploadNoMvnPath() throws Exception {
String jarPath = "acme-core-1.0.jar";
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JarOutputStream jas = new JarOutputStream(baos);
addEntry(jas, "hello.txt", "Hello!".getBytes());
jas.close();
byte[] contents = baos.toByteArray();
testUpload(jarPath, contents, true);
}
use of java.util.jar.JarOutputStream in project SimpleFlatMapper by arnaudroger.
the class OsgiTest method repackage.
private URL repackage(URL asm6) throws IOException {
File tmpFile = File.createTempFile("bundle", "jar");
try (InputStream fis = asm6.openStream();
JarInputStream jis = new JarInputStream(fis)) {
Manifest man = jis.getManifest();
Attributes mainAttributes = man.getMainAttributes();
System.out.println("mainAttributes = " + mainAttributes.keySet());
mainAttributes.remove(new Attributes.Name("Bundle-RequiredExecutionEnvironment"));
mainAttributes.remove(new Attributes.Name("Require-Capability"));
try (FileOutputStream fos = new FileOutputStream(tmpFile);
JarOutputStream jos = new JarOutputStream(fos, man)) {
JarEntry zentry;
while ((zentry = jis.getNextJarEntry()) != null) {
jos.putNextEntry(zentry);
IOUtils.copy(jis, jos);
}
}
}
return tmpFile.toURI().toURL();
}
Aggregations