You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by jm...@apache.org on 2005/01/19 21:52:51 UTC

svn commit: r125659 - /struts/taglib/trunk/project.xml /struts/taglib/trunk/src/test/org/apache/struts/taglib/TestTagUtils.java

Author: jmitchell
Date: Wed Jan 19 12:52:51 2005
New Revision: 125659

URL: http://svn.apache.org/viewcvs?view=rev&rev=125659
Log:
fix pom for maven build and get TestTagUtils to compile (this may still be broken, but at least it compiles)
Modified:
   struts/taglib/trunk/project.xml
   struts/taglib/trunk/src/test/org/apache/struts/taglib/TestTagUtils.java

Modified: struts/taglib/trunk/project.xml
Url: http://svn.apache.org/viewcvs/struts/taglib/trunk/project.xml?view=diff&rev=125659&p1=struts/taglib/trunk/project.xml&r1=125658&p2=struts/taglib/trunk/project.xml&r2=125659
==============================================================================
--- struts/taglib/trunk/project.xml	(original)
+++ struts/taglib/trunk/project.xml	Wed Jan 19 12:52:51 2005
@@ -4,7 +4,7 @@
   <id>struts-taglib</id>
   <groupId>struts</groupId>
   <name>Struts Taglibs</name>
-  <currentVersion>1.0-SNAPSHOT</currentVersion>
+  <currentVersion>1.3.0-dev</currentVersion>
   
   <organization>
     <name />
@@ -108,11 +108,41 @@
     </dependency>
    <dependency>
       <id>commons-validator</id>
-      <version>1.1.3</version>
+      <version>1.1.4</version>
     </dependency>
     <dependency>
       <id>oro</id>
       <version>2.0.8</version>
+    </dependency>
+    
+	<dependency>
+	  <groupId>antlr</groupId>
+	  <artifactId>antlr</artifactId>
+	  <version>2.7.2</version>
+	  <properties>
+		<war.bundle>true</war.bundle>
+	  </properties>
+	</dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <url>http://www.junit.org</url>
+    </dependency>
+
+    <dependency>
+      <groupId>cactus</groupId>
+      <artifactId>cactus</artifactId>
+      <version>12-1.4.1</version>
+      <url>http://jakarta.apache.org/cactus</url>
+    </dependency>
+    
+    <dependency>
+      <groupId>cactus</groupId>
+      <artifactId>cactus-ant</artifactId>
+      <version>1.4.1</version>
+      <url>http://jakarta.apache.org/cactus</url>
     </dependency>
   </dependencies>
   

Modified: struts/taglib/trunk/src/test/org/apache/struts/taglib/TestTagUtils.java
Url: http://svn.apache.org/viewcvs/struts/taglib/trunk/src/test/org/apache/struts/taglib/TestTagUtils.java?view=diff&rev=125659&p1=struts/taglib/trunk/src/test/org/apache/struts/taglib/TestTagUtils.java&r1=125658&p2=struts/taglib/trunk/src/test/org/apache/struts/taglib/TestTagUtils.java&r2=125659
==============================================================================
--- struts/taglib/trunk/src/test/org/apache/struts/taglib/TestTagUtils.java	(original)
+++ struts/taglib/trunk/src/test/org/apache/struts/taglib/TestTagUtils.java	Wed Jan 19 12:52:51 2005
@@ -16,11 +16,26 @@
 
 package org.apache.struts.taglib;
 
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.jsp.JspException;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
-import org.apache.commons.logging.LogFactory;
+
 import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.Globals;
