private String getDeploymentName(Archive<?> archive) { String archiveFilename = archive.getName(); int indexOfDot = archiveFilename.indexOf("."); if (indexOfDot != -1) { return archiveFilename.substring(0, indexOfDot); } return archiveFilename; }
public static boolean archiveHasExpectedFileExtension(final Archive<?> archive) { final String name = archive.getName(); for (Map.Entry<Class<? extends Archive<?>>, String> entry : archiveExpressions.entrySet()) { if (!name.endsWith(entry.getValue()) && entry.getKey().isInstance(archive)) { return false; } } return true; }
public static boolean archiveHasExpectedFileExtension(final Archive<?> archive) { final String name = archive.getName(); for (Map.Entry<Class<? extends Archive<?>>, String> entry : archiveExpressions.entrySet()) { if (!name.endsWith(entry.getValue()) && entry.getKey().isInstance(archive)) { return false; } } return true; }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#getName() */ @Override public String getName() { return this.getArchive().getName(); }
public static boolean isArchiveOfType(Class<? extends Archive<?>> type, Archive<?> archive) { String expression = getArchiveExpression(type); if (expression == null) { return false; } return archive.getName().endsWith(expression); }
@Override public String format(final Archive<?> archive) throws IllegalArgumentException { // Precondition checks if (archive == null) { throw new IllegalArgumentException("archive must be specified"); } // Format: "name: X assets" return new StringBuilder().append(archive.getName()).append(FormattingConstants.COLON) .append(FormattingConstants.SPACE).append(this.getNumAssets(archive)).append(FormattingConstants.SPACE) .append(ASSETS).toString(); }
private File toArchiveDump(final Archive<?> archive) { final File file = new File(this.configuration.getTempDir(), archive.getName()); file.getParentFile().mkdirs(); return file; } }
public String format(Archive<?> archive) throws IllegalArgumentException { StringBuilder xml = new StringBuilder(); xml.append("<?xml version=\"1.0\"?>\n<deployment") .append(" name=\"").append(archive.getName()).append("\"") .append(" testclass=\"").append(testClass.getName()).append("\"") .append(">\n"); formatNode(archive.get(ArchivePaths.root()), xml); xml.append("</deployment>").append("\n"); return xml.toString(); }
public String format(Archive<?> archive) throws IllegalArgumentException { StringBuilder xml = new StringBuilder(); xml.append("<?xml version=\"1.0\"?>\n<deployment") .append(" name=\"").append(archive.getName()).append("\"") .append(" testclass=\"").append(testClass.getName()).append("\"") .append(">\n"); formatNode(archive.get(ArchivePaths.root()), xml); xml.append("</deployment>").append("\n"); return xml.toString(); }
@Override public void undeploy(Archive<?> archive) throws DeploymentException { AbstractDeployment deployment = deployments.get(archive); if (deployment == null) { throw new DeploymentException("Could not find deployed archive " + archive.getName()); } deployment.stop(); deployments.remove(archive); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.exporter.ExplodedExporter#exportExploded(java.io.File) */ @Override public File exportExploded(final File baseDirectory) { return exportExploded(baseDirectory, this.getArchive().getName()); }
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; }
private static JavaArchive generateWar(Archive<?> archive, List<String> deploymentLibraries) { JavaArchive javaArchive = archive.as(JavaArchive.class); Archive<?>[] requiredLibraries = RequiredLibraries.getRequiredLibraries(deploymentLibraries); Arrays.stream(requiredLibraries).forEach(f -> javaArchive.add(new ArchiveAsset(f, ZipExporter.class), "/WEB-INF/lib/" + f.getName())); return javaArchive; }
private void logWarningIfArchiveHasUnexpectedFileExtension(final DeploymentDescription deployment) { if (!Validate.archiveHasExpectedFileExtension(deployment.getArchive())) { log.warning("Deployment archive of type " + deployment.getArchive().getClass().getSimpleName() + " has been given an unexpected file extension. Archive name: " + deployment.getArchive().getName() + ", deployment name: " + deployment.getName() + ". It might not be wrong, but the container will" + " rely on the given file extension, the archive type is only a description of a certain structure."); } }
/** * Creates a new instance, wrapping the specified {@link Archive} */ public ZipSerializableViewImpl(final Archive<?> archive) { Validate.notNull(archive, "Archive must be specified"); final String name = archive.getName(); Validate.notNullOrEmpty(name, "Name of archive must be specified"); this.archive = archive; this.name = name; this.id = archive.getId(); }
@Override public WarPackagingProcessor configure(Archive<?> archive, MavenWorkingSession session) { super.configure(session); // archive is ignored, just name is propagated String archiveName = hasGeneratedName(archive) ? session.getParsedPomFile().getFinalName() : archive.getName(); this.archive = ShrinkWrap.create(WebArchive.class, archiveName); return this; }
private String createFileName(DeploymentDescription deployment, Archive<?> archive) { // TODO: where do we get TestClass name from ? return deployment.getTarget().getName() + "_" + deployment.getName() + "_" + archive.getName(); } }
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"); }
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"); }