Search in sources :

Example 11 with FractionUsageAnalyzer

use of org.wildfly.swarm.fractions.FractionUsageAnalyzer in project wildfly-swarm by wildfly-swarm.

the class JsfIT method testFractionMatchingMETAINF.

@Test
public void testFractionMatchingMETAINF() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addAsResource("META-INF/faces-config.xml");
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();
    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);
    analyzer.source(out);
    assertThat(analyzer.detectNeededFractions().stream().filter(fd -> fd.getArtifactId().equals("jsf")).count()).isEqualTo(1);
}
Also used : ShrinkWrap(org.jboss.shrinkwrap.api.ShrinkWrap) FractionUsageAnalyzer(org.wildfly.swarm.fractions.FractionUsageAnalyzer) Request(org.apache.http.client.fluent.Request) Assertions.assertThat(org.fest.assertions.Assertions.assertThat) Files(java.nio.file.Files) JARArchive(org.wildfly.swarm.spi.api.JARArchive) IOException(java.io.IOException) Test(org.junit.Test) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) File(java.io.File) FractionUsageAnalyzer(org.wildfly.swarm.fractions.FractionUsageAnalyzer) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) JARArchive(org.wildfly.swarm.spi.api.JARArchive) File(java.io.File) Test(org.junit.Test)

Example 12 with FractionUsageAnalyzer

use of org.wildfly.swarm.fractions.FractionUsageAnalyzer in project wildfly-swarm by wildfly-swarm.

the class JsfIT method testFractionMatching.

@Test
public void testFractionMatching() throws Exception {
    JARArchive archive = ShrinkWrap.create(JARArchive.class);
    archive.addAsResource("WEB-INF/faces-config.xml");
    FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();
    final File out = Files.createTempFile(archive.getName(), ".war").toFile();
    out.deleteOnExit();
    archive.as(ZipExporter.class).exportTo(out, true);
    analyzer.source(out);
    assertThat(analyzer.detectNeededFractions().stream().filter(fd -> fd.getArtifactId().equals("jsf")).count()).isEqualTo(1);
}
Also used : ShrinkWrap(org.jboss.shrinkwrap.api.ShrinkWrap) FractionUsageAnalyzer(org.wildfly.swarm.fractions.FractionUsageAnalyzer) Request(org.apache.http.client.fluent.Request) Assertions.assertThat(org.fest.assertions.Assertions.assertThat) Files(java.nio.file.Files) JARArchive(org.wildfly.swarm.spi.api.JARArchive) IOException(java.io.IOException) Test(org.junit.Test) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) File(java.io.File) FractionUsageAnalyzer(org.wildfly.swarm.fractions.FractionUsageAnalyzer) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) JARArchive(org.wildfly.swarm.spi.api.JARArchive) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)12 FractionUsageAnalyzer (org.wildfly.swarm.fractions.FractionUsageAnalyzer)12 Files (java.nio.file.Files)11 ZipExporter (org.jboss.shrinkwrap.api.exporter.ZipExporter)11 Assertions.assertThat (org.fest.assertions.Assertions.assertThat)10 ShrinkWrap (org.jboss.shrinkwrap.api.ShrinkWrap)10 Test (org.junit.Test)10 JARArchive (org.wildfly.swarm.spi.api.JARArchive)10 IOException (java.io.IOException)3 TempFileManager (org.wildfly.swarm.bootstrap.util.TempFileManager)3 Request (org.apache.http.client.fluent.Request)2 ExplodedExporter (org.jboss.shrinkwrap.api.exporter.ExplodedExporter)2 FractionDescriptor (org.wildfly.swarm.fractions.FractionDescriptor)2 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 StringTokenizer (java.util.StringTokenizer)1