You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2012/10/08 22:18:51 UTC
[4/4] git commit: DELTASPIKE-277 improve graphene setup
DELTASPIKE-277 improve graphene setup
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/48694d0b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/48694d0b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/48694d0b
Branch: refs/heads/master
Commit: 48694d0bba7f6756c0b2396ca32d6aee1bfad2e4
Parents: a8a2815
Author: Mark Struberg <st...@apache.org>
Authored: Mon Oct 8 20:47:41 2012 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Mon Oct 8 20:48:20 2012 +0200
----------------------------------------------------------------------
.../test/jsf/impl/message/JsfMessageTest.java | 90 +++++++++++++++
.../src/test/resources/default/WEB-INF/web.xml | 6 +
.../src/test/resources/jsfMessageTest/page.xhtml | 39 ++++++
.../resources/viewScopedContextTest/page.xhtml | 3 -
4 files changed, 135 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/48694d0b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/message/JsfMessageTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/message/JsfMessageTest.java b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/message/JsfMessageTest.java
new file mode 100644
index 0000000..ed1849c
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/message/JsfMessageTest.java
@@ -0,0 +1,90 @@
+/*
+* 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.message;
+
+
+import java.net.URL;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.apache.deltaspike.test.jsf.impl.scope.view.beans.BackingBean;
+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;
+
+
+/**
+ * Test for the DeltaSpike ViewScoped context
+ */
+@WarpTest
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class JsfMessageTest
+{
+ @Drone
+ private WebDriver driver;
+
+ @ArquillianResource
+ private URL contextPath;
+
+ @Deployment
+ public static WebArchive deploy()
+ {
+ return ShrinkWrap
+ .create(WebArchive.class, "jsfMessageTest.war")
+ .addPackage(BackingBean.class.getPackage())
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())
+ .addAsWebInfResource("default/WEB-INF/web.xml", "web.xml")
+ .addAsWebResource("jsfMessageTest/page.xhtml", "page.xhtml")
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+
+ @Test
+ @RunAsClient
+ public void testViewScopedContext() throws Exception
+ {
+ driver.get(new URL(contextPath, "page.xhtml").toString());
+
+/*X
+ WebElement inputField = driver.findElement(By.id("test:valueInput"));
+ inputField.sendKeys("23");
+
+ WebElement button = driver.findElement(By.id("test:saveButton"));
+ button.click();
+
+ Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("test:valueOutput"), "23").apply(driver));
+*/
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/48694d0b/deltaspike/modules/jsf/impl/src/test/resources/default/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/resources/default/WEB-INF/web.xml b/deltaspike/modules/jsf/impl/src/test/resources/default/WEB-INF/web.xml
index 5e874fd..9d0668b 100644
--- a/deltaspike/modules/jsf/impl/src/test/resources/default/WEB-INF/web.xml
+++ b/deltaspike/modules/jsf/impl/src/test/resources/default/WEB-INF/web.xml
@@ -22,6 +22,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
+
+ <!--
+ * This is a simple web.xml for JSF applications.
+ * It just registers the FacesServlet and defines
+ * a mapping for xhtml files.
+ -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/48694d0b/deltaspike/modules/jsf/impl/src/test/resources/jsfMessageTest/page.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/resources/jsfMessageTest/page.xhtml b/deltaspike/modules/jsf/impl/src/test/resources/jsfMessageTest/page.xhtml
new file mode 100644
index 0000000..0174237
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/resources/jsfMessageTest/page.xhtml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ >
+
+<body>
+<div>
+ <h:form id="test">
+ <h:outputLabel for="valueInput" value="ViewScoped value:"/>
+ <h:inputText id="valueInput" value="#{viewScopedBean.i}"/>
+ <br/>
+ <h:outputLabel for="valueOutput" value="backing bean value:"/>
+ <h:outputText id="valueOutput" value="#{viewScopedBean.i}"/>
+ <br/>
+ <h:commandButton id="saveButton" action="#{viewScopedBean.someAction}" value="save"/>
+ </h:form>
+</div>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/48694d0b/deltaspike/modules/jsf/impl/src/test/resources/viewScopedContextTest/page.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/resources/viewScopedContextTest/page.xhtml b/deltaspike/modules/jsf/impl/src/test/resources/viewScopedContextTest/page.xhtml
index ead5230..6274040 100644
--- a/deltaspike/modules/jsf/impl/src/test/resources/viewScopedContextTest/page.xhtml
+++ b/deltaspike/modules/jsf/impl/src/test/resources/viewScopedContextTest/page.xhtml
@@ -27,9 +27,6 @@
<body>
<div>
- it works!
-</div>
-<div>
<h:form id="test">
<h:outputLabel for="valueInput" value="ViewScoped value:"/>
<h:inputText id="valueInput" value="#{viewScopedBean.i}"/>