struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mart...@apache.org
Subject svn commit: r894087 [27/46] - in /struts/xwork/trunk: ./ assembly/ assembly/src/ assembly/src/main/ assembly/src/main/assembly/ assembly/src/main/resources/ core/ core/src/ core/src/main/ core/src/main/java/ core/src/main/java/com/ core/src/main/java/c...
Date Sun, 27 Dec 2009 18:01:09 GMT
Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2;
+
+import com.opensymphony.xwork2.util.CompoundRoot;
+import com.opensymphony.xwork2.util.ValueStack;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Stub value stack for testing
+ */
+public class StubValueStack implements ValueStack {
+    Map<String, Object> ctx = new HashMap<String, Object>();
+    CompoundRoot root = new CompoundRoot();
+    
+    public Map<String, Object> getContext() {
+        return ctx;
+    }
+
+    public void setDefaultType(Class defaultType) {
+    }
+
+    public void setExprOverrides(Map<Object, Object> overrides) {
+    }
+
+    public Map<Object, Object> getExprOverrides() {
+        return null;
+    }
+
+    public CompoundRoot getRoot() {
+        return root;
+    }
+
+    public void setValue(String expr, Object value) {
+        ctx.put(expr, value);
+    }
+
+    public void setValue(String expr, Object value, boolean throwExceptionOnFailure) {
+        ctx.put(expr, value);
+    }
+
+    public String findString(String expr) {
+        return (String) ctx.get(expr);
+    }
+
+    public String findString(String expr, boolean throwExceptionOnFailure) {
+        return findString(expr, false);
+    }
+
+    public Object findValue(String expr) {
+        return ctx.get(expr);
+    }
+
+    public Object findValue(String expr, boolean throwExceptionOnFailure) {
+        return findValue(expr, false);
+    }
+
+    public Object findValue(String expr, Class asType) {
+        return ctx.get(expr);
+    }
+
+    public Object findValue(String expr, Class asType, boolean throwExceptionOnFailure) {
+        return findValue(expr, asType, false);
+    }
+
+    public Object peek() {
+        return root.peek();
+    }
+
+    public Object pop() {
+        return root.pop();
+    }
+
+    public void push(Object o) {
+        root.push(o);
+    }
+
+    public void set(String key, Object o) {
+        ctx.put(key, o);
+    }
+
+    public int size() {
+        return root.size();
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/StubValueStack.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestBean.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestBean.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestBean.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestBean.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2;
+
+import java.util.Date;
+
+
+/**
+ * TestBean
+ *
+ * @author Jason Carreira
+ *         Created Aug 4, 2003 12:39:53 AM
+ */
+public class TestBean {
+
+    private Date birth;
+    private String name;
+    private int count;
+    
+    private TestChildBean child = new TestChildBean();
+
+    public TestBean() {
+    }
+
+
+    public void setBirth(Date birth) {
+        this.birth = birth;
+    }
+
+    public Date getBirth() {
+        return birth;
+    }
+
+    public void setCount(int count) {
+        this.count = count;
+    }
+
+    public int getCount() {
+        return count;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+
+    public TestChildBean getChild() {
+        return child;
+    }
+
+
+    public void setChild(TestChildBean child) {
+        this.child = child;
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestChildBean.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestChildBean.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestChildBean.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestChildBean.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+
+/**
+ * TestBean
+ */
+public class TestChildBean {
+
+    private Date birth;
+    private String name;
+    private int count;
+
+
+    public TestChildBean() {
+        Calendar cal = new GregorianCalendar(1900, 01, 01);
+        setBirth(cal.getTime());
+    }
+
+
+    public void setBirth(Date birth) {
+        this.birth = birth;
+    }
+
+    public Date getBirth() {
+        return birth;
+    }
+
+    public void setCount(int count) {
+        this.count = count;
+    }
+
+    public int getCount() {
+        return count;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestChildBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestChildBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestInterceptor.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestInterceptor.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestInterceptor.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestInterceptor.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2;
+
+import com.opensymphony.xwork2.interceptor.Interceptor;
+import junit.framework.Assert;
+
+
+/**
+ * TestInterceptor
+ *
+ * @author Jason Carreira
+ *         Created Apr 21, 2003 9:04:06 PM
+ */
+public class TestInterceptor implements Interceptor {
+
+    public static final String DEFAULT_FOO_VALUE = "fooDefault";
+
+
+    private String expectedFoo = DEFAULT_FOO_VALUE;
+    private String foo = DEFAULT_FOO_VALUE;
+    private boolean executed = false;
+
+
+    public boolean isExecuted() {
+        return executed;
+    }
+
+    public void setExpectedFoo(String expectedFoo) {
+        this.expectedFoo = expectedFoo;
+    }
+
+    public String getExpectedFoo() {
+        return expectedFoo;
+    }
+
+    public void setFoo(String foo) {
+        this.foo = foo;
+    }
+
+    public String getFoo() {
+        return foo;
+    }
+
+    /**
+     * Called to let an interceptor clean up any resources it has allocated.
+     */
+    public void destroy() {
+    }
+
+    /**
+     * Called after an Interceptor is created, but before any requests are processed using the intercept() methodName. This
+     * gives the Interceptor a chance to initialize any needed resources.
+     */
+    public void init() {
+    }
+
+    /**
+     * Allows the Interceptor to do some processing on the request before and/or after the rest of the processing of the
+     * request by the DefaultActionInvocation or to short-circuit the processing and just return a String return code.
+     *
+     * @param invocation
+     * @return
+     * @throws Exception
+     */
+    public String intercept(ActionInvocation invocation) throws Exception {
+        executed = true;
+        Assert.assertNotSame(DEFAULT_FOO_VALUE, foo);
+        Assert.assertEquals(expectedFoo, foo);
+
+        return invocation.invoke();
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestNGXWorkTestCaseTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestNGXWorkTestCaseTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestNGXWorkTestCaseTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestNGXWorkTestCaseTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2;
+
+import com.opensymphony.xwork2.config.ConfigurationManager;
+import junit.framework.TestCase;
+import org.testng.TestListenerAdapter;
+import org.testng.TestNG;
+import org.testng.annotations.Test;
+
+public class TestNGXWorkTestCaseTest extends TestCase {
+
+    public void testSimpleTest() throws Exception {
+        TestListenerAdapter tla = new TestListenerAdapter();
+        TestNG testng = new TestNG();
+        testng.setTestClasses(new Class[] { RunTest.class });
+        testng.addListener(tla);
+        try {
+            testng.run();
+            assertEquals(1, tla.getPassedTests().size());
+            assertEquals(0, tla.getFailedTests().size());
+            assertTrue(RunTest.ran);
+            assertNotNull(RunTest.mgr);
+        } finally {
+            RunTest.mgr = null;
+        }
+    }
+    
+    @Test
+    public static class RunTest extends TestNGXWorkTestCase {
+        public static boolean ran = false;
+        public static ConfigurationManager mgr;
+        
+        public void testRun() {
+            ran = true;
+            mgr = this.configurationManager;
+        }
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestNGXWorkTestCaseTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TestNGXWorkTestCaseTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Unit test for {@link TextProviderSupport}.
+ *
+ * @author Claus Ibsen
+ */
+public class TextProviderSupportTest extends XWorkTestCase {
+
+    private TextProviderSupport tp;
+    private java.util.ResourceBundle rb;
+
+    public void testHasKey() throws Exception {
+    	assertTrue(tp.hasKey("hello"));
+    	assertFalse(tp.hasKey("not.in.bundle"));
+    }
+    
+    public void testSimpleGetTexts() throws Exception {
+        assertEquals("Hello World", tp.getText("hello"));
+        assertEquals("not.in.bundle", tp.getText("not.in.bundle"));
+
+        assertEquals("Hello World", tp.getText("hello", "this is default"));
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default"));
+    }
+
+    public void testGetTextsWithArgs() throws Exception {
+        assertEquals("Hello World", tp.getText("hello", "this is default", "from me")); // no args in bundle
+        assertEquals("Hello World from me", tp.getText("hello.0", "this is default", "from me"));
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", "from me"));
+        assertEquals("this is default from me", tp.getText("not.in.bundle", "this is default {0}", "from me"));
+
+        assertEquals("not.in.bundle", tp.getText("not.in.bundle"));
+    }
+
+    public void testGetTextsWithListArgs() throws Exception {
+        List<Object> args = new ArrayList<Object>();
+        args.add("Santa");
+        args.add("loud");
+        assertEquals("Hello World", tp.getText("hello", "this is default", args)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", "this is default", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", "this is default", args));
+
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", args));
+        assertEquals("this is default Santa", tp.getText("not.in.bundle", "this is default {0}", args));
+        assertEquals("this is default Santa speaking loud", tp.getText("not.in.bundle", "this is default {0} speaking {1}", args));
+
+        assertEquals("Hello World", tp.getText("hello", args)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", args));
+
+        assertEquals("not.in.bundle", tp.getText("not.in.bundle", args));
+    }
+
+    public void testGetTextsWithArrayArgs() throws Exception {
+        String[] args = { "Santa", "loud" };
+        assertEquals("Hello World", tp.getText("hello", "this is default", args)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", "this is default", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", "this is default", args));
+
+        assertEquals("this is default", tp.getText("not.in.bundle", "this is default", args));
+        assertEquals("this is default Santa", tp.getText("not.in.bundle", "this is default {0}", args));
+        assertEquals("this is default Santa speaking loud", tp.getText("not.in.bundle", "this is default {0} speaking {1}", args));
+
+        assertEquals("Hello World", tp.getText("hello", args)); // no args in bundle
+        assertEquals("Hello World Santa", tp.getText("hello.0", args)); // only 1 arg in bundle
+        assertEquals("Hello World. This is Santa speaking loud", tp.getText("hello.1", args));
+
+        assertEquals("not.in.bundle", tp.getText("not.in.bundle", args));
+    }
+
+    public void testGetBundle() throws Exception {
+        assertEquals(rb, tp.getTexts());
+        assertEquals(rb, tp.getTexts(TextProviderSupportTest.class.getName()));
+    }
+
+    public void testDifficultSymbols1() {
+        String val= tp.getText("symbols1"); 
+        assertEquals("\"=!@#$%^&*(){qwe}<>?:|}{[]\\';/.,<>`~'", val);
+    }
+
+    public void testDifficultSymbols2() {
+        String val= tp.getText("symbols2"); 
+        assertEquals("\"=!@#$%^&*()<>?:|[]\\';/.,<>`~'", val);
+    } 
+    
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        rb = ResourceBundle.getBundle(TextProviderSupportTest.class.getName(), Locale.ENGLISH);
+        tp = new TextProviderSupport(rb, new LocaleProvider() {
+            public Locale getLocale() {
+                return Locale.ENGLISH;
+            }
+        });
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        rb = null;
+        tp = null;
+    }
+
+
+}
+

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/TextProviderSupportTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UnknownHandlerManagerMock.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UnknownHandlerManagerMock.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UnknownHandlerManagerMock.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UnknownHandlerManagerMock.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,17 @@
+package com.opensymphony.xwork2;
+
+import com.opensymphony.xwork2.DefaultUnknownHandlerManager;
+
+import java.util.ArrayList;
+
+/*
+ * Utility class for testing DefaultUnknownHandlerManager, which does not allow to add
+ * UnknownHandlers directly
+ */
+public class UnknownHandlerManagerMock extends DefaultUnknownHandlerManager {
+    public void addUnknownHandler(UnknownHandler uh) {
+        if (this.unknownHandlers == null)
+            this.unknownHandlers = new ArrayList<UnknownHandler>();
+        this.unknownHandlers.add(uh);
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UnknownHandlerManagerMock.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UnknownHandlerManagerMock.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UserSpecifiedDefaultAction.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UserSpecifiedDefaultAction.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UserSpecifiedDefaultAction.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UserSpecifiedDefaultAction.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,10 @@
+package com.opensymphony.xwork2;
+
+/**
+ * <code>UserSpecifiedDefaultAction</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id$
+ */
+public class UserSpecifiedDefaultAction extends ActionSupport {
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UserSpecifiedDefaultAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/UserSpecifiedDefaultAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/ValidationOrderAction.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/ValidationOrderAction.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/ValidationOrderAction.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/ValidationOrderAction.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2;
+
+/**
+ * A sample action to test validation order.
+ * 
+ * @author tm_jee
+ * @version $Date$ $Id$
+ */
+public class ValidationOrderAction extends ActionSupport {
+	
+	private String username;
+	private String password;
+	private String confirmPassword;
+	private String firstName;
+	private String lastName;
+	private String city;
+	private String province;
+	private String country;
+	private String postalCode;
+	private String email;
+	private String website;
+	private String passwordHint;
+	
+	
+	
+	@Override
+    public String execute() throws Exception {
+		return SUCCESS;
+	}
+
+
+
+	public String getCity() {
+		return city;
+	}
+
+
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+
+
+	public String getConfirmPassword() {
+		return confirmPassword;
+	}
+
+
+
+	public void setConfirmPassword(String confirmPassword) {
+		this.confirmPassword = confirmPassword;
+	}
+
+
+
+	public String getCountry() {
+		return country;
+	}
+
+
+
+	public void setCountry(String country) {
+		this.country = country;
+	}
+
+
+
+	public String getEmail() {
+		return email;
+	}
+
+
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+
+
+	public String getFirstName() {
+		return firstName;
+	}
+
+
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+
+
+	public String getLastName() {
+		return lastName;
+	}
+
+
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+
+
+
+	public String getPassword() {
+		return password;
+	}
+
+
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+
+
+	public String getPasswordHint() {
+		return passwordHint;
+	}
+
+
+
+	public void setPasswordHint(String passwordHint) {
+		this.passwordHint = passwordHint;
+	}
+
+
+
+	public String getPostalCode() {
+		return postalCode;
+	}
+
+
+
+	public void setPostalCode(String postalCode) {
+		this.postalCode = postalCode;
+	}
+
+
+
+	public String getProvince() {
+		return province;
+	}
+
+
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+
+
+	public String getUsername() {
+		return username;
+	}
+
+
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+
+
+	public String getWebsite() {
+		return website;
+	}
+
+
+
+	public void setWebsite(String website) {
+		this.website = website;
+	}
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/ValidationOrderAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/ValidationOrderAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/VoidResult.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/VoidResult.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/VoidResult.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/VoidResult.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2;
+
+/**
+ */
+public class VoidResult implements Result {
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (!(o instanceof VoidResult)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    public void execute(ActionInvocation invocation) throws Exception {
+    }
+
+    @Override
+    public int hashCode() {
+        return 42;
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/VoidResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/VoidResult.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/WildCardResultTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/WildCardResultTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/WildCardResultTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/WildCardResultTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2;
+
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
+import com.opensymphony.xwork2.mock.MockResult;
+
+/**
+ * <code>WildCardResultTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id$
+ */
+public class WildCardResultTest extends XWorkTestCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        // ensure we're using the default configuration, not simple config
+        loadConfigurationProviders(new XmlConfigurationProvider("xwork-sample.xml"));
+    }
+
+    public void testWildCardEvaluation() throws Exception {
+        ActionContext.setContext(null);
+        ActionProxy proxy = actionProxyFactory.createActionProxy(null, "WildCard", null);
+        assertEquals("success", proxy.execute());
+        assertEquals(VoidResult.class, proxy.getInvocation().getResult().getClass());
+
+        ActionContext.setContext(null);
+        proxy = actionProxyFactory.createActionProxy(null, "WildCardInput", null);
+        assertEquals("input", proxy.execute());
+        assertEquals(MockResult.class, proxy.getInvocation().getResult().getClass());
+
+        ActionContext.setContext(null);
+        proxy = actionProxyFactory.createActionProxy(null, "WildCardError", null);
+        assertEquals("error", proxy.execute());
+        assertEquals(MockResult.class, proxy.getInvocation().getResult().getClass());
+    }
+
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/WildCardResultTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/WildCardResultTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/XWorkExceptionTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/XWorkExceptionTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/XWorkExceptionTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/XWorkExceptionTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2002-2007 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2;
+
+import com.opensymphony.xwork2.util.location.Location;
+
+public class XWorkExceptionTest extends XWorkTestCase {
+
+    public void testUnknown() throws Exception {
+        XWorkException e = new XWorkException("testXXX", this);
+        assertEquals(Location.UNKNOWN, e.getLocation());
+    }
+
+    public void testThrowable() {
+        XWorkException e = new XWorkException("testThrowable", new IllegalArgumentException("Arg is null"));
+        assertEquals("com/opensymphony/xwork2/XWorkExceptionTest.java", e.getLocation().getURI());
+        String s = e.getLocation().toString();
+        assertTrue(s.contains("Method: testThrowable"));
+    }
+
+    public void testCauseAndTarget() {
+        XWorkException e = new XWorkException(new IllegalArgumentException("Arg is null"), this);
+        assertEquals("com/opensymphony/xwork2/XWorkExceptionTest.java", e.getLocation().getURI());
+        String s = e.getLocation().toString();
+        assertTrue(s.contains("Method: testCauseAndTarget"));
+    }
+
+    public void testDefaultConstructor() {
+        XWorkException e = new XWorkException();
+
+        assertNull(e.getCause());
+        assertNull(e.getThrowable());
+        assertNull(e.getMessage());
+        assertNull(e.getLocation());
+
+        assertNull(e.toString()); // mo message so it returns null
+    }
+
+    public void testMessageOnly() {
+        XWorkException e = new XWorkException("Hello World");
+
+        assertNull(e.getCause());
+        assertEquals("Hello World", e.getMessage());
+        assertEquals(Location.UNKNOWN, e.getLocation());
+    }
+
+    public void testCauseOnly() {
+        XWorkException e = new XWorkException(new IllegalArgumentException("Arg is null"));
+
+        assertNotNull(e.getCause());
+        assertNotNull(e.getLocation());
+        assertEquals("com/opensymphony/xwork2/XWorkExceptionTest.java", e.getLocation().getURI());
+        String s = e.getLocation().toString();
+        assertTrue(s.contains("Method: testCauseOnly"));
+        assertTrue(e.toString().contains("Arg is null"));
+    }
+
+    public void testCauseOnlyNoMessage() {
+        XWorkException e = new XWorkException(new IllegalArgumentException());
+
+        assertNotNull(e.getCause());
+        assertNotNull(e.getLocation());
+        assertEquals("com/opensymphony/xwork2/XWorkExceptionTest.java", e.getLocation().getURI());
+        String s = e.getLocation().toString();
+        assertTrue(s.contains("Method: testCauseOnly"));
+        assertTrue(e.toString().contains("Method: testCauseOnly"));
+    }
+
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/XWorkExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/XWorkExceptionTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config;
+
+//import org.easymock.MockControl;
+
+import com.mockobjects.dynamic.C;
+import com.mockobjects.dynamic.Mock;
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider;
+import com.opensymphony.xwork2.inject.ContainerBuilder;
+import com.opensymphony.xwork2.util.FileManager;
+import com.opensymphony.xwork2.util.location.LocatableProperties;
+
+import java.util.Properties;
+
+
+/**
+ * ConfigurationManagerTest
+ *
+ * @author Jason Carreira
+ *         Created May 6, 2003 10:59:59 PM
+ */
+public class ConfigurationManagerTest extends XWorkTestCase {
+
+    Mock configProviderMock;
+
+
+    public void testConfigurationReload() {
+        FileManager.setReloadingConfigs(true);
+
+        // now check that it reloads
+        configProviderMock.expectAndReturn("needsReload", Boolean.TRUE);
+        configProviderMock.expect("init", C.isA(Configuration.class));
+        configProviderMock.expect("register", C.ANY_ARGS);
+        configProviderMock.expect("loadPackages", C.ANY_ARGS);
+        configProviderMock.expect("destroy", C.ANY_ARGS);
+        configProviderMock.matchAndReturn("toString", "mock");
+        configurationManager.getConfiguration();
+        configProviderMock.verify();
+
+        // this will be called in teardown
+        configProviderMock.expect("destroy");
+    }
+
+    public void testNoConfigurationReload() {
+        FileManager.setReloadingConfigs(false);
+
+        // now check that it doesn't try to reload
+        configurationManager.getConfiguration();
+        configProviderMock.verify();
+
+        // this will be called in teardown
+        configProviderMock.expect("destroy");
+    }
+
+    public void testDestroyConfiguration() throws Exception {
+    	class State {
+    		public boolean isDestroyed1 =false;
+    		public boolean isDestroyed2 =false;
+    	};
+    	
+    	final State state = new State();
+    	ConfigurationManager configurationManager = new ConfigurationManager();
+    	configurationManager.addConfigurationProvider(new ConfigurationProvider() {
+			public void destroy() { 
+				throw new RuntimeException("testing testing 123");
+			}
+			public void init(Configuration configuration) throws ConfigurationException {
+			}
+			public void loadPackages() throws ConfigurationException {
+			}
+			public boolean needsReload() { return false;
+			}
+			public void register(ContainerBuilder builder, Properties props) throws ConfigurationException {
+			}
+			public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException {
+			}
+    	});
+    	configurationManager.addConfigurationProvider(new ConfigurationProvider() {
+			public void destroy() { 
+				state.isDestroyed1 = true;
+			}
+			public void init(Configuration configuration) throws ConfigurationException {
+			}
+			public void loadPackages() throws ConfigurationException {
+			}
+			public boolean needsReload() { return false;
+			}
+			public void register(ContainerBuilder builder, Properties props) throws ConfigurationException {
+			}
+			public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException {
+			}
+    	});
+    	configurationManager.addConfigurationProvider(new ConfigurationProvider() {
+			public void destroy() { 
+				throw new RuntimeException("testing testing 123");
+			}
+			public void init(Configuration configuration) throws ConfigurationException {
+			}
+			public void loadPackages() throws ConfigurationException {
+			}
+			public boolean needsReload() { return false;
+			}
+			public void register(ContainerBuilder builder, Properties props) throws ConfigurationException {
+			}
+			public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException {
+			}
+    	});
+    	configurationManager.addConfigurationProvider(new ConfigurationProvider() {
+			public void destroy() { 
+				state.isDestroyed2 = true;
+			}
+			public void init(Configuration configuration) throws ConfigurationException {
+			}
+			public void loadPackages() throws ConfigurationException {
+			}
+			public boolean needsReload() { return false;
+			}
+			public void register(ContainerBuilder builder, Properties props) throws ConfigurationException {
+			}
+			public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException {
+			}
+    	});
+    	
+    	assertFalse(state.isDestroyed1);
+    	assertFalse(state.isDestroyed2);
+    	
+    	configurationManager.clearConfigurationProviders();
+    	
+    	assertTrue(state.isDestroyed1);
+    	assertTrue(state.isDestroyed2);
+    }
+
+    public void testClearConfigurationProviders() throws Exception {
+        configProviderMock.expect("destroy");
+        configurationManager.clearConfigurationProviders();
+        configProviderMock.verify();
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        configurationManager.destroyConfiguration();
+
+        configProviderMock = new Mock(ConfigurationProvider.class);
+        configProviderMock.matchAndReturn("equals", C.ANY_ARGS, false);
+
+        ConfigurationProvider mockProvider = (ConfigurationProvider) configProviderMock.proxy();
+        configurationManager.addConfigurationProvider(new XWorkConfigurationProvider());
+        configurationManager.addConfigurationProvider(mockProvider);
+        
+        //the first time it always inits
+        configProviderMock.expect("init", C.isA(Configuration.class));
+        configProviderMock.expect("register", C.ANY_ARGS);
+        configProviderMock.expect("loadPackages", C.ANY_ARGS);
+        configProviderMock.matchAndReturn("toString", "mock");
+        
+        configurationManager.getConfiguration();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        configProviderMock.expect("destroy");
+        FileManager.setReloadingConfigs(true);
+        super.tearDown();
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config;
+
+import com.mockobjects.dynamic.C;
+import com.mockobjects.dynamic.Mock;
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.SimpleAction;
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.InterceptorMapping;
+import com.opensymphony.xwork2.config.providers.MockConfigurationProvider;
+import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
+import com.opensymphony.xwork2.inject.ContainerBuilder;
+import com.opensymphony.xwork2.mock.MockInterceptor;
+import com.opensymphony.xwork2.test.StubConfigurationProvider;
+import com.opensymphony.xwork2.util.location.LocatableProperties;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * ConfigurationTest
+ * <p/>
+ * Created : Jan 27, 2003 1:30:08 AM
+ *
+ * @author Jason Carreira
+ */
+public class ConfigurationTest extends XWorkTestCase {
+
+    public void testAbstract() {
+        try {
+            actionProxyFactory.createActionProxy("/abstract", "test", null);
+            fail();
+        } catch (Exception e) {
+            // this is what we expected
+        }
+
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("/nonAbstract", "test", null);
+            assertTrue(proxy.getActionName().equals("test"));
+            assertTrue(proxy.getConfig().getClassName().equals(SimpleAction.class.getName()));
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testDefaultNamespace() {
+        HashMap<String, String> params = new HashMap<String, String>();
+        params.put("blah", "this is blah");
+
+        HashMap<String, Object> extraContext = new HashMap<String, Object>();
+        extraContext.put(ActionContext.PARAMETERS, params);
+
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("/does/not/exist", "Foo", extraContext);
+            proxy.execute();
+            assertEquals("this is blah", proxy.getInvocation().getStack().findValue("[1].blah"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testFileIncludeLoader() {
+        RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration();
+
+        // check entityTest package
+        assertNotNull(configuration.getActionConfig("includeTest", "includeTest"));
+
+        // check inheritance from Default
+        assertNotNull(configuration.getActionConfig("includeTest", "Foo"));
+    }
+    
+    public void testWildcardName() {
+        RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration();
+
+        ActionConfig config = configuration.getActionConfig("", "WildCard/Simple/input");
+        
+        assertNotNull(config);
+        assertTrue("Wrong class name, "+config.getClassName(), 
+                "com.opensymphony.xwork2.SimpleAction".equals(config.getClassName()));
+        assertTrue("Wrong method name", "input".equals(config.getMethodName()));
+        
+        Map<String, String> p = config.getParams();
+        assertTrue("Wrong parameter, "+p.get("foo"), "Simple".equals(p.get("foo")));
+        assertTrue("Wrong parameter, "+p.get("bar"), "input".equals(p.get("bar")));
+    }
+
+    public void testWildcardNamespace() {
+        RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration();
+
+        ActionConfig config = configuration.getActionConfig("/animals/dog", "commandTest");
+
+        assertNotNull(config);
+        assertTrue("Wrong class name, "+config.getClassName(),
+                "com.opensymphony.xwork2.SimpleAction".equals(config.getClassName()));
+
+        Map<String, String> p = config.getParams();
+        assertTrue("Wrong parameter, "+p.get("0"), "/animals/dog".equals(p.get("0")));
+        assertTrue("Wrong parameter, "+p.get("1"), "dog".equals(p.get("1")));
+    }
+
+    public void testGlobalResults() {
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("", "Foo", null);
+            assertNotNull(proxy.getConfig().getResults().get("login"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testInterceptorParamInehritanceOverride() {
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("/foo/bar", "TestInterceptorParamInehritanceOverride", null);
+            assertEquals(1, proxy.getConfig().getInterceptors().size());
+
+            MockInterceptor testInterceptor = (MockInterceptor) ((InterceptorMapping) proxy.getConfig().getInterceptors().get(0)).getInterceptor();
+            assertEquals("foo123", testInterceptor.getExpectedFoo());
+            proxy.execute();
+            assertTrue(testInterceptor.isExecuted());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testInterceptorParamInheritance() {
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("/foo/bar", "TestInterceptorParamInheritance", null);
+            assertEquals(1, proxy.getConfig().getInterceptors().size());
+
+            MockInterceptor testInterceptor = (MockInterceptor) ((InterceptorMapping) proxy.getConfig().getInterceptors().get(0)).getInterceptor();
+            assertEquals("expectedFoo", testInterceptor.getExpectedFoo());
+            proxy.execute();
+            assertTrue(testInterceptor.isExecuted());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testInterceptorParamOverride() {
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("", "TestInterceptorParamOverride", null);
+            assertEquals(1, proxy.getConfig().getInterceptors().size());
+
+            MockInterceptor testInterceptor = (MockInterceptor) ((InterceptorMapping) proxy.getConfig().getInterceptors().get(0)).getInterceptor();
+            assertEquals("foo123", testInterceptor.getExpectedFoo());
+            proxy.execute();
+            assertTrue(testInterceptor.isExecuted());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testInterceptorParams() {
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("", "TestInterceptorParam", null);
+            assertEquals(1, proxy.getConfig().getInterceptors().size());
+
+            MockInterceptor testInterceptor = (MockInterceptor) ((InterceptorMapping) proxy.getConfig().getInterceptors().get(0)).getInterceptor();
+            assertEquals("expectedFoo", testInterceptor.getExpectedFoo());
+            proxy.execute();
+            assertTrue(testInterceptor.isExecuted());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testMultipleConfigProviders() {
+        configurationManager.addConfigurationProvider(new MockConfigurationProvider());
+
+        try {
+            configurationManager.reload();
+        } catch (ConfigurationException e) {
+            e.printStackTrace();
+            fail();
+        }
+
+        RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration();
+
+        // check that it has configuration from xml
+        assertNotNull(configuration.getActionConfig("/foo/bar", "Bar"));
+
+        // check that it has configuration from MockConfigurationProvider
+        assertNotNull(configuration.getActionConfig("", MockConfigurationProvider.FOO_ACTION_NAME));
+    }
+    
+    public void testMultipleContainerProviders() throws Exception {
+        System.out.println("-----");
+        Mock mockContainerProvider = new Mock(ContainerProvider.class);
+        mockContainerProvider.expect("init", C.ANY_ARGS);
+        mockContainerProvider.expect("register", C.ANY_ARGS);
+        mockContainerProvider.matchAndReturn("equals", C.ANY_ARGS, false);
+        mockContainerProvider.matchAndReturn("toString", "foo");
+        mockContainerProvider.matchAndReturn("destroy", null);
+        mockContainerProvider.expectAndReturn("needsReload", true);
+        configurationManager.addContainerProvider((ContainerProvider) mockContainerProvider.proxy());
+
+        Configuration config = null;
+        try {
+            config = configurationManager.getConfiguration();
+        } catch (ConfigurationException e) {
+            e.printStackTrace();
+            fail();
+        }
+        
+
+        RuntimeConfiguration configuration = config.getRuntimeConfiguration();
+
+        // check that it has configuration from xml
+        assertNotNull(configuration.getActionConfig("/foo/bar", "Bar"));
+
+        System.out.println("-----");
+        mockContainerProvider.verify();
+    }
+    
+    public void testInitForPackageProviders() {
+        
+        loadConfigurationProviders(new StubConfigurationProvider() {
+            @Override
+            public void register(ContainerBuilder builder,
+                    LocatableProperties props) throws ConfigurationException {
+                builder.factory(PackageProvider.class, "foo", MyPackageProvider.class);
+            }
+        });
+        
+        assertEquals(configuration, MyPackageProvider.getConfiguration());
+    }
+    
+    public void testInitOnceForConfigurationProviders() {
+        
+        loadConfigurationProviders(new StubConfigurationProvider() {
+            boolean called = false;
+            @Override
+            public void init(Configuration config) {
+                if (called) {
+                    fail("Called twice");
+                }
+                called = true;
+            }
+            
+            @Override
+            public void loadPackages() {
+                if (!called) {
+                    fail("Never called");
+                }
+            }
+        });
+    }
+
+    public void testMultipleInheritance() {
+        try {
+            ActionProxy proxy;
+            proxy = actionProxyFactory.createActionProxy("multipleInheritance", "test", null);
+            assertNotNull(proxy);
+            proxy = actionProxyFactory.createActionProxy("multipleInheritance", "Foo", null);
+            assertNotNull(proxy);
+            proxy = actionProxyFactory.createActionProxy("multipleInheritance", "testMultipleInheritance", null);
+            assertNotNull(proxy);
+            assertEquals(5, proxy.getConfig().getInterceptors().size());
+            assertEquals(2, proxy.getConfig().getResults().size());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testPackageExtension() {
+        try {
+            ActionProxy proxy = actionProxyFactory.createActionProxy("/foo/bar", "Bar", null);
+            assertEquals(5, proxy.getConfig().getInterceptors().size());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+    
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        // ensure we're using the default configuration, not simple config
+        loadConfigurationProviders(new XmlConfigurationProvider("xwork-sample.xml"));
+    }
+    
+    public static class MyPackageProvider implements PackageProvider {
+        static Configuration config;
+        public void loadPackages() throws ConfigurationException {}
+        public boolean needsReload() { return config != null; }
+        
+        public static Configuration getConfiguration() {
+            return config;
+        }
+        public void init(Configuration configuration)
+                throws ConfigurationException {
+            config = configuration;
+        }
+        
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/ConfigurationTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config.entities;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.util.location.LocationImpl;
+
+/**
+ * ActionConfigTest
+ */
+public class ActionConfigTest extends XWorkTestCase {
+
+    public void testToString() {
+        ActionConfig cfg = new ActionConfig.Builder("", "bob", "foo.Bar")
+                .methodName("execute")
+                .location(new LocationImpl(null, "foo/xwork.xml", 10, 12))
+                .build();
+
+        assertTrue("Wrong toString(): "+cfg.toString(), 
+            "{ActionConfig bob (foo.Bar.execute()) - foo/xwork.xml:10:12}".equals(cfg.toString()));
+    }
+    
+    public void testToStringWithNoMethod() {
+        ActionConfig cfg = new ActionConfig.Builder("", "bob", "foo.Bar")
+                .location(new LocationImpl(null, "foo/xwork.xml", 10, 12))
+                .build();
+        
+        assertTrue("Wrong toString(): "+cfg.toString(),
+            "{ActionConfig bob (foo.Bar) - foo/xwork.xml:10:12}".equals(cfg.toString()));
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/ActionConfigTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config.entities;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+
+public class PackageConfigTest extends XWorkTestCase {
+
+    public void testFullDefaultInterceptorRef() {
+        PackageConfig cfg1 = new PackageConfig.Builder("pkg1")
+                .defaultInterceptorRef("ref1").build();
+        PackageConfig cfg2 = new PackageConfig.Builder("pkg2").defaultInterceptorRef("ref2").build();
+        PackageConfig cfg = new PackageConfig.Builder("pkg")
+                .addParent(cfg1)
+                .addParent(cfg2)
+                .build();
+        
+        assertEquals("ref2", cfg.getFullDefaultInterceptorRef());
+    }
+    
+}
\ No newline at end of file

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/entities/PackageConfigTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,164 @@
+/*
+ * $Id$
+ *
+ * Copyright 1999-2004 The 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.
+ */
+package com.opensymphony.xwork2.config.impl;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.ExceptionMappingConfig;
+import com.opensymphony.xwork2.config.entities.InterceptorMapping;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ActionConfigMatcherTest extends XWorkTestCase {
+
+    // ----------------------------------------------------- Instance Variables
+    private Map<String,ActionConfig> configMap;
+    private ActionConfigMatcher matcher;
+    
+    // ----------------------------------------------------- Setup and Teardown
+    @Override public void setUp() throws Exception {
+        super.setUp();
+        configMap = buildActionConfigMap();
+        matcher = new ActionConfigMatcher(configMap);
+    }
+
+    @Override public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    // ------------------------------------------------------- Individual Tests
+    // ---------------------------------------------------------- match()
+    public void testNoMatch() {
+        assertNull("ActionConfig shouldn't be matched", matcher.match("test"));
+    }
+
+    public void testNoWildcardMatch() {
+        assertNull("ActionConfig shouldn't be matched", matcher.match("noWildcard"));
+    }
+
+    public void testShouldMatch() {
+        ActionConfig matched = matcher.match("foo/class/method");
+
+        assertNotNull("ActionConfig should be matched", matched);
+        assertTrue("ActionConfig should have properties, had " +
+                matched.getParams().size(), matched.getParams().size() == 2);
+        assertTrue("ActionConfig should have interceptors",
+                matched.getInterceptors().size() == 1);
+        assertTrue("ActionConfig should have ex mappings",
+                matched.getExceptionMappings().size() == 1);
+        assertTrue("ActionConfig should have external refs",
+                matched.getExceptionMappings().size() == 1);
+        assertTrue("ActionConfig should have results",
+                matched.getResults().size() == 1);
+    }
+
+    public void testCheckSubstitutionsMatch() {
+        ActionConfig m = matcher.match("foo/class/method");
+
+        assertTrue("Class hasn't been replaced", "foo.bar.classAction".equals(m.getClassName()));
+        assertTrue("Method hasn't been replaced", "domethod".equals(m.getMethodName()));
+        assertTrue("Package isn't correct", "package-class".equals(m.getPackageName()));
+
+        assertTrue("First param isn't correct", "class".equals(m.getParams().get("first")));
+        assertTrue("Second param isn't correct", "method".equals(m.getParams().get("second")));
+        
+        ExceptionMappingConfig ex = m.getExceptionMappings().get(0);
+        assertTrue("Wrong name, was "+ex.getName(), "fooclass".equals(ex.getName()));
+        assertTrue("Wrong result", "successclass".equals(ex.getResult()));
+        assertTrue("Wrong exception", 
+                "java.lang.methodException".equals(ex.getExceptionClassName()));
+        assertTrue("First param isn't correct", "class".equals(ex.getParams().get("first")));
+        assertTrue("Second param isn't correct", "method".equals(ex.getParams().get("second")));
+        
+        ResultConfig result = m.getResults().get("successclass");
+        assertTrue("Wrong name, was "+result.getName(), "successclass".equals(result.getName()));
+        assertTrue("Wrong classname", "foo.method".equals(result.getClassName()));
+        assertTrue("First param isn't correct", "class".equals(result.getParams().get("first")));
+        assertTrue("Second param isn't correct", "method".equals(result.getParams().get("second")));
+        
+    }
+
+    public void testCheckMultipleSubstitutions() {
+        ActionConfig m = matcher.match("bar/class/method/more");
+
+        assertTrue("Method hasn't been replaced correctly: " + m.getMethodName(),
+            "doclass_class".equals(m.getMethodName()));
+    }
+    
+    public void testLooseMatch() {
+        configMap.put("*!*", configMap.get("bar/*/**"));
+        ActionConfigMatcher matcher = new ActionConfigMatcher(configMap, true);
+        
+        // exact match
+        ActionConfig m = matcher.match("foo/class/method");
+        assertNotNull("ActionConfig should be matched", m);
+        assertTrue("Class hasn't been replaced "+m.getClassName(), "foo.bar.classAction".equals(m.getClassName()));
+        assertTrue("Method hasn't been replaced", "domethod".equals(m.getMethodName()));
+        
+        // Missing last wildcard
+        m = matcher.match("foo/class");
+        assertNotNull("ActionConfig should be matched", m);
+        assertTrue("Class hasn't been replaced", "foo.bar.classAction".equals(m.getClassName()));
+        assertTrue("Method hasn't been replaced, "+m.getMethodName(), "do".equals(m.getMethodName()));
+        
+        // Simple mapping
+        m = matcher.match("class!method");
+        assertNotNull("ActionConfig should be matched", m);
+        assertTrue("Class hasn't been replaced, "+m.getPackageName(), "package-class".equals(m.getPackageName()));
+        assertTrue("Method hasn't been replaced", "method".equals(m.getParams().get("first")));
+        
+        // Simple mapping
+        m = matcher.match("class");
+        assertNotNull("ActionConfig should be matched", m);
+        assertTrue("Class hasn't been replaced", "package-class".equals(m.getPackageName()));
+        assertTrue("Method hasn't been replaced", "".equals(m.getParams().get("first")));
+        
+    }
+
+    private Map<String,ActionConfig> buildActionConfigMap() {
+        Map<String, ActionConfig> map = new HashMap<String,ActionConfig>();
+
+        HashMap params = new HashMap();
+        params.put("first", "{1}");
+        params.put("second", "{2}");
+
+        ActionConfig config = new ActionConfig.Builder("package-{1}", "foo/*/*", "foo.bar.{1}Action")
+                .methodName("do{2}")
+                .addParams(params)
+                .addExceptionMapping(new ExceptionMappingConfig.Builder("foo{1}", "java.lang.{2}Exception", "success{1}")
+                    .addParams(new HashMap(params))
+                    .build())
+                .addInterceptor(new InterceptorMapping(null, null))
+                .addResultConfig(new ResultConfig.Builder("success{1}", "foo.{2}").addParams(params).build())
+                .build();
+        map.put("foo/*/*", config);
+        
+        config = new ActionConfig.Builder("package-{1}", "bar/*/**", "bar")
+                .methodName("do{1}_{1}")
+                .addParam("first", "{2}")
+                .build();
+        
+        map.put("bar/*/**", config);
+        
+        map.put("noWildcard", new ActionConfig.Builder("", "", "").build());
+
+        return map;
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/ActionConfigMatcherTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config.impl;
+
+import com.opensymphony.xwork2.util.WildcardHelper;
+import junit.framework.TestCase;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class NamespaceMatcherTest extends TestCase {
+
+    public void testMatch() {
+        Set<String> names = new HashSet<String>();
+        names.add("/bar");
+        names.add("/foo/*/bar");
+        names.add("/foo/*");
+        names.add("/foo/*/jim/*");
+        NamespaceMatcher matcher = new NamespaceMatcher(new WildcardHelper(), names);
+        assertEquals(3, matcher.compiledPatterns.size());
+
+        assertNull(matcher.match("/asd"));
+        assertEquals("/foo/*", matcher.match("/foo/23").getPattern());
+        assertEquals("/foo/*/bar", matcher.match("/foo/23/bar").getPattern());
+        assertEquals("/foo/*/jim/*", matcher.match("/foo/23/jim/42").getPattern());
+        assertNull(matcher.match("/foo/23/asd"));
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/impl/NamespaceMatcherTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.impl.MockConfiguration;
+
+
+/**
+ * ConfigurationTestBase
+ *
+ * @author Jason Carreira
+ *         Created Jun 9, 2003 7:42:12 AM
+ */
+public abstract class ConfigurationTestBase extends XWorkTestCase {
+
+    protected ConfigurationProvider buildConfigurationProvider(final String filename) {
+        configuration = new MockConfiguration();
+        ((MockConfiguration)configuration).selfRegister();
+        container = configuration.getContainer();
+
+        XmlConfigurationProvider prov = new XmlConfigurationProvider(filename, true);
+        prov.setObjectFactory(container.getInstance(ObjectFactory.class));
+        prov.init(configuration);
+        prov.loadPackages();
+        return prov;
+    }
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,274 @@
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.config.entities.InterceptorConfig;
+import com.opensymphony.xwork2.config.entities.InterceptorMapping;
+import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.interceptor.Interceptor;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ * <code>InterceptorBuilderTest</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id$
+ */
+public class InterceptorBuilderTest extends XWorkTestCase {
+
+    ObjectFactory objectFactory;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        objectFactory = container.getInstance(ObjectFactory.class);
+    }
+    
+    /**
+     * Try to test this
+     * <interceptor-ref name="interceptorStack1">
+     * <param name="interceptor1.param1">interceptor1_value1</param>
+     * <param name="interceptor1.param2">interceptor1_value2</param>
+     * <param name="interceptor2.param1">interceptor2_value1</param>
+     * <param name="interceptor2.param2">interceptor2_value2</param>
+     * </interceptor-ref>
+     *
+     * @throws Exception
+     */
+    public void testBuildInterceptor_1() throws Exception {
+        InterceptorStackConfig interceptorStackConfig1 = new InterceptorStackConfig.Builder("interceptorStack1").build();
+
+        InterceptorConfig interceptorConfig1 = new InterceptorConfig.Builder("interceptor1", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
+
+        InterceptorConfig interceptorConfig2 = new InterceptorConfig.Builder("interceptor2", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
+
+
+        PackageConfig packageConfig = new PackageConfig.Builder("package1").namespace("/namespace").addInterceptorConfig(interceptorConfig1).addInterceptorConfig(interceptorConfig2).addInterceptorStackConfig(interceptorStackConfig1).build();
+
+        List
+                interceptorMappings =
+                InterceptorBuilder.constructInterceptorReference(packageConfig, "interceptorStack1",
+                        new LinkedHashMap<String, String>() {
+                            private static final long serialVersionUID = -1358620486812957895L;
+
+                            {
+                                put("interceptor1.param1", "interceptor1_value1");
+                                put("interceptor1.param2", "interceptor1_value2");
+                                put("interceptor2.param1", "interceptor2_value1");
+                                put("interceptor2.param2", "interceptor2_value2");
+                            }
+                        },null,  objectFactory);
+
+        assertEquals(interceptorMappings.size(), 2);
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getName(), "interceptor1");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor().getClass(), MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam1(), "interceptor1_value1");
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam2(), "interceptor1_value2");
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getName(), "interceptor2");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor().getClass(), MockInterceptor2.class);
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam1(), "interceptor2_value1");
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam2(), "interceptor2_value2");
+    }
+
+    /**
+     * Try to test this
+     * <interceptor-ref name="interceptorStack1">
+     * <param name="interceptorStack2.interceptor1.param1">interceptor1_value1</param>
+     * <param name="interceptorStack2.interceptor1.param2">interceptor1_value2</param>
+     * <param name="interceptorStack3.interceptor2.param1">interceptor2_value1</param>
+     * <param name="interceptorStack3.interceptor2.param2">interceptor2_value2</param>
+     * </interceptor-ref>
+     *
+     * @throws Exception
+     */
+    public void testBuildInterceptor_2() throws Exception {
+        InterceptorStackConfig interceptorStackConfig1 = new InterceptorStackConfig.Builder("interceptorStack1").build();
+
+        InterceptorStackConfig interceptorStackConfig2 = new InterceptorStackConfig.Builder("interceptorStack2").build();
+
+        InterceptorStackConfig interceptorStackConfig3 = new InterceptorStackConfig.Builder("interceptorStack3").build();
+
+        InterceptorConfig interceptorConfig1 = new InterceptorConfig.Builder("interceptor1", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
+
+        InterceptorConfig interceptorConfig2 = new InterceptorConfig.Builder("interceptor2", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
+
+
+        PackageConfig packageConfig = new PackageConfig.Builder("package1").namespace("/namspace").
+                addInterceptorConfig(interceptorConfig1).
+                addInterceptorConfig(interceptorConfig2).
+                addInterceptorStackConfig(interceptorStackConfig1).
+                addInterceptorStackConfig(interceptorStackConfig2).
+                addInterceptorStackConfig(interceptorStackConfig3).build();
+
+        List interceptorMappings = InterceptorBuilder.constructInterceptorReference(packageConfig, "interceptorStack1",
+                new LinkedHashMap<String, String>() {
+                    private static final long serialVersionUID = -5819935102242042570L;
+
+                    {
+                        put("interceptorStack2.interceptor1.param1", "interceptor1_value1");
+                        put("interceptorStack2.interceptor1.param2", "interceptor1_value2");
+                        put("interceptorStack3.interceptor2.param1", "interceptor2_value1");
+                        put("interceptorStack3.interceptor2.param2", "interceptor2_value2");
+                    }
+                }, null, objectFactory);
+
+        assertEquals(interceptorMappings.size(), 2);
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getName(), "interceptor1");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor().getClass(), MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam1(), "interceptor1_value1");
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam2(), "interceptor1_value2");
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getName(), "interceptor2");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor().getClass(), MockInterceptor2.class);
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam1(), "interceptor2_value1");
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam2(), "interceptor2_value2");
+    }
+
+    /**
+     * Try to test this
+     * <interceptor-ref name="interceptorStack1">
+     * <param name="interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param1">interceptor1_value1</param>
+     * <param name="interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param2">interceptor1_value2</param>
+     * <param name="interceptorStack5.interceptor2.param1">interceptor2_value1</param>
+     * <param name="interceptorStack5.interceptor2.param2">interceptor2_value2</param>
+     * </interceptor-ref>
+     *
+     * @throws Exception
+     */
+    public void testBuildInterceptor_3() throws Exception {
+        InterceptorConfig interceptorConfig1 = new InterceptorConfig.Builder("interceptor1", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
+
+        InterceptorConfig interceptorConfig2 = new InterceptorConfig.Builder("interceptor2", "com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
+
+
+        InterceptorStackConfig interceptorStackConfig1 = new InterceptorStackConfig.Builder("interceptorStack1").build();
+
+
+        InterceptorStackConfig interceptorStackConfig2 = new InterceptorStackConfig.Builder("interceptorStack2").build();
+
+
+        InterceptorStackConfig interceptorStackConfig3 = new InterceptorStackConfig.Builder("interceptorStack3").build();
+
+
+        InterceptorStackConfig interceptorStackConfig4 = new InterceptorStackConfig.Builder("interceptorStack4").build();
+
+
+        InterceptorStackConfig interceptorStackConfig5 = new InterceptorStackConfig.Builder("interceptorStack5").build();
+
+
+
+        PackageConfig packageConfig = new PackageConfig.Builder("package1").
+                addInterceptorConfig(interceptorConfig1).
+                addInterceptorConfig(interceptorConfig2).
+                addInterceptorStackConfig(interceptorStackConfig1).
+                addInterceptorStackConfig(interceptorStackConfig2).
+                addInterceptorStackConfig(interceptorStackConfig3).
+                addInterceptorStackConfig(interceptorStackConfig4).
+                addInterceptorStackConfig(interceptorStackConfig5).build();
+
+
+        List interceptorMappings = InterceptorBuilder.constructInterceptorReference(
+                packageConfig, "interceptorStack1",
+                new LinkedHashMap<String, String>() {
+                    private static final long serialVersionUID = 4675809753780875525L;
+
+                    {
+                        put("interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param1", "interceptor1_value1");
+                        put("interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param2", "interceptor1_value2");
+                        put("interceptorStack5.interceptor2.param1", "interceptor2_value1");
+                        put("interceptorStack5.interceptor2.param2", "interceptor2_value2");
+                    }
+                }, null, objectFactory);
+
+        assertEquals(interceptorMappings.size(), 2);
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getName(), "interceptor1");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(0)).getInterceptor().getClass(), MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam1(), "interceptor1_value1");
+        assertEquals(((MockInterceptor1) ((InterceptorMapping) interceptorMappings.get(0)).getInterceptor()).getParam2(), "interceptor1_value2");
+
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getName(), "interceptor2");
+        assertNotNull(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor());
+        assertEquals(((InterceptorMapping) interceptorMappings.get(1)).getInterceptor().getClass(), MockInterceptor2.class);
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam1(), "interceptor2_value1");
+        assertEquals(((MockInterceptor2) ((InterceptorMapping) interceptorMappings.get(1)).getInterceptor()).getParam2(), "interceptor2_value2");
+    }
+
+
+    public static class MockInterceptor1 implements Interceptor {
+        private static final long serialVersionUID = 2939902550126175874L;
+        private String param1;
+        private String param2;
+
+        public void setParam1(String param1) {
+            this.param1 = param1;
+        }
+
+        public String getParam1() {
+            return this.param1;
+        }
+
+        public void setParam2(String param2) {
+            this.param2 = param2;
+        }
+
+        public String getParam2() {
+            return this.param2;
+        }
+
+        public void destroy() {
+        }
+
+        public void init() {
+        }
+
+        public String intercept(ActionInvocation invocation) throws Exception {
+            return invocation.invoke();
+        }
+    }
+
+    public static class MockInterceptor2 implements Interceptor {
+        private static final long serialVersionUID = 267427973306989618L;
+        private String param1;
+        private String param2;
+
+        public void setParam1(String param1) {
+            this.param1 = param1;
+        }
+
+        public String getParam1() {
+            return this.param1;
+        }
+
+        public void setParam2(String param2) {
+            this.param2 = param2;
+        }
+
+        public String getParam2() {
+            return this.param2;
+        }
+
+        public void destroy() {
+        }
+
+        public void init() {
+        }
+
+        public String intercept(ActionInvocation invocation) throws Exception {
+            return invocation.invoke();
+        }
+    }
+
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java (added)
+++ struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config.providers;
+
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.interceptor.Interceptor;
+
+/**
+ * 
+ * @author tm_jee
+ * @version $Date$ $Id$
+ */
+public class InterceptorForTestPurpose implements Interceptor {
+
+	private String paramOne;
+	private String paramTwo;
+	
+	public String getParamOne() { return paramOne; }
+	public void setParamOne(String paramOne) { this.paramOne = paramOne; }
+	
+	public String getParamTwo() { return paramTwo; }
+	public void setParamTwo(String paramTwo) { this.paramTwo = paramTwo; }
+	
+	public void destroy() {
+	}
+
+	public void init() {
+	}
+
+	public String intercept(ActionInvocation invocation) throws Exception {
+		return invocation.invoke();
+	}
+
+}

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message