Commit 2a79aab7db98f9f6dfff2613a7866d52efd906fc
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
Showing
9 changed files
with
38 additions
and
99 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ViewScoped.java
impl/extension/jsf/src/test/java/exception/handler/authentication/AuthenticationBean.java
... | ... | @@ -36,11 +36,15 @@ |
36 | 36 | */ |
37 | 37 | package exception.handler.authentication; |
38 | 38 | |
39 | +import java.io.Serializable; | |
40 | + | |
39 | 41 | import br.gov.frameworkdemoiselle.security.NotLoggedInException; |
40 | 42 | import br.gov.frameworkdemoiselle.stereotype.ViewController; |
41 | 43 | |
42 | 44 | @ViewController |
43 | -public class AuthenticationBean { | |
45 | +public class AuthenticationBean implements Serializable { | |
46 | + | |
47 | + private static final long serialVersionUID = 1L; | |
44 | 48 | |
45 | 49 | private String msg = "Authentication Exception"; |
46 | 50 | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationBean.java
... | ... | @@ -36,11 +36,15 @@ |
36 | 36 | */ |
37 | 37 | package exception.handler.authorization; |
38 | 38 | |
39 | +import java.io.Serializable; | |
40 | + | |
39 | 41 | import br.gov.frameworkdemoiselle.security.AuthorizationException; |
40 | 42 | import br.gov.frameworkdemoiselle.stereotype.ViewController; |
41 | 43 | |
42 | 44 | @ViewController |
43 | -public class AuthorizationBean { | |
45 | +public class AuthorizationBean implements Serializable { | |
46 | + | |
47 | + private static final long serialVersionUID = 1L; | |
44 | 48 | |
45 | 49 | private String correctMessage = "Authorization Message."; |
46 | 50 | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/common/ExceptionHandlerConfigBean.java
... | ... | @@ -36,17 +36,21 @@ |
36 | 36 | */ |
37 | 37 | package exception.handler.common; |
38 | 38 | |
39 | +import java.io.Serializable; | |
40 | + | |
39 | 41 | import org.junit.Ignore; |
40 | 42 | |
41 | 43 | import br.gov.frameworkdemoiselle.stereotype.ViewController; |
42 | 44 | |
43 | 45 | @Ignore |
44 | 46 | @ViewController |
45 | -public class ExceptionHandlerConfigBean{ | |
46 | - | |
47 | +public class ExceptionHandlerConfigBean implements Serializable { | |
48 | + | |
49 | + private static final long serialVersionUID = 1L; | |
50 | + | |
47 | 51 | @SuppressWarnings("unused") |
48 | 52 | private String exp; |
49 | - | |
53 | + | |
50 | 54 | public String getExp() throws DummyException { |
51 | 55 | throw new DummyException("DummyException!"); |
52 | 56 | } | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/redirect/RedirectBean.java
1 | 1 | package exception.handler.redirect; |
2 | 2 | |
3 | +import java.io.Serializable; | |
4 | + | |
3 | 5 | import br.gov.frameworkdemoiselle.stereotype.ViewController; |
4 | 6 | |
5 | 7 | @ViewController |
6 | -public class RedirectBean { | |
8 | +public class RedirectBean implements Serializable { | |
9 | + | |
10 | + private static final long serialVersionUID = 1L; | |
7 | 11 | |
8 | 12 | private String redirectCorrectPage = "Correct Redirect Exception!"; |
9 | - | |
13 | + | |
10 | 14 | private String redirectWrongPage = "Wrong Redirect Exception!"; |
11 | 15 | |
12 | 16 | public String getRedirectCorrectPage() { |
... | ... | @@ -16,5 +20,5 @@ public class RedirectBean { |
16 | 20 | public String getRedirectWrongPage() { |
17 | 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 | 36 | */ |
37 | 37 | package message; |
38 | 38 | |
39 | +import java.io.Serializable; | |
40 | + | |
39 | 41 | import javax.inject.Inject; |
40 | 42 | |
41 | 43 | import br.gov.frameworkdemoiselle.message.MessageContext; |
42 | 44 | import br.gov.frameworkdemoiselle.stereotype.ViewController; |
43 | 45 | |
44 | 46 | @ViewController |
45 | -public class MessageBean { | |
47 | +public class MessageBean implements Serializable { | |
48 | + | |
49 | + private static final long serialVersionUID = 1L; | |
46 | 50 | |
47 | 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 | 48 | import br.gov.frameworkdemoiselle.annotation.PreviousView; |
49 | 49 | import br.gov.frameworkdemoiselle.annotation.Redirect; |
50 | 50 | import br.gov.frameworkdemoiselle.internal.bootstrap.JsfBootstrap; |
51 | -import br.gov.frameworkdemoiselle.internal.configuration.ExceptionHandlerConfigCompatible; | |
52 | 51 | import br.gov.frameworkdemoiselle.internal.configuration.ExceptionHandlerConfig; |
52 | +import br.gov.frameworkdemoiselle.internal.configuration.ExceptionHandlerConfigCompatible; | |
53 | 53 | import br.gov.frameworkdemoiselle.internal.configuration.JsfSecurityConfig; |
54 | 54 | import br.gov.frameworkdemoiselle.internal.context.FacesViewContextImpl; |
55 | 55 | import br.gov.frameworkdemoiselle.internal.implementation.AbstractExceptionHandler; |
... | ... | @@ -134,10 +134,13 @@ public final class Tests { |
134 | 134 | .addAsResource(createFileAsset("src/main/resources/demoiselle-jsf-bundle.properties"), |
135 | 135 | "demoiselle-jsf-bundle.properties") |
136 | 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 | 146 | public static FileAsset createFileAsset(final String pathname) { | ... | ... |
impl/extension/jsf/src/test/java/xxxx/XServlet.java
... | ... | @@ -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 | -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 | -} |