use common-shades/attributemaps and maven-shade-plugin instead of copied classes
diff --git a/test12/pom.xml b/test12/pom.xml
index 1838e31..62d6d71 100644
--- a/test12/pom.xml
+++ b/test12/pom.xml
@@ -91,6 +91,14 @@
             <version>1.0</version>
             <scope>provided</scope>
         </dependency>
+        
+        <!-- shaded artifacts -->
+        <dependency>
+            <groupId>org.apache.myfaces.common-shades</groupId>
+            <artifactId>attributemaps</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
 
     </dependencies>
 
@@ -122,6 +130,42 @@
                     </execution>
                 </executions>
             </plugin>
+            
+            <!-- 
+               Use maven-shade-plugin to include artifacts from 
+               org.apache.myfaces.common-shades directly in the target jar.
+            -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>1.3.3</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <createDependencyReducedPom>true</createDependencyReducedPom>
+                            <artifactSet>
+                                <includes>
+                                    <include>org.apache.myfaces.common-shades:attributemaps</include>
+                                </includes>
+                            </artifactSet>
+                            <relocations>
+                                <relocation>
+                                    <!-- rename packages to circumvent class loading conflicts  -->
+                                    <pattern>org.apache.myfaces.shaded</pattern>
+                                    <shadedPattern>org.apache.myfaces.test</shadedPattern>
+                                    <excludes>
+                                        <exclude>org.apache.myfaces.test.**</exclude>
+                                    </excludes>
+                                </relocation>
+                            </relocations>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
     <!-- Allow building with JDK 1.4 as well as JDK 1.5,
diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java b/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java
index b2592b2..31d8f33 100644
--- a/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java
+++ b/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java
@@ -36,7 +36,16 @@
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
+
+import org.apache.myfaces.shaded.context.servlet.ApplicationMap;
+import org.apache.myfaces.shaded.context.servlet.CookieMap;
+import org.apache.myfaces.shaded.context.servlet.InitParameterMap;
+import org.apache.myfaces.shaded.context.servlet.RequestHeaderMap;
+import org.apache.myfaces.shaded.context.servlet.RequestHeaderValuesMap;
+import org.apache.myfaces.shaded.context.servlet.RequestMap;
+import org.apache.myfaces.shaded.context.servlet.RequestParameterMap;
+import org.apache.myfaces.shaded.context.servlet.RequestParameterValuesMap;
+import org.apache.myfaces.shaded.context.servlet.SessionMap;
 
 /**
  * <p>Mock implementation of <code>ExternalContext</code>.</p>
@@ -103,7 +112,7 @@
     {
         Map map = getRequestCookieMap();
         if (request instanceof MockHttpServletRequest &&
-            map instanceof _CookieMap)
+            map instanceof CookieMap)
         {
             ((MockHttpServletRequest)request).addCookie(cookie);
         }
@@ -133,7 +142,7 @@
     {
         Map map = getRequestParameterMap();
         if (request instanceof MockHttpServletRequest &&
-            map instanceof _RequestParameterMap)
+            map instanceof RequestParameterMap)
         {
             ((MockHttpServletRequest)request).addParameter(key, value);
         }
@@ -163,7 +172,7 @@
     {
         Map map = getRequestHeaderMap();
         if (request instanceof MockHttpServletRequest &&
-            map instanceof _RequestHeaderMap)
+            map instanceof RequestHeaderMap)
         {
             ((MockHttpServletRequest)request).addHeader(key, value);
         }
@@ -234,7 +243,7 @@
     {
         if (applicationMap == null)
         {
-            applicationMap = new _ApplicationMap(context);
+            applicationMap = new ApplicationMap(context);
         }
         return applicationMap;
     }
@@ -262,7 +271,7 @@
     {
         if (initParameterMap == null)
         {
-            initParameterMap = new _InitParameterMap(context);
+            initParameterMap = new InitParameterMap(context);
         }
         return initParameterMap;
     }
@@ -290,7 +299,7 @@
     {
         if (requestCookieMap == null)
         {
-            requestCookieMap = new _CookieMap(request);
+            requestCookieMap = new CookieMap(request);
         }
         return requestCookieMap;
     }
@@ -300,7 +309,7 @@
     {
         if (requestHeaderMap == null)
         {
-            requestHeaderMap = new _RequestHeaderMap(request);
+            requestHeaderMap = new RequestHeaderMap(request);
         }
         return requestHeaderMap;
     }
@@ -310,7 +319,7 @@
     {
         if (requestHeaderValuesMap == null)
         {
-            requestHeaderValuesMap = new _RequestHeaderValuesMap(request);
+            requestHeaderValuesMap = new RequestHeaderValuesMap(request);
         }
         return requestHeaderValuesMap;
     }
@@ -332,7 +341,7 @@
     {
         if (requestMap == null)
         {
-            requestMap = new _RequestMap(request);
+            requestMap = new RequestMap(request);
         }
         return requestMap;
     }
@@ -342,7 +351,7 @@
     {
         if (requestParameterMap == null)
         {
-            requestParameterMap = new _RequestParameterMap(request);
+            requestParameterMap = new RequestParameterMap(request);
         }
         return requestParameterMap;
     }
@@ -378,7 +387,7 @@
     {
         if (requestParameterValuesMap == null)
         {
-            requestParameterValuesMap = new _RequestParameterValuesMap(request);
+            requestParameterValuesMap = new RequestParameterValuesMap(request);
         }
         return requestParameterValuesMap;
     }
@@ -430,7 +439,7 @@
     {
         if (sessionMap == null)
         {
-            sessionMap = new _SessionMap(request);
+            sessionMap = new SessionMap(request);
         }
         return sessionMap;
     }
diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_AbstractAttributeMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_AbstractAttributeMap.java
deleted file mode 100644
index 84ff97d..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_AbstractAttributeMap.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*

- * 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.AbstractMap;

-import java.util.AbstractSet;

-import java.util.ArrayList;

-import java.util.Collection;

-import java.util.Enumeration;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Map;

-import java.util.NoSuchElementException;

-import java.util.Set;

-

-

-/**

- * Helper Map implementation for use with different Attribute Maps.

- *

- * @author Anton Koinov (latest modification by $Author: grantsmith $)

- * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Mié, 08 Nov 2006) $

- */

