You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2010/01/27 02:46:59 UTC

svn commit: r903520 - in /geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src: main/java/org/apache/geronimo/farm/deployment/ test/java/org/apache/geronimo/farm/deployment/

Author: djencks
Date: Wed Jan 27 01:46:58 2010
New Revision: 903520

URL: http://svn.apache.org/viewvc?rev=903520&view=rev
Log:
GERONIMO-4844 Fix uninstall in a cluster.  Thanks to Ashish Jain for the original patch, the test also needed tweaking

Modified:
    geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClient.java
    geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/test/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClientTest.java

Modified: geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClient.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClient.java?rev=903520&r1=903519&r2=903520&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClient.java (original)
+++ geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClient.java Wed Jan 27 01:46:58 2010
@@ -40,6 +40,8 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.repository.Artifact;
 
@@ -129,12 +131,11 @@
 
     protected void uninstall(NodeInfo nodeInfo, Artifact configId) throws IOException {
         Kernel kernel = nodeInfo.newKernel();
-        
-        AbstractName clusterConfigurationStoreName = searchClusterConfigurationStore(kernel);
-        
-        Object[] params = new Object[] {configId};
         try {
-            kernel.invoke(clusterConfigurationStoreName, "uninstall", params, METHOD_SIGNATURE_UNINSTALL);
+        	ConfigurationManager configurationManager = (ConfigurationManager) kernel.getGBean(ConfigurationManager.class);
+            configurationManager.stopConfiguration(configId);
+            configurationManager.unloadConfiguration(configId);
+            configurationManager.uninstallConfiguration(configId);
         } catch (Exception e) {
             throw (IOException) new IOException("See nested").initCause(e);
         }

Modified: geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/test/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClientTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/test/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClientTest.java?rev=903520&r1=903519&r2=903520&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/test/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClientTest.java (original)
+++ geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/test/java/org/apache/geronimo/farm/deployment/BasicClusterConfigurationStoreClientTest.java Wed Jan 27 01:46:58 2010
@@ -40,6 +40,7 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.NoSuchOperationException;
 import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 
@@ -66,6 +67,7 @@
     private AbstractNameQuery clusterConfigurationStoreNameQuery;
     private Artifact configId;
     private ConfigurationData configurationData;
+    private ConfigurationManager configurationManager;
 
     @Override
     protected void setUp() throws Exception {
@@ -73,7 +75,7 @@
         configurationData = new ConfigurationData(new Environment(configId), new Jsr77Naming());
         File configurationDir = new File("configurationDir");
         configurationData.setConfigurationDir(configurationDir);
-
+        configurationManager = (ConfigurationManager) mock(ConfigurationManager.class);
         clusterInfo = (ClusterInfo) mock(ClusterInfo.class);
 
         Collection<NodeInfo> nodeInfos = new ArrayList<NodeInfo>();
@@ -228,11 +230,11 @@
     private void recordUninstall(Kernel kernel) throws GBeanNotFoundException, NoSuchOperationException, Exception {
         AbstractName storeName = new AbstractName(configId, Collections.singletonMap("name", "Store"));
         Set<AbstractName> storeNames = Collections.singleton(storeName);
-
-        kernel.listGBeans(clusterConfigurationStoreNameQuery);
-        modify().returnValue(storeNames);
-        
-        kernel.invoke(storeName, "uninstall", new Object[] {configId}, new String[] {Artifact.class.getName()});
+        kernel.getGBean(ConfigurationManager.class);
+        modify().returnValue(configurationManager);
+        configurationManager.stopConfiguration(configId);
+        configurationManager.unloadConfiguration(configId);
+        configurationManager.uninstallConfiguration(configId);
     }
     
     private void recordInstall(Kernel kernel, File packedDir) throws Exception {