Commit f2be871b55686345e813325438bc97dea29a3aeb
1 parent
231d335a
Exists in
master
IN PROGRESS - issue FWK-119: Testes da extensão Servlet
https://demoiselle.atlassian.net/browse/FWK-119
Showing
11 changed files
with
402 additions
and
147 deletions
Show diff stats
impl/extension/servlet/src/test/java/producer/HttpServletRequestProducerTest.java
0 → 100644
@@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
1 | +package producer; | ||
2 | + | ||
3 | +import static org.junit.Assert.assertEquals; | ||
4 | +import static org.junit.Assert.assertTrue; | ||
5 | +import static org.junit.Assert.fail; | ||
6 | + | ||
7 | +import java.net.URL; | ||
8 | + | ||
9 | +import javax.inject.Inject; | ||
10 | + | ||
11 | +import org.apache.commons.httpclient.HttpClient; | ||
12 | +import org.apache.commons.httpclient.HttpStatus; | ||
13 | +import org.apache.commons.httpclient.methods.GetMethod; | ||
14 | +import org.jboss.arquillian.container.test.api.Deployment; | ||
15 | +import org.jboss.arquillian.junit.Arquillian; | ||
16 | +import org.jboss.arquillian.test.api.ArquillianResource; | ||
17 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
18 | +import org.junit.Test; | ||
19 | +import org.junit.runner.RunWith; | ||
20 | + | ||
21 | +import test.Tests; | ||
22 | +import br.gov.frameworkdemoiselle.context.RequestContext; | ||
23 | + | ||
24 | +@RunWith(Arquillian.class) | ||
25 | +public class HttpServletRequestProducerTest { | ||
26 | + | ||
27 | + private static final String PATH = "src/test/resources/producer"; | ||
28 | + | ||
29 | + @ArquillianResource | ||
30 | + private URL deploymentUrl; | ||
31 | + | ||
32 | + @Deployment(testable = false) | ||
33 | + public static WebArchive createDeployment() { | ||
34 | + return Tests.createDeployment().addClass(RequestServlet.class) | ||
35 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | ||
36 | + } | ||
37 | + | ||
38 | + @Test | ||
39 | + public void createR() { | ||
40 | + HttpClient client = new HttpClient(); | ||
41 | + GetMethod method = new GetMethod(deploymentUrl + "/requestproducer"); | ||
42 | + try { | ||
43 | + int status = client.executeMethod(method); | ||
44 | + assertEquals(HttpStatus.SC_OK, status); | ||
45 | + } catch (Exception e) { | ||
46 | + fail(); | ||
47 | + } | ||
48 | + } | ||
49 | + | ||
50 | +} |
impl/extension/servlet/src/test/java/producer/HttpServletResponseProducerTest.java
0 → 100644
@@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
1 | +package producer; | ||
2 | + | ||
3 | +import static org.junit.Assert.assertEquals; | ||
4 | +import static org.junit.Assert.assertTrue; | ||
5 | +import static org.junit.Assert.fail; | ||
6 | + | ||
7 | +import java.net.URL; | ||
8 | + | ||
9 | +import javax.inject.Inject; | ||
10 | + | ||
11 | +import org.apache.commons.httpclient.HttpClient; | ||
12 | +import org.apache.commons.httpclient.HttpStatus; | ||
13 | +import org.apache.commons.httpclient.methods.GetMethod; | ||
14 | +import org.jboss.arquillian.container.test.api.Deployment; | ||
15 | +import org.jboss.arquillian.junit.Arquillian; | ||
16 | +import org.jboss.arquillian.test.api.ArquillianResource; | ||
17 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
18 | +import org.junit.Test; | ||
19 | +import org.junit.runner.RunWith; | ||
20 | + | ||
21 | +import test.Tests; | ||
22 | +import br.gov.frameworkdemoiselle.context.RequestContext; | ||
23 | + | ||
24 | +@RunWith(Arquillian.class) | ||
25 | +public class HttpServletResponseProducerTest { | ||
26 | + | ||
27 | + private static final String PATH = "src/test/resources/producer"; | ||
28 | + | ||
29 | + @ArquillianResource | ||
30 | + private URL deploymentUrl; | ||
31 | + | ||
32 | + @Deployment(testable = false) | ||
33 | + public static WebArchive createDeployment() { | ||
34 | + return Tests.createDeployment().addClass(RequestServlet.class) | ||
35 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | ||
36 | + } | ||
37 | + | ||
38 | + @Test | ||
39 | + public void createResponse() { | ||
40 | + HttpClient client = new HttpClient(); | ||
41 | + GetMethod method = new GetMethod(deploymentUrl + "/responseproducer"); | ||
42 | + try { | ||
43 | + int status = client.executeMethod(method); | ||
44 | + assertEquals(HttpStatus.SC_OK, status); | ||
45 | + } catch (Exception e) { | ||
46 | + fail(); | ||
47 | + } | ||
48 | + } | ||
49 | + | ||
50 | +} |
impl/extension/servlet/src/test/java/producer/RequestServlet.java
0 → 100644
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +package producer; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | + | ||
5 | +import javax.servlet.ServletException; | ||
6 | +import javax.servlet.http.HttpServlet; | ||
7 | +import javax.servlet.http.HttpServletRequest; | ||
8 | +import javax.servlet.http.HttpServletResponse; | ||
9 | + | ||
10 | +import org.apache.http.HttpStatus; | ||
11 | + | ||
12 | +import br.gov.frameworkdemoiselle.util.Beans; | ||
13 | + | ||
14 | +public class RequestServlet extends HttpServlet { | ||
15 | + | ||
16 | + private static final long serialVersionUID = 1L; | ||
17 | + | ||
18 | + @Override | ||
19 | + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
20 | + | ||
21 | + HttpServletRequest httpRequest = Beans.getReference(HttpServletRequest.class); | ||
22 | + | ||
23 | + if (httpRequest != null) { | ||
24 | + response.setStatus(HttpStatus.SC_OK); | ||
25 | + } else { | ||
26 | + response.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR); | ||
27 | + } | ||
28 | + } | ||
29 | + | ||
30 | +} |
impl/extension/servlet/src/test/java/producer/ResponseServlet.java
0 → 100644
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +package producer; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | + | ||
5 | +import javax.servlet.ServletException; | ||
6 | +import javax.servlet.http.HttpServlet; | ||
7 | +import javax.servlet.http.HttpServletRequest; | ||
8 | +import javax.servlet.http.HttpServletResponse; | ||
9 | + | ||
10 | +import org.apache.http.HttpStatus; | ||
11 | + | ||
12 | +import br.gov.frameworkdemoiselle.util.Beans; | ||
13 | + | ||
14 | +public class ResponseServlet extends HttpServlet { | ||
15 | + | ||
16 | + private static final long serialVersionUID = 1L; | ||
17 | + | ||
18 | + @Override | ||
19 | + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
20 | + | ||
21 | + HttpServletResponse httpResponse = Beans.getReference(HttpServletResponse.class); | ||
22 | + | ||
23 | + if (httpResponse != null) { | ||
24 | + response.setStatus(HttpStatus.SC_OK); | ||
25 | + } else { | ||
26 | + response.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR); | ||
27 | + } | ||
28 | + } | ||
29 | + | ||
30 | +} |
impl/extension/servlet/src/test/java/security/SecurityServlet.java
0 → 100644
@@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
1 | +package security; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | + | ||
5 | +import javax.inject.Inject; | ||
6 | +import javax.servlet.ServletException; | ||
7 | +import javax.servlet.annotation.WebServlet; | ||
8 | +import javax.servlet.http.HttpServlet; | ||
9 | +import javax.servlet.http.HttpServletRequest; | ||
10 | +import javax.servlet.http.HttpServletResponse; | ||
11 | + | ||
12 | +import org.apache.http.HttpStatus; | ||
13 | + | ||
14 | +import br.gov.frameworkdemoiselle.security.Credentials; | ||
15 | +import br.gov.frameworkdemoiselle.security.SecurityContext; | ||
16 | + | ||
17 | +@WebServlet("/login") | ||
18 | +public class SecurityServlet extends HttpServlet { | ||
19 | + | ||
20 | + private static final long serialVersionUID = 1L; | ||
21 | + | ||
22 | + @Inject | ||
23 | + private SecurityContext securityContext; | ||
24 | + | ||
25 | + @Inject | ||
26 | + private Credentials credentials; | ||
27 | + | ||
28 | + @Override | ||
29 | + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
30 | + super.doGet(request, response); | ||
31 | + | ||
32 | + credentials.setUsername("users"); | ||
33 | + credentials.setPassword("users"); | ||
34 | + securityContext.login(); | ||
35 | + response.setStatus(HttpStatus.SC_OK); | ||
36 | + } | ||
37 | +} |
impl/extension/servlet/src/test/java/security/SecurityTest.java
0 → 100644
@@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
1 | +package security; | ||
2 | + | ||
3 | +import static org.junit.Assert.assertEquals; | ||
4 | +import static org.junit.Assert.fail; | ||
5 | + | ||
6 | +import java.io.IOException; | ||
7 | +import java.net.URL; | ||
8 | + | ||
9 | +import org.apache.commons.httpclient.HttpClient; | ||
10 | +import org.apache.commons.httpclient.HttpException; | ||
11 | +import org.apache.commons.httpclient.HttpStatus; | ||
12 | +import org.apache.commons.httpclient.methods.GetMethod; | ||
13 | +import org.jboss.arquillian.container.test.api.Deployment; | ||
14 | +import org.jboss.arquillian.junit.Arquillian; | ||
15 | +import org.jboss.arquillian.test.api.ArquillianResource; | ||
16 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
17 | +import org.junit.Test; | ||
18 | +import org.junit.runner.RunWith; | ||
19 | + | ||
20 | +import test.Tests; | ||
21 | + | ||
22 | +@RunWith(Arquillian.class) | ||
23 | +public class SecurityTest { | ||
24 | + | ||
25 | + private static final String PATH = "src/test/resources/security"; | ||
26 | + | ||
27 | + @ArquillianResource | ||
28 | + private URL deploymentUrl; | ||
29 | + | ||
30 | + @Deployment(testable = false) | ||
31 | + public static WebArchive createDeployment() { | ||
32 | + return Tests.createDeployment().addClass(SecurityServlet.class) | ||
33 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | ||
34 | + } | ||
35 | + | ||
36 | + @Test | ||
37 | + public void login() { | ||
38 | + HttpClient client = new HttpClient(); | ||
39 | + GetMethod method = new GetMethod(deploymentUrl + "/login"); | ||
40 | + try { | ||
41 | + int status = client.executeMethod(method); | ||
42 | + assertEquals(HttpStatus.SC_OK, status); | ||
43 | + } catch (HttpException e) { | ||
44 | + fail(); | ||
45 | + } catch (IOException e) { | ||
46 | + e.printStackTrace(); | ||
47 | + } | ||
48 | + } | ||
49 | + | ||
50 | +} |
impl/extension/servlet/src/test/java/xxxx/XServlet.java
@@ -1,37 +0,0 @@ | @@ -1,37 +0,0 @@ | ||
1 | -package xxxx; | ||
2 | - | ||
3 | -import java.io.IOException; | ||
4 | - | ||
5 | -import javax.inject.Inject; | ||
6 | -import javax.servlet.ServletException; | ||
7 | -import javax.servlet.annotation.WebServlet; | ||
8 | -import javax.servlet.http.HttpServlet; | ||
9 | -import javax.servlet.http.HttpServletRequest; | ||
10 | -import javax.servlet.http.HttpServletResponse; | ||
11 | - | ||
12 | -import br.gov.frameworkdemoiselle.security.Credentials; | ||
13 | -import br.gov.frameworkdemoiselle.security.SecurityContext; | ||
14 | - | ||
15 | -@WebServlet("/login") | ||
16 | -public class XServlet extends HttpServlet { | ||
17 | - | ||
18 | - private static final long serialVersionUID = 1L; | ||
19 | - | ||
20 | - @Inject | ||
21 | - private SecurityContext securityContext; | ||
22 | - | ||
23 | - @Inject | ||
24 | - private Credentials credentials; | ||
25 | - | ||
26 | - @Override | ||
27 | - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
28 | - super.doGet(request, response); | ||
29 | - | ||
30 | - System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); | ||
31 | - | ||
32 | - credentials.setUsername("admin"); | ||
33 | - credentials.setPassword("changeit"); | ||
34 | - | ||
35 | - securityContext.login(); | ||
36 | - } | ||
37 | -} |
impl/extension/servlet/src/test/java/xxxx/XTest.java
@@ -1,58 +0,0 @@ | @@ -1,58 +0,0 @@ | ||
1 | -package xxxx; | ||
2 | - | ||
3 | -import java.io.IOException; | ||
4 | -import java.net.URL; | ||
5 | - | ||
6 | -import org.apache.commons.httpclient.HttpClient; | ||
7 | -import org.apache.commons.httpclient.HttpException; | ||
8 | -import org.apache.commons.httpclient.methods.GetMethod; | ||
9 | -import org.jboss.arquillian.container.test.api.Deployment; | ||
10 | -import org.jboss.arquillian.junit.Arquillian; | ||
11 | -import org.jboss.arquillian.test.api.ArquillianResource; | ||
12 | -import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
13 | -import org.junit.Test; | ||
14 | -import org.junit.runner.RunWith; | ||
15 | - | ||
16 | -import test.Tests; | ||
17 | - | ||
18 | -@RunWith(Arquillian.class) | ||
19 | -public class XTest { | ||
20 | - | ||
21 | - private static final String PATH = "src/test/resources/xxx"; | ||
22 | - | ||
23 | - @ArquillianResource | ||
24 | - private URL deploymentUrl; | ||
25 | - | ||
26 | - @Deployment(testable = false) | ||
27 | - public static WebArchive createDeployment() { | ||
28 | - return Tests.createDeployment().addClass(XServlet.class) | ||
29 | - .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | ||
30 | - } | ||
31 | - | ||
32 | - @Test | ||
33 | - public void xxxx() { | ||
34 | - HttpClient client = new HttpClient(); | ||
35 | - GetMethod method = new GetMethod(deploymentUrl + "/login"); | ||
36 | - | ||
37 | - try { | ||
38 | - int status = client.executeMethod(method); | ||
39 | - System.out.println(status); | ||
40 | - | ||
41 | - } catch (HttpException e) { | ||
42 | - e.printStackTrace(); | ||
43 | - | ||
44 | - } catch (IOException e) { | ||
45 | - e.printStackTrace(); | ||
46 | - } | ||
47 | - | ||
48 | - // browser.open(deploymentUrl + "login"); | ||
49 | - | ||
50 | - // browser.type("id=xxx-input", "demo"); | ||
51 | - // browser.waitForPageToLoad("15000"); | ||
52 | - | ||
53 | - // assertTrue("User should be logged in!", | ||
54 | - // browser.isElementPresent("xpath=//li[contains(text(), 'Welcome')]")); | ||
55 | - // assertTrue("Username should be shown!", | ||
56 | - // browser.isElementPresent("xpath=//p[contains(text(), 'You are signed in as demo.')]")); | ||
57 | - } | ||
58 | -} |
impl/extension/servlet/src/test/resources/producer/web.xml
0 → 100644
@@ -0,0 +1,72 @@ | @@ -0,0 +1,72 @@ | ||
1 | +<!-- | ||
2 | + Demoiselle Framework | ||
3 | + Copyright (C) 2010 SERPRO | ||
4 | + ============================================================================ | ||
5 | + This file is part of Demoiselle Framework. | ||
6 | + | ||
7 | + Demoiselle Framework is free software; you can redistribute it and/or | ||
8 | + modify it under the terms of the GNU Lesser General Public License version 3 | ||
9 | + as published by the Free Software Foundation. | ||
10 | + | ||
11 | + This program is distributed in the hope that it will be useful, | ||
12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | + GNU General Public License for more details. | ||
15 | + | ||
16 | + You should have received a copy of the GNU Lesser General Public License version 3 | ||
17 | + along with this program; if not, see <http://www.gnu.org/licenses /> | ||
18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
19 | + Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | + ============================================================================ | ||
21 | + Este arquivo é parte do Framework Demoiselle. | ||
22 | + | ||
23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | ||
24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | ||
25 | + do Software Livre (FSF). | ||
26 | + | ||
27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | ||
28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | ||
29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | ||
30 | + para maiores detalhes. | ||
31 | + | ||
32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | ||
33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | ||
34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | ||
35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | ||
36 | +--> | ||
37 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
38 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> | ||
39 | + | ||
40 | + <listener> | ||
41 | + <listener-class>br.gov.frameworkdemoiselle.util.ServletListener</listener-class> | ||
42 | + </listener> | ||
43 | + | ||
44 | + <filter> | ||
45 | + <filter-name>Demoiselle Servlet Filter</filter-name> | ||
46 | + <filter-class>br.gov.frameworkdemoiselle.util.ServletFilter</filter-class> | ||
47 | + </filter> | ||
48 | + <filter-mapping> | ||
49 | + <filter-name>Demoiselle Servlet Filter</filter-name> | ||
50 | + <url-pattern>/*</url-pattern> | ||
51 | + </filter-mapping> | ||
52 | + | ||
53 | + <servlet> | ||
54 | + <servlet-name>Request Class</servlet-name> | ||
55 | + <servlet-class>producer.RequestServlet</servlet-class> | ||
56 | + </servlet> | ||
57 | + | ||
58 | + <servlet-mapping> | ||
59 | + <servlet-name>Request Class</servlet-name> | ||
60 | + <url-pattern>/requestproducer</url-pattern> | ||
61 | + </servlet-mapping> | ||
62 | + | ||
63 | + <servlet> | ||
64 | + <servlet-name>Response xClass</servlet-name> | ||
65 | + <servlet-class>producer.ResponseServlet</servlet-class> | ||
66 | + </servlet> | ||
67 | + | ||
68 | + <servlet-mapping> | ||
69 | + <servlet-name>Response xClass</servlet-name> | ||
70 | + <url-pattern>/responseproducer</url-pattern> | ||
71 | + </servlet-mapping> | ||
72 | +</web-app> | ||
0 | \ No newline at end of file | 73 | \ No newline at end of file |
impl/extension/servlet/src/test/resources/security/web.xml
0 → 100644
@@ -0,0 +1,83 @@ | @@ -0,0 +1,83 @@ | ||
1 | +<!-- | ||
2 | + Demoiselle Framework | ||
3 | + Copyright (C) 2010 SERPRO | ||
4 | + ============================================================================ | ||
5 | + This file is part of Demoiselle Framework. | ||
6 | + | ||
7 | + Demoiselle Framework is free software; you can redistribute it and/or | ||
8 | + modify it under the terms of the GNU Lesser General Public License version 3 | ||
9 | + as published by the Free Software Foundation. | ||
10 | + | ||
11 | + This program is distributed in the hope that it will be useful, | ||
12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | + GNU General Public License for more details. | ||
15 | + | ||
16 | + You should have received a copy of the GNU Lesser General Public License version 3 | ||
17 | + along with this program; if not, see <http://www.gnu.org/licenses /> | ||
18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
19 | + Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | + ============================================================================ | ||
21 | + Este arquivo é parte do Framework Demoiselle. | ||
22 | + | ||
23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | ||
24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | ||
25 | + do Software Livre (FSF). | ||
26 | + | ||
27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | ||
28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | ||
29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | ||
30 | + para maiores detalhes. | ||
31 | + | ||
32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | ||
33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | ||
34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | ||
35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | ||
36 | +--> | ||
37 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
38 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> | ||
39 | + | ||
40 | + <listener> | ||
41 | + <listener-class>br.gov.frameworkdemoiselle.util.ServletListener</listener-class> | ||
42 | + </listener> | ||
43 | + | ||
44 | + <filter> | ||
45 | + <filter-name>Demoiselle Servlet Filter</filter-name> | ||
46 | + <filter-class>br.gov.frameworkdemoiselle.util.ServletFilter</filter-class> | ||
47 | + </filter> | ||
48 | + <filter-mapping> | ||
49 | + <filter-name>Demoiselle Servlet Filter</filter-name> | ||
50 | + <url-pattern>/*</url-pattern> | ||
51 | + </filter-mapping> | ||
52 | + | ||
53 | + | ||
54 | + <security-constraint> | ||
55 | + <web-resource-collection> | ||
56 | + <web-resource-name>myapp</web-resource-name> | ||
57 | + <url-pattern>/\*</url-pattern> | ||
58 | + <http-method>GET</http-method> | ||
59 | + </web-resource-collection> | ||
60 | + <auth-constraint> | ||
61 | + <role-name>users</role-name> | ||
62 | + </auth-constraint> | ||
63 | + </security-constraint> | ||
64 | + <login-config> | ||
65 | + <auth-method>BASIC</auth-method> | ||
66 | + <realm-name>default</realm-name> | ||
67 | + </login-config> | ||
68 | + <security-role> | ||
69 | + <role-name>users</role-name> | ||
70 | + </security-role> | ||
71 | + | ||
72 | + <servlet> | ||
73 | + <servlet-name>Security Class</servlet-name> | ||
74 | + <servlet-class>security.SecurityServlet</servlet-class> | ||
75 | + </servlet> | ||
76 | + | ||
77 | + <servlet-mapping> | ||
78 | + <servlet-name>Security Class</servlet-name> | ||
79 | + <url-pattern>/login</url-pattern> | ||
80 | + </servlet-mapping> | ||
81 | + | ||
82 | + | ||
83 | +</web-app> | ||
0 | \ No newline at end of file | 84 | \ No newline at end of file |
impl/extension/servlet/src/test/resources/xxx/web.xml
@@ -1,52 +0,0 @@ | @@ -1,52 +0,0 @@ | ||
1 | -<!-- | ||
2 | - Demoiselle Framework | ||
3 | - Copyright (C) 2010 SERPRO | ||
4 | - ============================================================================ | ||
5 | - This file is part of Demoiselle Framework. | ||
6 | - | ||
7 | - Demoiselle Framework is free software; you can redistribute it and/or | ||
8 | - modify it under the terms of the GNU Lesser General Public License version 3 | ||
9 | - as published by the Free Software Foundation. | ||
10 | - | ||
11 | - This program is distributed in the hope that it will be useful, | ||
12 | - but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | - GNU General Public License for more details. | ||
15 | - | ||
16 | - You should have received a copy of the GNU Lesser General Public License version 3 | ||
17 | - along with this program; if not, see <http://www.gnu.org/licenses /> | ||
18 | - or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
19 | - Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | - ============================================================================ | ||
21 | - Este arquivo é parte do Framework Demoiselle. | ||
22 | - | ||
23 | - O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | ||
24 | - modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | ||
25 | - do Software Livre (FSF). | ||
26 | - | ||
27 | - Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | ||
28 | - GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | ||
29 | - APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | ||
30 | - para maiores detalhes. | ||
31 | - | ||
32 | - Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | ||
33 | - "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | ||
34 | - ou escreva para a Fundação do Software Livre (FSF) Inc., | ||
35 | - 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | ||
36 | ---> | ||
37 | -<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | ||
38 | - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> | ||
39 | - | ||
40 | - <listener> | ||
41 | - <listener-class>br.gov.frameworkdemoiselle.util.ServletListener</listener-class> | ||
42 | - </listener> | ||
43 | - <filter> | ||
44 | - <filter-name>Demoiselle Servlet Filter</filter-name> | ||
45 | - <filter-class>br.gov.frameworkdemoiselle.util.ServletFilter</filter-class> | ||
46 | - </filter> | ||
47 | - <filter-mapping> | ||
48 | - <filter-name>Demoiselle Servlet Filter</filter-name> | ||
49 | - <url-pattern>/*</url-pattern> | ||
50 | - </filter-mapping> | ||
51 | - | ||
52 | -</web-app> | ||
53 | \ No newline at end of file | 0 | \ No newline at end of file |