-abstract class _AbstractAttributeMap

-    extends AbstractMap

-{

-    private Set              _keySet;

-    private Collection       _values;

-    private Set              _entrySet;

-

-    public void clear()

-    {

-        List names = new ArrayList();

-        for (Enumeration e = getAttributeNames(); e.hasMoreElements();)

-        {

-            names.add(e.nextElement());

-        }

-

-        for (Iterator it = names.iterator(); it.hasNext();)

-        {

-            removeAttribute((String) it.next());

-        }

-    }

-

-    public boolean containsKey(Object key)

-    {

-        return getAttribute(key.toString()) != null;

-    }

-

-    public boolean containsValue(Object findValue)

-    {

-        if (findValue == null)

-        {

-            return false;

-        }

-

-        for (Enumeration e = getAttributeNames(); e.hasMoreElements();)

-        {

-            Object value = getAttribute((String) e.nextElement());

-            if (findValue.equals(value))

-            {

-                return true;

-            }

-        }

-

-        return false;

-    }

-

-    public Set entrySet()

-    {

-        return (_entrySet != null) ? _entrySet : (_entrySet = new EntrySet());

-    }

-

-    public Object get(Object key)

-    {

-        return getAttribute(key.toString());

-    }

-

-    public boolean isEmpty()

-    {

-        return !getAttributeNames().hasMoreElements();

-    }

-

-    public Set keySet()

-    {

-        return (_keySet != null) ? _keySet : (_keySet = new KeySet());

-    }

-

-    public Object put(Object key, Object value)

-    {

-        String key_ = key.toString();

-        Object retval = getAttribute(key_);

-        setAttribute(key_, value);

-        return retval;

-    }

-

-    public void putAll(Map t)

-    {

-        for (Iterator it = t.entrySet().iterator(); it.hasNext();)

-        {

-            Entry entry = (Entry) it.next();

-            setAttribute(entry.getKey().toString(), entry.getValue());

-        }

-    }

-

-    public Object remove(Object key)

-    {

-        String key_ = key.toString();

-        Object retval = getAttribute(key_);

-        removeAttribute(key_);

-        return retval;

-    }

-

-    public int size()

-    {

-        int size = 0;

-        for (Enumeration e = getAttributeNames(); e.hasMoreElements();)

-        {

-            size++;

-            e.nextElement();

-        }

-        return size;

-    }

-

-    public Collection values()

-    {

-        return (_values != null) ? _values : (_values = new Values());

-    }

-

-

-    abstract protected Object getAttribute(String key);

-

-    abstract protected void setAttribute(String key, Object value);

-

-    abstract protected void removeAttribute(String key);

-

-    abstract protected Enumeration getAttributeNames();

-

-

-    private class KeySet extends AbstractSet

-    {

-        public Iterator iterator()

-        {

-            return new KeyIterator();

-        }

-

-        public boolean isEmpty()

-        {

-            return _AbstractAttributeMap.this.isEmpty();

-        }

-

-        public int size()

-        {

-            return _AbstractAttributeMap.this.size();

-        }

-

-        public boolean contains(Object o)

-        {

-            return _AbstractAttributeMap.this.containsKey(o);

-        }

-

-        public boolean remove(Object o)

-        {

-            return _AbstractAttributeMap.this.remove(o) != null;

-        }

-

-        public void clear()

-        {

-            _AbstractAttributeMap.this.clear();

-        }

-    }

-

-    private class KeyIterator

-        implements Iterator

-    {

-        protected final Enumeration _e = getAttributeNames();

-        protected Object            _currentKey;

-

-        public void remove()

-        {

-            // remove() may cause ConcurrentModificationException.

-            // We could throw an exception here, but not throwing an exception

-            //   allows one call to remove() to succeed

-            if (_currentKey == null)

-            {

-                throw new NoSuchElementException(

-                    "You must call next() at least once");

-            }

-            _AbstractAttributeMap.this.remove(_currentKey);

-        }

-

-        public boolean hasNext()

-        {

-            return _e.hasMoreElements();

-        }

-

-        public Object next()

-        {

-            return _currentKey = _e.nextElement();

-        }

-    }

-

-    private class Values extends KeySet

-    {

-        public Iterator iterator()

-        {

-            return new ValuesIterator();

-        }

-

-        public boolean contains(Object o)

-        {

-            return _AbstractAttributeMap.this.containsValue(o);

-        }

-

-        public boolean remove(Object o)

-        {

-            if (o == null)

-            {

-                return false;

-            }

-

-            for (Iterator it = iterator(); it.hasNext();)

-            {

-                if (o.equals(it.next()))

-                {

-                    it.remove();

-                    return true;

-                }

-            }

-

-            return false;

-        }

-    }

-

-    private class ValuesIterator extends KeyIterator

-    {

-        public Object next()

-        {

-            super.next();

-            return _AbstractAttributeMap.this.get(_currentKey);

-        }

-    }

-

-    private class EntrySet extends KeySet

-    {

-        public Iterator iterator() {

-            return new EntryIterator();

-        }

-

-        public boolean contains(Object o) {

-            if (!(o instanceof Entry))

-            {

-                return false;

-            }

-

-            Entry entry = (Entry) o;

-            Object key = entry.getKey();

-            Object value = entry.getValue();

-            if (key == null || value == null)

-            {

-                return false;

-            }

-

-            return value.equals(_AbstractAttributeMap.this.get(key));

-        }

-

-        public boolean remove(Object o) {

-            if (!(o instanceof Entry))

-            {

-                return false;

-            }

-

-            Entry entry = (Entry) o;

-            Object key = entry.getKey();

-            Object value = entry.getValue();

-            if (key == null || value == null

-                || !value.equals(_AbstractAttributeMap.this.get(key)))

-            {

-                return false;

-            }

-

-            return _AbstractAttributeMap.this.remove(((Entry) o).getKey()) != null;

-        }

-    }

-

-    /**

-     * Not very efficient since it generates a new instance of <code>Entry</code>

-     * for each element and still internaly uses the <code>KeyIterator</code>.

-     * It is more efficient to use the <code>KeyIterator</code> directly.

-     */

-    private class EntryIterator extends KeyIterator

-    {

-        public Object next()

-        {

-            super.next();

-            // Must create new Entry every time--value of the entry must stay

-            // linked to the same attribute name

-            return new EntrySetEntry(_currentKey);

-        }

-    }

-

-    private class EntrySetEntry implements Entry

-    {

-        private final Object _currentKey;

-

-        public EntrySetEntry(Object currentKey)

-        {

-            _currentKey = currentKey;

-        }

-

-        public Object getKey()

-        {

-            return _currentKey;

-        }

-

-        public Object getValue()

-        {

-            return _AbstractAttributeMap.this.get(_currentKey);

-        }

-

-        public Object setValue(Object value)

-        {

-            return _AbstractAttributeMap.this.put(_currentKey, value);

-        }

-

-        public int hashCode() {

-            return _currentKey == null ? 0 : _currentKey.hashCode();

-        }

-

-        public boolean equals(Object obj) {

-            if (!(obj instanceof EntrySetEntry))

-                return false;

-            return _currentKey != null && _currentKey.equals(obj);

-        }

-    }

-}

diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_ApplicationMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_ApplicationMap.java
deleted file mode 100644
index bfe1154..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_ApplicationMap.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*

- * 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.ArrayList;

-import java.util.Enumeration;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Map;

-

-import javax.servlet.ServletContext;

-

-

-/**

- * ServletContext attributes as a Map.

- *

- * @author Anton Koinov (latest modification by $Author: grantsmith $)

- * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Mié, 08 Nov 2006) $

- */

-class _ApplicationMap extends _AbstractAttributeMap

-{

-    final ServletContext _servletContext;

-

-    _ApplicationMap(ServletContext servletContext)

-    {

-        _servletContext = servletContext;

-    }

-

-    protected Object getAttribute(String key)

-    {

-        return _servletContext.getAttribute(key);

-    }

-

-    protected void setAttribute(String key, Object value)

-    {

-        _servletContext.setAttribute(key, value);

-    }

-

-    protected void removeAttribute(String key)

-    {

-        _servletContext.removeAttribute(key);

-    }

-

-    protected Enumeration getAttributeNames()

-    {

-        return _servletContext.getAttributeNames();

-    }

-

-    public void putAll(Map t)

-    {

-        for (Iterator it = t.entrySet().iterator(); it.hasNext();)

-        {

-            Map.Entry entry = (Map.Entry) it.next();

-            _servletContext.setAttribute((String)entry.getKey(), entry.getValue());

-        }

-    }

-

-    public void clear()

-    {

-        List names = new ArrayList();

-        for (Enumeration e = _servletContext.getAttributeNames(); e.hasMoreElements();)

-        {

-            String name = (String) e.nextElement();

-            names.add(name);

-        }

-        for (int i = 0; i < names.size(); i++)

-        {

-            _servletContext.removeAttribute((String) names.get(i));

-        }

-    }

-}

diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_CookieMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_CookieMap.java
deleted file mode 100644
index df22bd2..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_CookieMap.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*

- * 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.Enumeration;

-import java.util.Map;

-

-import javax.servlet.http.Cookie;

-import javax.servlet.http.HttpServletRequest;

-

-/**

- * HttpServletRequest Cookies as Map.

- *

- * @author Dimitry D'hondt

- * @author Anton Koinov

- * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Mié, 08 Nov 2006) $

- */

-class _CookieMap extends _AbstractAttributeMap

-{

-    private static final Cookie[] EMPTY_ARRAY = new Cookie[0];

-

-    final HttpServletRequest _httpServletRequest;

-

-    _CookieMap(HttpServletRequest httpServletRequest)

-    {

-        _httpServletRequest = httpServletRequest;

-    }

-

-    public void clear()

-    {

-        throw new UnsupportedOperationException(

-            "Cannot clear HttpRequest Cookies");

-    }

-

-    public boolean containsKey(Object key)

-    {

-        Cookie[] cookies = _httpServletRequest.getCookies();

-        if (cookies == null) return false;

-        for (int i = 0, len = cookies.length; i < len; i++)

-        {

-            if (cookies[i].getName().equals(key))

-            {

-                return true;

-            }

-        }

-

-        return false;

-    }

-

-    public boolean containsValue(Object findValue)

-    {

-        if (findValue == null)

-        {

-            return false;

-        }

-

-        Cookie[] cookies = _httpServletRequest.getCookies();

-        if (cookies == null) return false;

-        for (int i = 0, len = cookies.length; i < len; i++)

-        {

-            if (findValue.equals(cookies[i]))

-            {

-                return true;

-            }

-        }

-

-        return false;

-    }

-

-    public boolean isEmpty()

-    {

-        Cookie[] cookies = _httpServletRequest.getCookies();

-        return cookies == null || cookies.length == 0;

-    }

-

-    public int size()

-    {

-        Cookie[] cookies = _httpServletRequest.getCookies();

-        return cookies == null ? 0 : cookies.length;

-    }

-

-    public void putAll(Map t)

-    {

-        throw new UnsupportedOperationException();

-    }

-

-

-    protected Object getAttribute(String key)

-    {

-        Cookie[] cookies = _httpServletRequest.getCookies();

-        if (cookies == null) return null;

-        for (int i = 0, len = cookies.length; i < len; i++)

-        {

-            if (cookies[i].getName().equals(key))

-            {

-                return cookies[i];

-            }

-        }

-

-        return null;

-    }

-

-    protected void setAttribute(String key, Object value)

-    {

-        if (_httpServletRequest instanceof MockHttpServletRequest)

-        {

-            ((MockHttpServletRequest) _httpServletRequest).addCookie((Cookie) value);

-        }

-        else

-        {

-            throw new UnsupportedOperationException(

-                "Cannot set HttpRequest Cookies");

-        }

-    }

-

-    protected void removeAttribute(String key)

-    {

-        throw new UnsupportedOperationException(

-            "Cannot remove HttpRequest Cookies");

-    }

-

-    protected Enumeration getAttributeNames()

-    {

-        Cookie[] cookies = _httpServletRequest.getCookies();

-        if (cookies == null)

-        {

-            return new CookieNameEnumeration(EMPTY_ARRAY);

-        }

-        else

-        {

-            return new CookieNameEnumeration(cookies);

-        }

-    }

-

-    private static class CookieNameEnumeration implements Enumeration

-    {

-        private final Cookie[] _cookies;

-        private final int _length;

-        private int _index;

-

-        public CookieNameEnumeration(Cookie[] cookies)

-        {

-            _cookies = cookies;

-            _length = cookies.length;

-        }

-

-        public boolean hasMoreElements()

-        {

-            return _index < _length;

-        }

-

-        public Object nextElement()

-        {

-            return _cookies[_index++].getName();

-        }

-    }

-}

diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_InitParameterMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_InitParameterMap.java
deleted file mode 100644
index 13020ed..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_InitParameterMap.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*

- * 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.ArrayList;

-import java.util.Enumeration;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Map;

-import java.util.Map.Entry;

-

-import javax.servlet.ServletContext;

-

-

-/**

- * ServletContext init parameters as Map.

- * 

- * @author Anton Koinov (latest modification by $Author: grantsmith $)

- * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Mié, 08 Nov 2006) $

- */

-class _InitParameterMap extends _AbstractAttributeMap

-{

-    final ServletContext _servletContext;

-

-    _InitParameterMap(ServletContext servletContext)

-    {

-        _servletContext = servletContext;

-    }

-

-    protected Object getAttribute(String key)

-    {

-        return _servletContext.getInitParameter(key);

-    }

-

-    protected void setAttribute(String key, Object value)

-    {

-        if (_servletContext instanceof MockServletContext)

-        {

-            ((MockServletContext)_servletContext).addInitParameter(key, (String) value);

-        }

-        else

-        {

-            throw new UnsupportedOperationException(

-                "Cannot set ServletContext InitParameter");

-        }

-    }

-

-    protected void removeAttribute(String key)

-    {

-        throw new UnsupportedOperationException(

-            "Cannot remove ServletContext InitParameter");

-    }

-

-    protected Enumeration getAttributeNames()

-    {

-        return _servletContext.getInitParameterNames();

-    }

-}

diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_NullEnumeration.java b/test12/src/main/java/org/apache/myfaces/test/mock/_NullEnumeration.java
deleted file mode 100644
index be471e9..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_NullEnumeration.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*

- *  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.Enumeration;

-import java.util.NoSuchElementException;

-

-/**

- * Enumeration without elements

- *

- * @author Anton Koinov (latest modification by $Author: matzew $)

- * @version $Revision: 557350 $ $Date: 2007-07-18 13:19:50 -0500 (Mié, 18 Jul 2007) $

- */

-final class _NullEnumeration implements Enumeration

-{

-    private static final _NullEnumeration s_nullEnumeration = new _NullEnumeration();

-

-    public static final _NullEnumeration instance()

-    {

-        return s_nullEnumeration;

-    }

-

-    public boolean hasMoreElements()

-    {

-        return false;

-    }

-

-    public Object nextElement()

-    {

-        throw new NoSuchElementException("NullEnumeration has no elements");

-    }

-}

diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestHeaderMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_RequestHeaderMap.java
deleted file mode 100644
index f8d5dc7..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestHeaderMap.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*

- * 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.Enumeration;

-import java.util.Map;

-

-import javax.servlet.http.HttpServletRequest;

-

-

-/**

- * HttpServletRequest headers as Map.

- * 

- * @author Anton Koinov (latest modification by $Author: grantsmith $)

- * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Mié, 08 Nov 2006) $

- */

-class _RequestHeaderMap extends _AbstractAttributeMap

-{

-    private final HttpServletRequest _httpServletRequest;

-

-    _RequestHeaderMap(HttpServletRequest httpServletRequest)

-    {

-        _httpServletRequest = httpServletRequest;

-    }

-

-    protected Object getAttribute(String key)

-    {

-        return _httpServletRequest.getHeader(key);

-    }

-

-    protected void setAttribute(String key, Object value)

-    {

-        if (_httpServletRequest instanceof MockHttpServletRequest)

-        {

-            ((MockHttpServletRequest)_httpServletRequest).addHeader(key, (String)value);

-        }

-        else

-        {

-            throw new UnsupportedOperationException(

-                "Cannot set HttpServletRequest Header");

-        }

-    }

-

-    protected void removeAttribute(String key)

-    {

-        throw new UnsupportedOperationException(

-            "Cannot remove HttpServletRequest Header");

-    }

-

-    protected Enumeration getAttributeNames()

-    {

-        return _httpServletRequest.getHeaderNames();

-    }

-}

diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestHeaderValuesMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_RequestHeaderValuesMap.java
deleted file mode 100644
index 8059936..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestHeaderValuesMap.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*

- * 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.ArrayList;

-import java.util.Enumeration;

-import java.util.HashMap;

-import java.util.List;

-import java.util.Map;

-

-import javax.servlet.http.HttpServletRequest;

-

-class _RequestHeaderValuesMap extends _AbstractAttributeMap

-{

-    private final HttpServletRequest _httpServletRequest;

-    private final Map _valueCache = new HashMap();

-

-    _RequestHeaderValuesMap(final HttpServletRequest httpServletRequest)

-    {

-        _httpServletRequest = httpServletRequest;

-    }

-

-    protected Object getAttribute(final String key)

-    {

-        String[] ret = (String[])_valueCache.get(key);

-        if (ret == null)

-        {

-            _valueCache.put(key, ret = toArray(_httpServletRequest.getHeaders(key)));

-        }

-

-        return ret;

-    }

-

-    protected void setAttribute(final String key, final Object value)

-    {

-        throw new UnsupportedOperationException("Cannot set HttpServletRequest HeaderValues");

-    }

-

-    protected void removeAttribute(final String key)

-    {

-        throw new UnsupportedOperationException("Cannot remove HttpServletRequest HeaderValues");

-    }

-

-    protected Enumeration getAttributeNames()

-    {

-        return _httpServletRequest.getHeaderNames();

-    }

-

-    private String[] toArray(Enumeration e)

-    {

-        List ret = new ArrayList();

-

-        while (e.hasMoreElements())

-        {

-            ret.add(e.nextElement());

-        }

-

-        return (String[]) ret.toArray(new String[ret.size()]);

-    }

-}

diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_RequestMap.java
deleted file mode 100644
index 878485a..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestMap.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*

- * 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.Enumeration;

-import java.util.Map;

-

-import javax.servlet.ServletRequest;

-

-

-/**

- * ServletRequest attributes Map.

- * 

- * @author Anton Koinov (latest modification by $Author: grantsmith $)

- * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Mié, 08 Nov 2006) $

- */

-class _RequestMap extends _AbstractAttributeMap

-{

-    final ServletRequest _servletRequest;

-

-    _RequestMap(ServletRequest servletRequest)

-    {

-        _servletRequest = servletRequest;

-    }

-

-    protected Object getAttribute(String key)

-    {

-        return _servletRequest.getAttribute(key);

-    }

-

-    protected void setAttribute(String key, Object value)

-    {

-        _servletRequest.setAttribute(key, value);

-    }

-

-    protected void removeAttribute(String key)

-    {

-        _servletRequest.removeAttribute(key);

-    }

-

-    protected Enumeration getAttributeNames()

-    {

-        return _servletRequest.getAttributeNames();

-    }   

-}

diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestParameterMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_RequestParameterMap.java
deleted file mode 100644
index c3fb130..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestParameterMap.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*

- * 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.Enumeration;

-

-import javax.servlet.ServletRequest;

-

-/**

- * ServletRequest parameters as Map.

- * 

- * @author Anton Koinov (latest modification by $Author: grantsmith $)

- * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Mié, 08 Nov 2006) $

- */

-class _RequestParameterMap extends _AbstractAttributeMap

-{

-    private final ServletRequest _servletRequest;

-

-    _RequestParameterMap(ServletRequest servletRequest)

-    {

-        _servletRequest = servletRequest;

-    }

-

-    protected Object getAttribute(String key)

-    {

-        return _servletRequest.getParameter(key);

-    }

-

-    protected void setAttribute(String key, Object value)

-    {

-        if( _servletRequest instanceof MockHttpServletRequest)

-        {

-            ((MockHttpServletRequest)_servletRequest).addParameter(key, (String)value);

-        }

-        else

-        {

-            throw new UnsupportedOperationException(

-                "Cannot set ServletRequest Parameter");

-        }

-    }

-

-    protected void removeAttribute(String key)

-    {

-        throw new UnsupportedOperationException(

-            "Cannot remove ServletRequest Parameter");

-    }

-

-    protected Enumeration getAttributeNames()

-    {

-        return _servletRequest.getParameterNames();

-    }

-}
\ No newline at end of file
diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestParameterValuesMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_RequestParameterValuesMap.java
deleted file mode 100644
index 80bcc22..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_RequestParameterValuesMap.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*

- * 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.Enumeration;

-

-import javax.servlet.ServletRequest;

-

-/**

- * ServletRequest multi-value parameters as Map.

- * 

- * @author Anton Koinov (latest modification by $Author: grantsmith $)

- * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Mié, 08 Nov 2006) $

- */

-class _RequestParameterValuesMap extends _AbstractAttributeMap

-{

-    private final ServletRequest _servletRequest;

-

-    _RequestParameterValuesMap(ServletRequest servletRequest)

-    {

-        _servletRequest = servletRequest;

-    }

-

-    protected Object getAttribute(String key)

-    {

-        return _servletRequest.getParameterValues(key);

-    }

-

-    protected void setAttribute(String key, Object value)

-    {

-        throw new UnsupportedOperationException(

-            "Cannot set ServletRequest ParameterValues");

-    }

-

-    protected void removeAttribute(String key)

-    {

-        throw new UnsupportedOperationException(

-            "Cannot remove ServletRequest ParameterValues");

-    }

-

-    protected Enumeration getAttributeNames()

-    {

-        return _servletRequest.getParameterNames();

-    }

-}
\ No newline at end of file
diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/_SessionMap.java b/test12/src/main/java/org/apache/myfaces/test/mock/_SessionMap.java
deleted file mode 100644
index cdd2097..0000000
--- a/test12/src/main/java/org/apache/myfaces/test/mock/_SessionMap.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*

- * 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.Enumeration;

