You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ja...@apache.org on 2010/02/10 13:40:42 UTC
svn commit: r908472 [2/2] - in /myfaces/test/trunk:
test12/src/main/java/org/apache/myfaces/test/config/
test12/src/main/java/org/apache/myfaces/test/mock/
test20/src/main/java/org/apache/myfaces/test/config/
test20/src/main/java/org/apache/myfaces/tes...
Added: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockSubKeyMap.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockSubKeyMap.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockSubKeyMap.java (added)
+++ myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockSubKeyMap.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,285 @@
+/*
+ * 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.*;
+
+/**
+ * NOTE: Class copied from trinidad to be used on MockFlash.
+ * <p/>
+ * Map that wraps another to provide an isolated namespace using
+ * a prefix. This is especially handy for storing properties on
+ * the session in a structured manner without putting them into
+ * a true "Map" - because storing in a Map breaks session failover.
+ * (Session failover won't trigger on mutations of contained objects.)
+ * <p/>
+ * Note that there is a potential design flaw; if you create a SubKeyMap
+ * for "mypackage.foo" and for "mypackage.foo.bar", all the keys in the
+ * latter will actually show up in the former (prefixed by ".bar"). This
+ * "flaw" is actually relied on by PageFlowScopeMap (since it provides
+ * a handy way to clear out all descendents), so don't "fix" it!
+ */
+final class MockSubKeyMap<V> extends AbstractMap<String, V>
+{
+ public MockSubKeyMap(Map<String, Object> base, String prefix)
+ {
+ if (base == null) {
+ throw new NullPointerException();
+ }
+ if (prefix == null) {
+ throw new NullPointerException();
+ }
+
+ // Optimize the scenario where we're wrapping another SubKeyMap
+ if (base instanceof MockSubKeyMap) {
+ _base = ((MockSubKeyMap) base)._base;
+ _prefix = ((MockSubKeyMap) base)._prefix + prefix;
+ }
+ else {
+ _base = base;
+ _prefix = prefix;
+ }
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ return entrySet().isEmpty();
+ }
+
+ @Override
+ public V get(Object key)
+ {
+ key = _getBaseKey(key);
+ return (V) _base.get(key);
+ }
+
+ @Override
+ public V put(String key, V value)
+ {
+ key = _getBaseKey(key);
+ return (V) _base.put(key, value);
+ }
+
+ @Override
+ public V remove(Object key)
+ {
+ key = _getBaseKey(key);
+ return (V) _base.remove(key);
+ }
+
+ @Override
+ public boolean containsKey(Object key)
+ {
+ if (!(key instanceof String)) {
+ return false;
+ }
+
+ return _base.containsKey(_getBaseKey(key));
+ }
+
+ @Override
+ public Set<Map.Entry<String, V>> entrySet()
+ {
+ if (_entrySet == null) {
+ _entrySet = new Entries<V>();
+ }
+ return _entrySet;
+ }
+
+ private String _getBaseKey(Object key)
+ {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ // Yes, I want a ClassCastException if it's not a String
+ return _prefix + ((String) key);
+ }
+
+ private List<String> _gatherKeys()
+ {
+ List<String> list = new ArrayList<String>();
+ for (String key : _base.keySet()) {
+ if (key != null && key.startsWith(_prefix)) {
+ list.add(key);
+ }
+ }
+
+ return list;
+ }
+
+ //
+ // Set implementation for SubkeyMap.entrySet()
+ //
+
+ private class Entries<V> extends AbstractSet<Map.Entry<String, V>>
+ {
+ public Entries()
+ {
+ }
+
+ @Override
+ public Iterator<Map.Entry<String, V>> iterator()
+ {
+ // Sadly, if you just try to use a filtering approach
+ // on the iterator, you'll get concurrent modification
+ // exceptions. Consequently, gather the keys in a list
+ // and iterator over that.
+ List<String> keyList = _gatherKeys();
+ return new EntryIterator<V>(keyList.iterator());
+ }
+
+ @Override
+ public int size()
+ {
+ int size = 0;
+ for (String key : _base.keySet()) {
+ if (key != null && key.startsWith(_prefix)) {
+ size++;
+ }
+ }
+
+ return size;
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ Iterator<String> keys = _base.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ // Short-circuit: the default implementation would always
+ // need to iterate to find the total size.
+ if (key != null && key.startsWith(_prefix)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public void clear()
+ {
+ Iterator<String> keys = _base.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ if (key != null && key.startsWith(_prefix)) {
+ keys.remove();
+ }
+ }
+ }
+ }
+
+ private class EntryIterator<V> implements Iterator<Map.Entry<String, V>>
+ {
+ public EntryIterator(Iterator<String> iterator)
+ {
+ _iterator = iterator;
+ }
+
+ public boolean hasNext()
+ {
+ return _iterator.hasNext();
+ }
+
+ public Map.Entry<String, V> next()
+ {
+ String baseKey = _iterator.next();
+ _currentKey = baseKey;
+ return new Entry<V>(baseKey);
+ }
+
+ public void remove()
+ {
+ if (_currentKey == null) {
+ throw new IllegalStateException();
+ }
+
+ _base.remove(_currentKey);
+
+ _currentKey = null;
+ }
+
+ private Iterator<String> _iterator;
+ private String _currentKey;
+ }
+
+ private class Entry<V> implements Map.Entry<String, V>
+ {
+ public Entry(String baseKey)
+ {
+ _baseKey = baseKey;
+ }
+
+ public String getKey()
+ {
+ if (_key == null) {
+ _key = _baseKey.substring(_prefix.length());
+ }
+ return _key;
+ }
+
+ public V getValue()
+ {
+ return (V) _base.get(_baseKey);
+ }
+
+ public V setValue(V value)
+ {
+ return (V) _base.put(_baseKey, value);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof Map.Entry)) {
+ return false;
+ }
+ Map.Entry<String, V> e = (Map.Entry<String, V>) o;
+ return _equals(getKey(), e.getKey())
+ && _equals(getValue(), e.getValue());
+ }
+
+ @Override
+ public int hashCode()
+ {
+ Object key = getKey();
+ Object value = getValue();
+ return ((key == null) ? 0 : key.hashCode())
+ ^ ((value == null) ? 0 : value.hashCode());
+ }
+
+ private String _baseKey;
+ private String _key;
+ }
+
+ static private boolean _equals(Object a, Object b)
+ {
+ if (a == null) {
+ return b == null;
+ }
+ return a.equals(b);
+ }
+
+ private final Map<String, Object> _base;
+ private final String _prefix;
+ private Set<Map.Entry<String, V>> _entrySet;
+
+}
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockSubKeyMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockSubKeyMap.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockSubKeyMap.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResource.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResource.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResource.java (added)
+++ myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResource.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,167 @@
+/*
+ * 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.resource;
+
+import org.apache.myfaces.test.mock.MockServletContext;
+
+import javax.faces.application.Resource;
+import javax.faces.context.FacesContext;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * <p>Mock implementation of <code>Resource</code>.</p>
+ * <p/>
+ * $Id$
+ *
+ * @since 2.0
+ */
+public class MockResource extends Resource
+{
+
+ private String _prefix;
+ private String _libraryName;
+ private String _libraryVersion;
+ private String _resourceName;
+ private String _resourceVersion;
+ private File _documentRoot;
+
+ /**
+ * Creates new resource object
+ *
+ * @param prefix locale prefix if any
+ * @param libraryName resource library name
+ * @param libraryVersion resource library version if any
+ * @param resourceName resource file name
+ * @param resourceVersion resource version if any
+ * @param documentRoot parent folder of resource directories. Must not be <code>null</code>
+ */
+ public MockResource(String prefix, String libraryName, String libraryVersion, String resourceName, String resourceVersion, File documentRoot)
+ {
+ _prefix = prefix;
+ _libraryName = libraryName;
+ _libraryVersion = libraryVersion;
+ _resourceName = resourceName;
+ _resourceVersion = resourceVersion;
+ _documentRoot = documentRoot;
+
+ if (_documentRoot == null) {
+ throw new IllegalArgumentException("documentRoot must not be null");
+ }
+ }
+
+ @Override
+ public String getResourceName()
+ {
+ return _resourceName;
+ }
+
+ @Override
+ public String getLibraryName()
+ {
+ return _libraryName;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException
+ {
+ MockServletContext servletContext = (MockServletContext)
+ FacesContext.getCurrentInstance().getExternalContext().getContext();
+ servletContext.setDocumentRoot(_documentRoot);
+ return servletContext.getResourceAsStream(buildResourcePath());
+ }
+
+ @Override
+ public String getRequestPath()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Map<String, String> getResponseHeaders()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public URL getURL()
+ {
+ MockServletContext servletContext = (MockServletContext)
+ FacesContext.getCurrentInstance().getExternalContext().getContext();
+ servletContext.setDocumentRoot(_documentRoot);
+
+ try {
+ return servletContext.getResource(buildResourcePath());
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean userAgentNeedsUpdate(FacesContext context)
+ {
+ return true;
+ }
+
+ private String buildResourcePath()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append('/');
+ boolean firstSlashAdded = false;
+ if (_prefix != null && _prefix.length() > 0) {
+ builder.append(_prefix);
+ firstSlashAdded = true;
+ }
+ if (_libraryName != null) {
+ if (firstSlashAdded) {
+ builder.append('/');
+ }
+ builder.append(_libraryName);
+ firstSlashAdded = true;
+ }
+ if (_libraryVersion != null) {
+ if (firstSlashAdded) {
+ builder.append('/');
+ }
+ builder.append(_libraryVersion);
+ firstSlashAdded = true;
+ }
+ if (_resourceName != null) {
+ if (firstSlashAdded) {
+ builder.append('/');
+ }
+ builder.append(_resourceName);
+ firstSlashAdded = true;
+ }
+ if (_resourceVersion != null) {
+ if (firstSlashAdded) {
+ builder.append('/');
+ }
+ builder.append(_resourceVersion);
+ builder.append(
+ _resourceName.substring(_resourceName.lastIndexOf('.')));
+ }
+
+ return builder.toString();
+ }
+
+}
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResource.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResource.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java (added)
+++ myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,351 @@
+/*
+ * 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.resource;
+
+import org.apache.myfaces.test.mock.MockServletContext;
+
+import javax.faces.FacesException;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.*;
+import java.util.regex.Pattern;
+
+/**
+ * <p>Mock implementation of <code>ResourceHandler</code>.</p>
+ * <p/>
+ * $Id$
+ *
+ * @since 2.0
+ */
+public class MockResourceHandler extends ResourceHandler
+{
+
+ private static final String IS_RESOURCE_REQUEST = "org.apache.myfaces.IS_RESOURCE_REQUEST";
+
+ /**
+ * It checks version like this: /1/, /1_0/, /1_0_0/, /100_100/
+ * <p/>
+ * Used on getLibraryVersion to filter resource directories
+ */
+ protected static Pattern VERSION_CHECKER = Pattern.compile("/\\p{Digit}+(_\\p{Digit}*)*/");
+
+ /**
+ * It checks version like this: /1.js, /1_0.js, /1_0_0.js, /100_100.js
+ * <p/>
+ * Used on getResourceVersion to filter resources
+ */
+ protected static Pattern RESOURCE_VERSION_CHECKER = Pattern.compile("/\\p{Digit}+(_\\p{Digit}*)*\\..*");
+
+ private File _documentRoot;
+
+ /**
+ * @param documentRoot parent folder of resource directories. Must not be <code>null</code>
+ */
+ public MockResourceHandler(File documentRoot)
+ {
+ if (documentRoot == null) {
+ throw new NullPointerException("documentRoot must not be null");
+ }
+
+ _documentRoot = documentRoot;
+
+ ((MockServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext())
+ .setDocumentRoot(_documentRoot);
+ }
+
+ @Override
+ public Resource createResource(String resourceName)
+ {
+ return createResource(resourceName, null);
+ }
+
+ @Override
+ public Resource createResource(String resourceName, String libraryName)
+ {
+ return createResource(resourceName, libraryName, null);
+ }
+
+ @Override
+ public Resource createResource(String resourceName, String libraryName, String contentType)
+ {
+ String prefix = getLocalePrefixForLocateResource();
+ String libraryVersion = getLibraryVersion(prefix + "/" + libraryName);
+
+ String pathToResource;
+ if (null != libraryVersion) {
+ pathToResource = prefix + '/'
+ + libraryName + '/' + libraryVersion + '/'
+ + resourceName;
+ }
+ else {
+ pathToResource = prefix + '/'
+ + libraryName + '/' + resourceName;
+ }
+
+ return new MockResource(prefix, libraryName, libraryVersion, resourceName, getResourceVersion(pathToResource), _documentRoot);
+ }
+
+ @Override
+ public String getRendererTypeForResourceName(String resourceName)
+ {
+ if (resourceName.endsWith(".js")) {
+ return "javax.faces.resource.Script";
+ }
+ else if (resourceName.endsWith(".css")) {
+ return "javax.faces.resource.Stylesheet";
+ }
+ return null;
+ }
+
+ @Override
+ public void handleResourceRequest(FacesContext context) throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isResourceRequest(FacesContext facesContext)
+ {
+ // Since this method could be called many times we save it
+ //on request map so the first time is calculated it remains
+ //alive until the end of the request
+ Boolean value = (Boolean) facesContext.getExternalContext()
+ .getRequestMap().get(IS_RESOURCE_REQUEST);
+
+ if (value != null && value.booleanValue()) {
+ //return the saved value
+ return value.booleanValue();
+ }
+ else {
+ // assuming that we don't have servlet mapping
+ String resourceBasePath = facesContext.getExternalContext().getRequestPathInfo();
+
+ if (resourceBasePath != null
+ && resourceBasePath
+ .startsWith(ResourceHandler.RESOURCE_IDENTIFIER)) {
+ facesContext.getExternalContext().getRequestMap().put(
+ IS_RESOURCE_REQUEST, Boolean.TRUE);
+ return true;
+ }
+ else {
+ facesContext.getExternalContext().getRequestMap().put(
+ IS_RESOURCE_REQUEST, Boolean.FALSE);
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public boolean libraryExists(String libraryName)
+ {
+ String localePrefix = getLocalePrefixForLocateResource();
+
+ String pathToLib;
+
+ if (localePrefix != null) {
+ //Check with locale
+ pathToLib = localePrefix + '/' + libraryName;
+ }
+ else {
+ pathToLib = libraryName;
+ }
+
+ try {
+ URL url = FacesContext.getCurrentInstance().getExternalContext().getResource("/" + pathToLib);
+ return (url != null);
+ }
+ catch (MalformedURLException e) {
+ return false;
+ }
+ }
+
+ protected String getLocalePrefixForLocateResource()
+ {
+ String localePrefix = null;
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ String bundleName = context.getApplication().getMessageBundle();
+
+ if (null != bundleName) {
+ Locale locale = context.getApplication().getViewHandler()
+ .calculateLocale(context);
+
+ ResourceBundle bundle = ResourceBundle
+ .getBundle(bundleName, locale, getContextClassLoader());
+
+ if (bundle != null) {
+ try {
+ localePrefix = bundle.getString(ResourceHandler.LOCALE_PREFIX);
+ }
+ catch (MissingResourceException e) {
+ // Ignore it and return null
+ }
+ }
+ }
+ return localePrefix;
+ }
+
+ /**
+ * Gets the ClassLoader associated with the current thread. Includes a check for priviledges
+ * against java2 security to ensure no security related exceptions are encountered.
+ *
+ * @return ClassLoader
+ * @since 3.0.6
+ */
+ private static ClassLoader getContextClassLoader()
+ {
+ if (System.getSecurityManager() != null) {
+ try {
+ ClassLoader cl = AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>()
+ {
+ public ClassLoader run() throws PrivilegedActionException
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ return cl;
+ }
+ catch (PrivilegedActionException pae) {
+ throw new FacesException(pae);
+ }
+ }
+ else {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ }
+
+ private String getLibraryVersion(String path)
+ {
+ ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
+
+ String libraryVersion = null;
+ Set<String> libraryPaths = context.getResourcePaths("/" + path);
+ if (null != libraryPaths && !libraryPaths.isEmpty()) {
+ // Look in the libraryPaths for versioned libraries.
+ // If one or more versioned libraries are found, take
+ // the one with the "highest" version number as the value
+ // of libraryVersion. If no versioned libraries
+ // are found, let libraryVersion remain null.
+
+ for (String libraryPath : libraryPaths) {
+ String version = libraryPath.substring(path.length());
+
+ if (VERSION_CHECKER.matcher(version).matches()) {
+ version = version.substring(1, version.length() - 1);
+ if (libraryVersion == null) {
+ libraryVersion = version;
+ }
+ else if (compareVersion(libraryVersion, version) < 0) {
+ libraryVersion = version;
+ }
+ }
+ }
+ }
+ return libraryVersion;
+ }
+
+ private int compareVersion(String s1, String s2)
+ {
+ int n1 = 0;
+ int n2 = 0;
+ String o1 = s1;
+ String o2 = s2;
+
+ boolean p1 = true;
+ boolean p2 = true;
+
+ while (n1 == n2 && (p1 || p2)) {
+ int i1 = o1.indexOf('_');
+ int i2 = o2.indexOf('_');
+ if (i1 < 0) {
+ if (o1.length() > 0) {
+ p1 = false;
+ n1 = Integer.valueOf(o1);
+ o1 = "";
+ }
+ else {
+ p1 = false;
+ n1 = 0;
+ }
+ }
+ else {
+ n1 = Integer.valueOf(o1.substring(0, i1));
+ o1 = o1.substring(i1 + 1);
+ }
+ if (i2 < 0) {
+ if (o2.length() > 0) {
+ p2 = false;
+ n2 = Integer.valueOf(o2);
+ o2 = "";
+ }
+ else {
+ p2 = false;
+ n2 = 0;
+ }
+ }
+ else {
+ n2 = Integer.valueOf(o2.substring(0, i2));
+ o2 = o2.substring(i2 + 1);
+ }
+ }
+
+ if (n1 == n2) {
+ return s1.length() - s2.length();
+ }
+ return n1 - n2;
+ }
+
+ private String getResourceVersion(String path)
+ {
+ ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
+ String resourceVersion = null;
+ Set<String> resourcePaths = context.getResourcePaths("/" + path);
+
+ if (null != resourcePaths && !resourcePaths.isEmpty()) {
+ // resourceVersion = // execute the comment
+ // Look in the resourcePaths for versioned resources.
+ // If one or more versioned resources are found, take
+ // the one with the "highest" version number as the value
+ // of resourceVersion. If no versioned libraries
+ // are found, let resourceVersion remain null.
+ for (String resourcePath : resourcePaths) {
+ String version = resourcePath.substring(path.length());
+
+ if (RESOURCE_VERSION_CHECKER.matcher(version).matches()) {
+ version = version.substring(1, version.lastIndexOf('.'));
+ if (resourceVersion == null) {
+ resourceVersion = version;
+ }
+ else if (compareVersion(resourceVersion, version) < 0) {
+ resourceVersion = version;
+ }
+ }
+ }
+ }
+ return resourceVersion;
+ }
+}
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java (added)
+++ myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.visit;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitResult;
+
+/**
+ * <p>Mock implementation of <code>VisitCallback</code>.</p>
+ * <p/>
+ * $Id$
+ *
+ * @since 2.0
+ */
+public class MockVisitCallback implements VisitCallback
+{
+
+ public VisitResult visit(VisitContext context, UIComponent target)
+ {
+ return VisitResult.ACCEPT;
+ }
+}
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java (added)
+++ myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,100 @@
+/*
+ * 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.visit;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitHint;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Set;
+
+/**
+ * <p>Mock implementation of <code>VisitContext</code>.</p>
+ * <p/>
+ * $Id$
+ *
+ * @since 2.0
+ */
+public class MockVisitContext extends VisitContext
+{
+
+ private final FacesContext _facesContext;
+ private final Set<VisitHint> _hints;
+
+ public MockVisitContext(FacesContext facesContext)
+ {
+ this(facesContext, null);
+ }
+
+ public MockVisitContext(FacesContext facesContext, Set<VisitHint> hints)
+ {
+ if (facesContext == null) {
+ throw new NullPointerException();
+ }
+
+ _facesContext = facesContext;
+
+ // Copy and store hints - ensure unmodifiable and non-empty
+ EnumSet<VisitHint> hintsEnumSet = ((hints == null) || (hints.isEmpty()))
+ ? EnumSet.noneOf(VisitHint.class)
+ : EnumSet.copyOf(hints);
+
+ _hints = Collections.unmodifiableSet(hintsEnumSet);
+ }
+
+ @Override
+ public FacesContext getFacesContext()
+ {
+ return _facesContext;
+ }
+
+ @Override
+ public Set<VisitHint> getHints()
+ {
+ return _hints;
+ }
+
+ @Override
+ public Collection<String> getIdsToVisit()
+ {
+ return ALL_IDS;
+ }
+
+ @Override
+ public Collection<String> getSubtreeIdsToVisit(UIComponent component)
+ {
+ // Make sure component is a NamingContainer
+ if (!(component instanceof NamingContainer)) {
+ throw new IllegalArgumentException("Component is not a NamingContainer: " + component);
+ }
+
+ return ALL_IDS;
+ }
+
+ @Override
+ public VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback)
+ {
+ return callback.visit(this, component);
+ }
+}
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContextFactory.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContextFactory.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContextFactory.java (added)
+++ myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContextFactory.java Wed Feb 10 12:40:41 2010
@@ -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.
+ */
+
+package org.apache.myfaces.test.mock.visit;
+
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitContextFactory;
+import javax.faces.component.visit.VisitHint;
+import javax.faces.context.FacesContext;
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * <p>Mock implementation of <code>VisitContextFactory</code>.</p>
+ * <p/>
+ * $Id$
+ *
+ * @since 2.0
+ */
+public class MockVisitContextFactory extends VisitContextFactory
+{
+
+ @Override
+ public VisitContext getVisitContext(FacesContext context, Collection<String> ids, Set<VisitHint> hints)
+ {
+ return new MockVisitContext(context, hints);
+ }
+}
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContextFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/ConfigParser20TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/ConfigParser20TestCase.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/ConfigParser20TestCase.java (added)
+++ myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/ConfigParser20TestCase.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,119 @@
+/*
+ * 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.config;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.test.base.AbstractJsfTestCase;
+import org.apache.myfaces.test.mock.MockApplication20;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Test case for <code>ConfigParser20</code>
+ */
+public class ConfigParser20TestCase extends AbstractJsfTestCase
+{
+
+
+ // ------------------------------------------------------------ Constructors
+
+
+ // Construct a new instance of this test case.
+
+ public ConfigParser20TestCase(String name)
+ {
+ super(name);
+ }
+
+
+ // ---------------------------------------------------- Overall Test Methods
+
+
+ // Set up instance variables required by this test case.
+
+ protected void setUp() throws Exception
+ {
+
+ super.setUp();
+ parser = new ConfigParser20();
+ application20 = (MockApplication20) application;
+
+ }
+
+
+ // Return the tests included in this test case.
+
+ public static Test suite()
+ {
+
+ return (new TestSuite(ConfigParser20TestCase.class));
+
+ }
+
+
+ // Tear down instance variables required by this test case.
+
+ protected void tearDown() throws Exception
+ {
+
+ parser = null;
+ super.tearDown();
+
+ }
+
+
+ // ------------------------------------------------------ Instance Variables
+
+
+ // ConfigParser instance under test
+ ConfigParser20 parser = null;
+
+ MockApplication20 application20 = null;
+
+ // ------------------------------------------------- Individual Test Methods
+
+ @SuppressWarnings("unchecked")
+ public void testSimple() throws Exception
+ {
+
+ URL url = this.getClass().getResource("/org/apache/myfaces/test/config/myfaces20-faces-config-1.xml");
+ assertNotNull(url);
+ parser.parse(url);
+ Iterator items;
+ List list = new ArrayList();
+
+ items = application20.getComponentTypes();
+ list.clear();
+ while (items.hasNext()) {
+ list.add(items.next());
+ }
+ assertTrue(list.contains("component-type-1"));
+ assertTrue(list.contains("component-type-2"));
+
+ items = application20.getBehaviorIds();
+ list.clear();
+ while (items.hasNext()) {
+ list.add(items.next());
+ }
+ assertTrue(list.contains("behavior-1"));
+ assertTrue(list.contains("behavior-2"));
+ }
+}
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/ConfigParser20TestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/ConfigParser20TestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/ConfigParser20TestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/MyRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/MyRenderer.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/MyRenderer.java (added)
+++ myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/MyRenderer.java Wed Feb 10 12:40:41 2010
@@ -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.config;
+
+import javax.faces.render.Renderer;
+
+/**
+ * <p>Concrete renderer implementation for testing.</p>
+ */
+public class MyRenderer extends Renderer {
+
+}
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/MyRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/MyRenderer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/config/MyRenderer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockApplication20TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockApplication20TestCase.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockApplication20TestCase.java (added)
+++ myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockApplication20TestCase.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,92 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.test.base.AbstractJsfTestCase;
+
+import javax.faces.application.ProjectStage;
+import javax.faces.component.behavior.Behavior;
+
+/**
+ * Test case for <code>MockApplication20</code>
+ */
+public class MockApplication20TestCase extends AbstractJsfTestCase
+{
+
+ private MockApplication20 _application;
+
+ public MockApplication20TestCase(String name)
+ {
+ super(name);
+ }
+
+ // Set up instance variables required by this test case.
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _application = (MockApplication20) application;
+ }
+
+ // Return the tests included in this test case.
+
+ public static Test suite()
+ {
+ return (new TestSuite(MockApplication20TestCase.class));
+ }
+
+ // Tear down instance variables required by this test case.
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testGetProjectStage()
+ {
+ assertEquals(ProjectStage.Production, _application.getProjectStage());
+ }
+
+ public void testBehavior()
+ {
+ String behaviorId = "BehaviorBaseId";
+
+ _application.addBehavior(behaviorId,
+ "javax.faces.component.behavior.BehaviorBase");
+
+ assertTrue("Behavior not added", _application.getBehaviorIds().hasNext());
+ assertEquals(behaviorId, _application.getBehaviorIds().next());
+
+ Behavior createdBehavior = _application.createBehavior(behaviorId);
+ assertNotNull("Behavior not created", createdBehavior);
+ }
+
+ public void testDefaultValidator()
+ {
+ String validatorId = "testValidator";
+ String validatorClass = "javax.faces.validator.LengthValidator";
+
+ _application.addValidator(validatorId, validatorClass);
+ assertTrue(_application.getValidatorIds().hasNext());
+
+ _application.addDefaultValidatorId(validatorId);
+ assertTrue(_application.getDefaultValidatorInfo().containsKey(validatorId));
+ }
+}
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockApplication20TestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockApplication20TestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockApplication20TestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockExternalContext20TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockExternalContext20TestCase.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockExternalContext20TestCase.java (added)
+++ myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockExternalContext20TestCase.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,133 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.test.base.AbstractJsfTestCase;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Test case for <code>MockExternalContext20</code>
+ */
+public class MockExternalContext20TestCase extends AbstractJsfTestCase
+{
+
+ private MockExternalContext20 _context;
+
+ public MockExternalContext20TestCase(String name)
+ {
+ super(name);
+ }
+
+ // Set up instance variables required by this test case.
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _context = (MockExternalContext20) externalContext;
+ }
+
+ // Return the tests included in this test case.
+
+ public static Test suite()
+ {
+ return (new TestSuite(MockExternalContext20TestCase.class));
+ }
+
+ // Tear down instance variables required by this test case.
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testEncodeBookmarkableURL()
+ {
+ HashMap<String, List<String>> parameters = new HashMap<String, List<String>>();
+ List<String> valueList = new ArrayList<String>();
+ valueList.add("value1");
+ parameters.put("param1", valueList);
+
+ assertEquals("http://localhost:8080?param1=value1",
+ _context.encodeBookmarkableURL("http://localhost:8080", parameters));
+ }
+
+ public void testEncodeRedirectURL()
+ {
+ HashMap<String, List<String>> parameters = new HashMap<String, List<String>>();
+ List<String> valueList = new ArrayList<String>();
+ valueList.add("value1");
+ parameters.put("param1", valueList);
+
+ assertEquals("http://localhost:8080?param1=value1",
+ _context.encodeRedirectURL("http://localhost:8080", parameters));
+ }
+
+ public void testGetContextName()
+ {
+ assertEquals("MockServletContext", _context.getContextName());
+ }
+
+ public void testResponseSendError() throws Exception
+ {
+ _context.responseSendError(404, "not found");
+ assertEquals(404,
+ ((MockHttpServletResponse) _context.getResponse()).getStatus());
+ }
+
+ public void testResponseHeader() throws Exception
+ {
+ _context.setResponseHeader("header1", "value1");
+ assertEquals("value1",
+ ((MockHttpServletResponse) _context.getResponse()).getHeader("header1"));
+ }
+
+ public void testGetRequestScheme()
+ {
+ assertEquals("http", _context.getRequestScheme());
+ }
+
+ public void testGetRequestServerName()
+ {
+ assertEquals("localhost", _context.getRequestServerName());
+ }
+
+ public void testGetRequestServerPort()
+ {
+ assertEquals(8080, _context.getRequestServerPort());
+ }
+
+ public void testGetResponseOutputStream() throws Exception
+ {
+ assertNotNull(_context.getResponseOutputStream());
+ }
+
+ public void testGetResponseOutputWriter() throws Exception
+ {
+ assertNotNull(_context.getResponseOutputWriter());
+ }
+
+ public void testGetFlash() throws Exception
+ {
+ assertNotNull(_context.getFlash());
+ }
+}
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockExternalContext20TestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockExternalContext20TestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockExternalContext20TestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFacesContext20TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFacesContext20TestCase.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFacesContext20TestCase.java (added)
+++ myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFacesContext20TestCase.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,95 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.test.base.AbstractJsfTestCase;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.ExceptionHandler;
+import javax.faces.context.ExceptionHandlerFactory;
+import java.util.List;
+
+/**
+ * Test case for <code>MockFacesContext20</code>
+ */
+public class MockFacesContext20TestCase extends AbstractJsfTestCase
+{
+
+ private MockFacesContext20 _context;
+
+ public MockFacesContext20TestCase(String name)
+ {
+ super(name);
+ }
+
+ // Set up instance variables required by this test case.
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _context = (MockFacesContext20) facesContext;
+ }
+
+ // Return the tests included in this test case.
+
+ public static Test suite()
+ {
+ return (new TestSuite(MockFacesContext20TestCase.class));
+ }
+
+ // Tear down instance variables required by this test case.
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testSetGetExceptionHandler()
+ {
+ ExceptionHandlerFactory handlerFactory = new MockExceptionHandlerFactory();
+ ExceptionHandler handler = handlerFactory.getExceptionHandler();
+ _context.setExceptionHandler(handler);
+ assertEquals(handler, _context.getExceptionHandler());
+ }
+
+ public void testGetMessageList()
+ {
+ FacesMessage message1 = new FacesMessage("test message1");
+ FacesMessage message2 = new FacesMessage("test message2");
+ _context.addMessage("clientid1", message1);
+ _context.addMessage("clientid2", message2);
+
+ List<FacesMessage> messageList = _context.getMessageList();
+ assertEquals(2, messageList.size());
+ assertTrue(messageList.contains(message1));
+ assertTrue(messageList.contains(message2));
+
+ List<FacesMessage> messageListClientId = _context.getMessageList("clientid1");
+ assertEquals(1, messageListClientId.size());
+ assertTrue(messageListClientId.contains(message1));
+ }
+
+ public void testValidationFailed()
+ {
+ assertFalse(_context.isValidationFailed());
+ _context.validationFailed();
+ assertTrue(_context.isValidationFailed());
+ }
+}
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFacesContext20TestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFacesContext20TestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFacesContext20TestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFlashTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFlashTestCase.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFlashTestCase.java (added)
+++ myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFlashTestCase.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,78 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.test.base.AbstractJsfTestCase;
+
+import javax.faces.context.Flash;
+
+/**
+ * Test case for <code>MockFlash</code>
+ */
+public class MockFlashTestCase extends AbstractJsfTestCase
+{
+
+ public MockFlashTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Set up instance variables required by this test case.
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ // Return the tests included in this test case.
+
+ public static Test suite()
+ {
+ return (new TestSuite(MockFlashTestCase.class));
+ }
+
+ // Tear down instance variables required by this test case.
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testGetInstance()
+ {
+ Flash flash = MockFlash.getCurrentInstance(externalContext);
+ assertNotNull(flash);
+ assertTrue(flash instanceof MockFlash);
+
+ Flash flash2 = MockFlash.getCurrentInstance(externalContext);
+ assertNotNull(flash2);
+ assertTrue(flash2 instanceof MockFlash);
+ assertEquals(flash, flash2);
+ }
+
+ public void testIsRedirect()
+ {
+ Flash flash = MockFlash.getCurrentInstance(externalContext);
+ assertFalse(flash.isRedirect());
+ flash.setRedirect(true);
+ assertTrue(flash.isRedirect());
+ }
+
+}
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFlashTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFlashTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockFlashTestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java (added)
+++ myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,73 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.test.base.AbstractJsfTestCase;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.PartialViewContextFactory;
+
+/**
+ * Test case for <code>MockPartialViewContext</code>
+ */
+public class MockPartialViewContextTestCase extends AbstractJsfTestCase
+{
+
+ public MockPartialViewContextTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Set up instance variables required by this test case.
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ // Return the tests included in this test case.
+
+ public static Test suite()
+ {
+ return (new TestSuite(MockPartialViewContextTestCase.class));
+ }
+
+ // Tear down instance variables required by this test case.
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testIsAjaxRequest()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ PartialViewContextFactory factory = new MockPartialViewContextFactory();
+
+ PartialViewContext pvContext = factory.getPartialViewContext(facesContext);
+ assertFalse(pvContext.isAjaxRequest());
+
+ facesContext.getExternalContext().getRequestHeaderMap().put("Faces-Request", "partial/ajax");
+
+ pvContext = factory.getPartialViewContext(facesContext);
+ assertTrue(pvContext.isAjaxRequest());
+ }
+}
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockResourceTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockResourceTestCase.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockResourceTestCase.java (added)
+++ myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockResourceTestCase.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,98 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.test.base.AbstractJsfTestCase;
+import org.apache.myfaces.test.mock.resource.MockResource;
+import org.apache.myfaces.test.mock.resource.MockResourceHandler;
+
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * Test case for resource handling
+ */
+public class MockResourceTestCase extends AbstractJsfTestCase {
+
+ private File _documentRoot;
+
+ public MockResourceTestCase(String name) {
+ super(name);
+ }
+
+ // Set up instance variables required by this test case.
+ protected void setUp() throws Exception {
+ super.setUp();
+ _documentRoot = new File("src/test/resources/org/apache/myfaces/test/mock/resources");
+ }
+
+ // Return the tests included in this test case.
+ public static Test suite() {
+ return (new TestSuite(MockResourceTestCase.class));
+ }
+
+ // Tear down instance variables required by this test case.
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testGetResource() throws Exception {
+
+ Resource resource = new MockResource(null, "testlib", null, "testfile.js", null, _documentRoot);
+
+ URL resourceUrl = resource.getURL();
+ assertNotNull("Could not find resource", resourceUrl);
+ assertTrue(resourceUrl.toString().endsWith("org/apache/myfaces/test/mock/resources/testlib/testfile.js"));
+ }
+
+ public void testGetNotExistingResource() throws Exception {
+
+ Resource resource = new MockResource(null, "testlib", null, "notexisting.js", null, _documentRoot);
+
+ assertNull(resource.getURL());
+ }
+
+ public void testGetAsStream() throws Exception {
+ Resource resource = new MockResource(null, "testlib", null, "testfile.js", null, _documentRoot);
+ InputStream stream = resource.getInputStream();
+ assertNotNull(stream);
+ assertTrue(stream.read() != -1);
+ }
+
+ public void testCreateResource() throws Exception {
+ ResourceHandler handler = new MockResourceHandler(_documentRoot);
+ Resource resource = handler.createResource("testfile.js", "testlib");
+ assertNotNull("resource could not be created", resource);
+ assertTrue(resource.getURL().toString().endsWith("org/apache/myfaces/test/mock/resources/testlib/testfile.js"));
+ }
+
+ public void testResourceHandler() throws Exception {
+ ResourceHandler handler = new MockResourceHandler(_documentRoot);
+
+ assertTrue(handler.libraryExists("testlib"));
+ assertFalse(handler.libraryExists("notexistinglib"));
+
+ assertEquals("javax.faces.resource.Script", handler.getRendererTypeForResourceName("testfile.js"));
+ }
+
+}
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockResourceTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockResourceTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockResourceTestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockVisitTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockVisitTestCase.java?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockVisitTestCase.java (added)
+++ myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockVisitTestCase.java Wed Feb 10 12:40:41 2010
@@ -0,0 +1,76 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.test.base.AbstractJsfTestCase;
+import org.apache.myfaces.test.mock.visit.MockVisitCallback;
+import org.apache.myfaces.test.mock.visit.MockVisitContextFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitContextFactory;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+
+/**
+ * Test case for <code>MockVisitContext</code>
+ */
+public class MockVisitTestCase extends AbstractJsfTestCase
+{
+
+ public MockVisitTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Set up instance variables required by this test case.
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ // Return the tests included in this test case.
+
+ public static Test suite()
+ {
+ return (new TestSuite(MockVisitTestCase.class));
+ }
+
+ // Tear down instance variables required by this test case.
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testVisitTree()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ VisitContextFactory factory = new MockVisitContextFactory();
+ VisitContext visitContext = factory.getVisitContext(facesContext, null, null);
+
+ VisitCallback callback = new MockVisitCallback();
+ UIComponent component = facesContext.getViewRoot();
+ assertEquals(VisitResult.ACCEPT, visitContext.invokeVisitCallback(component, callback));
+ }
+
+}
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockVisitTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockVisitTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/java/org/apache/myfaces/test/mock/MockVisitTestCase.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/config/myfaces20-faces-config-1.xml
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/config/myfaces20-faces-config-1.xml?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/config/myfaces20-faces-config-1.xml (added)
+++ myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/config/myfaces20-faces-config-1.xml Wed Feb 10 12:40:41 2010
@@ -0,0 +1,78 @@
+<?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.
+-->
+
+<faces-config version="2.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ 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-facesconfig_2_0.xsd">
+
+ <component>
+ <component-type>component-type-1</component-type>
+ <component-class>com.mycompany.MyComponent1</component-class>
+ </component>
+
+ <component>
+ <component-type>component-type-2</component-type>
+ <component-class>com.mycompany.MyComponent2</component-class>
+ </component>
+
+ <converter>
+ <converter-for-class>java.lang.Integer</converter-for-class>
+ <converter-class>org.apache.myfaces.test.config.MyConverter</converter-class>
+ </converter>
+
+ <validator>
+ <validator-id>validator-id-1</validator-id>
+ <validator-class>javax.faces.validator.LengthValidator</validator-class>
+ </validator>
+
+ <validator>
+ <validator-id>validator-id-2</validator-id>
+ <validator-class>javax.faces.validator.LongRangeValidator</validator-class>
+ </validator>
+
+ <behavior>
+ <behavior-id>behavior-1</behavior-id>
+ <behavior-class>org.apache.myfaces.test.config.MyBehavior</behavior-class>
+ </behavior>
+ <behavior>
+ <behavior-id>behavior-2</behavior-id>
+ <behavior-class>org.apache.myfaces.test.config.MyBehavior</behavior-class>
+ </behavior>
+
+ <render-kit>
+
+ <renderer>
+ <component-family>component-family-1</component-family>
+ <renderer-type>renderer-type-1</renderer-type>
+ <renderer-class>org.apache.myfaces.test.config.MyRenderer</renderer-class>
+ </renderer>
+
+ <renderer>
+ <component-family>component-family-2</component-family>
+ <renderer-type>renderer-type-2</renderer-type>
+ <renderer-class>org.apache.myfaces.test.config.MyRenderer</renderer-class>
+ </renderer>
+
+ </render-kit>
+
+
+
+</faces-config>
Propchange: myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/config/myfaces20-faces-config-1.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/config/myfaces20-faces-config-1.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/config/myfaces20-faces-config-1.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/mock/resources/testlib/testfile.js
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/mock/resources/testlib/testfile.js?rev=908472&view=auto
==============================================================================
--- myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/mock/resources/testlib/testfile.js (added)
+++ myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/mock/resources/testlib/testfile.js Wed Feb 10 12:40:41 2010
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2009 Apache Software Foundation
+ *
+ * Licensed 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.
+ *
+ * Author: Ingo Hofmann (latest modification by $Author$)
+ * Version: $Revision$ $Date$
+ *
+ */
+function foo() {
+ alert('Hello World');
+}
Propchange: myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/mock/resources/testlib/testfile.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/test/trunk/test20/src/test/resources/org/apache/myfaces/test/mock/resources/testlib/testfile.js
------------------------------------------------------------------------------
svn:mime-type = text/plain