Search in sources :

Example 16 with ClassLoaderAsset

use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset in project tomee by apache.

the class DescriptorComplementsAnnotationsTest method createDeployment.

@Deployment(testable = false)
public static WebArchive createDeployment() {
    WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class).version(WebAppVersionType._3_0).createServlet().servletName(SERVLET_NAME).servletClass(DescriptorComplementsAnnotationsServlet.class.getName()).up().createServletMapping().servletName(SERVLET_NAME).urlPattern("/" + TEST_NAME).up();
    WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war").addClass(DescriptorComplementsAnnotationsTest.class).addClass(DescriptorComplementsAnnotationsServlet.class).addClass(Bean.class).addClass(FirstBean.class).addClass(SecondBean.class).addClass(Runner.class).addAsLibraries(JarLocation.jarLocation(Test.class)).addAsWebInfResource(new ClassLoaderAsset(CONTENT_LOCATION_EJB_JAR_XML), RESOURCE_EJB_JAR_XML).setWebXML(new StringAsset(descriptor.exportAsString()));
    return archive;
}
Also used : WebAppDescriptor(org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor) Runner(org.apache.openejb.arquillian.tests.Runner) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) Test(org.junit.Test) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ClassLoaderAsset(org.jboss.shrinkwrap.api.asset.ClassLoaderAsset) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 17 with ClassLoaderAsset

use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset in project camunda-bpm-platform by camunda.

the class TomcatServerBootstrap method start.

public void start() {
    Properties serverProperties = readProperties();
    int port = Integer.parseInt(serverProperties.getProperty(PORT_PROPERTY));
    tomcat = new Tomcat();
    tomcat.setPort(port);
    tomcat.setBaseDir(getWorkingDir());
    tomcat.getHost().setAppBase(getWorkingDir());
    tomcat.getHost().setAutoDeploy(true);
    tomcat.getHost().setDeployOnStartup(true);
    String contextPath = "/" + getContextPath();
    PomEquippedResolveStage resolver = Maven.configureResolver().useLegacyLocalRepo(true).workOffline().loadPomFromFile("pom.xml");
    WebArchive wa = ShrinkWrap.create(WebArchive.class, "rest-test.war").setWebXML(webXmlPath).addAsLibraries(resolver.resolve("org.codehaus.jackson:jackson-jaxrs:1.6.5").withTransitivity().asFile()).addAsLibraries(resolver.addDependencies(MavenDependencies.createDependency("org.mockito:mockito-core", ScopeType.TEST, false, MavenDependencies.createExclusion("org.hamcrest:hamcrest-core"))).resolve().withTransitivity().asFile()).addAsServiceProvider(ProcessEngineProvider.class, MockedProcessEngineProvider.class).add(new ClassLoaderAsset("runtime/tomcat/context.xml"), "META-INF/context.xml").addPackages(true, "org.camunda.bpm.engine.rest");
    addRuntimeSpecificLibraries(wa, resolver);
    wa.setWebXML(webXmlPath);
    String webAppPath = getWorkingDir() + "/" + getContextPath() + ".war";
    wa.as(ZipExporter.class).exportTo(new File(webAppPath), true);
    tomcat.addWebapp(tomcat.getHost(), contextPath, webAppPath);
    try {
        tomcat.start();
    } catch (LifecycleException e) {
        throw new RuntimeException(e);
    }
}
Also used : Tomcat(org.apache.catalina.startup.Tomcat) LifecycleException(org.apache.catalina.LifecycleException) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) Properties(java.util.Properties) ClassLoaderAsset(org.jboss.shrinkwrap.api.asset.ClassLoaderAsset) PomEquippedResolveStage(org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage) File(java.io.File)

Example 18 with ClassLoaderAsset

use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset 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 19 with ClassLoaderAsset

use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset in project dwoss by gg-net.

the class ArquillianProjectArchive method createDeployment.

@Deployment
public static WebArchive createDeployment() {
    // Compile Safe Packages.
    Package projectPackage = Searcher.class.getPackage();
    File[] libs = Maven.resolver().loadPomFromFile("pom.xml").importRuntimeDependencies().addDependency(// Log4J API
    MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)).addDependency(// AssertJ Fluent Assertions
    MavenDependencies.createDependency("org.assertj:assertj-core", RUNTIME, false)).resolve().withTransitivity().asFile();
    WebArchive war = ShrinkWrap.create(WebArchive.class, "misc-core-test.war").addPackages(true, projectPackage).addClass(// Need this cause of the maven resolver is part of the deployment
    Coordinate.class).addClass(// The local deployer configuration
    ArquillianProjectArchive.class).addClass(CustomerSearchProviderStub.class).addClass(UniqueUnitSearchProviderStub.class).addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties").addAsWebInfResource(// Needed for jboss/wildfly h2 enablement
    "jboss-deployment-structure.xml").addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsLibraries(libs);
    return war;
}
Also used : Coordinate(org.jboss.shrinkwrap.resolver.api.Coordinate) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ClassLoaderAsset(org.jboss.shrinkwrap.api.asset.ClassLoaderAsset) File(java.io.File) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 20 with ClassLoaderAsset

