Anonymous avatar Anonymous committed 7c14a05

Issue number: XW-359
Obtained from:
Submitted by:
Reviewed by:

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

Comments (0)

Files changed (2)

src/java/com/opensymphony/xwork/config/ConfigurationManager.java

 
     public static synchronized void destroyConfiguration() {
         synchronized (configurationProviders) {
+        	clearConfigurationProviders(); // let's destroy the ConfigurationProvider first
             configurationProviders = new ArrayList();
+            
+            if (configurationInstance != null)
+            	configurationInstance.destroy(); // let's destroy it first, before nulling it.
             configurationInstance = null;
         }
     }

src/test/com/opensymphony/xwork/config/ConfigurationManagerTest.java

  */
 package com.opensymphony.xwork.config;
 
+import org.easymock.MockControl;
+
 import com.mockobjects.dynamic.C;
 import com.mockobjects.dynamic.Mock;
 import com.opensymphony.util.FileManager;
         configProviderMock.expect("destroy");
     }
 
+    public void testDestroyConfiguration() throws Exception {
+    	MockControl control = MockControl.createControl(Configuration.class);
+    	Configuration configuration = (Configuration) control.getMock();
+    	ConfigurationManager.setConfiguration(configuration);
+    	
+    	configuration.destroy();		// EasyMock
+    	configProviderMock.expect("destroy");  // MockObject
+    	control.replay();
+    	ConfigurationManager.destroyConfiguration();
+    	configProviderMock.verify();
+    	control.verify();
+    }
+    
+    public void testClearConfigurationProviders() throws Exception {
+    	configProviderMock.expect("destroy");  
+    	ConfigurationManager.clearConfigurationProviders();
+    	configProviderMock.verify();
+    }
+    
     protected void setUp() throws Exception {
         super.setUp();
         ConfigurationManager.destroyConfiguration();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.