Package org.jboss.shrinkwrap.api.spec

Examples of org.jboss.shrinkwrap.api.spec.WebArchive.addClass()


public class SimpleWebTestCase {

    @Deployment(name = "deployment-single")
    public static Archive<?> deployment() {
        WebArchive war = ShrinkWrap.create(WebArchive.class, "distributable.war");
        war.addClass(SimpleServlet.class);
        war.setWebXML(SimpleWebTestCase.class.getPackage(), "web.xml");
        System.out.println(war.toString(true));
        return war;
    }
View Full Code Here


        Assert.assertFalse(SUCCESS.equals(ret.get(OUTCOME).asString()));
    }

    private static File getBrokenWar() {
        WebArchive war = ShrinkWrap.create(WebArchive.class, "malformedDeployment.war");
        war.addClass(SimpleServlet.class);
        war.addAsWebInfResource(new StringAsset("Malformed"), "web.xml");
        File brokenWar = new File(System.getProperty("java.io.tmpdir") + File.separator + "malformedDeployment.war");
        brokenWar.deleteOnExit();
        new ZipExporterImpl(war).exportTo(brokenWar, true);
        return brokenWar;
View Full Code Here

        final WebArchive war = ShrinkWrap.create(WebArchive.class, WEB_APP_CONTEXT_TWO + ".war");
        war.addClasses(HelloWorldServlet.class, EjbInvokingServlet.class);

        final WebArchive otherWar = ShrinkWrap.create(WebArchive.class, OTHER_WEB_APP_CONTEXT + ".war");
        otherWar.addClass(ServletInOtherWar.class);

        // TODO: Currently, due to an issue in AS7 integration with Arquillian, the web-app context and the
        // .ear name should be the same or else you run into test deployment failures like:
        // Caused by: java.lang.IllegalStateException: Error launching test at
        // http://127.0.0.1:8080/<earname>/ArquillianServletRunner?outputMode=serializedObject&className=org.jboss.as.test.spec.ear.classpath.unit.SubDeploymentAvailableInClassPathTestCase&methodName=testEjbClassAvailableInServlet. Kept on getting 404s.
View Full Code Here

    private URL ejbServletUrl;

    @Deployment(name = "servlet", order = 3)
    public static Archive<?> deployServlet() {
        WebArchive war = getServlet("ejb3-servlet.war");
        war.addClass(EJBServlet.class);
        war.addAsWebInfResource(ServletUnitTestCase.class.getPackage(), "jboss-web.xml", "jboss-web.xml");
        war.addAsWebInfResource(ServletUnitTestCase.class.getPackage(), "web.xml", "web.xml");
        war.addAsManifestResource(new StringAsset("Dependencies: deployment.ejb3-servlet-ejbs.jar \n"), "MANIFEST.MF");
        log.info(war.toString(true));
        return war;
View Full Code Here

        ear.addAsModule(getEjbs("ejb3-ear-servlet-ejbs.jar"));

        WebArchive war = getServlet("ejb3-ear-servlet.war");
        war.addAsWebInfResource(ServletUnitTestCase.class.getPackage(), "jboss-web-ear.xml", "jboss-web.xml");
        war.addAsWebInfResource(ServletUnitTestCase.class.getPackage(), "web-ear.xml", "web.xml");
        war.addClass(EJBServletEar.class);
        ear.addAsModule(war);

        ear.addAsManifestResource(ServletUnitTestCase.class.getPackage(), "application.xml", "application.xml");
        log.info(ear.toString(true));
        return ear;
View Full Code Here

    URL baseUrl;

    protected static WebArchive createWAR(Class beanClass) {
        final WebArchive war = ShrinkWrap.create(WebArchive.class, WAR_DEPLOYMENT_UNIT_NAME);

        war.addClass(beanClass);

        ClassLoader tccl = Thread.currentThread().getContextClassLoader();

        // war.addAsWebResource(tccl.getResource(DEPLOYMENT_RESOURCES + "/application.xml"), "application.xml");
        war.addAsWebResource(tccl.getResource(DEPLOYMENT_RESOURCES + "/index.html"), "index.html");
View Full Code Here

    }

    @Deployment(name = DEPLOYMENT_NAME, managed = false, testable = false)
    public static WebArchive endpointWar() {
        final WebArchive archive = ShrinkWrap.create(WebArchive.class, DEPLOYMENT_NAME);
        archive.addClass(SimpleRestEndpoint.class);
        archive.setWebXML("osgi/jaxrs/web.xml");
        // [SHRINKWRAP-278] WebArchive.setManifest() results in WEB-INF/classes/META-INF/MANIFEST.MF
        archive.add(new Asset() {
            public InputStream openStream() {
                ManifestBuilder builder = ManifestBuilder.newInstance();
View Full Code Here

        } catch (Exception e) {
            // ignore
        }

        WebArchive war = ShrinkWrap.create(WebArchive.class, "web-secure-client-cert.war");
        war.addClass(SecuredServlet.class);

        war.addAsWebInfResource(WebSecurityCERTTestCase.class.getPackage(), "jboss-web.xml", "jboss-web.xml");
        war.addAsWebInfResource(WebSecurityCERTTestCase.class.getPackage(), "web.xml", "web.xml");

        war.addAsResource(WebSecurityCERTTestCase.class.getPackage(), "users.properties", "users.properties");
View Full Code Here

public class WebSecurityBASICTestCase extends WebSecurityPasswordBasedBase {

    @Deployment
    public static WebArchive deployment() throws Exception {
        WebArchive war = ShrinkWrap.create(WebArchive.class, "web-secure-basic.war");
        war.addClass(SecuredServlet.class);

        war.addAsWebInfResource(WebSecurityBASICTestCase.class.getPackage(), "jboss-web.xml", "jboss-web.xml");
        war.addAsWebInfResource(WebSecurityBASICTestCase.class.getPackage(), "web.xml", "web.xml");

        war.addAsResource(WebSecurityBASICTestCase.class.getPackage(), "users.properties", "users.properties");
View Full Code Here

    private File getBrokenWar() {
        if (brokenWar != null) return brokenWar;

        WebArchive war = ShrinkWrap.create(WebArchive.class, "deployment2.war");
        war.addClass(SimpleServlet.class);
        war.addAsWebInfResource(new StringAsset("Malformed"), "web.xml");
        brokenWar = new File(System.getProperty("java.io.tmpdir") + File.separator + "malformedDeployment.war");
        brokenWar.deleteOnExit();
        new ZipExporterImpl(war).exportTo(brokenWar, true);
        return brokenWar;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.