public static File toExploded(Archive archive, String ext) { File tmp = assertTmpFile(ext); if (tmp.delete()) { ExplodedExporter exporter = archive.as(ExplodedExporter.class); exporter.exportExploded(tmp.getParentFile(), tmp.getName()); tmp.deleteOnExit(); return tmp; } else { throw failure("Could not delete tmp file " + tmp.getAbsolutePath()); } } }
public static File toFile(Archive archive, String ext) { File tmp = assertTmpFile(ext); if (tmp.delete()) { ZipExporter exporter = archive.as(ZipExporter.class); exporter.exportTo(tmp); tmp.deleteOnExit(); return tmp; } else { throw failure("Could not delete tmp file " + tmp.getAbsolutePath()); } }
protected boolean setupUsingAppArtifact(Archive<?> archive) throws IOException { final String appArtifact = System.getProperty(APP_ARTIFACT); if (appArtifact != null) { try (InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("_bootstrap/" + appArtifact)) { archive.as(ZipImporter.class) .importFrom(in); } return true; } return false; }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Specializer#as(java.lang.Class) */ @Override public final <TYPE extends Assignable> TYPE as(Class<TYPE> clazz) { return this.getArchive().as(clazz); }
public static void dumpJBossDeploymentStructure(Archive archive) { System.err.println("--- start jboss-deployment-structure.xml"); JBossDeploymentStructureAsset asset = archive.as(JARArchive.class).getDescriptorAsset(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(asset.openStream()))) { reader.lines().forEach(line -> System.err.println(line)); } catch (IOException e) { e.printStackTrace(); } System.err.println("--- end jboss-deployment-structure.xml"); } }
public static void dumpJBossDeploymentStructure(Archive archive) { System.err.println("--- start jboss-deployment-structure.xml"); JBossDeploymentStructureAsset asset = archive.as(JARArchive.class).getDescriptorAsset(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(asset.openStream()))) { reader.lines().forEach(line -> System.err.println(line)); } catch (IOException e) { e.printStackTrace(); } System.err.println("--- end jboss-deployment-structure.xml"); } }
@Override public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException { return getEntry(mountPoint, target) .map(e -> e.archive.as(ZipExporter.class).exportAsInputStream()).orElse(null); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#filter(Filter) */ @Override public T filter(Filter<ArchivePath> filter) { return this.shallowCopy(filter).as(getActualClass()); } /**
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#filter(Filter) */ @Override public T filter(Filter<ArchivePath> filter) { return this.shallowCopy(filter).as(getActualClass()); }
/** * Processes a nested archive by delegating to the ExplodedArchiveExporter * * @param parentDirectory * @param nestedArchiveAsset */ private void processArchiveAsset(File parentDirectory, ArchiveAsset nestedArchiveAsset) { // Get the nested archive Archive<?> nestedArchive = nestedArchiveAsset.getArchive(); nestedArchive.as(ExplodedExporter.class).exportExploded(parentDirectory); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.asset.Asset#openStream() */ @Override public InputStream openStream() { // Export via the specified exporter return this.getArchive().as(this.exporter).exportAsInputStream(); }
File getFile(Entry entry) { if (entry.file == null) { try { entry.file = this.tempDir.createFile(entry.archive.getName(), entry.archive.as(ZipExporter.class).exportAsInputStream()); } catch (IOException e) { e.printStackTrace(); } } return entry.file; }
public void process() { if (archive.get("META-INF/arquillian-testable") == null) { return; } archive.add(new StringAsset(archive.getName()), "META-INF/arquillian-testable"); archive.as(JARArchive.class) .addModule("org.wildfly.swarm.arquillian.adapter"); archive.as(JARArchive.class) .addModule("org.wildfly.swarm.arquillian", "deployment"); archive.as(ServiceActivatorArchive.class) .addServiceActivator("org.wildfly.swarm.arquillian.deployment.TestableArchiveServiceActivator"); }
long sizeof(Entry entry) { if (entry.size == null) { SizingOutputStream sizingOutputStream = new SizingOutputStream(); entry.archive.as(ZipExporter.class).exportTo(sizingOutputStream); entry.size = sizingOutputStream.getSize(); } return entry.size; }
long sizeof(Entry entry) { if (entry.size == null) { SizingOutputStream sizingOutputStream = new SizingOutputStream(); entry.archive.as(ZipExporter.class).exportTo(sizingOutputStream); entry.size = sizingOutputStream.getSize(); } return entry.size; }
long sizeof(Entry entry) { if (entry.size == null) { SizingOutputStream sizingOutputStream = new SizingOutputStream(); entry.archive.as(ZipExporter.class).exportTo(sizingOutputStream); entry.size = sizingOutputStream.getSize(); } return entry.size; }
@Override public ArchiveFormat getArchiveFormat() { return getArchive().as(Configurable.class).getConfiguration().getExtensionLoader() .getArchiveFormatFromExtensionMapping(actualType); }
@Deployment(name = "slave-2", order = 3) public static Archive<?> createDeploymentSlave2() throws Exception { WebArchive slave = DeploymentJmsMasterSlave.createSlave( "slave-2", REFRESH_PERIOD_IN_SEC, tmpDir, true ) .as( WebArchive.class ); addLibraries( slave ); return slave; }
@Deployment(name = "slave-1", order = 2) public static Archive<?> createDeploymentSlave1() throws Exception { WebArchive slave = DeploymentJmsMasterSlave.createSlave( "slave-1", REFRESH_PERIOD_IN_SEC, tmpDir, false ) .as( WebArchive.class ); addLibraries( slave ); return slave; }
@Deployment(name = "slave-1", order = 2) public static Archive<?> createDeploymentSlave1() throws Exception { WebArchive slave = DeploymentJmsMasterSlave.createSlave( "slave-1", REFRESH_PERIOD_IN_SEC, tmpDir, true ) .as( WebArchive.class ); addLibraries( slave ); return slave; }