Commit 2a79aab7db98f9f6dfff2613a7866d52efd906fc

Authored by Cleverson Sacramento
1 parent 1a85fed1
Exists in master

RESOLVED - issue FWK-130: Classes anotadas com @ViewScoped ou

@ViewController devem implementar Serializable 
https://demoiselle.atlassian.net/browse/FWK-130
impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ViewScoped.java
@@ -55,7 +55,7 @@ import javax.enterprise.context.NormalScope; @@ -55,7 +55,7 @@ import javax.enterprise.context.NormalScope;
55 @Inherited 55 @Inherited
56 @Target({ METHOD, TYPE, FIELD }) 56 @Target({ METHOD, TYPE, FIELD })
57 @Retention(RUNTIME) 57 @Retention(RUNTIME)
58 -@NormalScope(passivating=true) 58 +@NormalScope(passivating = true)
59 public @interface ViewScoped { 59 public @interface ViewScoped {
60 60
61 } 61 }
impl/extension/jsf/src/test/java/exception/handler/authentication/AuthenticationBean.java
@@ -36,11 +36,15 @@ @@ -36,11 +36,15 @@
36 */ 36 */
37 package exception.handler.authentication; 37 package exception.handler.authentication;
38 38
  39 +import java.io.Serializable;
  40 +
