Commit c3a8770f0d8aa4fdc61361c43a21fad3521e537d

Authored by Cleverson Sacramento
1 parent 611657cc
Exists in master

Mudando a dependência para o servlet-api 3 ou invés do 2.5

impl/core/src/test/java/br/gov/frameworkdemoiselle/util/BeansTest.java
@@ -50,7 +50,6 @@ import javax.enterprise.inject.spi.Bean; @@ -50,7 +50,6 @@ import javax.enterprise.inject.spi.Bean;
50 import javax.enterprise.inject.spi.BeanManager; 50 import javax.enterprise.inject.spi.BeanManager;
51 51
52 import org.easymock.EasyMock; 52 import org.easymock.EasyMock;
53 -import org.junit.Ignore;  
54 import org.junit.Test; 53 import org.junit.Test;
55 import org.junit.runner.RunWith; 54 import org.junit.runner.RunWith;
56 import org.powermock.api.easymock.PowerMock; 55 import org.powermock.api.easymock.PowerMock;
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/proxy/HttpSessionProxy.java
@@ -1,147 +0,0 @@ @@ -1,147 +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 -package br.gov.frameworkdemoiselle.internal.proxy;  
38 -  
39 -import java.io.Serializable;  
40 -import java.util.Enumeration;  
41 -  
42 -import javax.servlet.ServletContext;  
43 -import javax.servlet.http.HttpSession;  
44 -import javax.servlet.http.HttpSessionContext;  
45 -  
46 -@SuppressWarnings("deprecation")  
47 -public class HttpSessionProxy implements HttpSession, Serializable {  
48 -  
49 - private static final long serialVersionUID = 1L;  
50 -  
51 - private transient final HttpSession delegate;  
52 -  
53 - public HttpSessionProxy(HttpSession httpSession) {  
54 - this.delegate = httpSession;  
55 - }  
56 -  
57 - @Override  
58 - public long getCreationTime() {  
59 - return this.delegate.getCreationTime();  
60 - }  
61 -  
62 - @Override  
63 - public String getId() {  
64 - return this.delegate.getId();  
65 - }  
66 -  
67 - @Override  
68 - public long getLastAccessedTime() {  
69 - return this.delegate.getLastAccessedTime();  
70 - }  
71 -  
72 - @Override  
73 - public ServletContext getServletContext() {  
74 - return this.delegate.getServletContext();  
75 - }  
76 -  
77 - @Override  
78 - public void setMaxInactiveInterval(int interval) {  
79 - this.delegate.setMaxInactiveInterval(interval);  
80 - }  
81 -  
82 - @Override  
83 - public int getMaxInactiveInterval() {  
84 - return this.delegate.getMaxInactiveInterval();  
85 - }  
86 -  
87 - @Override  
88 - @Deprecated  
89 - public HttpSessionContext getSessionContext() {  
90 - return this.delegate.getSessionContext();  
91 - }  
92 -  
93 - @Override  
94 - public Object getAttribute(String name) {  
95 - return this.delegate.getAttribute(name);  
96 - }  
97 -  
98 - @Override  
99 - @Deprecated  
100 - public Object getValue(String name) {  
101 - return this.delegate.getValue(name);  
102 - }  
103 -  
104 - @Override  
105 - public Enumeration<?> getAttributeNames() {  
106 - return this.delegate.getAttributeNames();  
107 - }  
108 -  
109 - @Override  
110 - @Deprecated  
111 - public String[] getValueNames() {  
112 - return this.delegate.getValueNames();  
113 - }  
114 -  
115 - @Override  
116 - public void setAttribute(String name, Object value) {  
117 - this.delegate.setAttribute(name, value);  
118 - }  
119 -  
120 - @Override  
121 - @Deprecated  
122 - public void putValue(String name, Object value) {  
123 - this.delegate.putValue(name, value);  
124 - }  
125 -  
126 - @Override  
127 - public void removeAttribute(String name) {  
128 - this.delegate.removeAttribute(name);  
129 - }  
130 -  
131 - @Override  
132 - @Deprecated  
133 - public void removeValue(String name) {  
134 - this.delegate.removeValue(name);  
135 - }  
136 -  
137 - @Override  
138 - public void invalidate() {  
139 - this.delegate.invalidate();  
140 - }  
141 -  
142 - @Override  
143 - public boolean isNew() {  
144 - return this.delegate.isNew();  
145 - }  
146 -  
147 -}  
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/producer/HttpSessionProducerTest.java
@@ -1,70 +0,0 @@ @@ -1,70 +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 -package br.gov.frameworkdemoiselle.internal.producer;  
38 -import org.junit.Ignore;  
39 -import javax.servlet.http.HttpServletRequest;  
40 -  
41 -import org.easymock.EasyMock;  
42 -import org.junit.Assert;  
43 -import org.junit.Before;  
44 -import org.junit.Test;  
45 -import org.junit.runner.RunWith;  
46 -import org.powermock.api.easymock.PowerMock;  
47 -import org.powermock.core.classloader.annotations.PrepareForTest;  
48 -import org.powermock.modules.junit4.PowerMockRunner;  
49 -  
50 -import br.gov.frameworkdemoiselle.internal.proxy.HttpSessionProxy;  
51 -@Ignore  
52 -@RunWith(PowerMockRunner.class)  
53 -@PrepareForTest({ HttpServletRequest.class })  
54 -public class HttpSessionProducerTest {  
55 -  
56 - private HttpSessionProducer producer;  
57 -  
58 - @Before  
59 - public void before() {  
60 - producer = new HttpSessionProducer();  
61 - }  
62 -  
63 - @Test  
64 - public void testCreate() {  
65 - HttpServletRequest request = PowerMock.createMock(HttpServletRequest.class);  
66 - EasyMock.expect(request.getSession()).andReturn(null);  
67 - Assert.assertTrue(producer.create(request).getClass().equals(HttpSessionProxy.class));  
68 - }  
69 -  
70 -}  
impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/proxy/HttpSessionProxyTest.java
@@ -1,125 +0,0 @@ @@ -1,125 +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 -  
38 -package br.gov.frameworkdemoiselle.internal.proxy;  
39 -  
40 -import static org.easymock.EasyMock.expect;  
41 -import static org.easymock.EasyMock.replay;  
42 -import static org.easymock.EasyMock.verify;  
43 -import static org.junit.Assert.assertEquals;  
44 -  
45 -import java.util.Enumeration;  
46 -  
47 -import javax.servlet.ServletContext;  
48 -import javax.servlet.http.HttpSession;  
49 -import javax.servlet.http.HttpSessionContext;  
50 -  
51 -import org.junit.Before;  
52 -import org.junit.Test;  
53 -import org.junit.runner.RunWith;  
54 -import org.powermock.api.easymock.PowerMock;  
55 -import org.powermock.modules.junit4.PowerMockRunner;  
56 -  
57 -@SuppressWarnings("deprecation")  
58 -@RunWith(PowerMockRunner.class)  
59 -public class HttpSessionProxyTest {  
60 -  
61 - private HttpSessionProxy proxy;  
62 -  
63 - private ServletContext servletContext;  
64 -  
65 - private Enumeration<?> enumeration;  
66 -  
67 - private HttpSession session;  
68 -  
69 - private HttpSessionContext sessionContext;  
70 -  
71 - @Before  
72 - public void before() {  
73 - session = PowerMock.createMock(HttpSession.class);  
74 - servletContext = PowerMock.createMock(ServletContext.class);  
75 - enumeration = PowerMock.createMock(Enumeration.class);  
76 - sessionContext = PowerMock.createMock(HttpSessionContext.class);  
77 -  
78 - expect(session.getValueNames()).andReturn(new String[] { "abcdef" });  
79 - expect(session.getValue("value")).andReturn("value");  
80 - expect(session.getSessionContext()).andReturn(sessionContext);  
81 - expect(session.getCreationTime()).andReturn(10L);  
82 - expect(session.getId()).andReturn("ID");  
83 - expect(session.getLastAccessedTime()).andReturn(1L);  
84 - expect(session.getServletContext()).andReturn(servletContext);  
85 - expect(session.getMaxInactiveInterval()).andReturn(2);  
86 - expect(session.getAttribute("attribute")).andReturn("attribute-1");  
87 - expect(session.getAttributeNames()).andReturn(enumeration);  
88 - expect(session.isNew()).andReturn(true);  
89 -  
90 - session.removeValue("removeValue");  
91 - session.putValue("put", "it");  
92 - session.invalidate();  
93 - session.removeAttribute("remove");  
94 - session.setAttribute("name", "object");  
95 - session.setMaxInactiveInterval(1);  
96 -  
97 - replay(session);  
98 -  
99 - proxy = new HttpSessionProxy(session);  
100 - }  
101 -  
102 - @Test  
103 - public void testDelegation() {  
104 - assertEquals(sessionContext, proxy.getSessionContext());  
105 - assertEquals("value", proxy.getValue("value"));  
106 - assertEquals("abcdef", proxy.getValueNames()[0]);  
107 - assertEquals(10L, proxy.getCreationTime());  
108 - assertEquals("ID", proxy.getId());  
109 - assertEquals(1L, proxy.getLastAccessedTime());  
110 - assertEquals(servletContext, proxy.getServletContext());  
111 - assertEquals(2, proxy.getMaxInactiveInterval());  
112 - assertEquals("attribute-1", proxy.getAttribute("attribute"));  
113 - assertEquals(enumeration, proxy.getAttributeNames());  
114 - assertEquals(true, proxy.isNew());  
115 -  
116 - proxy.removeValue("removeValue");  
117 - proxy.putValue("put", "it");  
118 - proxy.invalidate();  
119 - proxy.removeAttribute("remove");  
120 - proxy.setAttribute("name", "object");  
121 - proxy.setMaxInactiveInterval(1);  
122 -  
123 - verify(session);  
124 - }  
125 -}  
impl/extension/servlet/pom.xml
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 <dependencies> 69 <dependencies>
70 <dependency> 70 <dependency>
71 <groupId>javax.servlet</groupId> 71 <groupId>javax.servlet</groupId>
72 - <artifactId>servlet-api</artifactId> 72 + <artifactId>javax.servlet-api</artifactId>
73 </dependency> 73 </dependency>
74 <dependency> 74 <dependency>
75 <groupId>javax.el</groupId> 75 <groupId>javax.el</groupId>
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/ServletFilter.java
@@ -38,7 +38,6 @@ package br.gov.frameworkdemoiselle.util; @@ -38,7 +38,6 @@ package br.gov.frameworkdemoiselle.util;
38 38
39 import java.io.IOException; 39 import java.io.IOException;
40 40
41 -import javax.security.auth.login.LoginContext;  
42 import javax.servlet.Filter; 41 import javax.servlet.Filter;
43 import javax.servlet.FilterChain; 42 import javax.servlet.FilterChain;
44 import javax.servlet.FilterConfig; 43 import javax.servlet.FilterConfig;
@@ -47,7 +46,6 @@ import javax.servlet.ServletRequest; @@ -47,7 +46,6 @@ import javax.servlet.ServletRequest;
47 import javax.servlet.ServletResponse; 46 import javax.servlet.ServletResponse;
48 import javax.servlet.http.HttpServletRequest; 47 import javax.servlet.http.HttpServletRequest;
49 import javax.servlet.http.HttpServletResponse; 48 import javax.servlet.http.HttpServletResponse;
50 -import javax.servlet.http.HttpSession;  
51 49
52 import br.gov.frameworkdemoiselle.internal.producer.HttpServletRequestProducer; 50 import br.gov.frameworkdemoiselle.internal.producer.HttpServletRequestProducer;
53 import br.gov.frameworkdemoiselle.internal.producer.HttpServletResponseProducer; 51 import br.gov.frameworkdemoiselle.internal.producer.HttpServletResponseProducer;
@@ -65,11 +63,11 @@ public class ServletFilter implements Filter { @@ -65,11 +63,11 @@ public class ServletFilter implements Filter {
65 Beans.getReference(HttpServletRequestProducer.class).setDelegate((HttpServletRequest) request); 63 Beans.getReference(HttpServletRequestProducer.class).setDelegate((HttpServletRequest) request);
66 Beans.getReference(HttpServletResponseProducer.class).setDelegate((HttpServletResponse) response); 64 Beans.getReference(HttpServletResponseProducer.class).setDelegate((HttpServletResponse) response);
67 65
68 - LoginContext ctx = null;  
69 - HttpSession sess = (HttpSession) ((HttpServletRequest) request).getSession(false);  
70 - if (sess != null) {  
71 - ctx = (LoginContext) sess.getAttribute("ctx");  
72 - } 66 + // LoginContext ctx = null;
  67 + // HttpSession sess = (HttpSession) ((HttpServletRequest) request).getSession(false);
  68 + // if (sess != null) {
  69 + // ctx = (LoginContext) sess.getAttribute("ctx");
  70 + // }
73 71
74 // System.out.println(ctx); 72 // System.out.println(ctx);
75 73
parent/bom/pom.xml
@@ -218,6 +218,11 @@ @@ -218,6 +218,11 @@
218 </dependency> 218 </dependency>
219 <dependency> 219 <dependency>
220 <groupId>javax.servlet</groupId> 220 <groupId>javax.servlet</groupId>
  221 + <artifactId>javax.servlet-api</artifactId>
  222 + <version>3.0.1</version>
  223 + </dependency>
  224 + <dependency>
  225 + <groupId>javax.servlet</groupId>
221 <artifactId>jstl</artifactId> 226 <artifactId>jstl</artifactId>
222 <version>1.2</version> 227 <version>1.2</version>
223 </dependency> 228 </dependency>
parent/servlet/pom.xml
@@ -84,16 +84,6 @@ @@ -84,16 +84,6 @@
84 </plugins> 84 </plugins>
85 </build> 85 </build>
86 86
87 - <dependencyManagement>  
88 - <dependencies>  
89 - <dependency>  
90 - <groupId>javax.servlet</groupId>  
91 - <artifactId>javax.servlet-api</artifactId>  
92 - <version>3.0.1</version>  
93 - </dependency>  
94 - </dependencies>  
95 - </dependencyManagement>  
96 -  
97 <dependencies> 87 <dependencies>
98 <dependency> 88 <dependency>
99 <groupId>br.gov.frameworkdemoiselle</groupId> 89 <groupId>br.gov.frameworkdemoiselle</groupId>
@@ -102,7 +92,7 @@ @@ -102,7 +92,7 @@
102 <exclusions> 92 <exclusions>
103 <exclusion> 93 <exclusion>
104 <groupId>javax.servlet</groupId> 94 <groupId>javax.servlet</groupId>
105 - <artifactId>servlet-api</artifactId> 95 + <artifactId>javax.servlet-api</artifactId>
106 </exclusion> 96 </exclusion>
107 </exclusions> 97 </exclusions>
108 </dependency> 98 </dependency>