|
| 1 | +/* |
| 2 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
| 3 | + * |
| 4 | + * Copyright (c) 2013 Red Hat and/or its affiliates. All rights reserved. |
| 5 | + */ |
| 6 | +package org.javaee7.servlet.metadata.complete; |
| 7 | + |
| 8 | +import java.io.File; |
| 9 | +import java.io.PrintWriter; |
| 10 | +import javax.servlet.http.HttpServletRequest; |
| 11 | +import javax.servlet.http.HttpServletResponse; |
| 12 | +import org.jboss.arquillian.container.test.api.Deployment; |
| 13 | +import org.jboss.arquillian.container.test.api.TargetsContainer; |
| 14 | +import org.jboss.arquillian.junit.Arquillian; |
| 15 | +import org.jboss.shrinkwrap.api.ShrinkWrap; |
| 16 | +import org.jboss.shrinkwrap.api.spec.WebArchive; |
| 17 | +import org.junit.Test; |
| 18 | +import static org.junit.Assert.*; |
| 19 | +import org.junit.runner.RunWith; |
| 20 | + |
| 21 | +/** |
| 22 | + * @author Arun Gupta |
| 23 | + */ |
| 24 | +@RunWith(Arquillian.class) |
| 25 | +public class TestServletTest { |
| 26 | + |
| 27 | + private static final String WEBAPP_SRC = "src/main/webapp"; |
| 28 | + |
| 29 | + /** |
| 30 | + * Arquillian specific method for creating a file which can be deployed |
| 31 | + * while executing the test. |
| 32 | + * |
| 33 | + * @return a war file |
| 34 | + */ |
| 35 | + @Deployment(testable = false) |
| 36 | + @TargetsContainer("wildfly-arquillian") |
| 37 | + public static WebArchive createDeployment() { |
| 38 | + WebArchive war = ShrinkWrap.create(WebArchive.class). |
| 39 | + addClass(TestServlet.class). |
| 40 | + addAsWebInfResource((new File(WEBAPP_SRC + "/WEB-INF", "web.xml"))); |
| 41 | + System.out.println(war.toString(true)); |
| 42 | + return war; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * Test of processRequest method, of class TestServlet. |
| 47 | + */ |
| 48 | + @Test |
| 49 | + public void testProcessRequest() throws Exception { |
| 50 | + System.out.println("processRequest"); |
| 51 | + HttpServletRequest request = null; |
| 52 | + HttpServletResponse response = null; |
| 53 | + TestServlet instance = new TestServlet(); |
| 54 | + instance.processRequest(request, response); |
| 55 | + PrintWriter writer = response.getWriter(); |
| 56 | +// response. |
| 57 | + } |
| 58 | +} |
0 commit comments