You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/09/11 07:21:28 UTC
svn commit: r574461 - in /myfaces/orchestra/trunk:
core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/
core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/
core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/...
Author: imario
Date: Mon Sep 10 22:21:27 2007
New Revision: 574461
URL: http://svn.apache.org/viewvc?rev=574461&view=rev
Log:
provide a LocalFrameworkAdapter to make Orchestra work in generic non Servlet/JSF environments
Added:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java
- copied, changed from r573836, myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java
Removed:
myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/
myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/
Modified:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapterInterface.java
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java
myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java
myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapterInterface.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapterInterface.java?rev=574461&r1=574460&r2=574461&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapterInterface.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapterInterface.java Mon Sep 10 22:21:27 2007
@@ -51,8 +51,6 @@
public boolean containsSessionAttribute(String key);
- public String getRequestContextPath();
-
public void redirect(String url) throws IOException;
public Object getBean(String name);
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java?rev=574461&r1=574460&r2=574461&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java Mon Sep 10 22:21:27 2007
@@ -189,7 +189,7 @@
throw new IllegalStateException(ISE_MESSAGE);
}
- public String getRequestContextPath()
+ protected String getRequestContextPath()
{
FacesContext context = getFacesContext();
if (context != null)
Copied: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java (from r573836, myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java)
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java?p2=myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java&p1=myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java&r1=573836&r2=574461&rev=574461&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/frameworkAdapter/MockFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java Mon Sep 10 22:21:27 2007
@@ -20,32 +20,32 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.orchestra.frameworkAdapter;
+package org.apache.myfaces.orchestra.frameworkAdapter.local;
+import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapterInterface;
import org.springframework.context.ConfigurableApplicationContext;
import java.io.IOException;
+import java.util.HashMap;
import java.util.Map;
-import java.util.TreeMap;
/**
- * A Mock implementation for test environments
+ * <p>
+ * A FrameworkAdapter which uses local maps to simulate a real framework.
+ * </p>
+ * <p>
+ * This adapter sill relies on Spring and thus you have to ensure to call {@link #setApplicationContext}
+ * on it.
+ * </p>
*/
-public class MockFrameworkAdapter implements FrameworkAdapterInterface
+public class LocalFrameworkAdapter implements FrameworkAdapterInterface
{
private ConfigurableApplicationContext configurableApplicationContext;
- private final Map sessionMap = new TreeMap();
- private final Map requestMap = new TreeMap();
- private final Map requestParameterMap = new TreeMap();
- private final Map initMap = new TreeMap();
-
- public static MockFrameworkAdapter register()
- {
- MockFrameworkAdapter instance = new MockFrameworkAdapter();
- FrameworkAdapter.setInstance(instance);
- return instance;
- }
+ private final Map sessionMap = new HashMap();
+ private final Map requestMap = new HashMap();
+ private final Map requestParameterMap = new HashMap();
+ private final Map initMap = new HashMap();
public String getInitParameter(String key)
{
@@ -102,11 +102,6 @@
return sessionMap.containsKey(key);
}
- public String getRequestContextPath()
- {
- return "/test";
- }
-
protected ConfigurableApplicationContext getApplicationContext()
{
return configurableApplicationContext;
@@ -129,4 +124,4 @@
public void invokeNavigation(String navigationName)
{
}
-}
+}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java?rev=574461&r1=574460&r2=574461&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java (original)
+++ myfaces/orchestra/trunk/core/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversation.java Mon Sep 10 22:21:27 2007
@@ -18,9 +18,10 @@
*/
package org.apache.myfaces.orchestra.conversation;
-import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
+import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
+import org.apache.myfaces.orchestra.frameworkAdapter.local.LocalFrameworkAdapter;
import org.springframework.aop.scope.ScopedObject;
-import org.apache.myfaces.orchestra.frameworkAdapter.MockFrameworkAdapter;
+import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
/**
* Test various aspects of the conversation handling
@@ -43,9 +44,10 @@
{
super.onSetUp();
- MockFrameworkAdapter frameworkAdapter = MockFrameworkAdapter.register();
+ LocalFrameworkAdapter frameworkAdapter = new LocalFrameworkAdapter();
frameworkAdapter.setApplicationContext(applicationContext);
- }
+ FrameworkAdapter.setInstance(frameworkAdapter);
+ }
public void testConversation() throws Exception
{
Modified: myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java?rev=574461&r1=574460&r2=574461&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java (original)
+++ myfaces/orchestra/trunk/core15/src/test/java/org/apache/myfaces/orchestra/conversation/TestConversationPersistence.java Mon Sep 10 22:21:27 2007
@@ -19,7 +19,8 @@
package org.apache.myfaces.orchestra.conversation;
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
-import org.apache.myfaces.orchestra.frameworkAdapter.MockFrameworkAdapter;
+import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
+import org.apache.myfaces.orchestra.frameworkAdapter.local.LocalFrameworkAdapter;
import org.apache.myfaces.orchestra.conversation.model.UserData;
/**
@@ -39,8 +40,9 @@
{
super.onSetUp();
- MockFrameworkAdapter frameworkAdapter = MockFrameworkAdapter.register();
- frameworkAdapter.setApplicationContext(applicationContext);
+ LocalFrameworkAdapter frameworkAdapter = new LocalFrameworkAdapter();
+ frameworkAdapter.setApplicationContext(applicationContext);
+ FrameworkAdapter.setInstance(frameworkAdapter);
}
public void testPersistence()