Commits

mrdon  committed 8f1aaa9

Make package parent list orderable

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1267e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits cc7708e

Comments (0)

Files changed (2)

File src/java/com/opensymphony/xwork2/config/entities/PackageConfig.java

     private Map interceptorConfigs = new LinkedHashMap();
     private Map<String, ResultTypeConfig> resultTypeConfigs = new LinkedHashMap<String, ResultTypeConfig>();
     private List globalExceptionMappingConfigs = new ArrayList();
-    private Set<PackageConfig> parents = new HashSet<PackageConfig>();
+    private List<PackageConfig> parents = new ArrayList<PackageConfig>();
     private String defaultInterceptorRef;
     private String defaultActionRef;
     private String defaultResultType;
             LOG.error("A package cannot extend itself: " + name);
         }
 
-        parents.add(parent);
+        parents.add(0, parent);
     }
 
     public void addResultTypeConfig(ResultTypeConfig config) {

File src/test/com/opensymphony/xwork2/config/entities/PackageConfigTest.java

+/*
+ * 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("pkg1");
+        cfg1.setDefaultInterceptorRef("ref1");
+        PackageConfig cfg2 = new PackageConfig("pkg2");
+        cfg2.setDefaultInterceptorRef("ref2");
+        PackageConfig cfg = new PackageConfig("pkg");
+        cfg.addParent(cfg1);
+        cfg.addParent(cfg2);
+        
+        assertEquals("ref2", cfg.getFullDefaultInterceptorRef());
+    }
+    
+}