struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-struts/src/test/org/apache/struts/tiles TestTilesPlugin.java
Date Sun, 04 May 2003 22:41:14 GMT
dgraham     2003/05/04 15:41:13

  Modified:    src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel
                        RssChannelsAction.java Channels.java
               src/tiles-documentation/org/apache/struts/webapp/tiles/test
                        NoForward.java
               src/test/org/apache/struts/mock TestMockBase.java
               src/share/org/apache/struts/config ConfigHelper.java
               src/test/org/apache/struts/util TestRequestUtils.java
               src/test/org/apache/struts/tiles TestTilesPlugin.java
  Log:
  Removed references to deprecated Action constants.
  
  Revision  Changes    Path
  1.3       +8 -8      jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/RssChannelsAction.java
  
  Index: RssChannelsAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/RssChannelsAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RssChannelsAction.java	28 Feb 2003 02:24:46 -0000	1.2
  +++ RssChannelsAction.java	4 May 2003 22:41:12 -0000	1.3
  @@ -178,7 +178,7 @@
           }
   
           // -- Handle Errors ---
  -        if (!errors.empty()) {
  +        if (!errors.isEmpty()) {
               saveErrors(request, errors);
               // If no input page, use error forwarding
            if(debug)
  
  
  
  1.4       +5 -5      jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/Channels.java
  
  Index: Channels.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/Channels.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Channels.java	28 Feb 2003 02:24:46 -0000	1.3
  +++ Channels.java	4 May 2003 22:41:12 -0000	1.4
  @@ -178,7 +178,7 @@
           }
   
           // -- Handle Errors ---
  -        if (!errors.empty()) {
  +        if (!errors.isEmpty()) {
               saveErrors(request, errors);
               if (mapping.getInput()!=null)
                   return (new ActionForward(mapping.getInput()));
  
  
  
  1.2       +4 -8      jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/test/NoForward.java
  
  Index: NoForward.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/test/NoForward.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NoForward.java	22 Mar 2003 00:31:09 -0000	1.1
  +++ NoForward.java	4 May 2003 22:41:13 -0000	1.2
  @@ -61,9 +61,6 @@
   
   package org.apache.struts.webapp.tiles.test;
   
  -import java.io.IOException;
  -
  -import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
  @@ -72,7 +69,6 @@
   import org.apache.struts.action.ActionForward;
   import org.apache.struts.action.ActionMapping;
   import org.apache.struts.tiles.ComponentContext;
  -import org.apache.struts.tiles.ComponentDefinition;
   
   
   /**
  
  
  
  1.11      +10 -9     jakarta-struts/src/test/org/apache/struts/mock/TestMockBase.java
  
  Index: TestMockBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/test/org/apache/struts/mock/TestMockBase.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestMockBase.java	8 Feb 2003 21:01:52 -0000	1.10
  +++ TestMockBase.java	4 May 2003 22:41:13 -0000	1.11
  @@ -67,6 +67,7 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  +import org.apache.struts.Globals;
   import org.apache.struts.action.Action;
   import org.apache.struts.action.ActionFormBean;
   import org.apache.struts.action.ActionForward;
  @@ -165,7 +166,7 @@
           ActionMapping mapping = null;
   
           appConfig = new ApplicationConfig("");
  -        context.setAttribute(Action.APPLICATION_KEY, appConfig);
  +        context.setAttribute(Globals.MODULE_KEY, appConfig);
   
           // Forward "external" to "http://jakarta.apache.org/"
           appConfig.addForwardConfig
  @@ -306,7 +307,7 @@
           ActionMapping mapping = null;
   
           appConfig2 = new ApplicationConfig("/2");
  -        context.setAttribute(Action.APPLICATION_KEY + "/2", appConfig2);
  +        context.setAttribute(Globals.MODULE_KEY + "/2", appConfig2);
   
           // Forward "external" to "http://jakarta.apache.org/"
           appConfig2.addForwardConfig
  @@ -411,7 +412,7 @@
   
   
           appConfig3 = new ApplicationConfig("/3");
  -        context.setAttribute(Action.APPLICATION_KEY + "/3", appConfig3);
  +        context.setAttribute(Globals.MODULE_KEY + "/3", appConfig3);
   
           // Instantiate the controller configuration for this app
           ControllerConfig controller = new ControllerConfig();
  @@ -515,13 +516,13 @@
           assertNotNull("appConfig is present", appConfig);
           assertEquals("context-->appConfig",
                        appConfig,
  -                     context.getAttribute(Action.APPLICATION_KEY));
  +                     context.getAttribute(Globals.MODULE_KEY));
   
           // Validate the configuration for the second module
           assertNotNull("appConfig2 is present", appConfig2);
           assertEquals("context-->appConfig2",
                        appConfig2,
  -                     context.getAttribute(Action.APPLICATION_KEY + "/2"));
  +                     context.getAttribute(Globals.MODULE_KEY + "/2"));
   
       }
   
  
  
  
  1.5       +33 -20    jakarta-struts/src/share/org/apache/struts/config/ConfigHelper.java
  
  Index: ConfigHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/config/ConfigHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConfigHelper.java	12 Nov 2002 03:56:09 -0000	1.4
  +++ ConfigHelper.java	4 May 2003 22:41:13 -0000	1.5
  @@ -237,9 +237,10 @@
        */
       public ActionFormBeans getActionFormBeans() {
   
  -        if (this.application == null)
  +        if (this.application == null) {
               return null;
  -        return (ActionFormBeans) this.application.getAttribute(Action.FORM_BEANS_KEY);
  +        }
  +        return (ActionFormBeans) this.application.getAttribute(Globals.FORM_BEANS_KEY);
   
       }
   
  @@ -249,9 +250,10 @@
        */
       public ActionForwards getActionForwards() {
   
  -        if (this.application == null)
  +        if (this.application == null) {
               return null;
  -        return (ActionForwards) this.application.getAttribute(Action.FORWARDS_KEY);
  +        }
  +        return (ActionForwards) this.application.getAttribute(Globals.FORWARDS_KEY);
   
       }
   
  @@ -262,9 +264,10 @@
        * ActionServlet.
        */
       public ActionMappings getActionMappings() {
  -        if (this.application == null)
  +        if (this.application == null) {
               return null;
  -        return (ActionMappings) this.application.getAttribute(Action.MAPPINGS_KEY);
  +        }
  +        return (ActionMappings) this.application.getAttribute(Globals.MAPPINGS_KEY);
       }
   
       /**
  @@ -272,8 +275,9 @@
        */
       public MessageResources getMessageResources() {
   
  -        if (this.application == null)
  +        if (this.application == null) {
               return null;
  +        }
           return (MessageResources) this.application.getAttribute(Globals.MESSAGES_KEY);
   
       }
  @@ -285,8 +289,9 @@
        */
       public String getServletMapping() {
   
  -        if (this.application == null)
  +        if (this.application == null) {
               return null;
  +        }
           return (String) this.application.getAttribute(Globals.SERVLET_KEY);
   
       }
  @@ -303,11 +308,13 @@
       public Locale getLocale() {
           Locale locale = null;
   
  -        if (session != null)
  +        if (session != null) {
               locale = (Locale) session.getAttribute(Globals.LOCALE_KEY);
  +        }
   
  -        if ((locale == null) && (request != null))
  +        if ((locale == null) && (request != null)) {
               locale = request.getLocale();
  +        }
   
           return locale;
       }
  @@ -317,8 +324,9 @@
        */
       public String getToken() {
   
  -        if (this.session == null)
  +        if (this.session == null) {
               return null;
  +        }
           return (String) session.getAttribute(Globals.TRANSACTION_TOKEN_KEY);
   
       }
  @@ -331,8 +339,9 @@
        */
       public ActionErrors getActionErrors() {
   
  -        if (this.request == null)
  +        if (this.request == null) {
               return null;
  +        }
           return (ActionErrors) this.request.getAttribute(Globals.ERROR_KEY);
   
       }
  @@ -344,8 +353,9 @@
        */
       public Throwable getException() {
   
  -        if (this.request == null)
  +        if (this.request == null) {
               return null;
  +        }
           return (Throwable) this.request.getAttribute(Globals.EXCEPTION_KEY);
   
       }
  @@ -355,8 +365,9 @@
        */
       public MultipartRequestWrapper getMultipartRequestWrapper() {
   
  -        if (this.request == null)
  +        if (this.request == null) {
               return null;
  +        }
           return (MultipartRequestWrapper) this.request.getAttribute(Globals.MULTIPART_KEY);
       }
   
  @@ -366,8 +377,9 @@
         */
       public ActionMapping getMapping() {
   
  -        if (this.request == null)
  +        if (this.request == null) {
               return null;
  +        }
           return (ActionMapping) this.request.getAttribute(Globals.MAPPING_KEY);
   
       }
  @@ -385,8 +397,9 @@
           // Look up the requested MessageResources
           MessageResources resources = getMessageResources();
   
  -        if (resources == null)
  +        if (resources == null) {
               return false;
  +        }
   
           // Return the requested message presence indicator
           return (resources.isPresent(getLocale(), key));
  
  
  
  1.18      +25 -25    jakarta-struts/src/test/org/apache/struts/util/TestRequestUtils.java
  
  Index: TestRequestUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/test/org/apache/struts/util/TestRequestUtils.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TestRequestUtils.java	8 Feb 2003 22:12:09 -0000	1.17
  +++ TestRequestUtils.java	4 May 2003 22:41:13 -0000	1.18
  @@ -163,7 +163,7 @@
       // Default application -- extension mapping
       public void testActionURL1() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig);
           request.setPathElements("/myapp", "/foo.do", null, null);
           String url = RequestUtils.actionURL
               (request, appConfig.findActionConfig("/dynamic"), "*.do");
  @@ -178,7 +178,7 @@
       // Second application -- extension mapping
       public void testActionURL2() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/foo.do", null, null);
           String url = RequestUtils.actionURL
               (request, appConfig2.findActionConfig("/dynamic2"), "*.do");
  @@ -193,7 +193,7 @@
       // Default application -- path mapping
       public void testActionURL3() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig);
           request.setPathElements("/myapp", "/do/foo", null, null);
           String url = RequestUtils.actionURL
               (request, appConfig.findActionConfig("/dynamic"), "/do/*");
  @@ -660,7 +660,7 @@
       // Second module -- Forward only
       public void testComputeURL2a() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/action.do", null, null);
           String url = null;
           try {
  @@ -682,7 +682,7 @@
       // Second module -- Href only
       public void testComputeURL2b() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/action.do", null, null);
           String url = null;
           try {
  @@ -704,7 +704,7 @@
       // Second module -- Page only
       public void testComputeURL2c() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/action.do", null, null);
           String url = null;
           try {
  @@ -726,7 +726,7 @@
       // Default module -- Forward with pattern
       public void testComputeURL2d() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           appConfig2.getControllerConfig().setForwardPattern
               ("$C/WEB-INF/pages$M$P");
           request.setPathElements("/myapp", "/2/action.do", null, null);
  @@ -752,7 +752,7 @@
   
           appConfig2.getControllerConfig().setPagePattern
               ("$C/WEB-INF/pages$M$P");
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/action.do", null, null);
           String url = null;
           try {
  @@ -774,7 +774,7 @@
       // Second module -- Forward with relative path (non-context-relative)
       public void testComputeURL2f() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/action.do", null, null);
           String url = null;
           try {
  @@ -796,7 +796,7 @@
       // Second module -- Forward with relative path (context-relative)
       public void testComputeURL2g() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/action.do", null, null);
           String url = null;
           try {
  @@ -818,7 +818,7 @@
       // Second module -- Forward with external path
       public void testComputeURL2h() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/action.do", null, null);
           String url = null;
           try {
  @@ -1211,7 +1211,7 @@
       // Default module (default forwardPattern)
       public void testForwardURL1() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig);
           request.setPathElements("/myapp", "/action.do", null, null);
           ForwardConfig forward = null;
           String result = null;
  @@ -1276,7 +1276,7 @@
       // Second module (default forwardPattern)
       public void testForwardURL2() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/action.do", null, null);
           ForwardConfig forward = null;
           String result = null;
  @@ -1341,7 +1341,7 @@
       // Third module (custom forwardPattern)
       public void testForwardURL3() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig3);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig3);
           request.setPathElements("/myapp", "/3/action.do", null, null);
           ForwardConfig forward = null;
           String result = null;
  @@ -1409,7 +1409,7 @@
       // Default module (default pagePattern)
       public void testPageURL1() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig);
           request.setPathElements("/myapp", "/action.do", null, null);
           String page = null;
           String result = null;
  @@ -1428,7 +1428,7 @@
       // Second module (default pagePattern)
       public void testPageURL2() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig2);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig2);
           request.setPathElements("/myapp", "/2/action.do", null, null);
           String page = null;
           String result = null;
  @@ -1447,7 +1447,7 @@
       // Third module (custom pagePattern)
       public void testPageURL3() {
   
  -        request.setAttribute(Action.APPLICATION_KEY, appConfig3);
  +        request.setAttribute(Globals.MODULE_KEY, appConfig3);
           request.setPathElements("/myapp", "/3/action.do", null, null);
           String page = null;
           String result = null;
  @@ -1492,7 +1492,7 @@
           request.setPathElements("/myapp", "/noform.do", null, null);
           RequestUtils.selectApplication(request, context);
           ApplicationConfig appConfig = (ApplicationConfig)
  -            request.getAttribute(Action.APPLICATION_KEY);
  +            request.getAttribute(Globals.MODULE_KEY);
           assertNotNull("Selected an application", appConfig);
           assertEquals("Selected correct application",
                        "", appConfig.getPrefix());
  @@ -1507,7 +1507,7 @@
           request.setPathElements("/myapp", "/2/noform.do", null, null);
           RequestUtils.selectApplication(request, context);
           ApplicationConfig appConfig = (ApplicationConfig)
  -            request.getAttribute(Action.APPLICATION_KEY);
  +            request.getAttribute(Globals.MODULE_KEY);
           assertNotNull("Selected an application", appConfig);
           assertEquals("Selected correct application",
                        "/2", appConfig.getPrefix());
  @@ -1524,7 +1524,7 @@
                                "/noform.do");
           RequestUtils.selectApplication(request, context);
           ApplicationConfig appConfig = (ApplicationConfig)
  -            request.getAttribute(Action.APPLICATION_KEY);
  +            request.getAttribute(Globals.MODULE_KEY);
           assertNotNull("Selected an application", appConfig);
           assertEquals("Selected correct application",
                        "", appConfig.getPrefix());
  @@ -1541,7 +1541,7 @@
                                "/2/noform.do");
           RequestUtils.selectApplication(request, context);
           ApplicationConfig appConfig = (ApplicationConfig)
  -            request.getAttribute(Action.APPLICATION_KEY);
  +            request.getAttribute(Globals.MODULE_KEY);
           assertNotNull("Selected an application", appConfig);
           assertEquals("Selected correct application",
                        "/2", appConfig.getPrefix());
  
  
  
  1.3       +66 -46    jakarta-struts/src/test/org/apache/struts/tiles/TestTilesPlugin.java
  
  Index: TestTilesPlugin.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/test/org/apache/struts/tiles/TestTilesPlugin.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTilesPlugin.java	28 Feb 2003 02:42:15 -0000	1.2
  +++ TestTilesPlugin.java	4 May 2003 22:41:13 -0000	1.3
  @@ -141,19 +141,31 @@
        * Create a module configuration
        * @param moduleName
        */
  -  public ModuleConfig createModuleConfig( String moduleName, String configFileName, boolean
moduleAware )
  -  {
  -  ModuleConfig moduleConfig = ModuleConfigFactory.createFactory().createModuleConfig(moduleName);
  -  context.setAttribute(Action.APPLICATION_KEY + moduleName, moduleConfig);
  -
  -    // Set tiles plugin
  -  PlugInConfig pluginConfig = new PlugInConfig();
  -  pluginConfig.setClassName( "org.apache.struts.tiles.TilesPlugin" );
  -  pluginConfig.addProperty( "moduleAware", (moduleAware==true?"true":"false") );
  -  pluginConfig.addProperty( "definitions-config", "/org/apache/struts/tiles/config/" +
configFileName );
  -  moduleConfig.addPlugInConfig( pluginConfig );
  -  return moduleConfig;
  -  }
  +    public ModuleConfig createModuleConfig(
  +    	String moduleName,
  +    	String configFileName,
  +    	boolean moduleAware) {
  +            
  +    	ModuleConfig moduleConfig =
  +    		ModuleConfigFactory.createFactory().createModuleConfig(moduleName);
  +            
  +    	context.setAttribute(Globals.MODULE_KEY + moduleName, moduleConfig);
  +    
  +    	// Set tiles plugin
  +    	PlugInConfig pluginConfig = new PlugInConfig();
  +    	pluginConfig.setClassName("org.apache.struts.tiles.TilesPlugin");
  +        
  +    	pluginConfig.addProperty(
  +    		"moduleAware",
  +    		(moduleAware == true ? "true" : "false"));
  +            
  +    	pluginConfig.addProperty(
  +    		"definitions-config",
  +    		"/org/apache/struts/tiles/config/" + configFileName);
  +            
  +    	moduleConfig.addPlugInConfig(pluginConfig);
  +    	return moduleConfig;
  +    }
   
       /**
        * Fake call to init module plugins
  @@ -192,33 +204,41 @@
       /**
        * Test multi factory creation when moduleAware=true.
        */
  -  public void testMultiFactory()
  -  {
  -    // init TilesPlugin
  -  module1 = createModuleConfig( "/module1", "tiles-defs.xml", true );
  -  module2 = createModuleConfig( "/module2", "tiles-defs.xml", true );
  -  initModulePlugIns(module1);
  -  initModulePlugIns(module2);
  -
  -    // mock request context
  -  request.setAttribute(Action.APPLICATION_KEY, module1);
  -  request.setPathElements("/myapp", "/module1/foo.do", null, null);
  -    // Retrieve factory for module1
  -  DefinitionsFactory factory1 = TilesUtil.getDefinitionsFactory( request, context);
  -  assertNotNull( "factory found", factory1);
  -  assertEquals( "factory name", "/module1", factory1.getConfig().getFactoryName() );
  -
  -    // mock request context
  -  request.setAttribute(Action.APPLICATION_KEY, module2);
  -  request.setPathElements("/myapp", "/module2/foo.do", null, null);
  -    // Retrieve factory for module2
  -  DefinitionsFactory factory2 = TilesUtil.getDefinitionsFactory( request, context);
  -  assertNotNull( "factory found", factory2);
  -  assertEquals( "factory name", "/module2", factory2.getConfig().getFactoryName() );
  -
  -    // Check that factory are different
  -  assertNotSame("Factory from different modules", factory1, factory2);
  -  }
  +    public void testMultiFactory() {
  +    	// init TilesPlugin
  +    	module1 = createModuleConfig("/module1", "tiles-defs.xml", true);
  +    	module2 = createModuleConfig("/module2", "tiles-defs.xml", true);
  +    	initModulePlugIns(module1);
  +    	initModulePlugIns(module2);
  +    
  +    	// mock request context
  +    	request.setAttribute(Globals.MODULE_KEY, module1);
  +    	request.setPathElements("/myapp", "/module1/foo.do", null, null);
  +    	// Retrieve factory for module1
  +    	DefinitionsFactory factory1 =
  +    		TilesUtil.getDefinitionsFactory(request, context);
  +            
  +    	assertNotNull("factory found", factory1);
  +    	assertEquals(
  +    		"factory name",
  +    		"/module1",
  +    		factory1.getConfig().getFactoryName());
  +    
  +    	// mock request context
  +    	request.setAttribute(Globals.MODULE_KEY, module2);
  +    	request.setPathElements("/myapp", "/module2/foo.do", null, null);
  +    	// Retrieve factory for module2
  +    	DefinitionsFactory factory2 =
  +    		TilesUtil.getDefinitionsFactory(request, context);
  +    	assertNotNull("factory found", factory2);
  +    	assertEquals(
  +    		"factory name",
  +    		"/module2",
  +    		factory2.getConfig().getFactoryName());
  +    
  +    	// Check that factory are different
  +    	assertNotSame("Factory from different modules", factory1, factory2);
  +    }
   
       /**
        * Test single factory creation when moduleAware=false.
  @@ -232,7 +252,7 @@
     initModulePlugIns(module2);
   
       // mock request context
  -  request.setAttribute(Action.APPLICATION_KEY, module1);
  +  request.setAttribute(Globals.MODULE_KEY, module1);
     request.setPathElements("/myapp", "/module1/foo.do", null, null);
       // Retrieve factory for module1
     DefinitionsFactory factory1 = TilesUtil.getDefinitionsFactory( request, context);
  @@ -240,7 +260,7 @@
     assertEquals( "factory name", "/module1", factory1.getConfig().getFactoryName() );
   
       // mock request context
  -  request.setAttribute(Action.APPLICATION_KEY, module2);
  +  request.setAttribute(Globals.MODULE_KEY, module2);
     request.setPathElements("/myapp", "/module2/foo.do", null, null);
       // Retrieve factory for module2
     DefinitionsFactory factory2 = TilesUtil.getDefinitionsFactory( request, context);
  
  
  

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


Mime
View raw message