You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2013/09/23 10:21:30 UTC
svn commit: r1525532 - in /myfaces/tobago/branches/tobago-1.5.x: ./
tobago-example/tobago-example-test/src/main/java/org/
tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/
tobago-example/tobago-example-test/src/ma...
Author: lofwyr
Date: Mon Sep 23 08:21:30 2013
New Revision: 1525532
URL: http://svn.apache.org/r1525532
Log:
TOBAGO-1314: Version detection works not correctly for JSF 2.1
Added:
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Version.java
- copied unchanged from r1524189, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Version.java
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/
- copied from r1524189, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js
Modified:
myfaces/tobago/branches/tobago-1.5.x/ (props changed)
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/ (props changed)
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml
myfaces/tobago/branches/tobago-1.5.x/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
Propchange: myfaces/tobago/branches/tobago-1.5.x/
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk:r1524189
Propchange: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org:r1524189
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml?rev=1525532&r1=1525531&r2=1525532&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml Mon Sep 23 08:21:30 2013
@@ -185,6 +185,12 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>version</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.tobago.example.test.Version</managed-bean-class>
+ <managed-bean-scope>none</managed-bean-scope>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>navigation</from-outcome>
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js?rev=1525532&r1=1525531&r2=1525532&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js Mon Sep 23 08:21:30 2013
@@ -58,12 +58,18 @@ var TobagoAssert = {
},
fail: function(name, element, expected, actual) {
- element.overlay({error: true, ajax: true});
- var text = "The element '" + element.get(0).tagName + "' with id='" + element.attr("id")
- + "' has wrong " + name + ": expected=" + expected + " actual=" + actual;
- var overlay = element.data("tobago-overlay").overlay;
- overlay.attr("title", (overlay.attr("title") === undefined ? "" : overlay.attr("title")+ "\n" ) + text);
- LOG.error(text);
+ var text;
+ if (element) {
+ element.overlay({error: true, ajax: true});
+ text = "The element '" + element.get(0).tagName + "' with id='" + element.attr("id")
+ + "' has wrong " + name + ": expected=" + expected + " actual=" + actual;
+ var overlay = element.data("tobago-overlay").overlay;
+ overlay.attr("title", (overlay.attr("title") === undefined ? "" : overlay.attr("title") + "\n" ) + text);
+ LOG.error(text);
+ } else {
+ text = name + ": expected=" + expected + " actual=" + actual;
+ LOG.error(text);
+ }
},
assertLayout:function (elementOrId, left, top, width, height) {
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js?rev=1525532&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js Mon Sep 23 08:21:30 2013
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+TestVersion = {};
+
+TestVersion.init = function() {
+
+ var checked = jQuery("input[checked]");
+ if (checked.size() != 2) {
+ TobagoAssert.fail("2 field must be checked", null, 2, checked);
+ }
+
+ var version = checked.eq(0).next().html();
+ var packageVersion = "Version " + jQuery("input[type=text]").eq(0).val();
+
+ if (version != packageVersion) {
+ TobagoAssert.fail("Version number", null, version, packageVersion);
+ }
+
+ var impl = checked.eq(1).next().html();
+ var packageImpl = jQuery("input[type=text]").eq(1).val();
+
+ if (impl != packageImpl) {
+ TobagoAssert.fail("Implementation", null, version, packageVersion);
+ }
+};
+
+Tobago.registerListener(TestVersion.init, Tobago.Phase.DOCUMENT_READY);
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml?rev=1525532&r1=1524189&r2=1525532&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml Mon Sep 23 08:21:30 2013
@@ -43,5 +43,8 @@
<tx:in value="#{version.jsfTitle}" label="JSF Title"/>
</tc:box>
+ <tc:script file="script/tobago-assert.js"/>
+ <tc:script file="test/version/version.js"/>
+
</tc:page>
</f:view>
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java?rev=1525532&r1=1525531&r2=1525532&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java Mon Sep 23 08:21:30 2013
@@ -20,13 +20,15 @@
package org.apache.myfaces.tobago.util;
import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
public enum FacesVersion {
VERSION_11,
VERSION_12,
VERSION_20,
- VERSION_21;
+ VERSION_21,
+ VERSION_22;
private static FacesVersion currentVersion;
private static boolean mojarra;
@@ -39,8 +41,10 @@ public enum FacesVersion {
currentVersion = VERSION_12;
Application.class.getMethod("getDefaultValidatorInfo");
currentVersion = VERSION_20;
- Application.class.getMethod("getExceptionHandler");
+ FacesContext.class.getMethod("isReleased");
currentVersion = VERSION_21;
+ Application.class.getMethod("getFlowHandler");
+ currentVersion = VERSION_22;
} catch (NoSuchMethodException e) {
// ignore
}
@@ -75,7 +79,10 @@ public enum FacesVersion {
* @return Supports 1.2 or higher
*/
public static boolean supports12() {
- return currentVersion == VERSION_12 || currentVersion == VERSION_20 || currentVersion == VERSION_21;
+ return currentVersion == VERSION_12
+ || currentVersion == VERSION_20
+ || currentVersion == VERSION_21
+ || currentVersion == VERSION_22;
}
/**
@@ -83,7 +90,9 @@ public enum FacesVersion {
* @return Supports 2.0 or higher
*/
public static boolean supports20() {
- return currentVersion == VERSION_20 || currentVersion == VERSION_21;
+ return currentVersion == VERSION_20
+ || currentVersion == VERSION_21
+ || currentVersion == VERSION_22;
}
/**
@@ -91,7 +100,16 @@ public enum FacesVersion {
* @return Supports 2.1 or higher
*/
public static boolean supports21() {
- return currentVersion == VERSION_21;
+ return currentVersion == VERSION_21
+ || currentVersion == VERSION_22;
+ }
+
+ /**
+ * Does the JSF is version 2.2 or higher
+ * @return Supports 2.2 or higher
+ */
+ public static boolean supports22() {
+ return currentVersion == VERSION_22;
}
public static boolean isMojarra() {