Search in sources :

Example 6 with Swarm

use of org.wildfly.swarm.Swarm in project wildfly-swarm by wildfly-swarm.

the class TopologyWebAppArquillianTest method newContainer.

@CreateSwarm
public static Swarm newContainer() throws Exception {
    TopologyWebAppFraction topology = new TopologyWebAppFraction();
    topology.proxyService("myService", "/my-proxy");
    return new Swarm().fraction(topology).fraction(new JGroupsTopologyFraction());
}
Also used : Swarm(org.wildfly.swarm.Swarm) CreateSwarm(org.wildfly.swarm.arquillian.CreateSwarm) JGroupsTopologyFraction(org.wildfly.swarm.topology.jgroups.JGroupsTopologyFraction) CreateSwarm(org.wildfly.swarm.arquillian.CreateSwarm)

Example 7 with Swarm

use of org.wildfly.swarm.Swarm in project wildfly-swarm by wildfly-swarm.

the class Main method main.

public static void main(String[] args) throws Exception {
    /*BEGIN:custom main:JAR_WITH_MAIN*/
    swarm = new Swarm();
    WARArchive war = ShrinkWrap.create(WARArchive.class).addPackage(Main.class.getPackage()).addAsWebInfResource(new ClassLoaderAsset("web.xml", Main.class.getClassLoader()), WebXmlAsset.NAME);
    swarm.start().deploy(war);
    /*END:custom main:JAR_WITH_MAIN*/
    /*BEGIN:custom main:WAR_WITH_MAIN*/
    swarm2 = new Swarm().start().deploy();
/*END:custom main:WAR_WITH_MAIN*/
}
Also used : Swarm(org.wildfly.swarm.Swarm) ClassLoaderAsset(org.jboss.shrinkwrap.api.asset.ClassLoaderAsset) WARArchive(org.wildfly.swarm.undertow.WARArchive)

Example 8 with Swarm

use of org.wildfly.swarm.Swarm in project wildfly-swarm by wildfly-swarm.

the class MainWithProperties method main.

public static void main(String... args) throws Exception {
    System.setProperty("swarm.logging", "TRACE");
    System.setProperty("swarm.logging.custom.category", "DEBUG");
    System.setProperty("swarm.logging.pattern-formatters.MY_COLOR_PATTERN.pattern", "%K{level}%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p (%t) [%c.%M()] %s%e%n");
    swarm = new Swarm(args);
    swarm.start().deploy();
}
Also used : Swarm(org.wildfly.swarm.Swarm)

Example 9 with Swarm

use of org.wildfly.swarm.Swarm in project wildfly-swarm by wildfly-swarm.

the class Main method main.

public static void main(String... args) throws Exception {
    swarm = new Swarm(args).fraction(new CamelFraction().addRouteBuilder(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from("direct:start").transform(simple("Hello ${body}"));
        }
    }));
    swarm.start().deploy();
}
Also used : Swarm(org.wildfly.swarm.Swarm) CamelFraction(org.wildfly.swarm.camel.core.CamelFraction) RouteBuilder(org.apache.camel.builder.RouteBuilder)

Example 10 with Swarm

use of org.wildfly.swarm.Swarm in project wildfly-swarm by wildfly-swarm.

the class DeploymentFailureTest method testDeploymentFailure.

@Test
public void testDeploymentFailure() throws Exception {
    Swarm swarm = new Swarm();
    swarm.start();
    JARArchive a = ShrinkWrap.create(JARArchive.class, "bad-deployment.jar");
    a.addModule("com.i.do.no.exist");
    try {
        swarm.deploy(a);
        fail("should have throw a DeploymentException");
    } catch (DeploymentException e) {
        // expected and correct
        assertThat(e.getArchive()).isSameAs(a);
        assertThat(e.getMessage()).contains("org.jboss.modules.ModuleNotFoundException: com.i.do.no.exist");
    } finally {
        swarm.stop();
    }
}
Also used : Swarm(org.wildfly.swarm.Swarm) DeploymentException(org.wildfly.swarm.container.DeploymentException) JARArchive(org.wildfly.swarm.spi.api.JARArchive) Test(org.junit.Test)

Aggregations

Swarm (org.wildfly.swarm.Swarm)15 CreateSwarm (org.wildfly.swarm.arquillian.CreateSwarm)7 Test (org.junit.Test)4 JARArchive (org.wildfly.swarm.spi.api.JARArchive)4 BufferedReader (java.io.BufferedReader)2 File (java.io.File)2 Deployment (org.jboss.arquillian.container.test.api.Deployment)2 Arquillian (org.jboss.arquillian.junit.Arquillian)2 Archive (org.jboss.shrinkwrap.api.Archive)2 Node (org.jboss.shrinkwrap.api.Node)2 ShrinkWrap (org.jboss.shrinkwrap.api.ShrinkWrap)2 RunWith (org.junit.runner.RunWith)2 MonitorFraction (org.wildfly.swarm.monitor.MonitorFraction)2 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 InputStreamReader (java.io.InputStreamReader)1 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1