+import org.apache.struts.config.ModuleConfig;
+import org.apache.struts.mock.MockFormBean;
+import org.apache.struts.mock.MockHttpServletRequest;
+import org.apache.struts.mock.MockHttpSession;
+import org.apache.struts.mock.MockPageContext;
+import org.apache.struts.taglib.html.Constants;
+
 
 
 /**
@@ -32,6 +47,12 @@
     private static Log log = LogFactory.getLog(TestTagUtils.class);
 
     protected TagUtils tagutils = TagUtils.getInstance();
+    private MockHttpServletRequest request;
+    private MockHttpSession session;
+    private MockPageContext page;
+    private ModuleConfig moduleConfig;
+    private ModuleConfig moduleConfig2;
+    private ModuleConfig moduleConfig3;
 
     /**
      * Defines the testcase name for JUnit.
@@ -119,7 +140,7 @@
 
         // Straight substitution
         page = "/mypages/index.jsp";
-        result = RequestUtils.pageURL(request, page);
+        result = tagutils.pageURL(request, page, moduleConfig);
         assertNotNull("straight sub found", result);
         assertEquals("straight sub value",
                      "/mypages/index.jsp", result);
@@ -138,7 +159,7 @@
 
         // Straight substitution
         page = "/mypages/index.jsp";
-        result = RequestUtils.pageURL(request, page);
+        result = tagutils.pageURL(request, page, moduleConfig2);
         assertNotNull("straight sub found", result);
         assertEquals("straight sub value",
                      "/2/mypages/index.jsp", result);
@@ -148,7 +169,7 @@
 
 
     // Third module (custom pagePattern)
-    public void testPageURL3() {
+    public void testPageURL3a() {
 
         request.setAttribute(Globals.MODULE_KEY, moduleConfig3);
         request.setPathElements("/myapp", "/3/action.do", null, null);
@@ -164,7 +185,7 @@
 
         Map map = null;
         try {
-            map = RequestUtils.computeParameters(page,
+            map = tagutils.computeParameters(page,
                                                  null, null, null, null,
                                                  null, null, null, false);
         } catch (JspException e) {
@@ -181,7 +202,7 @@
         session.setAttribute(Globals.TRANSACTION_TOKEN_KEY, "token");
         Map map = null;
         try {
-            map = RequestUtils.computeParameters
+            map = tagutils.computeParameters
                 (page, null, null, null, null,
                  null, null, null, true);
         } catch (JspException e) {
@@ -204,7 +225,7 @@
         session.setAttribute("attr", "bar");
         Map map = null;
         try {
-            map = RequestUtils.computeParameters
+            map = tagutils.computeParameters
                 (page, "foo", "attr", null, null,
                  null, null, null, false);
         } catch (JspException e) {
@@ -228,7 +249,7 @@
         request.setAttribute("attr", "bar");
         Map map = null;
         try {
-            map = RequestUtils.computeParameters
+            map = tagutils.computeParameters
                 (page, "foo", "attr", null, "request",
                  null, null, null, false);
         } catch (JspException e) {
@@ -253,7 +274,7 @@
 
         Map map = null;
         try {
-            map = RequestUtils.computeParameters
+            map = tagutils.computeParameters
                 (page, "foo", "attr", "stringProperty", "request",
                  null, null, null, false);
         } catch (JspException e) {
@@ -280,7 +301,7 @@
         session.setAttribute("attr", map);
 
         try {
-            map = RequestUtils.computeParameters
+            map = tagutils.computeParameters
                 (page, null, null, null, null,
                  "attr", null, null, false);
         } catch (JspException e) {
@@ -312,7 +333,7 @@
         request.setAttribute("attr", map);
 
         try {
-            map = RequestUtils.computeParameters
+            map = tagutils.computeParameters
                 (page, null, null, null, null,
                  "attr", null, "request", false);
         } catch (JspException e) {
@@ -341,7 +362,7 @@
 
         Map map = null;
         try {
-            map = RequestUtils.computeParameters
+            map = tagutils.computeParameters
                 (page, null, null, null, null,
                  "attr", "mapProperty", "request", false);
         } catch (JspException e) {
@@ -372,7 +393,7 @@
         session.setAttribute("attr", map);
 
         try {
-            map = RequestUtils.computeParameters
+            map = tagutils.computeParameters
                 (page, null, null, null, null,
                  "attr", null, null, false);
         } catch (JspException e) {
@@ -400,7 +421,7 @@
 
         Map map = null;
         try {
-            map = RequestUtils.computeParameters
+            map = tagutils.computeParameters
                 (page, "foo1", "attr", "stringProperty", "request",
                  "attr", "mapProperty", "request", true);
         } catch (JspException e) {
@@ -440,9 +461,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "foo",
-                 null, null,
+                 null, null, null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -461,9 +482,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 "http://foo.com/bar", null,
+                 "http://foo.com/bar", null, null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -482,9 +503,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -505,9 +526,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "foo",
-                 null, null,
+                 null, null, null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -528,9 +549,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -549,9 +570,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "relative1",
-                 null, null,
+                 null, null, null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -570,9 +591,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "relative2",
-                 null, null,
+                 null, null, null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -591,9 +612,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "external",
-                 null, null,
+                 null, null, null, null, 
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -612,9 +633,9 @@
         request.setPathElements("/myapp", "/2/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "foo",
-                 null, null,
+                 null, null, null, null, 
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -634,9 +655,9 @@
         request.setPathElements("/myapp", "/2/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 "http://foo.com/bar", null,
+                 "http://foo.com/bar", null, null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -656,9 +677,9 @@
         request.setPathElements("/myapp", "/2/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -680,9 +701,9 @@
         request.setPathElements("/myapp", "/2/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "foo",
-                 null, null,
+                 null, null, null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -704,9 +725,9 @@
         request.setPathElements("/myapp", "/2/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -726,9 +747,9 @@
         request.setPathElements("/myapp", "/2/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "relative1",
-                 null, null,
+                 null, null, null, null, 
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -748,9 +769,9 @@
         request.setPathElements("/myapp", "/2/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "relative2",
-                 null, null,
+                 null, null, null, null, 
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -770,9 +791,9 @@
         request.setPathElements("/myapp", "/2/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, "external",
-                 null, null,
+                 null, null, null, null,
                  null, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -793,9 +814,9 @@
         map.put("foo2", "bar2");
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null,
                  map, null, false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -814,9 +835,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null,
                  null, "anchor", false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -838,9 +859,9 @@
         map.put("foo2", "bar2");
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null,
                  map, "anchor", false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -862,9 +883,9 @@
         map.put("foo2", "bar2");
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null, 
                  map, null, true);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -883,9 +904,9 @@
         request.setPathElements("/myapp", "/action.do", null, null);
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null,
                  null, "anchor", true);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -907,9 +928,9 @@
         map.put("foo2", "bar2");
         String url = null;
         try {
-            url = RequestUtils.computeURL
+            url = tagutils.computeURL
                 (page, null,
-                 null, "/bar",
+                 null, "/bar", null, null,
                  map, "anchor", false);
         } catch (MalformedURLException e) {
             fail("MalformedURLException: " + e);
@@ -924,46 +945,8 @@
     // -------------------------------------------------------------- pageURL()
 
 
-    // Default module (default pagePattern)
-    public void testPageURL1() {
-
-        request.setAttribute(Globals.MODULE_KEY, moduleConfig);
-        request.setPathElements("/myapp", "/action.do", null, null);
-        String page = null;
-        String result = null;
-
-        // Straight substitution
-        page = "/mypages/index.jsp";
-        result = RequestUtils.pageURL(request, page);
-        assertNotNull("straight sub found", result);
-        assertEquals("straight sub value",
-                     "/mypages/index.jsp", result);
-
-
-    }
-
-
-    // Second module (default pagePattern)
-    public void testPageURL2() {
-
-        request.setAttribute(Globals.MODULE_KEY, moduleConfig2);
-        request.setPathElements("/myapp", "/2/action.do", null, null);
-        String page = null;
-        String result = null;
-
-        // Straight substitution
-        page = "/mypages/index.jsp";
-        result = RequestUtils.pageURL(request, page);
-        assertNotNull("straight sub found", result);
-        assertEquals("straight sub value",
-                     "/2/mypages/index.jsp", result);
-
-
-    }
-
-
     // Third module (custom pagePattern)
-    public void testPageURL3() {
+    public void testPageURL3b() {
 
         request.setAttribute(Globals.MODULE_KEY, moduleConfig3);
         request.setPathElements("/myapp", "/3/action.do", null, null);
@@ -972,7 +955,7 @@
 
         // Straight substitution
         page = "/mypages/index.jsp";
-        result = RequestUtils.pageURL(request, page);
+        result = tagutils.pageURL(request, page, moduleConfig3);
         assertNotNull("straight sub found", result);
         assertEquals("straight sub value",
                      "/paging/3/mypages/index.jsp", result);

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