use of org.jboss.shrinkwrap.api.asset.ClassLoaderAsset in project dwoss by gg-net.

the class ArquillianProjectArchive method createDeployment.

@Deployment
public static WebArchive createDeployment() {
    File[] libs = Maven.resolver().loadPomFromFile("pom.xml").importRuntimeDependencies().addDependency(// The Sample Mandator is needed on many places.
    MavenDependencies.createDependency("eu.ggnet.dwoss:dwoss-mandator-sample", RUNTIME, false)).addDependency(// Log4J API
    MavenDependencies.createDependency("org.slf4j:slf4j-log4j12", RUNTIME, false)).addDependency(// Fest assertion
    MavenDependencies.createDependency("org.assertj:assertj-core", RUNTIME, false)).resolve().withTransitivity().asFile();
    WebArchive war = ShrinkWrap.create(WebArchive.class, "spec-persistence-test.war").addPackages(true, // Compile safe package "eu.ggnet.dwoss.customer.itest"
    Filters.exclude(// Compile safe package "eu.ggnet.dwoss.customer.itest"
    PersistenceIT.class.getPackage(), // Compile safe package "eu.ggnet.dwoss.customer.test"
    SpecTest.class.getPackage()), "eu.ggnet.dwoss.spec").addClass(// The Datasource Configuration and the Static Producers
    MandatorSupportProducer.class).addClass(// Alle Datasources. More than we need.
    SampleDataSourceDefinition.class).addClass(// Need this cause of the maven resolver is part of the deployment
    Coordinate.class).addClass(// The local deployer configuration
    ArquillianProjectArchive.class).addClass(ContainerITGeneratorHelper.class).addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml").addAsResource(new ClassLoaderAsset("log4j.properties"), "log4j.properties").addAsResource(new ClassLoaderAsset("eu/ggnet/dwoss/spec/ee/assist/gen/specs.xml"), // Needed for the Specgenerator.
    "eu/ggnet/dwoss/spec/ee/assist/gen/specs.xml").addAsWebInfResource(// Needed for jboss/wildfly h2 enablement
    "jboss-deployment-structure.xml").addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsLibraries(libs);
    return war;
}
Also used : SampleDataSourceDefinition(eu.ggnet.dwoss.mandator.tryout.SampleDataSourceDefinition) SpecTest(eu.ggnet.dwoss.spec.test.SpecTest) PersistenceIT(eu.ggnet.dwoss.spec.itest.PersistenceIT) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ClassLoaderAsset(org.jboss.shrinkwrap.api.asset.ClassLoaderAsset) File(java.io.File) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

ClassLoaderAsset (org.jboss.shrinkwrap.api.asset.ClassLoaderAsset)26 Deployment (org.jboss.arquillian.container.test.api.Deployment)20 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)20 File (java.io.File)15 SampleDataSourceDefinition (eu.ggnet.dwoss.mandator.tryout.SampleDataSourceDefinition)8 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)8 Test (org.junit.Test)7 Runner (org.apache.openejb.arquillian.tests.Runner)6 WebAppDescriptor (org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor)6 Coordinate (org.jboss.shrinkwrap.resolver.api.Coordinate)4 Asset (org.jboss.shrinkwrap.api.asset.Asset)3 WARArchive (org.wildfly.swarm.undertow.WARArchive)3 PersistenceIT (eu.ggnet.dwoss.customer.itest.PersistenceIT)1 CustomerTest (eu.ggnet.dwoss.customer.test.CustomerTest)1 RedTapeHelper (eu.ggnet.dwoss.redtape.itest.eao.RedTapeHelper)1 PersistenceIT (eu.ggnet.dwoss.spec.itest.PersistenceIT)1 SpecTest (eu.ggnet.dwoss.spec.test.SpecTest)1 PersistenceIT (eu.ggnet.dwoss.stock.ee.itest.PersistenceIT)1 ValidationTest (eu.ggnet.dwoss.stock.ee.test.ValidationTest)1 BufferedReader (java.io.BufferedReader)1