Commits

Anonymous committed 5aa71ae

WW-945
- Global Results conflict

git-svn-id: http://svn.opensymphony.com/svn/xwork/branches/xwork_1-2@1066e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits e331fc4
  • Branches xwork_1-2

Comments (0)

Files changed (5)

src/java/com/opensymphony/xwork/config/impl/DefaultConfiguration.java

      */
     private ActionConfig buildFullActionConfig(PackageConfig packageContext, ActionConfig baseConfig) throws ConfigurationException {
         Map params = new TreeMap(baseConfig.getParams());
-        Map results = new TreeMap(packageContext.getAllGlobalResults());
-        results.putAll(baseConfig.getResults());
+        
+        Map results = new TreeMap();
+        if (baseConfig.getPackageName().equals(packageContext.getName())) {
+        	results = new TreeMap(packageContext.getAllGlobalResults());
+        	results.putAll(baseConfig.getResults());
+        }
+        else {
+            PackageConfig baseConfigPackageConfig = (PackageConfig) packageContexts.get(baseConfig.getPackageName());
+            results = new TreeMap(baseConfigPackageConfig.getAllGlobalResults());
+            results.putAll(baseConfig.getResults());
+        }
 
         setDefaultResults(results, packageContext);
 

src/test/com/opensymphony/xwork/ActionNestingTest.java

          * Initializes the configuration object.
          */
         public void init(Configuration configurationManager) {
-            PackageConfig packageContext = new PackageConfig();
+            PackageConfig packageContext = new PackageConfig("nestedActionTest");
             ActionConfig config = new ActionConfig(null, SimpleAction.class, null, null, null);
+            config.setPackageName("nestedActionTest");
             packageContext.addActionConfig(SIMPLE_ACTION_NAME, config);
             config = new ActionConfig("noStack", com.opensymphony.xwork.NestedAction.class, null, null, null);
+            config.setPackageName("nestedActionTest");
             packageContext.addActionConfig(NO_STACK_ACTION_NAME, config);
             config = new ActionConfig("stack", com.opensymphony.xwork.NestedAction.class, null, null, null);
+            config.setPackageName("nestedActionTest");
             packageContext.addActionConfig(STACK_ACTION_NAME, config);
             packageContext.setNamespace(NAMESPACE);
             configurationManager.addPackageConfig("nestedActionTest", packageContext);

src/test/com/opensymphony/xwork/config/providers/MockConfigurationProvider.java

      * Initializes the configuration object.
      */
     public void init(Configuration configurationManager) {
-        PackageConfig defaultPackageContext = new PackageConfig();
+        PackageConfig defaultPackageContext = new PackageConfig("defaultPackage");
         HashMap params = new HashMap();
         params.put("bar", "5");
 
         results.put("success", new ResultConfig("success", ActionChainResult.class, successParams));
 
         ActionConfig fooActionConfig = new ActionConfig(null, SimpleAction.class, params, results, null);
+        fooActionConfig.setPackageName("defaultPackage");
         defaultPackageContext.addActionConfig(FOO_ACTION_NAME, fooActionConfig);
 
         results = new HashMap();
         interceptors.add(new InterceptorMapping("params", new ParametersInterceptor()));
 
         ActionConfig paramInterceptorActionConfig = new ActionConfig(null, SimpleAction.class, null, results, interceptors);
+        paramInterceptorActionConfig.setPackageName("defaultPackage");
         defaultPackageContext.addActionConfig(PARAM_INTERCEPTOR_ACTION_NAME, paramInterceptorActionConfig);
 
         interceptors = new ArrayList();
         interceptors.add(new InterceptorMapping("params", new ParametersInterceptor()));
 
         ActionConfig modelParamActionConfig = new ActionConfig(null, ModelDrivenAction.class, null, null, interceptors);
+        modelParamActionConfig.setPackageName("defaultPackage");
         defaultPackageContext.addActionConfig(MODEL_DRIVEN_PARAM_TEST, modelParamActionConfig);
         
         //List paramFilterInterceptor=new ArrayList();
         params.put("percentage", new Double(100.0123));
 
         ActionConfig validationActionConfig = new ActionConfig(null, SimpleAction.class, params, results, interceptors);
+        validationActionConfig.setPackageName("defaultPackage");
         defaultPackageContext.addActionConfig(VALIDATION_ACTION_NAME, validationActionConfig);
         defaultPackageContext.addActionConfig(VALIDATION_ALIAS_NAME, validationActionConfig);
         defaultPackageContext.addActionConfig(VALIDATION_SUBPROPERTY_NAME, validationActionConfig);
         params = new HashMap();
         params.put("percentage", new Double(1.234567));
         ActionConfig percentageActionConfig = new ActionConfig(null, SimpleAction.class, params, results, interceptors);
+        percentageActionConfig.setPackageName("defaultPackage");
         defaultPackageContext.addActionConfig("percentage", percentageActionConfig);
 
         // We need this actionconfig to be the final destination for action chaining
         ActionConfig barActionConfig = new ActionConfig(null, SimpleAction.class, null, null, null);
+        barActionConfig.setPackageName("defaultPackage");
         defaultPackageContext.addActionConfig("bar", barActionConfig);
 
         configurationManager.addPackageConfig("defaultPackage", defaultPackageContext);

src/test/com/opensymphony/xwork/config/providers/XmlConfigurationProviderGlobalResultInheritenceTest.java

         assertFalse(parentResultConfig1 == anotherResultConfig1);
         assertFalse(parentResultConfig2 == anotherResultConfig2);
 
-        assertTrue(parentResultConfig1 == childResultConfig1);
+        assertFalse(parentResultConfig1 == childResultConfig1);
         assertTrue(parentResultConfig2 == childResultConfig2);
     }
 }

src/test/com/opensymphony/xwork/interceptor/PreResultListenerTest.java

             public void init(Configuration configuration) throws ConfigurationException {
                 PackageConfig packageConfig = new PackageConfig("package");
                 ActionConfig actionConfig = new ActionConfig(null, SimpleFooAction.class, null, null, null);
+                actionConfig.setPackageName("package");
                 packageConfig.addActionConfig("action", actionConfig);
                 configuration.addPackageConfig("package", packageConfig);
             }