You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ra...@apache.org on 2006/02/09 21:04:01 UTC

svn commit: r376411 - in /jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env: faces/ jexl/ servlet/

Author: rahul
Date: Thu Feb  9 12:03:58 2006
New Revision: 376411

URL: http://svn.apache.org/viewcvs?rev=376411&view=rev
Log:
Add some tests to the env packages.

Added:
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/SessionContextTest.java   (with props)
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/JexlContextTest.java   (with props)
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/ServletContextResolverTest.java   (with props)
Modified:
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/EnvFacesTestSuite.java
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/EnvJexlTestSuite.java
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/EnvServletTestSuite.java

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/EnvFacesTestSuite.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/EnvFacesTestSuite.java?rev=376411&r1=376410&r2=376411&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/EnvFacesTestSuite.java (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/EnvFacesTestSuite.java Thu Feb  9 12:03:58 2006
@@ -47,6 +47,7 @@
     public static Test suite() {
         TestSuite suite = new TestSuite();
         suite.setName("Commons-SCXML Faces Environment Tests");
+        suite.addTest(SessionContextTest.suite());
         return suite;
     }
 }

Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/SessionContextTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/SessionContextTest.java?rev=376411&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/SessionContextTest.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/SessionContextTest.java Thu Feb  9 12:03:58 2006
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006 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 org.apache.commons.scxml.env.faces;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class SessionContextTest extends TestCase {
+
+    public SessionContextTest(String testName) {
+        super(testName);
+    }
+
+    public static Test suite() {
+        return new TestSuite(SessionContextTest.class);
+    }
+
+    public static void main(String args[]) {
+        String[] testCaseName = {SessionContextTest.class.getName()};
+        junit.textui.TestRunner.main(testCaseName);
+    }
+
+    public void testIllegalInstance() {
+    	try {
+            new SessionContext(null);
+            fail("SessionContext successfully instantiated with"
+                + " null FacesContext");
+    	} catch (IllegalArgumentException iae) {
+    		// expected, ignore
+    	}
+    }
+
+}

Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/SessionContextTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/faces/SessionContextTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/EnvJexlTestSuite.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/EnvJexlTestSuite.java?rev=376411&r1=376410&r2=376411&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/EnvJexlTestSuite.java (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/EnvJexlTestSuite.java Thu Feb  9 12:03:58 2006
@@ -47,6 +47,7 @@
     public static Test suite() {
         TestSuite suite = new TestSuite();
         suite.setName("Commons-SCXML JEXL Environment Tests");
+        suite.addTest(JexlContextTest.suite());
         return suite;
     }
 }

Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/JexlContextTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/JexlContextTest.java?rev=376411&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/JexlContextTest.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/JexlContextTest.java Thu Feb  9 12:03:58 2006
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2006 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 org.apache.commons.scxml.env.jexl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.commons.scxml.Builtin;
+
+public class JexlContextTest extends TestCase {
+
+    public JexlContextTest(String testName) {
+        super(testName);
+    }
+
+    public static Test suite() {
+        return new TestSuite(JexlContextTest.class);
+    }
+
+    public static void main(String args[]) {
+        String[] testCaseName = {JexlContextTest.class.getName()};
+        junit.textui.TestRunner.main(testCaseName);
+    }
+
+    public void testNew() {
+        JexlContext ctx = new JexlContext();
+        assertNotNull(ctx);
+        assertEquals(1, ctx.getVars().size());
+        assertTrue(ctx.get("_builtin") instanceof Builtin);
+    }
+
+    public void testPrepopulated() {
+        Map m = new HashMap();
+        m.put("foo", "bar");
+        JexlContext ctx = new JexlContext(m);
+        assertNotNull(ctx);
+        assertEquals(2, ctx.getVars().size());
+        assertTrue(ctx.get("_builtin") instanceof Builtin);
+        String fooValue = (String) ctx.get("foo");
+        assertEquals("bar", fooValue);
+    }
+
+    public void testSetVars() {
+        JexlContext ctx = new JexlContext();
+        assertNotNull(ctx);
+        assertEquals(1, ctx.getVars().size());
+        assertTrue(ctx.get("_builtin") instanceof Builtin);
+        Map m = new HashMap();
+        m.put("foo", "bar");
+        ctx.setVars(m);
+        assertEquals(2, ctx.getVars().size());
+        String fooValue = (String) ctx.get("foo");
+        assertTrue(ctx.get("_builtin") instanceof Builtin);
+        assertEquals("bar", fooValue);
+    }
+
+}

Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/JexlContextTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/JexlContextTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/EnvServletTestSuite.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/EnvServletTestSuite.java?rev=376411&r1=376410&r2=376411&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/EnvServletTestSuite.java (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/EnvServletTestSuite.java Thu Feb  9 12:03:58 2006
@@ -47,6 +47,7 @@
     public static Test suite() {
         TestSuite suite = new TestSuite();
         suite.setName("Commons-SCXML Servlet Environment Tests");
+        suite.addTest(ServletContextResolverTest.suite());
         return suite;
     }
 }

Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/ServletContextResolverTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/ServletContextResolverTest.java?rev=376411&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/ServletContextResolverTest.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/ServletContextResolverTest.java Thu Feb  9 12:03:58 2006
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006 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 org.apache.commons.scxml.env.servlet;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class ServletContextResolverTest extends TestCase {
+
+    public ServletContextResolverTest(String testName) {
+        super(testName);
+    }
+
+    public static Test suite() {
+        return new TestSuite(ServletContextResolverTest.class);
+    }
+
+    public static void main(String args[]) {
+        String[] testCaseName = {ServletContextResolverTest.class.getName()};
+        junit.textui.TestRunner.main(testCaseName);
+    }
+
+    public void testIllegalInstance() {
+    	try {
+            new ServletContextResolver(null);
+            fail("ServletContextResolver successfully instantiated with"
+                + " null ServletContext");
+    	} catch (IllegalArgumentException iae) {
+    		// expected, ignore
+    	}
+    }
+
+}

Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/ServletContextResolverTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/servlet/ServletContextResolverTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org