MYFACESTEST-35: Support for JSF 1.1
 - put the JSF 1.2 stuff in classes that will only be loaded when there is JSF 1.2 available.
diff --git a/test12/pom.xml b/test12/pom.xml
index 5e2a4bc..1d04eff 100644
--- a/test12/pom.xml
+++ b/test12/pom.xml
@@ -29,7 +29,7 @@
 
     <artifactId>myfaces-test12</artifactId>
     <packaging>jar</packaging>
-    <name>Myfaces Test Framework for JSF 1.2</name>
+    <name>Myfaces Test Framework for JSF 1.2 (and 1.1)</name>
 
     <dependencies>
 
diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/lifecycle/RestoreViewExecutor.java b/test12/src/main/java/org/apache/myfaces/test/mock/lifecycle/RestoreViewExecutor.java
index d613dae..949a26b 100644
--- a/test12/src/main/java/org/apache/myfaces/test/mock/lifecycle/RestoreViewExecutor.java
+++ b/test12/src/main/java/org/apache/myfaces/test/mock/lifecycle/RestoreViewExecutor.java
@@ -17,18 +17,20 @@
 

 package org.apache.myfaces.test.mock.lifecycle;

 

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.apache.myfaces.test.util.Jsf11Utils;

+import org.apache.myfaces.test.util.Jsf12Utils;

+import org.apache.myfaces.test.util.JsfVersion;

+

 import javax.faces.FacesException;

 import javax.faces.application.Application;

-import javax.faces.application.ViewExpiredException;

 import javax.faces.application.ViewHandler;

 import javax.faces.component.UIViewRoot;

 import javax.faces.context.ExternalContext;

 import javax.faces.context.FacesContext;

 import javax.faces.event.PhaseId;

 

-import org.apache.commons.logging.Log;

-import org.apache.commons.logging.LogFactory;

-

 /**

  * Implements the Restore View Phase (JSF Spec 2.2.1)

  * 

@@ -53,7 +55,11 @@
         // init the View

         Application application = facesContext.getApplication();

         ViewHandler viewHandler = application.getViewHandler();

-        viewHandler.initView(facesContext);

+        if (JsfVersion.supports12()) {

+          Jsf12Utils.initView(facesContext, viewHandler);

+        } else {

+          // nothing to do

+        }

 

         UIViewRoot viewRoot = facesContext.getViewRoot();

 

@@ -81,9 +87,11 @@
             viewRoot = viewHandler.restoreView(facesContext, viewId);

             if (viewRoot == null)

             {

-                throw new ViewExpiredException(

-                        "The expected view was not returned "

-                                + "for the view identifier: " + viewId, viewId);

+              if (JsfVersion.supports12()) {

+                Jsf12Utils.throwViewExpiredException(viewId);

+              } else {

+                Jsf11Utils.throwViewExpiredException(viewId);

+              }

             }

             restoreViewSupport.processComponentBinding(facesContext, viewRoot);

         }

diff --git a/test12/src/main/java/org/apache/myfaces/test/util/Jsf11Utils.java b/test12/src/main/java/org/apache/myfaces/test/util/Jsf11Utils.java
new file mode 100644
index 0000000..9edeae5
--- /dev/null
+++ b/test12/src/main/java/org/apache/myfaces/test/util/Jsf11Utils.java
@@ -0,0 +1,27 @@
+/*
+ * 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.test.util;
+
+public class Jsf11Utils {
+
+  public static void throwViewExpiredException(String viewId)
+  {
+    throw new RuntimeException(
+            "The expected view was not returned for the view identifier: " + viewId);
+  }
+}
diff --git a/test12/src/main/java/org/apache/myfaces/test/util/Jsf12Utils.java b/test12/src/main/java/org/apache/myfaces/test/util/Jsf12Utils.java
new file mode 100644
index 0000000..fc64054
--- /dev/null
+++ b/test12/src/main/java/org/apache/myfaces/test/util/Jsf12Utils.java
@@ -0,0 +1,37 @@
+/*
+ * 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.test.util;
+
+import javax.faces.application.ViewExpiredException;
+import javax.faces.application.ViewHandler;
+import javax.faces.context.FacesContext;
+
+public class Jsf12Utils
+{
+
+  public static void initView(FacesContext facesContext, ViewHandler viewHandler)
+  {
+    viewHandler.initView(facesContext);
+  }
+
+  public static void throwViewExpiredException(String viewId)
+  {
+    throw new ViewExpiredException(
+        "The expected view was not returned for the view identifier: " + viewId, viewId);
+  }
+}
diff --git a/test12/src/main/java/org/apache/myfaces/test/util/JsfVersion.java b/test12/src/main/java/org/apache/myfaces/test/util/JsfVersion.java
new file mode 100644
index 0000000..600a68a
--- /dev/null
+++ b/test12/src/main/java/org/apache/myfaces/test/util/JsfVersion.java
@@ -0,0 +1,71 @@
+/*
+ * 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.test.util;
+
+import javax.faces.application.Application;
+
+public class JsfVersion
+{
+  private static boolean supports12;
+  private static boolean supports20;
+
+  static
+  {
+    try
+    {
+      Application.class.getMethod("getExpressionFactory");
+      supports12 = true;
+
+      try
+      {
+        Application.class.getMethod("getExceptionHandler");
+        supports20 = true;
+
+      } catch (NoSuchMethodException e) {
+        // ignore
+      }
+
+    } catch (NoSuchMethodException e) {
+      // ignore
+    }
+  }
+
+  private JsfVersion() {
+    // avoid instantiation
+  }
+
+  /**
+   * Does the JSF is version 1.2 or higher
+   *
+   * @return Supports 1.2 or higher
+   */
+  public static boolean supports12()
+  {
+    return supports12;
+  }
+
+  /**
+   * Does the JSF is version 2.0 or higher
+   *
+   * @return Supports 2.0 or higher
+   */
+  public static boolean supports20()
+  {
+    return supports20;
+  }
+}