You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/02/21 02:28:30 UTC
svn commit: r1448488 - in /myfaces/test/trunk: ./ test22/ test22/src/
test22/src/main/ test22/src/main/java/ test22/src/main/java/org/
test22/src/main/java/org/apache/ test22/src/main/java/org/apache/myfaces/
test22/src/main/java/org/apache/myfaces/tes...
Author: lu4242
Date: Thu Feb 21 01:28:30 2013
New Revision: 1448488
URL: http://svn.apache.org/r1448488
Log:
add test22 module
Added:
myfaces/test/trunk/test22/ (with props)
myfaces/test/trunk/test22/pom.xml (with props)
myfaces/test/trunk/test22/src/
myfaces/test/trunk/test22/src/main/
myfaces/test/trunk/test22/src/main/java/
myfaces/test/trunk/test22/src/main/java/org/
myfaces/test/trunk/test22/src/main/java/org/apache/
myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/
myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/
myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/
myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplication22.java
- copied, changed from r1366645, myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java
myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java
- copied, changed from r1366645, myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java
myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFlowHandler.java (with props)
myfaces/test/trunk/test22/src/main/resources/ (with props)
Modified:
myfaces/test/trunk/pom.xml
Modified: myfaces/test/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/pom.xml?rev=1448488&r1=1448487&r2=1448488&view=diff
==============================================================================
--- myfaces/test/trunk/pom.xml (original)
+++ myfaces/test/trunk/pom.xml Thu Feb 21 01:28:30 2013
@@ -45,6 +45,7 @@
<modules>
<module>test12</module>
<module>test20</module>
+ <module>test22</module>
</modules>
<!--
<repositories>
Propchange: myfaces/test/trunk/test22/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Feb 21 01:28:30 2013
@@ -0,0 +1,12 @@
+*.iml
+*.ipr
+*.iws
+*.jdbc
+.classpath
+.externalToolBuilders
+.project
+.settings
+derby.log
+maven-eclipse.xml
+myfacesOrchestraDB
+target
Added: myfaces/test/trunk/test22/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test22/pom.xml?rev=1448488&view=auto
==============================================================================
--- myfaces/test/trunk/test22/pom.xml (added)
+++ myfaces/test/trunk/test22/pom.xml Thu Feb 21 01:28:30 2013
@@ -0,0 +1,260 @@
+<!--
+/*
+ * 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.
+ *
+ * $Id: pom.xml 1326869 2012-04-17 01:30:30Z lu4242 $
+ */
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.myfaces.test</groupId>
+ <artifactId>myfaces-test-project</artifactId>
+ <version>1.0.5-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>myfaces-test22</artifactId>
+ <packaging>jar</packaging>
+ <name>Myfaces Test Framework for JSF 2.2</name>
+
+ <dependencies>
+
+ <!-- Required only for using the org.apache.shale.test.config package -->
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>1.8</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>1.14</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>jmock</groupId>
+ <artifactId>jmock</artifactId>
+ <version>1.0.1</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>jmock</groupId>
+ <artifactId>jmock-cglib</artifactId>
+ <version>1.0.1</version>
+ <optional>true</optional>
+ </dependency>
+
+ <!-- For the "org.apache.shale.test.cargo" package, we need to have -->
+ <!-- JUnit as a compile time dependency, not just scope="test". -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-core-uberjar</artifactId>
+ <version>0.8</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-ant</artifactId>
+ <version>0.8</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf-myfaces.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${jsf-myfaces.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- Servlet 2.5 -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <version>1.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- JSP 2.1 -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jsp_2.1_spec</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- EL 1.0 -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_1.0_spec</artifactId>
+ <version>1.0.2</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-source</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!--
+ - Add a new source directory to the compile path.
+ -
+ - test12_sources: contains all the source code from the "main" branch of test,
+ - which is written to be JSF1.2 and JSF1.1-compatible.
+ -->
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>
+ ${project.build.directory}/test20_sources
+ </source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.myfaces.buildtools</groupId>
+ <artifactId>myfaces-builder-plugin</artifactId>
+ <version>1.0.10</version>
+ <executions>
+ <execution>
+ <id>unpack-test12</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <scanModel>false</scanModel>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.myfaces.test</groupId>
+ <artifactId>myfaces-test20</artifactId>
+ <version>1.0.5-SNAPSHOT</version>
+ <classifier>sources</classifier>
+ <outputDirectory>${project.build.directory}/test20_sources</outputDirectory>
+ <includes>org/apache/myfaces/**/*.java</includes>
+ <excludes>**/*.class,**/META-INF/**</excludes>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>generate-assembly</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>attach-javadoc</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.8</version>
+ <reportSets>
+ <reportSet>
+ <id>non-aggregate</id>
+ <configuration>
+ <!-- Specific configuration for the non aggregate report -->
+ </configuration>
+ <reports>
+ <report>javadoc</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+ <properties>
+ <jsf-ri.version>2.0.2-b10</jsf-ri.version>
+ <jsf-myfaces.version>2.2.0-SNAPSHOT</jsf-myfaces.version>
+ </properties>
+</project>
Propchange: myfaces/test/trunk/test22/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Copied: myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplication22.java (from r1366645, myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java)
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplication22.java?p2=myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplication22.java&p1=myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java&r1=1366645&r2=1448488&rev=1448488&view=diff
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplication20.java (original)
+++ myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplication22.java Thu Feb 21 01:28:30 2013
@@ -17,50 +17,7 @@
package org.apache.myfaces.test.mock;
-import java.beans.BeanDescriptor;
-import java.beans.BeanInfo;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.application.Application;
-import javax.faces.application.ProjectStage;
-import javax.faces.application.Resource;
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.application.ResourceHandler;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UINamingContainer;
-import javax.faces.component.UIOutput;
-import javax.faces.component.UIViewRoot;
-import javax.faces.component.behavior.Behavior;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.el.ValueBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.ComponentSystemEventListener;
-import javax.faces.event.ListenerFor;
-import javax.faces.event.ListenersFor;
-import javax.faces.event.SystemEvent;
-import javax.faces.event.SystemEventListener;
-import javax.faces.event.SystemEventListenerHolder;
-import javax.faces.render.Renderer;
-import javax.faces.validator.Validator;
-import javax.faces.view.ViewDeclarationLanguage;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.test.mock.resource.MockResourceHandler;
+import javax.faces.flow.FlowHandler;
/**
* <p>Mock implementation of <code>Application</code> that includes the semantics
@@ -70,1121 +27,34 @@ import org.apache.myfaces.test.mock.reso
* @since 1.0.0
*
*/
-public class MockApplication20 extends MockApplication12
+public class MockApplication22 extends MockApplication20
{
-
// ------------------------------------------------------------ Constructors
- public MockApplication20()
+ public MockApplication22()
{
super();
- // install the 2.0-ViewHandler-Mock
- this.setViewHandler(new MockViewHandler20());
- this.setResourceHandler(new MockResourceHandler());
- }
-
- private static class SystemListenerEntry
- {
- private List<SystemEventListener> _lstSystemEventListener;
- private Map<Class<?>, List<SystemEventListener>> _sourceClassMap;
-
- public SystemListenerEntry()
- {
- }
-
- public void addListener(SystemEventListener listener)
- {
- assert listener != null;
-
- addListenerNoDuplicate(getAnySourceListenersNotNull(), listener);
- }
-
- public void addListener(SystemEventListener listener, Class<?> source)
- {
- assert listener != null;
-
- if (source == null)
- {
- addListener(listener);
- }
- else
- {
- addListenerNoDuplicate(
- getSpecificSourceListenersNotNull(source), listener);
- }
- }
-
- public void removeListener(SystemEventListener listener)
- {
- assert listener != null;
-
- if (_lstSystemEventListener != null)
- {
- _lstSystemEventListener.remove(listener);
- }
- }
-
- public void removeListener(SystemEventListener listener,
- Class<?> sourceClass)
- {
- assert listener != null;
-
- if (sourceClass == null)
- {
- removeListener(listener);
- }
- else
- {
- if (_sourceClassMap != null)
- {
- List<SystemEventListener> listeners = _sourceClassMap
- .get(sourceClass);
- if (listeners != null)
- {
- listeners.remove(listener);
- }
- }
- }
- }
-
- public void publish(Class<? extends SystemEvent> systemEventClass,
- Class<?> classSource, Object source, SystemEvent event)
- {
- if (source != null && _sourceClassMap != null)
- {
- event = _traverseListenerList(_sourceClassMap.get(classSource),
- systemEventClass, source, event);
- }
-
- _traverseListenerList(_lstSystemEventListener, systemEventClass,
- source, event);
- }
-
- private void addListenerNoDuplicate(
- List<SystemEventListener> listeners,
- SystemEventListener listener)
- {
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
- }
-
- private synchronized List<SystemEventListener> getAnySourceListenersNotNull()
- {
- if (_lstSystemEventListener == null)
- {
- /*
- * TODO: Check if modification occurs often or not, might have to use a synchronized list instead.
- *
- * Registrations found:
- */
- _lstSystemEventListener = new CopyOnWriteArrayList<SystemEventListener>();
- }
-
- return _lstSystemEventListener;
- }
-
- private synchronized List<SystemEventListener> getSpecificSourceListenersNotNull(
- Class<?> sourceClass)
- {
- if (_sourceClassMap == null)
- {
- _sourceClassMap = new ConcurrentHashMap<Class<?>, List<SystemEventListener>>();
- }
-
- List<SystemEventListener> list = _sourceClassMap.get(sourceClass);
- if (list == null)
- {
- /*
- * TODO: Check if modification occurs often or not, might have to use a synchronized list instead.
- *
- * Registrations found:
- */
- list = new CopyOnWriteArrayList<SystemEventListener>();
- _sourceClassMap.put(sourceClass, list);
- }
-
- return list;
- }
+ // install flow Handler
+ setFlowHandler(new MockFlowHandler());
}
// ------------------------------------------------------ Instance Variables
- private static final Log log = LogFactory.getLog(MockApplication20.class);
-
- private final Map<Class<? extends SystemEvent>, SystemListenerEntry> _systemEventListenerClassMap = new ConcurrentHashMap<Class<? extends SystemEvent>, SystemListenerEntry>();
-
- private Map<String, String> _defaultValidatorsIds = new HashMap<String, String>();
-
- private ProjectStage _projectStage;
-
- private final Map<String, Class<?>> _behaviorClassMap = new ConcurrentHashMap<String, Class<?>>();
-
- private final Map<String, Class<?>> _validatorClassMap = new ConcurrentHashMap<String, Class<?>>();
-
- private ResourceHandler _resourceHandler;
+ private FlowHandler _flowHandler;
// ----------------------------------------------------- Mock Object Methods
- public Map<String, String> getDefaultValidatorInfo()
- {
- return Collections.unmodifiableMap(_defaultValidatorsIds);
- }
-
- private void _handleAnnotations(FacesContext context, Object inspected, UIComponent component)
- {
- // determine the ProjectStage setting via the given FacesContext
- // note that a local getProjectStage() could cause problems in wrapped environments
- boolean isProduction = context.isProjectStage(ProjectStage.Production);
-
- Class<?> inspectedClass = inspected.getClass();
- _handleListenerForAnnotations(context, inspected, inspectedClass, component, isProduction);
-
- _handleResourceDependencyAnnotations(context, inspectedClass, component, isProduction);
- }
-
- private void _handleListenerForAnnotations(FacesContext context, Object inspected, Class<?> inspectedClass, UIComponent component, boolean isProduction)
- {
- List<ListenerFor> listenerForList = null;
-
- if(listenerForList == null) //not in production or the class hasn't been inspected yet
- {
- ListenerFor listener = inspectedClass.getAnnotation(ListenerFor.class);
- ListenersFor listeners = inspectedClass.getAnnotation(ListenersFor.class);
- if(listener != null || listeners != null)
- {
- //listeners were found using one or both annotations, create and build a new list
- listenerForList = new ArrayList<ListenerFor>();
-
- if(listener != null)
- listenerForList.add(listener);
-
- if(listeners != null)
- listenerForList.addAll(Arrays.asList(listeners.value()));
- }
- }
-
- if (listenerForList != null) //listeners were found through inspection or from cache, handle them
- {
- for (ListenerFor listenerFor : listenerForList)
- {
- _handleListenerFor(context, inspected, component, listenerFor);
- }
- }
- }
-
- private void _handleListenerFor(FacesContext context, Object inspected, UIComponent component,
- ListenerFor annotation)
- {
- // If this annotation is not present on the class in question, no action must be taken.
- if (annotation != null)
- {
- // Determine the "target" on which to call subscribeToEvent.
- // If the class to which this annotation is attached implements ComponentSystemEventListener
- if (inspected instanceof ComponentSystemEventListener)
- {
- // If the class to which this annotation is attached is a UIComponent instance, "target" is the
- // UIComponent instance.
-
- // If the class to which this annotation is attached is a Renderer instance, "target" is the
- // UIComponent instance.
-
- /*
- * If "target" is a UIComponent call UIComponent.subscribeToEvent(Class, ComponentSystemEventListener)
- * passing the systemEventClass() of the annotation as the first argument and the instance of the class
- * to which this annotation is attached (which must implement ComponentSystemEventListener) as the
- * second argument.
- */
- component.subscribeToEvent(annotation.systemEventClass(), (ComponentSystemEventListener) inspected);
- }
- // If the class to which this annotation is attached implements SystemEventListener and does not implement
- // ComponentSystemEventListener, "target" is the Application instance.
- else if (component instanceof SystemEventListener)
- {
- // use the Application object from the FacesContext (note that a
- // direct use of subscribeToEvent() could cause problems if the
- // Application is wrapped)
- Application application = context.getApplication();
-
- // If "target" is the Application instance, inspect the value of the sourceClass() annotation attribute
- // value.
- if (Void.class.equals(annotation.sourceClass()))
- {
- /*
- * If the value is Void.class, call Application.subscribeToEvent(Class, SystemEventListener),
- * passing the value of systemEventClass() as the first argument and the instance of the class to
- * which this annotation is attached (which must implement SystemEventListener) as the second
- * argument.
- */
- application.subscribeToEvent(annotation.systemEventClass(), (SystemEventListener) inspected);
- }
- else
- {
- /*
- * Otherwise, call Application.subscribeToEvent(Class, Class, SystemEventListener), passing the
- * value of systemEventClass() as the first argument, the value of sourceClass() as the second
- * argument, and the instance of the class to which this annotation is attached (which must
- * implement SystemEventListener) as the third argument.
- */
- application.subscribeToEvent(annotation.systemEventClass(), annotation.sourceClass(),
- (SystemEventListener) inspected);
- }
- }
-
- /*
- * If the class to which this annotation is attached implements ComponentSystemEventListener and is neither
- * an instance of Renderer nor UIComponent, the action taken is unspecified. This case must not trigger any
- * kind of error.
- */
- }
- }
-
- private void _handleResourceDependencyAnnotations(FacesContext context, Class<?> inspectedClass, UIComponent component, boolean isProduction)
- {
- List<ResourceDependency> dependencyList = null;
-
- if(dependencyList == null) //not in production or the class hasn't been inspected yet
- {
- ResourceDependency dependency = inspectedClass.getAnnotation(ResourceDependency.class);
- ResourceDependencies dependencies = inspectedClass.getAnnotation(ResourceDependencies.class);
- if(dependency != null || dependencies != null)
- {
- //resource dependencies were found using one or both annotations, create and build a new list
- dependencyList = new ArrayList<ResourceDependency>();
-
- if(dependency != null)
- dependencyList.add(dependency);
-
- if(dependencies != null)
- dependencyList.addAll(Arrays.asList(dependencies.value()));
- }
- }
-
- if (dependencyList != null) //resource dependencies were found through inspection or from cache, handle them
- {
- for (ResourceDependency dependency : dependencyList)
- {
- _handleResourceDependency(context, component, dependency);
- }
- }
- }
-
- private void _handleResourceDependency(FacesContext context, UIComponent component, ResourceDependency annotation)
- {
- // If this annotation is not present on the class in question, no action must be taken.
- if (annotation != null)
- {
- // Create a UIOutput instance by passing javax.faces.Output. to
- // Application.createComponent(java.lang.String).
- UIOutput output = (UIOutput) createComponent(UIOutput.COMPONENT_TYPE);
-
- // Get the annotation instance from the class and obtain the values of the name, library, and
- // target attributes.
- String name = annotation.name();
- if (name != null && name.length() > 0)
- {
- name = _ELText.parse(getExpressionFactory(), context.getELContext(), name).toString(context.getELContext());
- }
-
- // Obtain the renderer-type for the resource name by passing name to
- // ResourceHandler.getRendererTypeForResourceName(java.lang.String).
- // (note that we can not use this.getResourceHandler(), because the Application might be wrapped)
- String rendererType = context.getApplication().getResourceHandler().getRendererTypeForResourceName(name);
-
- // Call setRendererType on the UIOutput instance, passing the renderer-type.
- output.setRendererType(rendererType);
-
- // Obtain the Map of attributes from the UIOutput component by calling UIComponent.getAttributes().
- Map<String, Object> attributes = output.getAttributes();
-
- // Store the name into the attributes Map under the key "name".
- attributes.put("name", name);
-
- // If library is the empty string, let library be null.
- String library = annotation.library();
- if (library != null && library.length() > 0)
- {
- library = _ELText.parse(getExpressionFactory(), context.getELContext(), library).toString(context.getELContext());
- // If library is non-null, store it under the key "library".
- if ("this".equals(library))
- {
- // Special "this" behavior
- Resource resource = (Resource)component.getAttributes().get(Resource.COMPONENT_RESOURCE_KEY);
- if (resource != null)
- {
- attributes.put("library", resource.getLibraryName());
- }
- }
- else
- {
- attributes.put("library", library);
- }
- }
-
- // If target is the empty string, let target be null.
- String target = annotation.target();
- if (target != null && target.length() > 0)
- {
- target = _ELText.parse(getExpressionFactory(), context.getELContext(), target).toString(context.getELContext());
- // If target is non-null, store it under the key "target".
- attributes.put("target", target);
- context.getViewRoot().addComponentResource(context, output, target);
- }
- else
- {
- // Otherwise, if target is null, call UIViewRoot.addComponentResource(javax.faces.context.FacesContext,
- // javax.faces.component.UIComponent), passing the UIOutput instance as the second argument.
- context.getViewRoot().addComponentResource(context, output);
- }
- }
- }
-
- private void _inspectRenderer(FacesContext context, UIComponent component, String componentType, String rendererType)
- {
- /*
- * The Renderer instance to inspect must be obtained by calling FacesContext.getRenderKit() and calling
- * RenderKit.getRenderer(java.lang.String, java.lang.String) on the result, passing the argument componentFamily
- * of the newly created component as the first argument and the argument rendererType as the second argument.
- */
- Renderer renderer = context.getRenderKit().getRenderer(component.getFamily(), rendererType);
- if (renderer == null)
- {
- // If no such Renderer can be found, a message must be logged with a helpful error message.
- log.error("renderer cannot be found for component type " + componentType + " and renderer type "
- + rendererType);
- }
- else
- {
- // Otherwise, UIComponent.setRendererType(java.lang.String) must be called on the newly created
- // UIComponent instance, passing the argument rendererType as the argument.
- component.setRendererType(rendererType);
-
- /*
- * except the Renderer for the component to be returned must be inspected for the annotations mentioned in
- * createComponent(ValueExpression, FacesContext, String) as specified in the documentation for that method.
- */
- _handleAnnotations(context, renderer, component);
- }
- }
-
- private static SystemEvent _traverseListenerList(
- List<? extends SystemEventListener> listeners,
- Class<? extends SystemEvent> systemEventClass, Object source,
- SystemEvent event)
- {
- if (listeners != null && !listeners.isEmpty())
- {
- for (SystemEventListener listener : listeners)
- {
- // Call SystemEventListener.isListenerForSource(java.lang.Object), passing the source argument.
- // If this returns false, take no action on the listener.
- if (listener.isListenerForSource(source))
- {
- // Otherwise, if the event to be passed to the listener instances has not yet been constructed,
- // construct the event, passing source as the argument to the one-argument constructor that takes
- // an Object. This same event instance must be passed to all listener instances.
- event = _createEvent(systemEventClass, source, event);
-
- // Call SystemEvent.isAppropriateListener(javax.faces.event.FacesListener), passing the listener
- // instance as the argument. If this returns false, take no action on the listener.
- if (event.isAppropriateListener(listener))
- {
- // Call SystemEvent.processListener(javax.faces.event.FacesListener), passing the listener
- // instance.
- event.processListener(listener);
- }
- }
- }
- }
-
- return event;
- }
-
- private static SystemEvent _createEvent(
- Class<? extends SystemEvent> systemEventClass, Object source,
- SystemEvent event)
- {
- if (event == null)
- {
- try
- {
- Constructor<?>[] constructors = systemEventClass.getConstructors();
- Constructor<? extends SystemEvent> constructor = null;
- for (Constructor<?> c : constructors)
- {
- if (c.getParameterTypes().length == 1)
- {
- // Safe cast, since the constructor belongs
- // to a class of type SystemEvent
- constructor = (Constructor<? extends SystemEvent>) c;
- break;
- }
- }
- if (constructor != null)
- {
- event = constructor.newInstance(source);
- }
-
- }
- catch (Exception e)
- {
- throw new FacesException("Couldn't instanciate system event of type " + systemEventClass.getName(), e);
- }
- }
-
- return event;
- }
-
- private void checkNull(final Object param, final String paramName)
- {
- if (param == null)
- {
- throw new NullPointerException(paramName + " cannot be null.");
- }
- }
-
- private void checkEmpty(final String param, final String paramName)
- {
- if (param.length() == 0)
- {
- throw new NullPointerException("String " + paramName
- + " cannot be empty.");
- }
- }
-
- public void publishEvent(FacesContext facesContext,
- Class<? extends SystemEvent> systemEventClass,
- Class<?> sourceBaseType, Object source)
- {
- checkNull(systemEventClass, "systemEventClass");
- checkNull(source, "source");
-
- //Call events only if event processing is enabled.
- if (!facesContext.isProcessingEvents())
- {
- return;
- }
-
- try
- {
- SystemEvent event = null;
- if (source instanceof SystemEventListenerHolder)
- {
- SystemEventListenerHolder holder = (SystemEventListenerHolder) source;
-
- // If the source argument implements SystemEventListenerHolder, call
- // SystemEventListenerHolder.getListenersForEventClass(java.lang.Class) on it, passing the systemEventClass
- // argument. If the list is not empty, perform algorithm traverseListenerList on the list.
- event = _traverseListenerList(holder
- .getListenersForEventClass(systemEventClass),
- systemEventClass, source, event);
- }
-
- UIViewRoot uiViewRoot = facesContext.getViewRoot();
- if (uiViewRoot != null)
- {
- //Call listeners on view level
- event = _traverseListenerList(uiViewRoot.getViewListenersForEventClass(systemEventClass),
- systemEventClass, source, event);
- }
-
- SystemListenerEntry systemListenerEntry = _systemEventListenerClassMap
- .get(systemEventClass);
- if (systemListenerEntry != null)
- {
- systemListenerEntry.publish(systemEventClass, sourceBaseType,
- source, event);
- }
- }
- catch (AbortProcessingException e)
- {
- // If the act of invoking the processListener method causes an AbortProcessingException to be thrown,
- // processing of the listeners must be aborted, no further processing of the listeners for this event must
- // take place, and the exception must be logged with Level.SEVERE.
- log.error("Event processing was aborted", e);
- }
- }
-
- public void publishEvent(FacesContext facesContext,
- Class<? extends SystemEvent> systemEventClass, Object source)
- {
- publishEvent(facesContext, systemEventClass, source.getClass(), source);
- }
-
- public ProjectStage getProjectStage()
- {
- // If the value has already been determined by a previous call to this
- // method, simply return that value.
- if (_projectStage == null)
- {
-
- FacesContext context = FacesContext.getCurrentInstance();
- String stageName = context.getExternalContext().getInitParameter(
- ProjectStage.PROJECT_STAGE_PARAM_NAME);
-
- // If a value is found found
- if (stageName != null)
- {
- /*
- * see if an enum constant can be obtained by calling ProjectStage.valueOf(), passing the value from the
- * initParamMap. If this succeeds without exception, save the value and return it.
- */
- try
- {
- _projectStage = ProjectStage.valueOf(stageName);
- return _projectStage;
- }
- catch (IllegalArgumentException e)
- {
- //log.log(Level.SEVERE, "Couldn't discover the current project stage", e);
- }
- }
-
- _projectStage = ProjectStage.Production;
- }
-
- return _projectStage;
- }
-
- public void addBehavior(String behaviorId, String behaviorClass)
- {
- checkNull(behaviorId, "behaviorId");
- checkEmpty(behaviorId, "behaviorId");
- checkNull(behaviorClass, "behaviorClass");
- checkEmpty(behaviorClass, "behaviorClass");
-
- try
- {
- _behaviorClassMap.put(behaviorId, Class.forName(behaviorClass));
- }
- catch (ClassNotFoundException ignore)
- {
-
- }
-
- }
-
- public Iterator<String> getBehaviorIds()
- {
- return _behaviorClassMap.keySet().iterator();
- }
-
- public Behavior createBehavior(String behaviorId) throws FacesException
- {
- checkNull(behaviorId, "behaviorId");
- checkEmpty(behaviorId, "behaviorId");
-
- final Class<?> behaviorClass = this._behaviorClassMap.get(behaviorId);
- if (behaviorClass == null)
- {
- throw new FacesException(
- "Could not find any registered behavior-class for behaviorId : "
- + behaviorId);
- }
-
- try
- {
- final Behavior behavior = (Behavior) behaviorClass.newInstance();
- _handleAttachedResourceDependencyAnnotations(FacesContext.getCurrentInstance(), behaviorClass);
- return behavior;
- }
- catch (Exception e)
- {
- throw new FacesException("Could not instantiate behavior: "
- + behaviorClass, e);
- }
- }
-
@Override
- public void addValidator(String validatorId, String validatorClass)
- {
- super.addValidator(validatorId, validatorClass);
-
- try
- {
- _validatorClassMap.put(validatorId, Class.forName(validatorClass));
- }
- catch (ClassNotFoundException ex)
- {
- throw new FacesException(ex.getMessage());
- }
-
- }
-
- public void addDefaultValidatorId(String validatorId)
- {
- if (_validatorClassMap.containsKey(validatorId))
- {
- _defaultValidatorsIds.put(validatorId, _validatorClassMap.get(
- validatorId).getName());
- }
- }
-
- public final ResourceHandler getResourceHandler()
+ public FlowHandler getFlowHandler()
{
- return _resourceHandler;
+ return _flowHandler;
}
- public final void setResourceHandler(ResourceHandler resourceHandler)
- {
- checkNull(resourceHandler, "resourceHandler");
-
- _resourceHandler = resourceHandler;
- }
-
- public void subscribeToEvent(Class<? extends SystemEvent> systemEventClass,
- SystemEventListener listener)
- {
- subscribeToEvent(systemEventClass, null, listener);
- }
-
- public void subscribeToEvent(Class<? extends SystemEvent> systemEventClass,
- Class<?> sourceClass, SystemEventListener listener)
- {
- checkNull(systemEventClass, "systemEventClass");
- checkNull(listener, "listener");
-
- SystemListenerEntry systemListenerEntry;
- synchronized (_systemEventListenerClassMap)
- {
- systemListenerEntry = _systemEventListenerClassMap
- .get(systemEventClass);
- if (systemListenerEntry == null)
- {
- systemListenerEntry = new SystemListenerEntry();
- _systemEventListenerClassMap.put(systemEventClass,
- systemListenerEntry);
- }
- }
-
- systemListenerEntry.addListener(listener, sourceClass);
- }
-
- public void unsubscribeFromEvent(
- Class<? extends SystemEvent> systemEventClass,
- SystemEventListener listener)
- {
- unsubscribeFromEvent(systemEventClass, null, listener);
- }
-
- public void unsubscribeFromEvent(
- Class<? extends SystemEvent> systemEventClass,
- Class<?> sourceClass, SystemEventListener listener)
- {
- checkNull(systemEventClass, "systemEventClass");
- checkNull(listener, "listener");
-
- SystemListenerEntry systemListenerEntry = _systemEventListenerClassMap
- .get(systemEventClass);
- if (systemListenerEntry != null)
- {
- systemListenerEntry.removeListener(listener, sourceClass);
- }
- }
-
- @Override
- public UIComponent createComponent(String componentType)
- {
- UIComponent component = super.createComponent(componentType);
- _handleAnnotations(FacesContext.getCurrentInstance(), component, component);
- return component;
- }
-
-
-
@Override
- public UIComponent createComponent(ValueBinding componentBinding,
- FacesContext context, String componentType) throws FacesException
+ public void setFlowHandler(FlowHandler flowHandler)
{
- UIComponent component = null;
- try
- {
- component = (UIComponent) componentBinding.getValue(context);
- if (component == null)
- {
- component = createComponent(componentType);
- componentBinding.setValue(context, component);
- }
- else
- {
- _handleAnnotations(context, component, component);
- }
-
- }
- catch (Exception e)
- {
- throw new FacesException(e);
- }
- return component;
+ this._flowHandler = flowHandler;
}
- @Override
- public UIComponent createComponent(ValueExpression componentExpression,
- FacesContext facesContext, String componentType)
- throws FacesException, NullPointerException
- {
-
- /*
- * Before the component instance is returned, it must be inspected for the presence of a ListenerFor (or
- * ListenersFor) or ResourceDependency (or ResourceDependencies) annotation. If any of these annotations are
- * present, the action listed in ListenerFor or ResourceDependency must be taken on the component, before it is
- * returned from this method. This variant of createComponent must not inspect the Renderer for the component to
- * be returned for any of the afore mentioned annotations. Such inspection is the province of
- */
-
- checkNull(componentExpression, "componentExpression");
- checkNull(facesContext, "facesContext");
- checkNull(componentType, "componentType");
-
- ELContext elContext = facesContext.getELContext();
-
- try
- {
- Object retVal = componentExpression.getValue(elContext);
-
- UIComponent createdComponent;
-
- if (retVal instanceof UIComponent)
- {
- createdComponent = (UIComponent) retVal;
- _handleAnnotations(facesContext, createdComponent, createdComponent);
- }
- else
- {
- createdComponent = createComponent(componentType);
- componentExpression.setValue(elContext, createdComponent);
- }
-
- return createdComponent;
- }
- catch (FacesException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new FacesException(e);
- }
- }
-
- @Override
- public UIComponent createComponent(ValueExpression componentExpression, FacesContext context, String componentType,
- String rendererType)
- {
- // Like createComponent(ValueExpression, FacesContext, String)
- UIComponent component = createComponent(componentExpression, context, componentType);
-
- _inspectRenderer(context, component, componentType, rendererType);
-
- return component;
- }
-
-
- @Override
- public UIComponent createComponent(FacesContext context, String componentType, String rendererType)
- {
- checkNull(context, "context");
- checkNull(componentType, "componentType");
-
- // Like createComponent(String)
- UIComponent component = createComponent(componentType);
-
- _inspectRenderer(context, component, componentType, rendererType);
-
- return component;
- }
-
- @Override
- public UIComponent createComponent(FacesContext context, Resource componentResource)
- {
- checkNull(context, "context");
- checkNull(componentResource, "componentResource");
-
- UIComponent component = null;
- Resource resource;
- String fqcn;
- Class<? extends UIComponent> componentClass = null;
-
- /*
- * Obtain a reference to the ViewDeclarationLanguage for this Application instance by calling
- * ViewHandler.getViewDeclarationLanguage(javax.faces.context.FacesContext, java.lang.String), passing the
- * viewId found by calling UIViewRoot.getViewId() on the UIViewRoot in the argument FacesContext.
- */
- UIViewRoot view = context.getViewRoot();
- Application application = context.getApplication();
- ViewDeclarationLanguage vdl = application.getViewHandler().getViewDeclarationLanguage(context, view.getViewId());
-
- /*
- * Obtain a reference to the composite component metadata for this composite component by calling
- * ViewDeclarationLanguage.getComponentMetadata(javax.faces.context.FacesContext,
- * javax.faces.application.Resource), passing the facesContext and componentResource arguments to this method.
- * This version of JSF specification uses JavaBeans as the API to the component metadata.
- */
- BeanInfo metadata = vdl.getComponentMetadata(context, componentResource);
- if (metadata == null)
- {
- throw new FacesException("Could not get component metadata for "
- + componentResource.getResourceName()
- + ". Did you forget to specify <composite:interface>?");
- }
-
- /*
- * Determine if the component author declared a component-type for this component instance by obtaining the
- * BeanDescriptor from the component metadata and calling its getValue() method, passing
- * UIComponent.COMPOSITE_COMPONENT_TYPE_KEY as the argument. If non-null, the result must be a ValueExpression
- * whose value is the component-type of the UIComponent to be created for this Resource component. Call through
- * to createComponent(java.lang.String) to create the component.
- */
- BeanDescriptor descriptor = metadata.getBeanDescriptor();
- ValueExpression componentType = (ValueExpression) descriptor.getValue(UIComponent.COMPOSITE_COMPONENT_TYPE_KEY);
- boolean annotationsApplied = false;
- if (componentType != null)
- {
- component = application.createComponent((String) componentType.getValue(context.getELContext()));
- annotationsApplied = true;
- }
- else
- {
- /*
- * Otherwise, determine if a script based component for this Resource can be found by calling
- * ViewDeclarationLanguage.getScriptComponentResource(javax.faces.context.FacesContext,
- * javax.faces.application.Resource). If the result is non-null, and is a script written in one of the
- * languages listed in JSF 4.3 of the specification prose document, create a UIComponent instance from the
- * script resource.
- */
- resource = vdl.getScriptComponentResource(context, componentResource);
- if (resource != null)
- {
- String name = resource.getResourceName();
- String className = name.substring(0, name.lastIndexOf('.'));
-
- Class clazz;
- try
- {
- clazz = Class.forName(className);
- component = (UIComponent)clazz.newInstance();
- }
- catch (Exception e)
- {
- throw new FacesException(e);
- }
- }
- else
- {
- /*
- * Otherwise, let library-name be the return from calling Resource.getLibraryName() on the argument
- * componentResource and resource-name be the return from calling Resource.getResourceName() on the
- * argument componentResource. Create a fully qualified Java class name by removing any file extension
- * from resource-name and let fqcn be library-name + "." + resource-name. If a class with the name of
- * fqcn cannot be found, take no action and continue to the next step. If any of InstantiationException,
- * IllegalAccessException, or ClassCastException are thrown, wrap the exception in a FacesException and
- * re-throw it. If any other exception is thrown, log the exception and continue to the next step.
- */
-
- String name = componentResource.getResourceName();
- String className = name.substring(0, name.lastIndexOf('.'));
- fqcn = componentResource.getLibraryName() + "." + className;
-
- try
- {
- componentClass = classForName(fqcn);
- }
- catch (ClassNotFoundException e)
- {
- }
-
- if (componentClass != null)
- {
- try
- {
- component = componentClass.newInstance();
- }
- catch (InstantiationException e)
- {
- log.error("Could not instantiate component class name = " + fqcn, e);
- throw new FacesException("Could not instantiate component class name = " + fqcn, e);
- }
- catch (IllegalAccessException e)
- {
- log.error("Could not instantiate component class name = " + fqcn, e);
- throw new FacesException("Could not instantiate component class name = " + fqcn, e);
- }
- catch (Exception e)
- {
- log.error("Could not instantiate component class name = " + fqcn, e);
- }
- }
-
- /*
- * If none of the previous steps have yielded a UIComponent instance, call
- * createComponent(java.lang.String) passing "javax.faces.NamingContainer" as the argument.
- */
- if (component == null)
- {
- component = application.createComponent(UINamingContainer.COMPONENT_TYPE);
- annotationsApplied = true;
- }
- }
- }
-
- /*
- * Call UIComponent.setRendererType(java.lang.String) on the UIComponent instance, passing
- * "javax.faces.Composite" as the argument.
- */
- component.setRendererType("javax.faces.Composite");
-
- /*
- * Store the argument Resource in the attributes Map of the UIComponent under the key,
- * Resource.COMPONENT_RESOURCE_KEY.
- */
- component.getAttributes().put(Resource.COMPONENT_RESOURCE_KEY, componentResource);
-
- /*
- * Store composite component metadata in the attributes Map of the UIComponent under the key,
- * UIComponent.BEANINFO_KEY.
- */
- component.getAttributes().put(UIComponent.BEANINFO_KEY, metadata);
-
- /*
- * Before the component instance is returned, it must be inspected for the presence of a ListenerFor annotation.
- * If this annotation is present, the action listed in ListenerFor must be taken on the component, before it is
- * returned from this method.
- */
- if (!annotationsApplied)
- {
- _handleAnnotations(context, component, component);
- }
-
- return component;
- }
-
- private static Class classForName(String type)
- throws ClassNotFoundException
- {
- if (type == null) throw new NullPointerException("type");
- try
- {
- // Try WebApp ClassLoader first
- return Class.forName(type,
- false, // do not initialize for faster startup
- Thread.currentThread().getContextClassLoader());
- }
- catch (ClassNotFoundException ignore)
- {
- // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib)
- return Class.forName(type,
- false, // do not initialize for faster startup
- MockApplication20.class.getClassLoader());
- }
- }
-
- private void _handleAttachedResourceDependencyAnnotations(FacesContext context, Object inspected)
- {
- if (inspected == null) {
- return;
- }
-
- ResourceDependency annotation = inspected.getClass().getAnnotation(ResourceDependency.class);
-
- if (annotation == null)
- {
- // If the ResourceDependency annotation is not present, the argument must be inspected for the presence
- // of the ResourceDependencies annotation.
- ResourceDependencies dependencies = inspected.getClass().getAnnotation(ResourceDependencies.class);
- if (dependencies != null)
- {
- // If the ResourceDependencies annotation is present, the action described in ResourceDependencies
- // must be taken.
- for (ResourceDependency dependency : dependencies.value())
- {
- _handleAttachedResourceDependency(context, dependency);
- }
- }
- }
- else
- {
- // If the ResourceDependency annotation is present, the action described in ResourceDependency must be
- // taken.
- _handleAttachedResourceDependency(context, annotation);
- }
- }
-
- private void _handleAttachedResourceDependency(FacesContext context, ResourceDependency annotation)
- {
- // If this annotation is not present on the class in question, no action must be taken.
- if (annotation != null)
- {
- Application application = context.getApplication();
-
- // Create a UIOutput instance by passing javax.faces.Output. to
- // Application.createComponent(java.lang.String).
- UIOutput output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
-
- // Get the annotation instance from the class and obtain the values of the name, library, and
- // target attributes.
- String name = annotation.name();
- if (name != null && name.length() > 0)
- {
- name = _ELText.parse(getExpressionFactory(), context.getELContext(), name).toString(context.getELContext());
- }
-
- // Obtain the renderer-type for the resource name by passing name to
- // ResourceHandler.getRendererTypeForResourceName(java.lang.String).
- String rendererType = application.getResourceHandler().getRendererTypeForResourceName(name);
-
- // Call setRendererType on the UIOutput instance, passing the renderer-type.
- output.setRendererType(rendererType);
-
- // Obtain the Map of attributes from the UIOutput component by calling UIComponent.getAttributes().
- Map<String, Object> attributes = output.getAttributes();
-
- // Store the name into the attributes Map under the key "name".
- attributes.put("name", name);
-
- // If library is the empty string, let library be null.
- String library = annotation.library();
- if (library != null && library.length() > 0)
- {
- library = _ELText.parse(getExpressionFactory(), context.getELContext(), library).toString(context.getELContext());
- // If library is non-null, store it under the key "library".
- attributes.put("library", library);
- }
-
- // If target is the empty string, let target be null.
- String target = annotation.target();
- if (target != null && target.length() > 0)
- {
- target = _ELText.parse(getExpressionFactory(), context.getELContext(), target).toString(context.getELContext());
- // If target is non-null, store it under the key "target".
- attributes.put("target", target);
- context.getViewRoot().addComponentResource(context, output, target);
- }
- else
- {
- // Otherwise, if target is null, call UIViewRoot.addComponentResource(javax.faces.context.FacesContext,
- // javax.faces.component.UIComponent), passing the UIOutput instance as the second argument.
- context.getViewRoot().addComponentResource(context, output);
- }
- }
- }
-
- @Override
- public Converter createConverter(String converterId)
- {
- Converter converter = super.createConverter(converterId);
- _handleAttachedResourceDependencyAnnotations(FacesContext.getCurrentInstance(), converter);
- return converter;
- }
-
- @Override
- public Validator createValidator(String validatorId)
- {
- Validator validator = super.createValidator(validatorId);
- _handleAttachedResourceDependencyAnnotations(FacesContext.getCurrentInstance(), validator);
- return validator;
- }
-
-
}
Copied: myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java (from r1366645, myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java)
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java?p2=myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java&p1=myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java&r1=1366645&r2=1448488&rev=1448488&view=diff
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java (original)
+++ myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockApplicationFactory.java Thu Feb 21 01:28:30 2013
@@ -64,7 +64,12 @@ public class MockApplicationFactory exte
try
{
clazz = this.getClass().getClassLoader().loadClass(
- "org.apache.myfaces.test.mock.MockApplication20");
+ "org.apache.myfaces.test.mock.MockApplication22");
+ if (clazz == null)
+ {
+ clazz = this.getClass().getClassLoader().loadClass(
+ "org.apache.myfaces.test.mock.MockApplication20");
+ }
this.application = (MockApplication) clazz.newInstance();
}
catch (NoClassDefFoundError e)
Added: myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFlowHandler.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFlowHandler.java?rev=1448488&view=auto
==============================================================================
--- myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFlowHandler.java (added)
+++ myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFlowHandler.java Thu Feb 21 01:28:30 2013
@@ -0,0 +1,66 @@
+/*
+ * 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.mock;
+
+import java.util.Collections;
+import java.util.Map;
+import javax.faces.context.FacesContext;
+import javax.faces.flow.Flow;
+import javax.faces.flow.FlowCallNode;
+import javax.faces.flow.FlowHandler;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+public class MockFlowHandler extends FlowHandler
+{
+
+ @Override
+ public Map<Object, Object> getCurrentFlowScope()
+ {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public Flow getFlow(FacesContext context, String definingDocumentId, String id)
+ {
+ return null;
+ }
+
+ @Override
+ public void addFlow(FacesContext context, Flow toAdd)
+ {
+ }
+
+ @Override
+ public Flow getCurrentFlow(FacesContext context)
+ {
+ return null;
+ }
+
+ @Override
+ public void transition(FacesContext context, Flow sourceFlow, Flow targetFlow, FlowCallNode outboundCallNode)
+ {
+ }
+
+ @Override
+ public boolean isActive(FacesContext context, String definingDocument, String id)
+ {
+ return false;
+ }
+}
Propchange: myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFlowHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test22/src/main/resources/
------------------------------------------------------------------------------
bugtraq:number = true