From 73aeab54aee4c1dc19deb0e36dcf3a93ac0138c1 Mon Sep 17 00:00:00 2001 From: Emerson Oliveira Date: Fri, 20 Sep 2013 16:02:24 -0300 Subject: [PATCH] IN PROGRESS - issue FWK-120: Testes da extensão JSF (segurança + mensagem + exceção) --- impl/extension/jsf/src/test/java/exception/handler/common/DummyException.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/java/exception/handler/common/ExceptionHandlerConfigBean.java | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerConfigFilter.java | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerDefaultConfigTest.java | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerRedirectConfigTest.java | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionNotHandlerConfigTest.java | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionHandlerRedirectConfigTest.java | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionNotHandlerConfigTest.java | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/java/test/Tests.java | 3 +++ impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/application_error.xhtml | 9 +++++++++ impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/demoiselle.properties | 36 ++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/index.xhtml | 9 +++++++++ impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/web.xml | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/resources/exception-handler-config/application_error.xhtml | 9 +++++++++ impl/extension/jsf/src/test/resources/exception-handler-config/demoiselle.properties | 36 ++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/resources/exception-handler-config/index.xhtml | 9 +++++++++ impl/extension/jsf/src/test/resources/exception-handler-config/web.xml | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/demoiselle.properties | 36 ++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/error_page.xhtml | 9 +++++++++ impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/index.xhtml | 9 +++++++++ impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/web.xml | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/resources/exception-handler-redirect-config/demoiselle.properties | 36 ++++++++++++++++++++++++++++++++++++ impl/extension/jsf/src/test/resources/exception-handler-redirect-config/error_page.xhtml | 9 +++++++++ impl/extension/jsf/src/test/resources/exception-handler-redirect-config/index.xhtml | 9 +++++++++ impl/extension/jsf/src/test/resources/exception-handler-redirect-config/web.xml | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 25 files changed, 1126 insertions(+), 0 deletions(-) create mode 100644 impl/extension/jsf/src/test/java/exception/handler/common/DummyException.java create mode 100644 impl/extension/jsf/src/test/java/exception/handler/common/ExceptionHandlerConfigBean.java create mode 100644 impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerConfigFilter.java create mode 100644 impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerDefaultConfigTest.java create mode 100644 impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerRedirectConfigTest.java create mode 100644 impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionNotHandlerConfigTest.java create mode 100644 impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionHandlerRedirectConfigTest.java create mode 100644 impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionNotHandlerConfigTest.java create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/application_error.xhtml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/demoiselle.properties create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/index.xhtml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/web.xml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-config/application_error.xhtml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-config/demoiselle.properties create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-config/index.xhtml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-config/web.xml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/demoiselle.properties create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/error_page.xhtml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/index.xhtml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/web.xml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-redirect-config/demoiselle.properties create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-redirect-config/error_page.xhtml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-redirect-config/index.xhtml create mode 100644 impl/extension/jsf/src/test/resources/exception-handler-redirect-config/web.xml diff --git a/impl/extension/jsf/src/test/java/exception/handler/common/DummyException.java b/impl/extension/jsf/src/test/java/exception/handler/common/DummyException.java new file mode 100644 index 0000000..bd5552b --- /dev/null +++ b/impl/extension/jsf/src/test/java/exception/handler/common/DummyException.java @@ -0,0 +1,49 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package exception.handler.common; + +import br.gov.frameworkdemoiselle.exception.ApplicationException; + +@ApplicationException +public class DummyException extends RuntimeException{ + + private static final long serialVersionUID = 1L; + + public DummyException(String string) { + super(string); + } +} diff --git a/impl/extension/jsf/src/test/java/exception/handler/common/ExceptionHandlerConfigBean.java b/impl/extension/jsf/src/test/java/exception/handler/common/ExceptionHandlerConfigBean.java new file mode 100644 index 0000000..90ae320 --- /dev/null +++ b/impl/extension/jsf/src/test/java/exception/handler/common/ExceptionHandlerConfigBean.java @@ -0,0 +1,50 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package exception.handler.common; + +import br.gov.frameworkdemoiselle.stereotype.ViewController; + +@ViewController +public class ExceptionHandlerConfigBean{ + + @SuppressWarnings("unused") + private String exp; + + public String getExp() throws DummyException { + throw new DummyException("DummyException!"); + } +} diff --git a/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerConfigFilter.java b/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerConfigFilter.java new file mode 100644 index 0000000..abec1fa --- /dev/null +++ b/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerConfigFilter.java @@ -0,0 +1,99 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package exception.handler.configuration; + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletResponse; + +import br.gov.frameworkdemoiselle.util.Beans; + +public class ExceptionHandlerConfigFilter implements Filter { + + private static final long serialVersionUID = 1L; + + private List facesMessage; + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, + ServletException { + +// try { + + chain.doFilter(request, response); + +// String message = response.getContentType(); +// System.out.println("MESSAGE FILTER: " + message); + +// facesMessage = FacesContext.getCurrentInstance().getMessageList(); + +// for(FacesMessage fm : FacesContext.getCurrentInstance().getMessageList()) { +// System.out.println("Sumary: " + fm.getSummary()); +// System.out.println("Detail: " + fm.getDetail()); +// +// if(fm.getSummary().equals("DummyException!")) { +// ((HttpServletResponse)response).setStatus(200); +// }else { +// ((HttpServletResponse)response).setStatus(200); +// } +// } + +// }catch(Exception e) { +// ((HttpServletResponse)response).setStatus(200); +// } + } + + @Override + public void destroy() { + } + +} diff --git a/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerDefaultConfigTest.java b/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerDefaultConfigTest.java new file mode 100644 index 0000000..d31653a --- /dev/null +++ b/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerDefaultConfigTest.java @@ -0,0 +1,98 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package exception.handler.configuration; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.net.URL; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.methods.GetMethod; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import exception.handler.common.DummyException; +import exception.handler.common.ExceptionHandlerConfigBean; +import test.Tests; + +@RunWith(Arquillian.class) +public class ExceptionHandlerDefaultConfigTest{ + + @ArquillianResource + private URL deploymentUrl; + + private static final String PATH = "src/test/resources/exception-handler-config"; + + @Deployment(testable = false) + public static WebArchive createDeployment() { + return Tests.createDeployment().addClass(ExceptionHandlerDefaultConfigTest.class) + .addClass(DummyException.class) + .addClass(ExceptionHandlerConfigBean.class) + .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") + .addAsWebResource(Tests.createFileAsset(PATH + "/application_error.xhtml"), "application_error.xhtml") + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); + } + + @Test + public void defaultConfiguration() { + HttpClient client = new HttpClient(); + GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); + + try { + client.executeMethod(method); + String message = method.getResponseBodyAsString(); + assertTrue(message.contains("Called the page /application_error")); + + } catch (HttpException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} + + + + + + diff --git a/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerRedirectConfigTest.java b/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerRedirectConfigTest.java new file mode 100644 index 0000000..0fa0943 --- /dev/null +++ b/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionHandlerRedirectConfigTest.java @@ -0,0 +1,92 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package exception.handler.configuration; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.net.URL; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.methods.GetMethod; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import test.Tests; +import exception.handler.common.DummyException; +import exception.handler.common.ExceptionHandlerConfigBean; + +@RunWith(Arquillian.class) +public class ExceptionHandlerRedirectConfigTest { + + @ArquillianResource + private URL deploymentUrl; + + private static final String PATH = "src/test/resources/exception-handler-redirect-config"; + + @Deployment(testable = false) + public static WebArchive createDeployment() { + return Tests.createDeployment().addClass(ExceptionHandlerRedirectConfigTest.class) + .addClass(DummyException.class).addClass(ExceptionHandlerConfigBean.class) + .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") + .addAsWebResource(Tests.createFileAsset(PATH + "/error_page.xhtml"), "error_page.xhtml") + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") + .addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); + } + + @Test + public void notHandlerConfiguration() { + HttpClient client = new HttpClient(); + GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); + + try { + client.executeMethod(method); + String message = method.getResponseBodyAsString(); + assertTrue(message.contains("Called the page /error_page")); + + } catch (HttpException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionNotHandlerConfigTest.java b/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionNotHandlerConfigTest.java new file mode 100644 index 0000000..dc7c4c8 --- /dev/null +++ b/impl/extension/jsf/src/test/java/exception/handler/configuration/ExceptionNotHandlerConfigTest.java @@ -0,0 +1,91 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package exception.handler.configuration; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.net.URL; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.methods.GetMethod; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import test.Tests; +import exception.handler.common.DummyException; +import exception.handler.common.ExceptionHandlerConfigBean; + +@RunWith(Arquillian.class) +public class ExceptionNotHandlerConfigTest { + + @ArquillianResource + private URL deploymentUrl; + + private static final String PATH = "src/test/resources/exception-handler-config"; + + @Deployment(testable = false) + public static WebArchive createDeployment() { + return Tests.createDeployment().addClass(ExceptionNotHandlerConfigTest.class).addClass(DummyException.class) + .addClass(ExceptionHandlerConfigBean.class) + .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") + .addAsWebResource(Tests.createFileAsset(PATH + "/application_error.xhtml"), "application_error.xhtml") + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") + .addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); + } + + @Test + public void notHandlerConfiguration() { + HttpClient client = new HttpClient(); + GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); + + try { + assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, client.executeMethod(method)); + + } catch (HttpException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionHandlerRedirectConfigTest.java b/impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionHandlerRedirectConfigTest.java new file mode 100644 index 0000000..a86dae8 --- /dev/null +++ b/impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionHandlerRedirectConfigTest.java @@ -0,0 +1,92 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package exception.handler.configuration.compatibility; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.net.URL; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.methods.GetMethod; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import test.Tests; +import exception.handler.common.DummyException; +import exception.handler.common.ExceptionHandlerConfigBean; + +@RunWith(Arquillian.class) +public class ExceptionHandlerRedirectConfigTest { + + @ArquillianResource + private URL deploymentUrl; + + private static final String PATH = "src/test/resources/exception-handler-redirect-config-compatibility"; + + @Deployment(testable = false) + public static WebArchive createDeployment() { + return Tests.createDeployment().addClass(ExceptionHandlerRedirectConfigTest.class) + .addClass(DummyException.class).addClass(ExceptionHandlerConfigBean.class) + .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") + .addAsWebResource(Tests.createFileAsset(PATH + "/error_page.xhtml"), "error_page.xhtml") + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") + .addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); + } + + @Test + public void notHandlerConfiguration() { + HttpClient client = new HttpClient(); + GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); + + try { + client.executeMethod(method); + String message = method.getResponseBodyAsString(); + assertTrue(message.contains("Called the page /error_page")); + + } catch (HttpException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionNotHandlerConfigTest.java b/impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionNotHandlerConfigTest.java new file mode 100644 index 0000000..9796e6a --- /dev/null +++ b/impl/extension/jsf/src/test/java/exception/handler/configuration/compatibility/ExceptionNotHandlerConfigTest.java @@ -0,0 +1,92 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package exception.handler.configuration.compatibility; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.net.URL; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.methods.GetMethod; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import test.Tests; +import exception.handler.common.DummyException; +import exception.handler.common.ExceptionHandlerConfigBean; + +@RunWith(Arquillian.class) +public class ExceptionNotHandlerConfigTest { + + @ArquillianResource + private URL deploymentUrl; + + private static final String PATH = "src/test/resources/exception-handler-config-compatibility"; + + @Deployment(testable = false) + public static WebArchive createDeployment() { + return Tests.createDeployment().addClass(ExceptionNotHandlerConfigTest.class).addClass(DummyException.class) + .addClass(ExceptionHandlerConfigBean.class) + .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml") + .addAsWebResource(Tests.createFileAsset(PATH + "/application_error.xhtml"), "application_error.xhtml") + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml") + .addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); + } + + @Test + public void notHandlerConfiguration() { + HttpClient client = new HttpClient(); + GetMethod method = new GetMethod(deploymentUrl + "/index.jsf"); + + try { + int status = client.executeMethod(method); + assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, status); + + } catch (HttpException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/impl/extension/jsf/src/test/java/test/Tests.java b/impl/extension/jsf/src/test/java/test/Tests.java index 64929b1..cce625f 100644 --- a/impl/extension/jsf/src/test/java/test/Tests.java +++ b/impl/extension/jsf/src/test/java/test/Tests.java @@ -134,6 +134,9 @@ public final class Tests { .addAsResource(createFileAsset("src/main/resources/demoiselle-jsf-bundle.properties"), "demoiselle-jsf-bundle.properties") .addAsWebInfResource(createFileAsset("src/test/resources/test/beans.xml"), "beans.xml") + .addAsManifestResource(createFileAsset("src/main/resources/META-INF/faces-config.xml"), "faces-config.xml") + .addAsManifestResource(createFileAsset("src/main/resources/META-INF/demoiselle-d.taglib.xml"), "demoiselle-d.taglib.xml") + .addAsManifestResource(createFileAsset("src/main/resources/META-INF/tags/br/gov/frameworkdemoiselle/checkLoggedIn.xhtml"), "checkedLoggedIn.xhtml") .addAsLibraries(libs); } diff --git a/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/application_error.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/application_error.xhtml new file mode 100644 index 0000000..83fe20d --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/application_error.xhtml @@ -0,0 +1,9 @@ + + + + + Called the page /application_error + + + \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/demoiselle.properties b/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/demoiselle.properties new file mode 100644 index 0000000..4780cd1 --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/demoiselle.properties @@ -0,0 +1,36 @@ +# Demoiselle Framework +# Copyright (C) 2010 SERPRO +# ---------------------------------------------------------------------------- +# This file is part of Demoiselle Framework. +# +# Demoiselle Framework is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License version 3 +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License version 3 +# along with this program; if not, see +# or write to the Free Software Foundation, Inc., 51 Franklin Street, +# Fifth Floor, Boston, MA 02110-1301, USA. +# ---------------------------------------------------------------------------- +# Este arquivo é parte do Framework Demoiselle. +# +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação +# do Software Livre (FSF). +# +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português +# para maiores detalhes. +# +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título +# "LICENCA.txt", junto com esse programa. Se não, acesse +# ou escreva para a Fundação do Software Livre (FSF) Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + +frameworkdemoiselle.handle.application.exception=false \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/index.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/index.xhtml new file mode 100644 index 0000000..6b08495 --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/index.xhtml @@ -0,0 +1,9 @@ + + + + + #{exceptionHandlerConfigBean.exp} + + + diff --git a/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/web.xml b/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/web.xml new file mode 100644 index 0000000..c2a321e --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-config-compatibility/web.xml @@ -0,0 +1,61 @@ + + + + + br.gov.frameworkdemoiselle.util.ServletListener + + + Demoiselle Servlet Filter + br.gov.frameworkdemoiselle.util.ServletFilter + + + Demoiselle Servlet Filter + /* + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + *.jsf + + \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-config/application_error.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-config/application_error.xhtml new file mode 100644 index 0000000..83fe20d --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-config/application_error.xhtml @@ -0,0 +1,9 @@ + + + + + Called the page /application_error + + + \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-config/demoiselle.properties b/impl/extension/jsf/src/test/resources/exception-handler-config/demoiselle.properties new file mode 100644 index 0000000..1d39250 --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-config/demoiselle.properties @@ -0,0 +1,36 @@ +# Demoiselle Framework +# Copyright (C) 2010 SERPRO +# ---------------------------------------------------------------------------- +# This file is part of Demoiselle Framework. +# +# Demoiselle Framework is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License version 3 +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License version 3 +# along with this program; if not, see +# or write to the Free Software Foundation, Inc., 51 Franklin Street, +# Fifth Floor, Boston, MA 02110-1301, USA. +# ---------------------------------------------------------------------------- +# Este arquivo é parte do Framework Demoiselle. +# +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação +# do Software Livre (FSF). +# +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português +# para maiores detalhes. +# +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título +# "LICENCA.txt", junto com esse programa. Se não, acesse +# ou escreva para a Fundação do Software Livre (FSF) Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + +frameworkdemoiselle.exception.application.handle=false \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-config/index.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-config/index.xhtml new file mode 100644 index 0000000..6b08495 --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-config/index.xhtml @@ -0,0 +1,9 @@ + + + + + #{exceptionHandlerConfigBean.exp} + + + diff --git a/impl/extension/jsf/src/test/resources/exception-handler-config/web.xml b/impl/extension/jsf/src/test/resources/exception-handler-config/web.xml new file mode 100644 index 0000000..c2a321e --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-config/web.xml @@ -0,0 +1,61 @@ + + + + + br.gov.frameworkdemoiselle.util.ServletListener + + + Demoiselle Servlet Filter + br.gov.frameworkdemoiselle.util.ServletFilter + + + Demoiselle Servlet Filter + /* + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + *.jsf + + \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/demoiselle.properties b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/demoiselle.properties new file mode 100644 index 0000000..9e8a94d --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/demoiselle.properties @@ -0,0 +1,36 @@ +# Demoiselle Framework +# Copyright (C) 2010 SERPRO +# ---------------------------------------------------------------------------- +# This file is part of Demoiselle Framework. +# +# Demoiselle Framework is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License version 3 +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License version 3 +# along with this program; if not, see +# or write to the Free Software Foundation, Inc., 51 Franklin Street, +# Fifth Floor, Boston, MA 02110-1301, USA. +# ---------------------------------------------------------------------------- +# Este arquivo é parte do Framework Demoiselle. +# +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação +# do Software Livre (FSF). +# +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português +# para maiores detalhes. +# +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título +# "LICENCA.txt", junto com esse programa. Se não, acesse +# ou escreva para a Fundação do Software Livre (FSF) Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + +frameworkdemoiselle.handle.application.exception.page=/error_page \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/error_page.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/error_page.xhtml new file mode 100644 index 0000000..0257f08 --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/error_page.xhtml @@ -0,0 +1,9 @@ + + + + + Called the page /error_page + + + \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/index.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/index.xhtml new file mode 100644 index 0000000..6b08495 --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/index.xhtml @@ -0,0 +1,9 @@ + + + + + #{exceptionHandlerConfigBean.exp} + + + diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/web.xml b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/web.xml new file mode 100644 index 0000000..fe1a20c --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config-compatibility/web.xml @@ -0,0 +1,61 @@ + + + + + br.gov.frameworkdemoiselle.util.ServletListener + + + Demoiselle Servlet Filter + br.gov.frameworkdemoiselle.util.ServletFilter + + + Demoiselle Servlet Filter + /* + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + *.jsf + + \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/demoiselle.properties b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/demoiselle.properties new file mode 100644 index 0000000..1e061a1 --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/demoiselle.properties @@ -0,0 +1,36 @@ +# Demoiselle Framework +# Copyright (C) 2010 SERPRO +# ---------------------------------------------------------------------------- +# This file is part of Demoiselle Framework. +# +# Demoiselle Framework is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License version 3 +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License version 3 +# along with this program; if not, see +# or write to the Free Software Foundation, Inc., 51 Franklin Street, +# Fifth Floor, Boston, MA 02110-1301, USA. +# ---------------------------------------------------------------------------- +# Este arquivo é parte do Framework Demoiselle. +# +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação +# do Software Livre (FSF). +# +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português +# para maiores detalhes. +# +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título +# "LICENCA.txt", junto com esse programa. Se não, acesse +# ou escreva para a Fundação do Software Livre (FSF) Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + +frameworkdemoiselle.exception.default.redirect.page=/error_page \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/error_page.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/error_page.xhtml new file mode 100644 index 0000000..0257f08 --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/error_page.xhtml @@ -0,0 +1,9 @@ + + + + + Called the page /error_page + + + \ No newline at end of file diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/index.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/index.xhtml new file mode 100644 index 0000000..6b08495 --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/index.xhtml @@ -0,0 +1,9 @@ + + + + + #{exceptionHandlerConfigBean.exp} + + + diff --git a/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/web.xml b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/web.xml new file mode 100644 index 0000000..c2a321e --- /dev/null +++ b/impl/extension/jsf/src/test/resources/exception-handler-redirect-config/web.xml @@ -0,0 +1,61 @@ + + + + + br.gov.frameworkdemoiselle.util.ServletListener + + + Demoiselle Servlet Filter + br.gov.frameworkdemoiselle.util.ServletFilter + + + Demoiselle Servlet Filter + /* + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + *.jsf + + \ No newline at end of file -- libgit2 0.21.2