You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2019/01/23 11:27:12 UTC

[myfaces] branch master updated: MYFACES-4265: adding a test for the chain function fixing a package problem and a missing license header

This is an automated email from the ASF dual-hosted git repository.

werpu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new af52187  MYFACES-4265: adding a test for the chain function fixing a package problem and a missing license header
af52187 is described below

commit af5218738a85021537efa5ed239eb555b7c5c060
Author: Werner Punz <we...@gmail.com>
AuthorDate: Wed Jan 23 12:27:04 2019 +0100

    MYFACES-4265: adding a test for the chain function fixing a package problem
    and a missing license header
---
 integration-tests/ajax/readme.txt                  |  1 +
 .../core/integrationtests/ajax/basic/TestBean.java |  2 +-
 .../ajax/test1Protocol/JSF21Simulation.java        | 18 ++++++
 .../ajax/src/main/webapp/test3-chain.xhtml         | 65 ++++++++++++++++++++++
 .../integrationtests/ajax/IntegrationTest.java     | 24 ++++++--
 pom.xml                                            |  4 +-
 6 files changed, 107 insertions(+), 7 deletions(-)

diff --git a/integration-tests/ajax/readme.txt b/integration-tests/ajax/readme.txt
index 723a191..2dd9116 100644
--- a/integration-tests/ajax/readme.txt
+++ b/integration-tests/ajax/readme.txt
@@ -1,2 +1,3 @@
 run integration test manually  mvn clean integration-test -Ptomcat-embedded-9
 run jetty: mvn clean package jetty:run-exploded
+JDK baseline JAVA8
diff --git a/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/basic/TestBean.java b/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/basic/TestBean.java
index 017560e..06004f3 100644
--- a/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/basic/TestBean.java
+++ b/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/basic/TestBean.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.core.integrationtests.ajax;
+package org.apache.myfaces.core.integrationtests.ajax.basic;
 
 import javax.enterprise.context.RequestScoped;
 import javax.faces.annotation.FacesConfig;
diff --git a/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/test1Protocol/JSF21Simulation.java b/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/test1Protocol/JSF21Simulation.java
index a167b49..cd87c7b 100644
--- a/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/test1Protocol/JSF21Simulation.java
+++ b/integration-tests/ajax/src/main/java/org/apache/myfaces/core/integrationtests/ajax/test1Protocol/JSF21Simulation.java
@@ -1,3 +1,21 @@
+/*
+ * 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.myfaces.core.integrationtests.ajax.test1Protocol;
 
 import org.apache.myfaces.core.integrationtests.ajax.test1Protocol.jsfxmlnodes.Changes;
diff --git a/integration-tests/ajax/src/main/webapp/test3-chain.xhtml b/integration-tests/ajax/src/main/webapp/test3-chain.xhtml
new file mode 100644
index 0000000..07b4e5b
--- /dev/null
+++ b/integration-tests/ajax/src/main/webapp/test3-chain.xhtml
@@ -0,0 +1,65 @@
+<!--
+    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>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:h="http://xmlns.jcp.org/jsf/html"
+>
+
+<h:head>
+    <title>test</title>
+    <h:outputScript library="javax.faces" name="jsf.js"/>
+    <script type="text/javascript" src="./scripts/testhelpers.js"></script>
+
+</h:head>
+
+<h:body>
+    <div id="centerDiv">
+        <h1>Chain Test</h1>
+
+        <h2>This test case tests the jsf.util.chain function</h2>
+        <script type="text/javascript">
+            function testFunc1(event) {
+                var element = document.getElementById("testResults");
+                element.innerHTML = "test1 succeeded ";
+                return true;
+            }
+            var testFunc2 = "  var element = document.getElementById('testResults'); element.innerHTML += ('test2 succeeded'); return true;";
+            var testFunc3 = function() {
+                var element = document.getElementById("testResults");
+                element.innerHTML += "test3 succeeded ";
+                //this function returns false so the  chain should stop here!
+                return false;
+            }
+            var testFunc4 = function() {
+                var element = document.getElementById("testResults");
+                element.innerHTML += ("test4 failed ");
+                return false;
+            }
+        </script>
+
+        <div id="testResults">
+            <h3>The test result will be shown here</h3>
+        </div>
+    </div>
+
+
+    <input type="button" id="chaincall" value="press for chaintest"
+           onclick="jsf.util.chain(this, event, testFunc1,testFunc2,testFunc3,testFunc4);"/>
+</h:body>
+</html>
\ No newline at end of file
diff --git a/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java b/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java
index bc30046..bcb97eb 100644
--- a/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java
+++ b/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java
@@ -28,7 +28,6 @@ import org.jboss.arquillian.test.api.ArquillianResource;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.jboss.shrinkwrap.resolver.api.maven.embedded.EmbeddedMaven;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -42,6 +41,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.function.Function;
 
 import static org.jboss.arquillian.graphene.Graphene.waitAjax;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 
 @RunWith(Arquillian.class)
@@ -103,9 +104,9 @@ public class IntegrationTest {
                 return webDriver.getPageSource().contains("Action Performed");
             }
         });
-        Assert.assertTrue(webDriver.getPageSource().contains("ViewState"));
-        Assert.assertTrue(webDriver.getPageSource().contains("_ajax_found"));
-        Assert.assertTrue(webDriver.getPageSource().contains("Action Performed"));
+        assertTrue(webDriver.getPageSource().contains("ViewState"));
+        assertTrue(webDriver.getPageSource().contains("_ajax_found"));
+        assertTrue(webDriver.getPageSource().contains("Action Performed"));
     }
 
 
@@ -170,6 +171,21 @@ public class IntegrationTest {
 
 
     /**
+     * third test, testing the chain function
+     */
+    @Test
+    public void testChain() {
+        webDriver.get(contextPath + "test3-chain.jsf");
+        webDriver.findElement(new ByIdOrName("chaincall")).click();
+        String testSource = webDriver.findElement(new ByIdOrName("testResults")).getText();
+        assertTrue(testSource.contains("test1 succeeded"));
+        assertTrue(testSource.contains("test2 succeeded"));
+        assertTrue(testSource.contains("test3 succeeded"));
+        assertFalse(testSource.contains("test4 failed"));
+    }
+
+
+    /**
      * recurring trigger, wait until ajax processing is done function
      *
      * @param id        the trigger element id
diff --git a/pom.xml b/pom.xml
index 3d17bf0..e81fc8b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,9 +55,9 @@
         <module>test</module>
         <module>impl</module>
         <module>bundle</module>
-        <!--
+
         <module>integration-tests</module>
-        -->
+
     </modules>
 
     <build>