Commit 0633ded6d6aa3d75f604845b6656b823fd269ea4
1 parent
ea9c617b
Exists in
master
IN PROGRESS - issue FWK-92: Redirecionamento ao usar
securityContext.hasRole/hasPermissions com propriedade desativada https://demoiselle.atlassian.net/browse/FWK-92
Showing
30 changed files
with
529 additions
and
415 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/NotLoggedInException.java
| ... | ... | @@ -44,7 +44,7 @@ package br.gov.frameworkdemoiselle.security; |
| 44 | 44 | public class NotLoggedInException extends AuthenticationException { |
| 45 | 45 | |
| 46 | 46 | private static final long serialVersionUID = 1L; |
| 47 | - | |
| 47 | + | |
| 48 | 48 | /** |
| 49 | 49 | * Constructs an <code>NotLoggedInException</code> with a message. |
| 50 | 50 | */ | ... | ... |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandler.java
| ... | ... | @@ -36,14 +36,20 @@ |
| 36 | 36 | */ |
| 37 | 37 | package br.gov.frameworkdemoiselle.internal.implementation; |
| 38 | 38 | |
| 39 | +import static org.apache.http.HttpStatus.SC_FORBIDDEN; | |
| 40 | + | |
| 39 | 41 | import javax.faces.context.ExceptionHandler; |
| 40 | 42 | import javax.faces.context.FacesContext; |
| 43 | +import javax.servlet.http.HttpServletResponse; | |
| 41 | 44 | |
| 45 | +import br.gov.frameworkdemoiselle.internal.configuration.JsfSecurityConfig; | |
| 42 | 46 | import br.gov.frameworkdemoiselle.security.NotLoggedInException; |
| 43 | 47 | import br.gov.frameworkdemoiselle.util.Beans; |
| 44 | 48 | |
| 45 | 49 | public class AuthenticationExceptionHandler extends AbstractExceptionHandler { |
| 46 | 50 | |
| 51 | + private transient JsfSecurityConfig config; | |
| 52 | + | |
| 47 | 53 | public AuthenticationExceptionHandler(final ExceptionHandler wrapped) { |
| 48 | 54 | super(wrapped); |
| 49 | 55 | } |
| ... | ... | @@ -53,10 +59,25 @@ public class AuthenticationExceptionHandler extends AbstractExceptionHandler { |
| 53 | 59 | |
| 54 | 60 | if (cause instanceof NotLoggedInException) { |
| 55 | 61 | handled = true; |
| 56 | - //TODO Inter [NQ]: remover referência a SecurityObserver criando uma classe comum que faz o redirecionamento e que é compartilhada entre elas. | |
| 57 | - Beans.getReference(SecurityObserver.class).redirectToLoginPage(); | |
| 62 | + // TODO Inter [NQ]: remover referência a SecurityObserver criando uma classe comum que faz o | |
| 63 | + // redirecionamento e que é compartilhada entre elas. | |
| 64 | + | |
| 65 | + if (getConfig().isRedirectEnabled()) { | |
| 66 | + Beans.getReference(SecurityObserver.class).redirectToLoginPage(); | |
| 67 | + } else { | |
| 68 | + HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); | |
| 69 | + response.setStatus(SC_FORBIDDEN); | |
| 70 | + } | |
| 58 | 71 | } |
| 59 | 72 | |
| 60 | 73 | return handled; |
| 61 | 74 | } |
| 75 | + | |
| 76 | + public JsfSecurityConfig getConfig() { | |
| 77 | + if (this.config == null) { | |
| 78 | + this.config = Beans.getReference(JsfSecurityConfig.class); | |
| 79 | + } | |
| 80 | + | |
| 81 | + return this.config; | |
| 82 | + } | |
| 62 | 83 | } | ... | ... |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/AuthorizationExceptionHandler.java
| ... | ... | @@ -36,9 +36,12 @@ |
| 36 | 36 | */ |
| 37 | 37 | package br.gov.frameworkdemoiselle.internal.implementation; |
| 38 | 38 | |
| 39 | +import static org.apache.http.HttpStatus.SC_UNAUTHORIZED; | |
| 40 | + | |
| 39 | 41 | import javax.faces.context.ExceptionHandler; |
| 40 | 42 | import javax.faces.context.FacesContext; |
| 41 | 43 | import javax.faces.event.PhaseId; |
| 44 | +import javax.servlet.http.HttpServletResponse; | |
| 42 | 45 | |
| 43 | 46 | import br.gov.frameworkdemoiselle.security.AuthorizationException; |
| 44 | 47 | import br.gov.frameworkdemoiselle.util.Faces; |
| ... | ... | @@ -53,9 +56,15 @@ public class AuthorizationExceptionHandler extends AbstractExceptionHandler { |
| 53 | 56 | boolean handled = false; |
| 54 | 57 | boolean rendering = PhaseId.RENDER_RESPONSE.equals(facesContext.getCurrentPhaseId()); |
| 55 | 58 | |
| 56 | - if (!rendering && cause instanceof AuthorizationException) { | |
| 57 | - Faces.addMessage(cause); | |
| 59 | + if (cause instanceof AuthorizationException) { | |
| 58 | 60 | handled = true; |
| 61 | + | |
| 62 | + if (rendering) { | |
| 63 | + HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); | |
| 64 | + response.setStatus(SC_UNAUTHORIZED); | |
| 65 | + } else { | |
| 66 | + Faces.addMessage(cause); | |
| 67 | + } | |
| 59 | 68 | } |
| 60 | 69 | |
| 61 | 70 | return handled; | ... | ... |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/AbstractEditPageBean.java
| ... | ... | @@ -49,7 +49,7 @@ import br.gov.frameworkdemoiselle.util.Reflections; |
| 49 | 49 | import br.gov.frameworkdemoiselle.util.ResourceBundle; |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Template Managed Bean class that implements the methods defined by the interface EditPageBean. | |
| 52 | + * Template Managed AuthenticationBean class that implements the methods defined by the interface EditPageBean. | |
| 53 | 53 | * |
| 54 | 54 | * @param <T> |
| 55 | 55 | * bean object type | ... | ... |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/AbstractListPageBean.java
| ... | ... | @@ -50,7 +50,7 @@ import br.gov.frameworkdemoiselle.pagination.Pagination; |
| 50 | 50 | import br.gov.frameworkdemoiselle.pagination.PaginationContext; |
| 51 | 51 | import br.gov.frameworkdemoiselle.util.Reflections; |
| 52 | 52 | /** |
| 53 | - * Template Managed Bean class that implements the methods defined by the interface ListPageBean. | |
| 53 | + * Template Managed AuthenticationBean class that implements the methods defined by the interface ListPageBean. | |
| 54 | 54 | * |
| 55 | 55 | * @param <T> |
| 56 | 56 | * bean object type | ... | ... |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/AbstractPageBean.java
| ... | ... | @@ -43,7 +43,7 @@ import br.gov.frameworkdemoiselle.annotation.NextView; |
| 43 | 43 | import br.gov.frameworkdemoiselle.annotation.PreviousView; |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * Template Managed Bean class that implements the methods defined by the interface PageBean. | |
| 46 | + * Template Managed AuthenticationBean class that implements the methods defined by the interface PageBean. | |
| 47 | 47 | * |
| 48 | 48 | * @author SERPRO |
| 49 | 49 | * @see PageBean | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/authentication/AuthenticationBean.java
| ... | ... | @@ -46,9 +46,7 @@ public class AuthenticationBean implements Serializable { |
| 46 | 46 | |
| 47 | 47 | private static final long serialVersionUID = 1L; |
| 48 | 48 | |
| 49 | - private String msg = "Authentication Exception"; | |
| 50 | - | |
| 51 | 49 | public String getMsg() { |
| 52 | - throw new NotLoggedInException(msg); | |
| 50 | + throw new NotLoggedInException(""); | |
| 53 | 51 | } |
| 54 | 52 | } | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/authentication/AuthenticationExceptionTest.java
| ... | ... | @@ -1,89 +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 exception.handler.authentication; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertTrue; | |
| 40 | - | |
| 41 | -import java.io.IOException; | |
| 42 | -import java.net.URL; | |
| 43 | - | |
| 44 | -import org.apache.commons.httpclient.HttpClient; | |
| 45 | -import org.apache.commons.httpclient.HttpException; | |
| 46 | -import org.apache.commons.httpclient.methods.GetMethod; | |
| 47 | -import org.jboss.arquillian.container.test.api.Deployment; | |
| 48 | -import org.jboss.arquillian.junit.Arquillian; | |
| 49 | -import org.jboss.arquillian.test.api.ArquillianResource; | |
| 50 | -import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 51 | -import org.junit.Test; | |
| 52 | -import org.junit.runner.RunWith; | |
| 53 | - | |
| 54 | -import test.Tests; | |
| 55 | - | |
| 56 | -@RunWith(Arquillian.class) | |
| 57 | -public class AuthenticationExceptionTest { | |
| 58 | - | |
| 59 | - @ArquillianResource | |
| 60 | - private URL deploymentUrl; | |
| 61 | - | |
| 62 | - private static final String PATH = "src/test/resources/exception-handler-authentication"; | |
| 63 | - | |
| 64 | - @Deployment(testable = false) | |
| 65 | - public static WebArchive createDeployment() { | |
| 66 | - return Tests.createDeployment().addClass(AuthenticationExceptionTest.class).addClass(AuthenticationBean.class) | |
| 67 | - .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") | |
| 68 | - .addAsWebResource(Tests.createFileAsset(PATH + "/login.xhtml"), "login.xhtml") | |
| 69 | - .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | |
| 70 | - } | |
| 71 | - | |
| 72 | - @Test | |
| 73 | - public void authenticationException() { | |
| 74 | - HttpClient client = new HttpClient(); | |
| 75 | - GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); | |
| 76 | - | |
| 77 | - try { | |
| 78 | - client.executeMethod(method); | |
| 79 | - String message = method.getResponseBodyAsString(); | |
| 80 | - System.out.println("MESAGE: " + message); | |
| 81 | - assertTrue(message.contains("Called the page /login")); | |
| 82 | - | |
| 83 | - } catch (HttpException e) { | |
| 84 | - e.printStackTrace(); | |
| 85 | - } catch (IOException e) { | |
| 86 | - e.printStackTrace(); | |
| 87 | - } | |
| 88 | - } | |
| 89 | -} |
impl/extension/jsf/src/test/java/exception/handler/authentication/HandledAuthenticationExceptionTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,81 @@ |
| 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 exception.handler.authentication; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertTrue; | |
| 40 | + | |
| 41 | +import java.io.IOException; | |
| 42 | +import java.net.URL; | |
| 43 | + | |
| 44 | +import org.apache.commons.httpclient.HttpClient; | |
| 45 | +import org.apache.commons.httpclient.HttpException; | |
| 46 | +import org.apache.commons.httpclient.methods.GetMethod; | |
| 47 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 48 | +import org.jboss.arquillian.junit.Arquillian; | |
| 49 | +import org.jboss.arquillian.test.api.ArquillianResource; | |
| 50 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 51 | +import org.junit.Test; | |
| 52 | +import org.junit.runner.RunWith; | |
| 53 | + | |
| 54 | +import test.Tests; | |
| 55 | + | |
| 56 | +@RunWith(Arquillian.class) | |
| 57 | +public class HandledAuthenticationExceptionTest { | |
| 58 | + | |
| 59 | + @ArquillianResource | |
| 60 | + private URL deploymentUrl; | |
| 61 | + | |
| 62 | + private static final String PATH = "src/test/resources/exception-handler-authentication"; | |
| 63 | + | |
| 64 | + @Deployment(testable = false) | |
| 65 | + public static WebArchive createDeployment() { | |
| 66 | + return Tests.createDeployment().addClasses(AuthenticationBean.class) | |
| 67 | + .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") | |
| 68 | + .addAsWebResource(Tests.createFileAsset(PATH + "/login.xhtml"), "login.xhtml") | |
| 69 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Test | |
| 73 | + public void authenticationException() throws HttpException, IOException { | |
| 74 | + HttpClient client = new HttpClient(); | |
| 75 | + GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); | |
| 76 | + | |
| 77 | + client.executeMethod(method); | |
| 78 | + String message = method.getResponseBodyAsString(); | |
| 79 | + assertTrue(message.contains("Called the page /login")); | |
| 80 | + } | |
| 81 | +} | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/authentication/UnhandledAuthenticationExceptionTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,81 @@ |
| 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 exception.handler.authentication; | |
| 38 | + | |
| 39 | +import static org.apache.http.HttpStatus.SC_FORBIDDEN; | |
| 40 | +import static org.junit.Assert.assertEquals; | |
| 41 | + | |
| 42 | +import java.io.IOException; | |
| 43 | +import java.net.URL; | |
| 44 | + | |
| 45 | +import org.apache.commons.httpclient.HttpClient; | |
| 46 | +import org.apache.commons.httpclient.HttpException; | |
| 47 | +import org.apache.commons.httpclient.methods.GetMethod; | |
| 48 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 49 | +import org.jboss.arquillian.junit.Arquillian; | |
| 50 | +import org.jboss.arquillian.test.api.ArquillianResource; | |
| 51 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 52 | +import org.junit.Test; | |
| 53 | +import org.junit.runner.RunWith; | |
| 54 | + | |
| 55 | +import test.Tests; | |
| 56 | + | |
| 57 | +@RunWith(Arquillian.class) | |
| 58 | +public class UnhandledAuthenticationExceptionTest { | |
| 59 | + | |
| 60 | + @ArquillianResource | |
| 61 | + private URL deploymentUrl; | |
| 62 | + | |
| 63 | + private static final String PATH = "src/test/resources/exception-handler-authentication"; | |
| 64 | + | |
| 65 | + @Deployment(testable = false) | |
| 66 | + public static WebArchive createDeployment() { | |
| 67 | + return Tests.createDeployment().addClasses(AuthenticationBean.class) | |
| 68 | + .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") | |
| 69 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") | |
| 70 | + .addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @Test | |
| 74 | + public void authenticationException() throws HttpException, IOException { | |
| 75 | + HttpClient client = new HttpClient(); | |
| 76 | + GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); | |
| 77 | + | |
| 78 | + int status = client.executeMethod(method); | |
| 79 | + assertEquals(SC_FORBIDDEN, status); | |
| 80 | + } | |
| 81 | +} | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationBean.java
| ... | ... | @@ -46,20 +46,7 @@ public class AuthorizationBean implements Serializable { |
| 46 | 46 | |
| 47 | 47 | private static final long serialVersionUID = 1L; |
| 48 | 48 | |
| 49 | - private String correctMessage = "Authorization Message."; | |
| 50 | - | |
| 51 | - private String exceptionMessage = "Authorization Exception!"; | |
| 52 | - | |
| 53 | - public String getCorrectMessage() { | |
| 54 | - return correctMessage; | |
| 55 | - } | |
| 56 | - | |
| 57 | - public String getExceptionMessage() { | |
| 58 | - throw new AuthorizationException(exceptionMessage); | |
| 49 | + public String getThrowExceptionMessage() { | |
| 50 | + throw new AuthorizationException("Authorization Exception!"); | |
| 59 | 51 | } |
| 60 | - | |
| 61 | - public void loadExceptionMessage() { | |
| 62 | - throw new AuthorizationException(exceptionMessage); | |
| 63 | - } | |
| 64 | - | |
| 65 | 52 | } | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationHandledExceptionTest.java
| ... | ... | @@ -1,94 +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 exception.handler.authorization; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertNotSame; | |
| 40 | -import static org.junit.Assert.assertTrue; | |
| 41 | - | |
| 42 | -import java.io.IOException; | |
| 43 | -import java.net.URL; | |
| 44 | - | |
| 45 | -import org.apache.commons.httpclient.HttpClient; | |
| 46 | -import org.apache.commons.httpclient.HttpException; | |
| 47 | -import org.apache.commons.httpclient.HttpStatus; | |
| 48 | -import org.apache.commons.httpclient.methods.GetMethod; | |
| 49 | -import org.jboss.arquillian.container.test.api.Deployment; | |
| 50 | -import org.jboss.arquillian.junit.Arquillian; | |
| 51 | -import org.jboss.arquillian.test.api.ArquillianResource; | |
| 52 | -import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 53 | -import org.junit.Test; | |
| 54 | -import org.junit.runner.RunWith; | |
| 55 | - | |
| 56 | -import test.Tests; | |
| 57 | - | |
| 58 | -@RunWith(Arquillian.class) | |
| 59 | -public class AuthorizationHandledExceptionTest { | |
| 60 | - | |
| 61 | - @ArquillianResource | |
| 62 | - private URL deploymentUrl; | |
| 63 | - | |
| 64 | - private static final String PATH = "src/test/resources/exception-handler-authorization"; | |
| 65 | - | |
| 66 | - @Deployment(testable = false) | |
| 67 | - public static WebArchive createDeployment() { | |
| 68 | - return Tests.createDeployment().addClass(AuthorizationHandledExceptionTest.class).addClass(AuthorizationBean.class) | |
| 69 | - .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") | |
| 70 | - .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") | |
| 71 | - .addAsWebInfResource(Tests.createFileAsset(PATH + "/pretty-config.xml"), "pretty-config.xml"); | |
| 72 | - | |
| 73 | - } | |
| 74 | - | |
| 75 | - @Test | |
| 76 | - public void authorizationHandledException() { | |
| 77 | - HttpClient client = new HttpClient(); | |
| 78 | - GetMethod method = new GetMethod(deploymentUrl + "/index"); | |
| 79 | - | |
| 80 | - try { | |
| 81 | - int status = client.executeMethod(method); | |
| 82 | - String message = method.getResponseBodyAsString(); | |
| 83 | - | |
| 84 | - assertNotSame(HttpStatus.SC_INTERNAL_SERVER_ERROR, status); | |
| 85 | - assertTrue(message.contains("Authorization Message.")); | |
| 86 | - assertTrue(message.contains("Authorization Exception!")); | |
| 87 | - | |
| 88 | - } catch (HttpException e) { | |
| 89 | - e.printStackTrace(); | |
| 90 | - } catch (IOException e) { | |
| 91 | - e.printStackTrace(); | |
| 92 | - } | |
| 93 | - } | |
| 94 | -} |
impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationNotHandledExceptionTest.java
| ... | ... | @@ -1,93 +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 exception.handler.authorization; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertEquals; | |
| 40 | -import static org.junit.Assert.assertFalse; | |
| 41 | -import static org.junit.Assert.assertTrue; | |
| 42 | - | |
| 43 | -import java.io.IOException; | |
| 44 | -import java.net.URL; | |
| 45 | - | |
| 46 | -import org.apache.commons.httpclient.HttpClient; | |
| 47 | -import org.apache.commons.httpclient.HttpException; | |
| 48 | -import org.apache.commons.httpclient.HttpStatus; | |
| 49 | -import org.apache.commons.httpclient.methods.GetMethod; | |
| 50 | -import org.jboss.arquillian.container.test.api.Deployment; | |
| 51 | -import org.jboss.arquillian.junit.Arquillian; | |
| 52 | -import org.jboss.arquillian.test.api.ArquillianResource; | |
| 53 | -import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 54 | -import org.junit.Test; | |
| 55 | -import org.junit.runner.RunWith; | |
| 56 | - | |
| 57 | -import test.Tests; | |
| 58 | - | |
| 59 | -@RunWith(Arquillian.class) | |
| 60 | -public class AuthorizationNotHandledExceptionTest { | |
| 61 | - | |
| 62 | - @ArquillianResource | |
| 63 | - private URL deploymentUrl; | |
| 64 | - | |
| 65 | - private static final String PATH = "src/test/resources/exception-handler-authorization"; | |
| 66 | - | |
| 67 | - @Deployment(testable = false) | |
| 68 | - public static WebArchive createDeployment() { | |
| 69 | - return Tests.createDeployment().addClass(AuthorizationNotHandledExceptionTest.class).addClass(AuthorizationBean.class) | |
| 70 | - .addAsWebResource(Tests.createFileAsset(PATH + "/page.xhtml"), "page.xhtml") | |
| 71 | - .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | |
| 72 | - } | |
| 73 | - | |
| 74 | - @Test | |
| 75 | - public void authorizationNotHandledException() { | |
| 76 | - HttpClient client = new HttpClient(); | |
| 77 | - GetMethod method = new GetMethod(deploymentUrl + "/page.jsf"); | |
| 78 | - | |
| 79 | - try { | |
| 80 | - int status = client.executeMethod(method); | |
| 81 | - String message = method.getResponseBodyAsString(); | |
| 82 | - | |
| 83 | - assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, status); | |
| 84 | - assertTrue(message.contains("Authorization Exception!")); | |
| 85 | - assertFalse(message.contains("Authorization Message.")); | |
| 86 | - | |
| 87 | - } catch (HttpException e) { | |
| 88 | - e.printStackTrace(); | |
| 89 | - } catch (IOException e) { | |
| 90 | - e.printStackTrace(); | |
| 91 | - } | |
| 92 | - } | |
| 93 | -} |
impl/extension/jsf/src/test/java/exception/handler/authorization/HandledAuthorizationExceptionTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,86 @@ |
| 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 exception.handler.authorization; | |
| 38 | + | |
| 39 | +import static org.apache.commons.httpclient.HttpStatus.SC_OK; | |
| 40 | +import static org.junit.Assert.assertEquals; | |
| 41 | +import static org.junit.Assert.assertTrue; | |
| 42 | + | |
| 43 | +import java.io.IOException; | |
| 44 | +import java.net.URL; | |
| 45 | + | |
| 46 | +import org.apache.commons.httpclient.HttpClient; | |
| 47 | +import org.apache.commons.httpclient.HttpException; | |
| 48 | +import org.apache.commons.httpclient.methods.GetMethod; | |
| 49 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 50 | +import org.jboss.arquillian.junit.Arquillian; | |
| 51 | +import org.jboss.arquillian.test.api.ArquillianResource; | |
| 52 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 53 | +import org.junit.Test; | |
| 54 | +import org.junit.runner.RunWith; | |
| 55 | + | |
| 56 | +import test.Tests; | |
| 57 | + | |
| 58 | +@RunWith(Arquillian.class) | |
| 59 | +public class HandledAuthorizationExceptionTest { | |
| 60 | + | |
| 61 | + @ArquillianResource | |
| 62 | + private URL deploymentUrl; | |
| 63 | + | |
| 64 | + private static final String PATH = "src/test/resources/exception-handler-authorization"; | |
| 65 | + | |
| 66 | + @Deployment(testable = false) | |
| 67 | + public static WebArchive createDeployment() { | |
| 68 | + return Tests.createDeployment().addClasses(AuthorizationBean.class) | |
| 69 | + .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") | |
| 70 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") | |
| 71 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/pretty-config.xml"), "pretty-config.xml"); | |
| 72 | + | |
| 73 | + } | |
| 74 | + | |
| 75 | + @Test | |
| 76 | + public void authorizationException() throws HttpException, IOException { | |
| 77 | + HttpClient client = new HttpClient(); | |
| 78 | + GetMethod method = new GetMethod(deploymentUrl + "/index"); | |
| 79 | + | |
| 80 | + int status = client.executeMethod(method); | |
| 81 | + String message = method.getResponseBodyAsString(); | |
| 82 | + | |
| 83 | + assertEquals(SC_OK, status); | |
| 84 | + assertTrue(message.contains("Authorization Exception!")); | |
| 85 | + } | |
| 86 | +} | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/authorization/UnhandledAuthorizationExceptionTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,80 @@ |
| 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 exception.handler.authorization; | |
| 38 | + | |
| 39 | +import static org.apache.commons.httpclient.HttpStatus.SC_UNAUTHORIZED; | |
| 40 | +import static org.junit.Assert.assertEquals; | |
| 41 | + | |
| 42 | +import java.io.IOException; | |
| 43 | +import java.net.URL; | |
| 44 | + | |
| 45 | +import org.apache.commons.httpclient.HttpClient; | |
| 46 | +import org.apache.commons.httpclient.HttpException; | |
| 47 | +import org.apache.commons.httpclient.methods.GetMethod; | |
| 48 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 49 | +import org.jboss.arquillian.junit.Arquillian; | |
| 50 | +import org.jboss.arquillian.test.api.ArquillianResource; | |
| 51 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 52 | +import org.junit.Test; | |
| 53 | +import org.junit.runner.RunWith; | |
| 54 | + | |
| 55 | +import test.Tests; | |
| 56 | + | |
| 57 | +@RunWith(Arquillian.class) | |
| 58 | +public class UnhandledAuthorizationExceptionTest { | |
| 59 | + | |
| 60 | + @ArquillianResource | |
| 61 | + private URL deploymentUrl; | |
| 62 | + | |
| 63 | + private static final String PATH = "src/test/resources/exception-handler-authorization"; | |
| 64 | + | |
| 65 | + @Deployment(testable = false) | |
| 66 | + public static WebArchive createDeployment() { | |
| 67 | + return Tests.createDeployment().addClasses(AuthorizationBean.class) | |
| 68 | + .addAsWebResource(Tests.createFileAsset(PATH + "/error.xhtml"), "error.xhtml") | |
| 69 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Test | |
| 73 | + public void authorizationException() throws HttpException, IOException { | |
| 74 | + HttpClient client = new HttpClient(); | |
| 75 | + GetMethod method = new GetMethod(deploymentUrl + "/error.jsf"); | |
| 76 | + | |
| 77 | + int status = client.executeMethod(method); | |
| 78 | + assertEquals(SC_UNAUTHORIZED, status); | |
| 79 | + } | |
| 80 | +} | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerDefaultConfigTest.java
| ... | ... | @@ -51,48 +51,33 @@ import org.jboss.shrinkwrap.api.spec.WebArchive; |
| 51 | 51 | import org.junit.Test; |
| 52 | 52 | import org.junit.runner.RunWith; |
| 53 | 53 | |
| 54 | +import test.Tests; | |
| 54 | 55 | import exception.handler.common.DummyException; |
| 55 | 56 | import exception.handler.common.ExceptionHandlerConfigBean; |
| 56 | -import test.Tests; | |
| 57 | 57 | |
| 58 | 58 | @RunWith(Arquillian.class) |
| 59 | -public class ExceptionHandlerDefaultConfigTest{ | |
| 59 | +public class ExceptionHandlerDefaultConfigTest { | |
| 60 | 60 | |
| 61 | 61 | @ArquillianResource |
| 62 | 62 | private URL deploymentUrl; |
| 63 | - | |
| 63 | + | |
| 64 | 64 | private static final String PATH = "src/test/resources/exception-handler-config"; |
| 65 | 65 | |
| 66 | 66 | @Deployment(testable = false) |
| 67 | 67 | public static WebArchive createDeployment() { |
| 68 | - return Tests.createDeployment().addClass(ExceptionHandlerDefaultConfigTest.class) | |
| 69 | - .addClass(DummyException.class) | |
| 70 | - .addClass(ExceptionHandlerConfigBean.class) | |
| 68 | + return Tests.createDeployment().addClasses(DummyException.class, ExceptionHandlerConfigBean.class) | |
| 71 | 69 | .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") |
| 72 | 70 | .addAsWebResource(Tests.createFileAsset(PATH + "/application_error.xhtml"), "application_error.xhtml") |
| 73 | 71 | .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); |
| 74 | 72 | } |
| 75 | - | |
| 73 | + | |
| 76 | 74 | @Test |
| 77 | - public void defaultConfiguration() { | |
| 75 | + public void defaultConfiguration() throws HttpException, IOException { | |
| 78 | 76 | HttpClient client = new HttpClient(); |
| 79 | 77 | GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); |
| 80 | - | |
| 81 | - try { | |
| 82 | - client.executeMethod(method); | |
| 83 | - String message = method.getResponseBodyAsString(); | |
| 84 | - assertTrue(message.contains("Called the page /application_error")); | |
| 85 | - | |
| 86 | - } catch (HttpException e) { | |
| 87 | - e.printStackTrace(); | |
| 88 | - } catch (IOException e) { | |
| 89 | - e.printStackTrace(); | |
| 90 | - } | |
| 78 | + | |
| 79 | + client.executeMethod(method); | |
| 80 | + String message = method.getResponseBodyAsString(); | |
| 81 | + assertTrue(message.contains("Called the page /application_error")); | |
| 91 | 82 | } |
| 92 | 83 | } |
| 93 | - | |
| 94 | - | |
| 95 | - | |
| 96 | - | |
| 97 | - | |
| 98 | - | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerRedirectConfigTest.java
| ... | ... | @@ -65,8 +65,7 @@ public class ExceptionHandlerRedirectConfigTest { |
| 65 | 65 | |
| 66 | 66 | @Deployment(testable = false) |
| 67 | 67 | public static WebArchive createDeployment() { |
| 68 | - return Tests.createDeployment().addClass(ExceptionHandlerRedirectConfigTest.class) | |
| 69 | - .addClass(DummyException.class).addClass(ExceptionHandlerConfigBean.class) | |
| 68 | + return Tests.createDeployment().addClasses(DummyException.class, ExceptionHandlerConfigBean.class) | |
| 70 | 69 | .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") |
| 71 | 70 | .addAsWebResource(Tests.createFileAsset(PATH + "/error_page.xhtml"), "error_page.xhtml") |
| 72 | 71 | .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionNotHandlerConfigTest.java
| ... | ... | @@ -66,8 +66,7 @@ public class ExceptionNotHandlerConfigTest { |
| 66 | 66 | |
| 67 | 67 | @Deployment(testable = false) |
| 68 | 68 | public static WebArchive createDeployment() { |
| 69 | - return Tests.createDeployment().addClass(ExceptionNotHandlerConfigTest.class).addClass(DummyException.class) | |
| 70 | - .addClass(ExceptionHandlerConfigBean.class) | |
| 69 | + return Tests.createDeployment().addClasses(DummyException.class, ExceptionHandlerConfigBean.class) | |
| 71 | 70 | .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") |
| 72 | 71 | .addAsWebResource(Tests.createFileAsset(PATH + "/application_error.xhtml"), "application_error.xhtml") |
| 73 | 72 | .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") |
| ... | ... | @@ -75,17 +74,10 @@ public class ExceptionNotHandlerConfigTest { |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | @Test |
| 78 | - public void notHandlerConfiguration() { | |
| 77 | + public void notHandlerConfiguration() throws HttpException, IOException { | |
| 79 | 78 | HttpClient client = new HttpClient(); |
| 80 | 79 | GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); |
| 81 | 80 | |
| 82 | - try { | |
| 83 | - assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, client.executeMethod(method)); | |
| 84 | - | |
| 85 | - } catch (HttpException e) { | |
| 86 | - e.printStackTrace(); | |
| 87 | - } catch (IOException e) { | |
| 88 | - e.printStackTrace(); | |
| 89 | - } | |
| 81 | + assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, client.executeMethod(method)); | |
| 90 | 82 | } |
| 91 | 83 | } | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionHandlerRedirectConfigTest.java
| ... | ... | @@ -65,8 +65,7 @@ public class ExceptionHandlerRedirectConfigTest { |
| 65 | 65 | |
| 66 | 66 | @Deployment(testable = false) |
| 67 | 67 | public static WebArchive createDeployment() { |
| 68 | - return Tests.createDeployment().addClass(ExceptionHandlerRedirectConfigTest.class) | |
| 69 | - .addClass(DummyException.class).addClass(ExceptionHandlerConfigBean.class) | |
| 68 | + return Tests.createDeployment().addClasses(DummyException.class, ExceptionHandlerConfigBean.class) | |
| 70 | 69 | .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") |
| 71 | 70 | .addAsWebResource(Tests.createFileAsset(PATH + "/error_page.xhtml"), "error_page.xhtml") |
| 72 | 71 | .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") |
| ... | ... | @@ -74,19 +73,12 @@ public class ExceptionHandlerRedirectConfigTest { |
| 74 | 73 | } |
| 75 | 74 | |
| 76 | 75 | @Test |
| 77 | - public void notHandlerConfiguration() { | |
| 76 | + public void notHandlerConfiguration() throws HttpException, IOException { | |
| 78 | 77 | HttpClient client = new HttpClient(); |
| 79 | 78 | GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); |
| 80 | 79 | |
| 81 | - try { | |
| 82 | - client.executeMethod(method); | |
| 83 | - String message = method.getResponseBodyAsString(); | |
| 84 | - assertTrue(message.contains("Called the page /error_page")); | |
| 85 | - | |
| 86 | - } catch (HttpException e) { | |
| 87 | - e.printStackTrace(); | |
| 88 | - } catch (IOException e) { | |
| 89 | - e.printStackTrace(); | |
| 90 | - } | |
| 80 | + client.executeMethod(method); | |
| 81 | + String message = method.getResponseBodyAsString(); | |
| 82 | + assertTrue(message.contains("Called the page /error_page")); | |
| 91 | 83 | } |
| 92 | 84 | } | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionNotHandlerConfigTest.java
| ... | ... | @@ -66,8 +66,7 @@ public class ExceptionNotHandlerConfigTest { |
| 66 | 66 | |
| 67 | 67 | @Deployment(testable = false) |
| 68 | 68 | public static WebArchive createDeployment() { |
| 69 | - return Tests.createDeployment().addClass(ExceptionNotHandlerConfigTest.class).addClass(DummyException.class) | |
| 70 | - .addClass(ExceptionHandlerConfigBean.class) | |
| 69 | + return Tests.createDeployment().addClasses(DummyException.class, ExceptionHandlerConfigBean.class) | |
| 71 | 70 | .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") |
| 72 | 71 | .addAsWebResource(Tests.createFileAsset(PATH + "/application_error.xhtml"), "application_error.xhtml") |
| 73 | 72 | .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") |
| ... | ... | @@ -75,18 +74,11 @@ public class ExceptionNotHandlerConfigTest { |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | @Test |
| 78 | - public void notHandlerConfiguration() { | |
| 77 | + public void notHandlerConfiguration() throws HttpException, IOException { | |
| 79 | 78 | HttpClient client = new HttpClient(); |
| 80 | 79 | GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); |
| 81 | 80 | |
| 82 | - try { | |
| 83 | - int status = client.executeMethod(method); | |
| 84 | - assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, status); | |
| 85 | - | |
| 86 | - } catch (HttpException e) { | |
| 87 | - e.printStackTrace(); | |
| 88 | - } catch (IOException e) { | |
| 89 | - e.printStackTrace(); | |
| 90 | - } | |
| 81 | + int status = client.executeMethod(method); | |
| 82 | + assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, status); | |
| 91 | 83 | } |
| 92 | 84 | } | ... | ... |
impl/extension/jsf/src/test/java/exception/handler/redirect/RedirectExceptionTest.java
| ... | ... | @@ -25,20 +25,18 @@ public class RedirectExceptionTest { |
| 25 | 25 | |
| 26 | 26 | @ArquillianResource |
| 27 | 27 | private URL deploymentUrl; |
| 28 | - | |
| 28 | + | |
| 29 | 29 | private static final String PATH = "src/test/resources/exception-handler-redirect"; |
| 30 | 30 | |
| 31 | 31 | @Deployment(testable = false) |
| 32 | 32 | public static WebArchive createDeployment() { |
| 33 | - return Tests.createDeployment().addClass(RedirectExceptionTest.class) | |
| 34 | - .addClass(RedirectBean.class) | |
| 35 | - .addClass(ExceptionWithCorrectRedirect.class) | |
| 33 | + return Tests.createDeployment().addClasses(RedirectBean.class, ExceptionWithCorrectRedirect.class) | |
| 36 | 34 | .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") |
| 37 | 35 | .addAsWebResource(Tests.createFileAsset(PATH + "/page.xhtml"), "page.xhtml") |
| 38 | 36 | .addAsWebResource(Tests.createFileAsset(PATH + "/redirect.xhtml"), "redirect.xhtml") |
| 39 | 37 | .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); |
| 40 | 38 | } |
| 41 | - | |
| 39 | + | |
| 42 | 40 | @Test |
| 43 | 41 | public void handleExceptionWithCorrectRedirect() { |
| 44 | 42 | HttpClient client = new HttpClient(); |
| ... | ... | @@ -47,7 +45,7 @@ public class RedirectExceptionTest { |
| 47 | 45 | try { |
| 48 | 46 | int status = client.executeMethod(method); |
| 49 | 47 | String message = method.getResponseBodyAsString(); |
| 50 | - | |
| 48 | + | |
| 51 | 49 | assertEquals(HttpStatus.SC_OK, status); |
| 52 | 50 | assertFalse(message.contains("Correct Redirect Exception!")); |
| 53 | 51 | assertTrue(message.contains("Page redirected!")); |
| ... | ... | @@ -58,7 +56,7 @@ public class RedirectExceptionTest { |
| 58 | 56 | e.printStackTrace(); |
| 59 | 57 | } |
| 60 | 58 | } |
| 61 | - | |
| 59 | + | |
| 62 | 60 | @Test |
| 63 | 61 | public void handleExceptionWithWrongRedirect() { |
| 64 | 62 | HttpClient client = new HttpClient(); |
| ... | ... | @@ -75,4 +73,3 @@ public class RedirectExceptionTest { |
| 75 | 73 | } |
| 76 | 74 | } |
| 77 | 75 | } |
| 78 | - | ... | ... |
impl/extension/jsf/src/test/java/message/MessageTest.java
| ... | ... | @@ -63,26 +63,18 @@ public class MessageTest { |
| 63 | 63 | |
| 64 | 64 | @Deployment(testable = false) |
| 65 | 65 | public static WebArchive createDeployment() { |
| 66 | - return Tests.createDeployment().addClass(MessageTest.class) | |
| 67 | - .addClass(MessageBean.class) | |
| 66 | + return Tests.createDeployment().addClasses(MessageBean.class) | |
| 68 | 67 | .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") |
| 69 | 68 | .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); |
| 70 | 69 | } |
| 71 | 70 | |
| 72 | 71 | @Test |
| 73 | - public void showMessage() { | |
| 72 | + public void showMessage() throws HttpException, IOException { | |
| 74 | 73 | HttpClient client = new HttpClient(); |
| 75 | 74 | GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); |
| 76 | 75 | |
| 77 | - try { | |
| 78 | - client.executeMethod(method); | |
| 79 | - String message = method.getResponseBodyAsString(); | |
| 80 | - assertTrue(message.contains("Message shown.")); | |
| 81 | - | |
| 82 | - } catch (HttpException e) { | |
| 83 | - e.printStackTrace(); | |
| 84 | - } catch (IOException e) { | |
| 85 | - e.printStackTrace(); | |
| 86 | - } | |
| 76 | + client.executeMethod(method); | |
| 77 | + String message = method.getResponseBodyAsString(); | |
| 78 | + assertTrue(message.contains("Message shown.")); | |
| 87 | 79 | } |
| 88 | 80 | } | ... | ... |
impl/extension/jsf/src/test/java/proxy/FacesContextProxyTest.java
| ... | ... | @@ -69,17 +69,11 @@ public class FacesContextProxyTest { |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | @Test |
| 72 | - public void facesContextProxy() { | |
| 72 | + public void facesContextProxy() throws HttpException, IOException { | |
| 73 | 73 | HttpClient client = new HttpClient(); |
| 74 | 74 | GetMethod method = new GetMethod(deploymentUrl + "/index"); |
| 75 | 75 | |
| 76 | - try { | |
| 77 | - int status = client.executeMethod(method); | |
| 78 | - assertEquals( HttpStatus.SC_OK, status); | |
| 79 | - } catch (HttpException e) { | |
| 80 | - e.printStackTrace(); | |
| 81 | - } catch (IOException e) { | |
| 82 | - e.printStackTrace(); | |
| 83 | - } | |
| 76 | + int status = client.executeMethod(method); | |
| 77 | + assertEquals(HttpStatus.SC_OK, status); | |
| 84 | 78 | } |
| 85 | 79 | } | ... | ... |
impl/extension/jsf/src/test/java/test/Tests.java
| ... | ... | @@ -80,17 +80,13 @@ import br.gov.frameworkdemoiselle.util.PageNotFoundException; |
| 80 | 80 | import br.gov.frameworkdemoiselle.util.Parameter; |
| 81 | 81 | import br.gov.frameworkdemoiselle.util.Redirector; |
| 82 | 82 | |
| 83 | -@SuppressWarnings("deprecation") | |
| 84 | 83 | @Ignore |
| 84 | +@SuppressWarnings("deprecation") | |
| 85 | 85 | public final class Tests { |
| 86 | 86 | |
| 87 | 87 | private Tests() { |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public static WebArchive createDeployment(final Class<?> baseClass) { | |
| 91 | - return createDeployment().addPackages(true, baseClass.getPackage()).addClass(Tests.class); | |
| 92 | - } | |
| 93 | - | |
| 94 | 90 | public static WebArchive createDeployment() { |
| 95 | 91 | File[] libs = Maven.resolver().offline().loadPomFromFile("pom.xml", "arquillian-test") |
| 96 | 92 | .importCompileAndRuntimeDependencies().resolve().withTransitivity().asFile(); | ... | ... |
impl/extension/jsf/src/test/resources/exception-handler-authentication/demoiselle.properties
0 → 100644
| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | +# Demoiselle Framework | |
| 2 | +# Copyright (C) 2010 SERPRO | |
| 3 | +# ---------------------------------------------------------------------------- | |
| 4 | +# This file is part of Demoiselle Framework. | |
| 5 | +# | |
| 6 | +# Demoiselle Framework is free software; you can redistribute it and/or | |
| 7 | +# modify it under the terms of the GNU Lesser General Public License version 3 | |
| 8 | +# as published by the Free Software Foundation. | |
| 9 | +# | |
| 10 | +# This program is distributed in the hope that it will be useful, | |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 | +# GNU General Public License for more details. | |
| 14 | +# | |
| 15 | +# You should have received a copy of the GNU Lesser General Public License version 3 | |
| 16 | +# along with this program; if not, see <http://www.gnu.org/licenses/> | |
| 17 | +# or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
| 18 | +# Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 | +# ---------------------------------------------------------------------------- | |
| 20 | +# Este arquivo é parte do Framework Demoiselle. | |
| 21 | +# | |
| 22 | +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
| 23 | +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
| 24 | +# do Software Livre (FSF). | |
| 25 | +# | |
| 26 | +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
| 27 | +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
| 28 | +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
| 29 | +# para maiores detalhes. | |
| 30 | +# | |
| 31 | +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
| 32 | +# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
| 33 | +# ou escreva para a Fundação do Software Livre (FSF) Inc., | |
| 34 | +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
| 35 | + | |
| 36 | +frameworkdemoiselle.security.redirect.enabled=false | |
| 0 | 37 | \ No newline at end of file | ... | ... |
impl/extension/jsf/src/test/resources/exception-handler-authorization/error.xhtml
0 → 100644
| ... | ... | @@ -0,0 +1,43 @@ |
| 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 | +<html xmlns:h="http://java.sun.com/jsf/html"> | |
| 38 | + | |
| 39 | + <h:body> | |
| 40 | + #{authorizationBean.throwExceptionMessage} | |
| 41 | + </h:body> | |
| 42 | + | |
| 43 | +</html> | ... | ... |
impl/extension/jsf/src/test/resources/exception-handler-authorization/index.xhtml
| 1 | -<html xmlns:h="http://java.sun.com/jsf/html" | |
| 2 | - xmlns:ui="http://java.sun.com/jsf/facelets"> | |
| 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 | +<html xmlns:h="http://java.sun.com/jsf/html"> | |
| 3 | 38 | |
| 4 | 39 | <h:body> |
| 5 | - #{authorizationBean.correctMessage} | |
| 6 | - <h:messages /> | |
| 40 | + <h:messages /> | |
| 7 | 41 | </h:body> |
| 8 | 42 | |
| 9 | 43 | </html> | ... | ... |
impl/extension/jsf/src/test/resources/exception-handler-authorization/page.xhtml
| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | -<html xmlns:h="http://java.sun.com/jsf/html" | |
| 2 | - xmlns:ui="http://java.sun.com/jsf/facelets"> | |
| 3 | - | |
| 4 | - <h:body> | |
| 5 | - #{authorizationBean.correctMessage} | |
| 6 | - #{authorizationBean.exceptionMessage} | |
| 7 | - <h:messages /> | |
| 8 | - </h:body> | |
| 9 | - | |
| 10 | -</html> | |
| 11 | 0 | \ No newline at end of file |
impl/extension/jsf/src/test/resources/exception-handler-authorization/pretty-config.xml
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | <url-mapping id="index"> |
| 44 | 44 | <pattern value="/index" /> |
| 45 | 45 | <view-id value="/index.jsf" /> |
| 46 | - <action>#{authorizationBean.loadExceptionMessage}</action> | |
| 46 | + <action>#{authorizationBean.getThrowExceptionMessage}</action> | |
| 47 | 47 | </url-mapping> |
| 48 | 48 | |
| 49 | 49 | </pretty-config> |
| 50 | 50 | \ No newline at end of file | ... | ... |
impl/extension/jsf/src/test/resources/exception-handler-authorization/web.xml
| ... | ... | @@ -71,4 +71,9 @@ |
| 71 | 71 | <servlet-name>Faces Servlet</servlet-name> |
| 72 | 72 | <url-pattern>*.jsf</url-pattern> |
| 73 | 73 | </servlet-mapping> |
| 74 | + | |
| 75 | + <context-param> | |
| 76 | + <param-name>facelets.SKIP_COMMENTS</param-name> | |
| 77 | + <param-value>true</param-value> | |
| 78 | + </context-param> | |
| 74 | 79 | </web-app> |
| 75 | 80 | \ No newline at end of file | ... | ... |