use of org.jboss.shrinkwrap.api.Archive in project wildfly-swarm by wildfly-swarm.
the class MockArtifactResolver method resolve.
@Override
public ArtifactSpec resolve(ArtifactSpec spec) throws Exception {
File resolved = resolvedArtifacts.get(spec);
if (resolved == null) {
Archive archive = artifacts.get(spec);
if (archive != null) {
resolved = File.createTempFile(spec.artifactId(), ".jar");
resolved.delete();
resolved.deleteOnExit();
archive.as(ZipExporter.class).exportTo(resolved);
this.resolvedArtifacts.put(spec, resolved);
}
}
spec.file = resolved;
return spec;
}
use of org.jboss.shrinkwrap.api.Archive in project wildfly-swarm by wildfly-swarm.
the class MockArtifactResolver method add.
public void add(ArtifactSpec spec) {
Archive archive = ShrinkWrap.create(JavaArchive.class);
archive.add(EmptyAsset.INSTANCE, "nothing");
Entry entry = new Entry(spec);
this.entries.put(spec, entry);
this.artifacts.put(spec, archive);
}
use of org.jboss.shrinkwrap.api.Archive in project wildfly-swarm by wildfly-swarm.
the class BuildTool method repackageWar.
public void repackageWar(File file) throws IOException {
this.log.info("Repackaging .war: " + file);
Path backupPath = get(file);
move(file, backupPath, this.log);
Archive original = ShrinkWrap.create(JavaArchive.class);
try (InputStream inputStream = Files.newInputStream(backupPath)) {
original.as(ZipImporter.class).importFrom(inputStream);
}
WebInfLibFilteringArchive repackaged = new WebInfLibFilteringArchive(original, this.dependencyManager);
repackaged.as(ZipExporter.class).exportTo(file, true);
this.log.info("Repackaged .war: " + file);
}
use of org.jboss.shrinkwrap.api.Archive in project wildfly-swarm by wildfly-swarm.
the class ApimanManagerApiDeploymentTest method testApimanGatewayWAR.
@Test
public void testApimanGatewayWAR() throws Exception {
File warFile = Maven.resolver().resolve("io.apiman:apiman-gateway-platforms-war-wildfly8-api:war:1.3.1.Final").withoutTransitivity().asSingleFile();
WildFlyConfigBuilder cfgBuilder = new WildFlyConfigBuilder();
cfgBuilder.addDefaultSources();
Config cfg = cfgBuilder.build();
Archive archive = ShrinkWrap.createFromZipFile(JAXRSArchive.class, warFile);
OpenApiConfig config = new OpenApiConfig(cfg);
OpenApiDocument.INSTANCE.reset();
OpenApiDeploymentProcessor processor = new OpenApiDeploymentProcessor(config, archive);
processor.process();
new OpenApiServletContextListener().contextInitialized(null);
String actual = OpenApiSerializer.serialize(OpenApiDocument.INSTANCE.get(), Format.JSON);
String expected = loadResource(getClass().getResource("testApimanGatewayWAR.expected.json"));
// System.out.println(actual);
assertJsonEquals(expected, actual);
}
use of org.jboss.shrinkwrap.api.Archive in project wildfly-swarm by wildfly-swarm.
the class RuntimeDeployer method archives.
protected static Stream<Archive> archives(Collection<Path> paths) {
return paths.stream().map(path -> {
String simpleName = path.getFileName().toString();
Archive archive = ShrinkWrap.create(JavaArchive.class, simpleName);
archive.as(ZipImporter.class).importFrom(path.toFile());
return archive;
});
}
Aggregations