You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2014/04/29 08:26:54 UTC
[1/2] git commit: DELTASPIKE-571 navigation tests
Repository: deltaspike
Updated Branches:
refs/heads/master 61aaa25e5 -> 842933b7b
DELTASPIKE-571 navigation tests
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/842933b7
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/842933b7
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/842933b7
Branch: refs/heads/master
Commit: 842933b7bab0061eef9237d2a839a3ef18bc6059
Parents: 43b7fd0
Author: Rafael Benevides <be...@redhat.com>
Authored: Mon Apr 28 22:38:14 2014 +0200
Committer: gpetracek <gp...@apache.org>
Committed: Tue Apr 29 08:25:38 2014 +0200
----------------------------------------------------------------------
.../destination/uc001/PageBean001.java | 2 -
.../destination/uc001/ViewConfigTest.java | 80 +++++++++++++
.../destination/uc002/PageBean002.java | 2 -
.../destination/uc002/ViewConfigTest.java | 114 +++++++++++++++++++
.../navigation/event/uc001/PageBean002.java | 11 +-
.../view/navigation/event/uc001/Pages.java | 6 +
.../uc001/PreViewConfigNavigateEventTest.java | 89 +++++++++++++++
.../StaticNavigationParameterWarFileTest.java | 10 +-
.../uc003/NavigationParameterTest.java | 85 ++++++++++++++
.../navigation/parameter/uc003/PageBean003.java | 5 +-
.../parameter/uc003/SimplePageConfig.java | 4 +
.../uc004/NavigationParameterTest.java | 92 +++++++++++++++
.../parameter/uc004/SimplePageConfig.java | 4 +
.../uc005/NavigationParameterTest.java | 103 +++++++++++++++++
.../navigation/parameter/uc005/PageBean005.java | 6 +-
.../view/navigation/parameter/uc005/Pages.java | 6 +-
.../uc006/NavigationParameterTest.java | 85 ++++++++++++++
.../navigation/parameter/uc006/PageBean006.java | 1 -
.../parameter/uc006/PageConfigForRedirect.java | 29 -----
.../view/navigation/parameter/uc006/Pages.java | 33 ++++++
.../src/test/resources/navigation/origin.xhtml | 45 ++++++++
.../navigation/pages/customErrorPage.xhtml | 29 +++++
.../test/resources/navigation/pages/home.xhtml | 29 +++++
.../test/resources/navigation/pages/index.xhtml | 29 +++++
.../resources/navigation/pages/overview.xhtml | 29 +++++
.../resources/navigation/simplePageConfig.xhtml | 29 +++++
26 files changed, 904 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/PageBean001.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/PageBean001.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/PageBean001.java
index ff3995d..9504061 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/PageBean001.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/PageBean001.java
@@ -22,8 +22,6 @@ import org.apache.deltaspike.core.api.config.view.ViewConfig;
import javax.enterprise.inject.Model;
-//TODO add jsf-navigation test
-
@Model
public class PageBean001
{
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/ViewConfigTest.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/ViewConfigTest.java
new file mode 100644
index 0000000..a3d8c4b
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc001/ViewConfigTest.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc001;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.warp.WarpTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+@WarpTest
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class ViewConfigTest
+{
+
+ @Drone
+ private WebDriver driver;
+
+ @ArquillianResource
+ private URL contextPath;
+
+ @Deployment
+ public static WebArchive deploy()
+ {
+ return ShrinkWrap
+ .create(WebArchive.class, "nav-destination-uc001.war")
+ .addPackage(Pages.class.getPackage())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())
+ .addAsWebResource("navigation/origin.xhtml", "/origin.xhtml")
+ .addAsWebResource("navigation/pages/index.xhtml", "/pages/index.xhtml")
+ .addAsWebInfResource("default/WEB-INF/web.xml", "web.xml")
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ @Test
+ @RunAsClient
+ public void testNavigation() throws MalformedURLException
+ {
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+
+ WebElement button = driver.findElement(By.id("destination:pb001ActionMethod"));
+ button.click();
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("indexPage"), "You arrived at index page").apply(driver));
+ }
+}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/PageBean002.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/PageBean002.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/PageBean002.java
index c5618af..ef821eb 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/PageBean002.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/PageBean002.java
@@ -23,8 +23,6 @@ import org.apache.deltaspike.core.api.config.view.ViewConfig;
import javax.enterprise.inject.Model;
-//TODO add jsf-navigation tests
-
@Model
public class PageBean002
{
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/ViewConfigTest.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/ViewConfigTest.java
new file mode 100644
index 0000000..81622e9
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/destination/uc002/ViewConfigTest.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc002;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.warp.WarpTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+@WarpTest
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class ViewConfigTest
+{
+
+ @Drone
+ private WebDriver driver;
+
+ @ArquillianResource
+ private URL contextPath;
+
+ @Deployment
+ public static WebArchive deploy()
+ {
+ return ShrinkWrap
+ .create(WebArchive.class, "nav-destination-uc002.war")
+ .addPackage(Pages.class.getPackage())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())
+ .addAsWebResource("navigation/origin.xhtml", "/origin.xhtml")
+ .addAsWebResource("navigation/pages/index.xhtml", "/pages/index.xhtml")
+ .addAsWebResource("navigation/pages/home.xhtml", "/pages/home.xhtml")
+ .addAsWebResource("navigation/pages/overview.xhtml", "/pages/overview.xhtml")
+ .addAsWebResource("navigation/pages/customErrorPage.xhtml", "/pages/customErrorPage.xhtml")
+ .addAsWebInfResource("default/WEB-INF/web.xml", "web.xml")
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ @Test
+ @RunAsClient
+ public void testNavigationActionWithoutError() throws MalformedURLException
+ {
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+
+ WebElement button = driver.findElement(By.id("destination:pb002ActionWithoutError"));
+ button.click();
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("overviewPage"),
+ "You arrived at overview page").apply(driver));
+ // Was redirected ?
+ Assert.assertTrue(driver.getCurrentUrl().contains("overview.xhtml"));
+ }
+
+ @Test
+ @RunAsClient
+ public void testNavigationActionWithError() throws MalformedURLException
+ {
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+
+ WebElement button = driver.findElement(By.id("destination:pb002ActionWithError"));
+ button.click();
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("customErrorPage"),
+ "This is a custom error page").apply(driver));
+ }
+
+
+ @Test
+ @RunAsClient
+ public void testNavigationRestrictedToPages() throws MalformedURLException
+ {
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+
+ WebElement button = driver.findElement(By.id("destination:pb002RestrictedToPages"));
+ button.click();
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("homePage"), "You arrived at home page")
+ .apply(driver));
+ // Was fowarded ?
+ Assert.assertTrue(driver.getCurrentUrl().contains("origin.xhtml"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PageBean002.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PageBean002.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PageBean002.java
index ed27cb4..4f96c37 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PageBean002.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PageBean002.java
@@ -18,14 +18,13 @@
*/
package org.apache.deltaspike.test.jsf.impl.config.view.navigation.event.uc001;
-import org.apache.deltaspike.core.api.config.view.DefaultErrorView;
-import org.apache.deltaspike.core.api.config.view.ViewConfig;
-import org.apache.deltaspike.core.api.config.view.navigation.event.PreViewConfigNavigateEvent;
-
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Model;
-//TODO add jsf-navigation tests
+import org.apache.deltaspike.core.api.config.view.DefaultErrorView;
+import org.apache.deltaspike.core.api.config.view.ViewConfig;
+import org.apache.deltaspike.core.api.config.view.navigation.event.PreViewConfigNavigateEvent;
+import org.apache.deltaspike.test.jsf.impl.config.view.navigation.event.uc001.Pages.CustomErrorPage;
@Model
public class PageBean002
@@ -43,7 +42,7 @@ public class PageBean002
protected void onNavigation(@Observes PreViewConfigNavigateEvent navigateEvent)
{
//change the target dynamically instead of a static config of the DefaultErrorView
- if (navigateEvent.getToView().equals(DefaultErrorView.class))
+ if (navigateEvent.getToView().equals(CustomErrorPage.class))
{
navigateEvent.navigateTo(Pages.Index.class);
}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/Pages.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/Pages.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/Pages.java
index dad22ae..a823f10 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/Pages.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/Pages.java
@@ -18,6 +18,7 @@
*/
package org.apache.deltaspike.test.jsf.impl.config.view.navigation.event.uc001;
+import org.apache.deltaspike.core.api.config.view.DefaultErrorView;
import org.apache.deltaspike.core.api.config.view.ViewConfig;
import org.apache.deltaspike.jsf.api.config.view.View;
@@ -42,4 +43,9 @@ public interface Pages extends ViewConfig
class Home implements Pages
{
}
+
+ class CustomErrorPage extends DefaultErrorView
+ {
+
+ }
}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PreViewConfigNavigateEventTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PreViewConfigNavigateEventTest.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PreViewConfigNavigateEventTest.java
new file mode 100644
index 0000000..c1289f2
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/event/uc001/PreViewConfigNavigateEventTest.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.test.jsf.impl.config.view.navigation.event.uc001;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.warp.WarpTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+//Needs DELTASPIKE-565 to be fixed
+@WarpTest
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class PreViewConfigNavigateEventTest
+{
+
+ @Drone
+ private WebDriver driver;
+
+ @ArquillianResource
+ private URL contextPath;
+
+ @Deployment
+ public static WebArchive deploy()
+ {
+ WebArchive archive = ShrinkWrap
+ .create(WebArchive.class, "nav-event-uc001.war")
+ .addPackage(Pages.class.getPackage())
+ .addClass(PageBean002.class)
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())
+ .addAsWebResource("navigation/origin.xhtml", "/origin.xhtml")
+ .addAsWebResource("navigation/pages/index.xhtml", "/pages/index.xhtml")
+ .addAsWebResource("navigation/pages/home.xhtml", "/pages/home.xhtml")
+ .addAsWebResource("navigation/pages/overview.xhtml", "/pages/overview.xhtml")
+ .addAsWebResource("navigation/pages/customErrorPage.xhtml", "/pages/customErrorPage.xhtml")
+ .addAsWebInfResource("default/WEB-INF/web.xml", "web.xml")
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ public void testNavigationActionWithError() throws MalformedURLException
+ {
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+
+ WebElement button = driver.findElement(By.id("event:pb002ActionWithError"));
+ button.click();
+ // Index Page is shown instead of DefaultErrorView because PreViewConfigNavigateEvent changed the navigation
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("indexPage"), "You arrived at index page")
+ .apply(driver));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc002/StaticNavigationParameterWarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc002/StaticNavigationParameterWarFileTest.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc002/StaticNavigationParameterWarFileTest.java
index d7a205e..cf71f94 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc002/StaticNavigationParameterWarFileTest.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc002/StaticNavigationParameterWarFileTest.java
@@ -18,7 +18,12 @@
*/
package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc002;
+import java.net.URL;
+
+import javax.inject.Inject;
+
import junit.framework.Assert;
+
import org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;
import org.apache.deltaspike.test.category.DeltaSpikeTest;
import org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.shared.TestClassDeactivator;
@@ -31,9 +36,6 @@ import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.inject.Inject;
-import java.net.URL;
-
@RunWith(Arquillian.class)
public class StaticNavigationParameterWarFileTest
@@ -63,7 +65,7 @@ public class StaticNavigationParameterWarFileTest
private NavigationParameterContext navigationParameterContext;
@Test
- public void oneParameters()
+ public void oneParameter()
{
Assert.assertTrue(this.navigationParameterContext.getPageParameters().isEmpty());
this.pageBean.actionMethod1();
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/NavigationParameterTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/NavigationParameterTest.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/NavigationParameterTest.java
new file mode 100644
index 0000000..501a360
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/NavigationParameterTest.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc003;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.warp.WarpTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+@WarpTest
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class NavigationParameterTest
+{
+ @Drone
+ private WebDriver driver;
+
+ @ArquillianResource
+ private URL contextPath;
+
+ @Deployment
+ public static WebArchive deploy()
+ {
+ WebArchive archive = ShrinkWrap
+ .create(WebArchive.class, "nav-parameter-uc003.war")
+ .addPackage(SimplePageConfig.class.getPackage())
+ .addClass(PageBean003.class)
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())
+ .addAsWebResource("navigation/origin.xhtml", "/origin.xhtml")
+ .addAsWebResource("navigation/simplePageConfig.xhtml", "/simplePageConfig.xhtml")
+ .addAsWebInfResource("default/WEB-INF/web.xml", "web.xml")
+ .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ public void testNavigationActionWithParameter() throws MalformedURLException
+ {
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+ WebElement button = driver.findElement(By.id("parameter:pb003ActionMethod"));
+ button.click();
+
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("simplePageConfig"),
+ "You arrived at simplePageConfig page")
+ .apply(driver));
+ System.out.println(driver.getCurrentUrl());
+ Assert.assertTrue(driver.getCurrentUrl().contains("param1=0"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/PageBean003.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/PageBean003.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/PageBean003.java
index 2724b81..abe9980 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/PageBean003.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/PageBean003.java
@@ -18,17 +18,16 @@
*/
package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc003;
+import javax.enterprise.inject.Model;
+
import org.apache.deltaspike.core.api.config.view.ViewConfig;
import org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;
-import javax.enterprise.inject.Model;
-
@Model
public class PageBean003
{
private int nextValue = 0;
- //TODO add test
@NavigationParameter(key = "param1", value = "#{pageBean003.nextValue}")
public Class<? extends ViewConfig> actionMethod()
{
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/SimplePageConfig.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/SimplePageConfig.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/SimplePageConfig.java
index ab757c4..0973648 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/SimplePageConfig.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc003/SimplePageConfig.java
@@ -19,7 +19,11 @@
package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc003;
import org.apache.deltaspike.core.api.config.view.ViewConfig;
+import org.apache.deltaspike.jsf.api.config.view.View;
+import org.apache.deltaspike.jsf.api.config.view.View.NavigationMode;
+import org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode;
+@View(navigation = NavigationMode.REDIRECT, viewParams = ViewParameterMode.INCLUDE)
public class SimplePageConfig implements ViewConfig
{
}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/NavigationParameterTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/NavigationParameterTest.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/NavigationParameterTest.java
new file mode 100644
index 0000000..cf28ec4
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/NavigationParameterTest.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc004;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.warp.WarpTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+@WarpTest
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class NavigationParameterTest
+{
+
+ @Drone
+ private WebDriver driver;
+
+ @ArquillianResource
+ private URL contextPath;
+
+ @Deployment
+ public static WebArchive deploy()
+ {
+ WebArchive archive = ShrinkWrap
+ .create(WebArchive.class, "nav-parameter-uc004-drone.war")
+ .addPackage(SimplePageConfig.class.getPackage())
+ .addClass(PageBean004.class)
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())
+ .addAsWebResource("navigation/origin.xhtml", "/origin.xhtml")
+ .addAsWebResource("navigation/simplePageConfig.xhtml", "/simplePageConfig.xhtml")
+ .addAsWebInfResource("default/WEB-INF/web.xml", "web.xml")
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ public void testNavigationActionWithParameter() throws MalformedURLException
+ {
+ //first click
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+ WebElement button = driver.findElement(By.id("parameter:pb004ActionMethod"));
+ button.click();
+
+ //second click
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+ button = driver.findElement(By.id("parameter:pb004ActionMethod"));
+ button.click();
+
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("simplePageConfig"),
+ "You arrived at simplePageConfig page")
+ .apply(driver));
+ Assert.assertTrue(driver.getCurrentUrl().contains("&cv="));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/SimplePageConfig.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/SimplePageConfig.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/SimplePageConfig.java
index 831dd05..b17b365 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/SimplePageConfig.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc004/SimplePageConfig.java
@@ -19,7 +19,11 @@
package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc004;
import org.apache.deltaspike.core.api.config.view.ViewConfig;
+import org.apache.deltaspike.jsf.api.config.view.View;
+import org.apache.deltaspike.jsf.api.config.view.View.NavigationMode;
+import org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode;
+@View(navigation = NavigationMode.REDIRECT, viewParams = ViewParameterMode.INCLUDE)
public class SimplePageConfig implements ViewConfig
{
}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/NavigationParameterTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/NavigationParameterTest.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/NavigationParameterTest.java
new file mode 100644
index 0000000..a46ae31
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/NavigationParameterTest.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc005;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.warp.WarpTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+@WarpTest
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class NavigationParameterTest
+{
+
+ @Drone
+ private WebDriver driver;
+
+ @ArquillianResource
+ private URL contextPath;
+
+ @Deployment
+ public static WebArchive deploy()
+ {
+ WebArchive archive = ShrinkWrap
+ .create(WebArchive.class, "nav-parameter-uc005.war")
+ .addPackage(Pages.class.getPackage())
+ .addClass(PageBean005.class)
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())
+ .addAsWebResource("navigation/origin.xhtml", "/origin.xhtml")
+ .addAsWebResource("navigation/pages/index.xhtml", "/pages/index.xhtml")
+ .addAsWebResource("navigation/pages/overview.xhtml", "/pages/overview.xhtml")
+ .addAsWebInfResource("default/WEB-INF/web.xml", "web.xml")
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ public void testNavigationActionOverview() throws MalformedURLException
+ {
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+
+ WebElement button = driver.findElement(By.id("parameter:pb005Overview"));
+ button.click();
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("overviewPage"),
+ "You arrived at overview page")
+ .apply(driver));
+ System.out.println(driver.getCurrentUrl());
+ Assert.assertTrue(driver.getCurrentUrl().contains("param1=staticValue2"));
+ Assert.assertTrue(driver.getCurrentUrl().contains("param2=aValue"));
+ }
+
+ @Test
+ @RunAsClient
+ public void testNavigationActionIndex() throws MalformedURLException
+ {
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+
+ WebElement button = driver.findElement(By.id("parameter:pb005Index"));
+ button.click();
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("indexPage"),
+ "You arrived at index page")
+ .apply(driver));
+ System.out.println(driver.getCurrentUrl());
+ Assert.assertTrue(driver.getCurrentUrl().contains("param1=staticValue2"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/PageBean005.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/PageBean005.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/PageBean005.java
index cc07ae1..8df0830 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/PageBean005.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/PageBean005.java
@@ -25,21 +25,19 @@ import javax.enterprise.inject.Model;
@Model
public class PageBean005
{
- private int currentValue = 0;
+ private String currentValue = "aValue";
public Class<? extends ViewConfig> index()
{
- currentValue++;
return Pages.Index.class;
}
public Class<? extends ViewConfig> overview()
{
- currentValue++;
return Pages.Overview.class;
}
- public int getCurrentValue()
+ public String getCurrentValue()
{
return currentValue;
}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/Pages.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/Pages.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/Pages.java
index 26b26a7..091d1ec 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/Pages.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc005/Pages.java
@@ -20,9 +20,11 @@ package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc0
import org.apache.deltaspike.core.api.config.view.ViewConfig;
import org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter;
+import org.apache.deltaspike.jsf.api.config.view.View;
+import org.apache.deltaspike.jsf.api.config.view.View.NavigationMode;
+import org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode;
-//TODO add tests
-
+@View(navigation = NavigationMode.REDIRECT, viewParams = ViewParameterMode.INCLUDE)
public interface Pages extends ViewConfig
{
@NavigationParameter(key = "param1", value = "staticValue2")
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/NavigationParameterTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/NavigationParameterTest.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/NavigationParameterTest.java
new file mode 100644
index 0000000..1064227
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/NavigationParameterTest.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc006;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.apache.deltaspike.test.jsf.impl.util.ArchiveUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.warp.WarpTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+@WarpTest
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class NavigationParameterTest
+{
+
+ @Drone
+ private WebDriver driver;
+
+ @ArquillianResource
+ private URL contextPath;
+
+ @Deployment
+ public static WebArchive deploy()
+ {
+ WebArchive archive = ShrinkWrap
+ .create(WebArchive.class, "nav-parameter-uc006.war")
+ .addPackage(PageBean006.class.getPackage())
+ .addClass(Pages.class)
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())
+ .addAsWebResource("navigation/origin.xhtml", "/origin.xhtml")
+ .addAsWebResource("navigation/pages/customErrorPage.xhtml", "/pages/customErrorPage.xhtml")
+ .addAsWebInfResource("default/WEB-INF/web.xml", "web.xml")
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ public void testNavigationActionWithParameter() throws MalformedURLException
+ {
+ driver.get(new URL(contextPath, "origin.xhtml").toString());
+
+ WebElement button = driver.findElement(By.id("parameter:pb006AnyMethod"));
+ button.click();
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("customErrorPage"),
+ "This is a custom error page")
+ .apply(driver));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageBean006.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageBean006.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageBean006.java
index b5e12a5..ca06984 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageBean006.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageBean006.java
@@ -31,7 +31,6 @@ public class PageBean006
private ViewNavigationHandler viewNavigationHandler;
//faces-redirect=true will be added by the navigation handler
- //TODO add test
public void anyMethod()
{
//navigates to the view which is configured as default error-view
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageConfigForRedirect.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageConfigForRedirect.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageConfigForRedirect.java
deleted file mode 100644
index d9c4e7b..0000000
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/PageConfigForRedirect.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc006;
-
-import org.apache.deltaspike.core.api.config.view.DefaultErrorView;
-import org.apache.deltaspike.jsf.api.config.view.View;
-
-import static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;
-
-@View(navigation = REDIRECT)
-public class PageConfigForRedirect extends DefaultErrorView
-{
-}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/Pages.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/Pages.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/Pages.java
new file mode 100644
index 0000000..2f0b1c7
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/parameter/uc006/Pages.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc006;
+
+import static org.apache.deltaspike.jsf.api.config.view.View.NavigationMode.REDIRECT;
+
+import org.apache.deltaspike.core.api.config.view.DefaultErrorView;
+import org.apache.deltaspike.core.api.config.view.ViewConfig;
+import org.apache.deltaspike.jsf.api.config.view.View;
+
+@View(navigation = REDIRECT)
+public interface Pages extends ViewConfig
+{
+ public class CustomErrorPage extends DefaultErrorView implements Pages
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/resources/navigation/origin.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/resources/navigation/origin.xhtml b/deltaspike/modules/jsf/impl/src/test/resources/navigation/origin.xhtml
new file mode 100644
index 0000000..98353c0
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/resources/navigation/origin.xhtml
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<h:head><title>Test</title></h:head>
+<body>
+ <h:form id="destination">
+ <h:commandButton id="pb001ActionMethod" value="Action Method" action="#{pageBean001.actionMethod()}" />
+ <h:commandButton id="pb002ActionWithoutError" value="Action Method" action="#{pageBean002.actionWithoutError()}" />
+ <h:commandButton id="pb002ActionWithError" value="Action Method" action="#{pageBean002.actionWithError()}" />
+ <h:commandButton id="pb002RestrictedToPages" value="Action Method" action="#{pageBean002.restrictedToPages()}" />
+ </h:form>
+ <h:form id="event">
+ <h:commandButton id="pb002ActionWithError" value="Action Method" action="#{pageBean002.actionWithError()}" />
+ </h:form>
+ <h:form id="parameter">
+ <h:commandButton id="pb003ActionMethod" value="Action Method" action="#{pageBean003.actionMethod()}" />
+ <h:commandButton id="pb004ActionMethod" value="Action Method" action="#{pageBean004.actionMethod()}" />
+ <h:commandButton id="pb005Overview" value="Action Method" action="#{pageBean005.overview()}" />
+ <h:commandButton id="pb005Index" value="Action Method" action="#{pageBean005.index()}" />
+ <h:commandButton id="pb006AnyMethod" value="Action" action="#{pageBean006.anyMethod()}" />
+ </h:form>
+
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/customErrorPage.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/customErrorPage.xhtml b/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/customErrorPage.xhtml
new file mode 100644
index 0000000..b205634
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/customErrorPage.xhtml
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<h:head><title>Test</title></h:head>
+<body>
+ <div id="customErrorPage">This is a custom error page</div>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/home.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/home.xhtml b/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/home.xhtml
new file mode 100644
index 0000000..538f97a
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/home.xhtml
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<h:head><title>Test</title></h:head>
+<body>
+ <div id="homePage">You arrived at home page</div>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/index.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/index.xhtml b/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/index.xhtml
new file mode 100644
index 0000000..cb98d66
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/index.xhtml
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<h:head><title>Test</title></h:head>
+<body>
+ <div id="indexPage">You arrived at index page</div>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/overview.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/overview.xhtml b/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/overview.xhtml
new file mode 100644
index 0000000..f149f26
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/resources/navigation/pages/overview.xhtml
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<h:head><title>Test</title></h:head>
+<body>
+ <div id="overviewPage">You arrived at overview page</div>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/842933b7/deltaspike/modules/jsf/impl/src/test/resources/navigation/simplePageConfig.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/resources/navigation/simplePageConfig.xhtml b/deltaspike/modules/jsf/impl/src/test/resources/navigation/simplePageConfig.xhtml
new file mode 100644
index 0000000..34e3539
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/resources/navigation/simplePageConfig.xhtml
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<h:head><title>Test</title></h:head>
+<body>
+ <div id="simplePageConfig">You arrived at simplePageConfig page</div>
+</body>
+</html>
[2/2] git commit: DELTASPIKE-449 integration of AccessDeniedException
with ExceptionToCatchEvent
Posted by gp...@apache.org.
DELTASPIKE-449 integration of AccessDeniedException with ExceptionToCatchEvent
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/43b7fd02
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/43b7fd02
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/43b7fd02
Branch: refs/heads/master
Commit: 43b7fd02e39a7bbfa1429c242534f881e46fc1fb
Parents: 61aaa25
Author: gpetracek <gp...@apache.org>
Authored: Mon Apr 28 11:21:02 2014 +0200
Committer: gpetracek <gp...@apache.org>
Committed: Tue Apr 29 08:25:38 2014 +0200
----------------------------------------------------------------------
.../authorization/SecuredAnnotationAuthorizer.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/43b7fd02/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java
index 951c0fe..409b300 100644
--- a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java
+++ b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java
@@ -18,6 +18,7 @@
*/
package org.apache.deltaspike.security.impl.authorization;
+import org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;
import org.apache.deltaspike.core.api.provider.BeanProvider;
import org.apache.deltaspike.security.api.authorization.AccessDecisionState;
import org.apache.deltaspike.security.api.authorization.AccessDecisionVoter;
@@ -30,6 +31,7 @@ import org.apache.deltaspike.security.impl.util.SecurityUtils;
import org.apache.deltaspike.security.spi.authorization.EditableAccessDecisionVoterContext;
import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
import javax.interceptor.InvocationContext;
import java.lang.annotation.Annotation;
@@ -49,6 +51,9 @@ public class SecuredAnnotationAuthorizer
@Inject
private AccessDecisionVoterContext voterContext;
+ @Inject
+ private BeanManager beanManager;
+
@Secures
@Secured({ })
@SuppressWarnings("UnusedDeclaration")
@@ -137,7 +142,14 @@ public class SecuredAnnotationAuthorizer
((EditableAccessDecisionVoterContext) voterContext).addViolation(securityViolation);
}
}
- throw new AccessDeniedException(violations);
+ AccessDeniedException accessDeniedException = new AccessDeniedException(violations);
+ ExceptionToCatchEvent exceptionToCatchEvent = new ExceptionToCatchEvent(accessDeniedException);
+ this.beanManager.fireEvent(exceptionToCatchEvent);
+
+ if (!exceptionToCatchEvent.isHandled())
+ {
+ throw accessDeniedException;
+ }
}
}
}