-import java.util.Map;

-

-import javax.servlet.http.HttpServletRequest;

-import javax.servlet.http.HttpSession;

-

-

-/**

- * HttpSession attibutes as Map.

- *

- * @author Anton Koinov (latest modification by $Author: grantsmith $)

- * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Mié, 08 Nov 2006) $

- */

-class _SessionMap extends _AbstractAttributeMap

-{

-    private final HttpServletRequest _httpRequest;

-

-    _SessionMap(HttpServletRequest httpRequest)

-    {

-        _httpRequest = httpRequest;

-    }

-

-    protected Object getAttribute(String key)

-    {

-        HttpSession httpSession = getSession();

-        return (httpSession == null)

-            ? null : httpSession.getAttribute(key.toString());

-    }

-

-    protected void setAttribute(String key, Object value)

-    {

-        _httpRequest.getSession(true).setAttribute(key, value);

-    }

-

-    protected void removeAttribute(String key)

-    {

-        HttpSession httpSession = getSession();

-        if (httpSession != null)

-        {

-            httpSession.removeAttribute(key);

-        }

-    }

-

-    protected Enumeration getAttributeNames()

-    {

-        HttpSession httpSession = getSession();

-        return (httpSession == null)

-            ? _NullEnumeration.instance()

-            : httpSession.getAttributeNames();

-    }

-

-    private HttpSession getSession()

-    {

-        return _httpRequest.getSession(false);

-    }

-

-

-    public void putAll(Map t)

-    {

-        throw new UnsupportedOperationException();

-    }

-

-

-    public void clear()

-    {

-        throw new UnsupportedOperationException();

-    }

-}
\ No newline at end of file
diff --git a/test20/pom.xml b/test20/pom.xml
index 86c5c99..2fc0341 100644
--- a/test20/pom.xml
+++ b/test20/pom.xml
@@ -116,6 +116,14 @@
             <version>2.1</version>
             <scope>provided</scope>
         </dependency>
+        
+        <!-- shaded artifacts -->
+        <dependency>
+            <groupId>org.apache.myfaces.common-shades</groupId>
+            <artifactId>attributemaps</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
 
     </dependencies>
 
@@ -192,11 +200,47 @@
                     </configuration>
                   </execution>
                 </executions>
-            </plugin>            
+            </plugin> 
+            
+            <!-- 
+               Use maven-shade-plugin to include artifacts from 
+               org.apache.myfaces.common-shades directly in the target jar.
+            -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>1.3.3</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <createDependencyReducedPom>true</createDependencyReducedPom>
+                            <artifactSet>
+                                <includes>
+                                    <include>org.apache.myfaces.common-shades:attributemaps</include>
+                                </includes>
+                            </artifactSet>
+                            <relocations>
+                                <relocation>
+                                    <!-- rename packages to circumvent class loading conflicts  -->
+                                    <pattern>org.apache.myfaces.shaded</pattern>
+                                    <shadedPattern>org.apache.myfaces.test</shadedPattern>
+                                    <excludes>
+                                        <exclude>org.apache.myfaces.test.**</exclude>
+                                    </excludes>
+                                </relocation>
+                            </relocations>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>    
     </build>
     <properties>
         <jsf-ri.version>2.0.2-b10</jsf-ri.version>
-        <jsf-myfaces.version>2.0.0-beta</jsf-myfaces.version>
+        <jsf-myfaces.version>2.0.2-SNAPSHOT</jsf-myfaces.version>
     </properties>
 </project>
diff --git a/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java b/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java
index e877d91..72d3647 100644
--- a/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java
+++ b/test20/src/test/java/org/apache/myfaces/test/mock/MockPartialViewContextTestCase.java
@@ -65,7 +65,7 @@
         PartialViewContext pvContext = factory.getPartialViewContext(facesContext);
         assertFalse(pvContext.isAjaxRequest());
 
-        facesContext.getExternalContext().getRequestHeaderMap().put("Faces-Request", "partial/ajax");
+        externalContext.addRequestHeader("Faces-Request", "partial/ajax");
 
         pvContext = factory.getPartialViewContext(facesContext);
         assertTrue(pvContext.isAjaxRequest());