diff --git a/impl/extension/jsf/pom.xml b/impl/extension/jsf/pom.xml
index dd27508..81c4ced 100755
--- a/impl/extension/jsf/pom.xml
+++ b/impl/extension/jsf/pom.xml
@@ -76,6 +76,12 @@
jsf-api
+ org.glassfish.web
+ el-impl
+ provided
+
+
+
com.sun.faces
jsf-impl
test
@@ -87,9 +93,10 @@
test
- org.glassfish.web
- el-impl
- provided
+ com.ocpsoft
+ prettyfaces-jsf2
+ 3.3.0
+ test
diff --git a/impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationBean.java b/impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationBean.java
new file mode 100644
index 0000000..1670aa1
--- /dev/null
+++ b/impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationBean.java
@@ -0,0 +1,25 @@
+package exception.handler.authorization;
+
+import br.gov.frameworkdemoiselle.security.AuthorizationException;
+import br.gov.frameworkdemoiselle.stereotype.ViewController;
+
+@ViewController
+public class AuthorizationBean {
+
+ private String correctMessage = "Authorization Message.";
+
+ private String exceptionMessage = "Authorization Exception!";
+
+ public String getCorrectMessage() {
+ return correctMessage;
+ }
+
+ public String getExceptionMessage() {
+ throw new AuthorizationException(exceptionMessage);
+ }
+
+ public void loadExceptionMessage() {
+ throw new AuthorizationException(exceptionMessage);
+ }
+
+}
diff --git a/impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationHandledExceptionTest.java b/impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationHandledExceptionTest.java
new file mode 100644
index 0000000..61f43b5
--- /dev/null
+++ b/impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationHandledExceptionTest.java
@@ -0,0 +1,59 @@
+package exception.handler.authorization;
+
+import static org.junit.Assert.assertNotSame;
+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.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;
+
+@RunWith(Arquillian.class)
+public class AuthorizationHandledExceptionTest {
+
+ @ArquillianResource
+ private URL deploymentUrl;
+
+ private static final String PATH = "src/test/resources/exception-handler-authorization";
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ return Tests.createDeployment().addClass(AuthorizationHandledExceptionTest.class).addClass(AuthorizationBean.class)
+ .addAsWebResource(Tests.createFileAsset(PATH + "/index.xhtml"), "index.xhtml")
+ .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml")
+ .addAsWebInfResource(Tests.createFileAsset(PATH + "/pretty-config.xml"), "pretty-config.xml");
+
+ }
+
+ @Test
+ public void authorizationHandledException() {
+ HttpClient client = new HttpClient();
+ GetMethod method = new GetMethod(deploymentUrl + "/index");
+
+ try {
+ int status = client.executeMethod(method);
+ String message = method.getResponseBodyAsString();
+ System.out.println("MESAGE: " + message);
+
+ assertNotSame(HttpStatus.SC_INTERNAL_SERVER_ERROR, status);
+ assertTrue(message.contains("Authorization Message."));
+ assertTrue(message.contains("Authorization Exception!"));
+
+ } catch (HttpException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationNotHandledExceptionTest.java b/impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationNotHandledExceptionTest.java
new file mode 100644
index 0000000..6804dff
--- /dev/null
+++ b/impl/extension/jsf/src/test/java/exception/handler/authorization/AuthorizationNotHandledExceptionTest.java
@@ -0,0 +1,61 @@
+package exception.handler.authorization;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.Assert;
+
+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;
+
+@RunWith(Arquillian.class)
+public class AuthorizationNotHandledExceptionTest {
+
+ @ArquillianResource
+ private URL deploymentUrl;
+
+ private static final String PATH = "src/test/resources/exception-handler-authorization";
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ return Tests.createDeployment().addClass(AuthorizationNotHandledExceptionTest.class).addClass(AuthorizationBean.class)
+ .addAsWebResource(Tests.createFileAsset(PATH + "/page.xhtml"), "page.xhtml")
+ .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml");
+ }
+
+ @Test
+ public void authorizationNotHandledException() {
+ HttpClient client = new HttpClient();
+ GetMethod method = new GetMethod(deploymentUrl + "/page.jsf");
+
+ try {
+ int status = client.executeMethod(method);
+ String message = method.getResponseBodyAsString();
+ System.out.println("MESAGE: " + message);
+
+ assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, status);
+ assertTrue(message.contains("Authorization Exception!"));
+ assertFalse(message.contains("Authorization Message."));
+
+ } catch (HttpException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/impl/extension/jsf/src/test/resources/exception-handler-authorization/index.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-authorization/index.xhtml
new file mode 100644
index 0000000..71b029a
--- /dev/null
+++ b/impl/extension/jsf/src/test/resources/exception-handler-authorization/index.xhtml
@@ -0,0 +1,9 @@
+
+
+
+ #{authorizationBean.correctMessage}
+
+
+
+
diff --git a/impl/extension/jsf/src/test/resources/exception-handler-authorization/page.xhtml b/impl/extension/jsf/src/test/resources/exception-handler-authorization/page.xhtml
new file mode 100644
index 0000000..821aa31
--- /dev/null
+++ b/impl/extension/jsf/src/test/resources/exception-handler-authorization/page.xhtml
@@ -0,0 +1,10 @@
+
+
+
+ #{authorizationBean.correctMessage}
+ #{authorizationBean.exceptionMessage}
+
+
+
+
\ No newline at end of file
diff --git a/impl/extension/jsf/src/test/resources/exception-handler-authorization/pretty-config.xml b/impl/extension/jsf/src/test/resources/exception-handler-authorization/pretty-config.xml
new file mode 100644
index 0000000..9b3d397
--- /dev/null
+++ b/impl/extension/jsf/src/test/resources/exception-handler-authorization/pretty-config.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+ #{authorizationBean.loadExceptionMessage}
+
+
+
\ No newline at end of file
diff --git a/impl/extension/jsf/src/test/resources/exception-handler-authorization/web.xml b/impl/extension/jsf/src/test/resources/exception-handler-authorization/web.xml
new file mode 100644
index 0000000..b8a230d
--- /dev/null
+++ b/impl/extension/jsf/src/test/resources/exception-handler-authorization/web.xml
@@ -0,0 +1,74 @@
+
+
+
+
+ br.gov.frameworkdemoiselle.util.ServletListener
+
+
+ Demoiselle Servlet Filter
+ br.gov.frameworkdemoiselle.util.ServletFilter
+
+
+ Demoiselle Servlet Filter
+ /*
+
+
+
+ Pretty Filter
+ com.ocpsoft.pretty.PrettyFilter
+
+
+
+ Pretty Filter
+ /*
+ FORWARD
+ REQUEST
+ ERROR
+
+
+
+ Faces Servlet
+ javax.faces.webapp.FacesServlet
+ 1
+
+
+ Faces Servlet
+ *.jsf
+
+
\ No newline at end of file
--
libgit2 0.21.2