39 import br.gov.frameworkdemoiselle.security.NotLoggedInException; 41 import br.gov.frameworkdemoiselle.security.NotLoggedInException;
40 import br.gov.frameworkdemoiselle.stereotype.ViewController; 42 import br.gov.frameworkdemoiselle.stereotype.ViewController;
41 43
42 @ViewController 44 @ViewController
43 -public class AuthenticationBean { 45 +public class AuthenticationBean implements Serializable {
  46 +
  47 + private static final long serialVersionUID = 1L;
44 48
45 private String msg = "Authentication Exception"; 49 private String msg = "Authentication Exception";
46 50
impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationBean.java
@@ -36,11 +36,15 @@ @@ -36,11 +36,15 @@
36 */ 36 */
37 package exception.handler.authorization; 37 package exception.handler.authorization;
38 38
  39 +import java.io.Serializable;
  40 +
39 import br.gov.frameworkdemoiselle.security.AuthorizationException; 41 import br.gov.frameworkdemoiselle.security.AuthorizationException;
40 import br.gov.frameworkdemoiselle.stereotype.ViewController; 42 import br.gov.frameworkdemoiselle.stereotype.ViewController;
41 43
42 @ViewController 44 @ViewController
43 -public class AuthorizationBean { 45 +public class AuthorizationBean implements Serializable {
  46 +
  47 + private static final long serialVersionUID = 1L;
44 48
45 private String correctMessage = "Authorization Message."; 49 private String correctMessage = "Authorization Message.";
46 50
impl/extension/jsf/src/test/java/exception/handler/common/ExceptionHandlerConfigBean.java
@@ -36,17 +36,21 @@ @@ -36,17 +36,21 @@
36 */ 36 */
37 package exception.handler.common; 37 package exception.handler.common;
38 38
  39 +import java.io.Serializable;
  40 +
39 import org.junit.Ignore; 41 import org.junit.Ignore;
40 42
41 import br.gov.frameworkdemoiselle.stereotype.ViewController; 43 import br.gov.frameworkdemoiselle.stereotype.ViewController;
42 44
43 @Ignore 45 @Ignore
44 @ViewController 46 @ViewController
45 -public class ExceptionHandlerConfigBean{  
46 - 47 +public class ExceptionHandlerConfigBean implements Serializable {
  48 +
  49 + private static final long serialVersionUID = 1L;
  50 +
47 @SuppressWarnings("unused") 51 @SuppressWarnings("unused")
48 private String exp; 52 private String exp;
49 - 53 +
50 public String getExp() throws DummyException { 54 public String getExp() throws DummyException {
51 throw new DummyException("DummyException!"); 55 throw new DummyException("DummyException!");
52 } 56 }
impl/extension/jsf/src/test/java/exception/handler/redirect/RedirectBean.java
1 package exception.handler.redirect; 1 package exception.handler.redirect;
2 2
  3 +import java.io.Serializable;
  4 +
3 import br.gov.frameworkdemoiselle.stereotype.ViewController; 5 import br.gov.frameworkdemoiselle.stereotype.ViewController;
4 6
5 @ViewController 7 @ViewController
6 -public class RedirectBean { 8 +public class RedirectBean implements Serializable {
  9 +
  10 + private static final long serialVersionUID = 1L;
7 11
8 private String redirectCorrectPage = "Correct Redirect Exception!"; 12 private String redirectCorrectPage = "Correct Redirect Exception!";
9 - 13 +
10 private String redirectWrongPage = "Wrong Redirect Exception!"; 14 private String redirectWrongPage = "Wrong Redirect Exception!";
11 15
12 public String getRedirectCorrectPage() { 16 public String getRedirectCorrectPage() {
@@ -16,5 +20,5 @@ public class RedirectBean { @@ -16,5 +20,5 @@ public class RedirectBean {
16 public String getRedirectWrongPage() { 20 public String getRedirectWrongPage() {
17 throw new ExceptionWithWrongRedirect(redirectWrongPage); 21 throw new ExceptionWithWrongRedirect(redirectWrongPage);
18 } 22 }
19 - 23 +
20 } 24 }
impl/extension/jsf/src/test/java/message/MessageBean.java
@@ -36,13 +36,17 @@ @@ -36,13 +36,17 @@
36 */ 36 */
37 package message; 37 package message;
38 38
  39 +import java.io.Serializable;
  40 +
39 import javax.inject.Inject; 41 import javax.inject.Inject;
40 42
41 import br.gov.frameworkdemoiselle.message.MessageContext; 43 import br.gov.frameworkdemoiselle.message.MessageContext;
42 import br.gov.frameworkdemoiselle.stereotype.ViewController; 44 import br.gov.frameworkdemoiselle.stereotype.ViewController;
43 45
44 @ViewController 46 @ViewController
45 -public class MessageBean { 47 +public class MessageBean implements Serializable {
  48 +
  49 + private static final long serialVersionUID = 1L;
46 50
47 private String msg = "Message shown."; 51 private String msg = "Message shown.";
48 52
impl/extension/jsf/src/test/java/test/Tests.java
@@ -48,8 +48,8 @@ import br.gov.frameworkdemoiselle.annotation.NextView; @@ -48,8 +48,8 @@ import br.gov.frameworkdemoiselle.annotation.NextView;
48 import br.gov.frameworkdemoiselle.annotation.PreviousView; 48 import br.gov.frameworkdemoiselle.annotation.PreviousView;
49 import br.gov.frameworkdemoiselle.annotation.Redirect; 49 import br.gov.frameworkdemoiselle.annotation.Redirect;
50 import br.gov.frameworkdemoiselle.internal.bootstrap.JsfBootstrap; 50 import br.gov.frameworkdemoiselle.internal.bootstrap.JsfBootstrap;
51 -import br.gov.frameworkdemoiselle.internal.configuration.ExceptionHandlerConfigCompatible;  
52 import br.gov.frameworkdemoiselle.internal.configuration.ExceptionHandlerConfig; 51 import br.gov.frameworkdemoiselle.internal.configuration.ExceptionHandlerConfig;
  52 +import br.gov.frameworkdemoiselle.internal.configuration.ExceptionHandlerConfigCompatible;
53 import br.gov.frameworkdemoiselle.internal.configuration.JsfSecurityConfig; 53 import br.gov.frameworkdemoiselle.internal.configuration.JsfSecurityConfig;
54 import br.gov.frameworkdemoiselle.internal.context.FacesViewContextImpl; 54 import br.gov.frameworkdemoiselle.internal.context.FacesViewContextImpl;
55 import br.gov.frameworkdemoiselle.internal.implementation.AbstractExceptionHandler; 55 import br.gov.frameworkdemoiselle.internal.implementation.AbstractExceptionHandler;
@@ -134,10 +134,13 @@ public final class Tests { @@ -134,10 +134,13 @@ public final class Tests {
134 .addAsResource(createFileAsset("src/main/resources/demoiselle-jsf-bundle.properties"), 134 .addAsResource(createFileAsset("src/main/resources/demoiselle-jsf-bundle.properties"),
135 "demoiselle-jsf-bundle.properties") 135 "demoiselle-jsf-bundle.properties")
136 .addAsWebInfResource(createFileAsset("src/test/resources/test/beans.xml"), "beans.xml") 136 .addAsWebInfResource(createFileAsset("src/test/resources/test/beans.xml"), "beans.xml")
137 - .addAsManifestResource(createFileAsset("src/main/resources/META-INF/faces-config.xml"), "faces-config.xml")  
138 - .addAsManifestResource(createFileAsset("src/main/resources/META-INF/demoiselle-d.taglib.xml"), "demoiselle-d.taglib.xml")  
139 - .addAsManifestResource(createFileAsset("src/main/resources/META-INF/tags/br/gov/frameworkdemoiselle/checkLoggedIn.xhtml"), "checkedLoggedIn.xhtml")  
140 - .addAsLibraries(libs); 137 + .addAsManifestResource(createFileAsset("src/main/resources/META-INF/faces-config.xml"),
  138 + "faces-config.xml")
  139 + .addAsManifestResource(createFileAsset("src/main/resources/META-INF/demoiselle-d.taglib.xml"),
  140 + "demoiselle-d.taglib.xml")
  141 + .addAsManifestResource(
  142 + createFileAsset("src/main/resources/META-INF/tags/br/gov/frameworkdemoiselle/checkLoggedIn.xhtml"),
  143 + "checkedLoggedIn.xhtml").addAsLibraries(libs);
141 } 144 }
142 145
143 public static FileAsset createFileAsset(final String pathname) { 146 public static FileAsset createFileAsset(final String pathname) {
impl/extension/jsf/src/test/java/xxxx/XServlet.java
@@ -1,35 +0,0 @@ @@ -1,35 +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 - credentials.setUsername("admin");  
31 - credentials.setPassword("changeit");  
32 -  
33 - securityContext.login();  
34 - }  
35 -}  
impl/extension/jsf/src/test/java/xxxx/XTest.java
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -package xxxx;  
2 -  
3 -import org.junit.Ignore;  
4 -  
5 -//import java.net.URL;  
6 -  
7 -//import org.jboss.arquillian.container.test.api.Deployment;  
8 -//import org.jboss.arquillian.drone.api.annotation.Drone;  
9 -//import org.jboss.arquillian.junit.Arquillian;  
10 -//import org.jboss.arquillian.test.api.ArquillianResource;  
11 -//import org.jboss.shrinkwrap.api.spec.WebArchive;  
12 -//import org.junit.Test;  
13 -//import org.junit.runner.RunWith;  
14 -  
15 -//import test.Tests;  
16 -  
17 -//import com.thoughtworks.selenium.DefaultSelenium;  
18 -  
19 -//@RunWith(Arquillian.class)  
20 -@Ignore  
21 -public class XTest {  
22 -  
23 -// private static final String PATH = "src/test/resources/xxx";  
24 -//  
25 -// @Drone  
26 -// private DefaultSelenium browser;  
27 -//  
28 -// @ArquillianResource  
29 -// private URL deploymentUrl;  
30 -//  
31 -// @Deployment(testable = false)  
32 -// public static WebArchive createDeployment() {  
33 -// return Tests.createDeployment().addClass(XServlet.class)  
34 -// .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml");  
35 -// }  
36 -//  
37 -// @Test  
38 -// public void xxxx() {  
39 -// browser.open(deploymentUrl + "/login");  
40 -  
41 - // browser.type("id=xxx-input", "demo");  
42 - // browser.waitForPageToLoad("15000");  
43 -  
44 - // assertTrue("User should be logged in!",  
45 - // browser.isElementPresent("xpath=//li[contains(text(), 'Welcome')]"));  
46 - // assertTrue("Username should be shown!",  
47 - // browser.isElementPresent("xpath=//p[contains(text(), 'You are signed in as demo.')]"));  
48 -// }  
49 -}