You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by az...@apache.org on 2008/01/09 17:25:37 UTC

svn commit: r610437 - in /webservices/axis2/trunk/java/modules/clustering: ./ src/org/apache/axis2/clustering/configuration/ src/org/apache/axis2/clustering/context/ src/org/apache/axis2/clustering/context/commands/ src/org/apache/axis2/clustering/trib...

Author: azeez
Date: Wed Jan  9 08:25:28 2008
New Revision: 610437

URL: http://svn.apache.org/viewvc?rev=610437&view=rev
Log:
Fixing up some testcases


Added:
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java
Modified:
    webservices/axis2/trunk/java/modules/clustering/pom.xml
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/configuration/DefaultConfigurationManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateContextCommand.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java

Modified: webservices/axis2/trunk/java/modules/clustering/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/pom.xml?rev=610437&r1=610436&r2=610437&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/clustering/pom.xml Wed Jan  9 08:25:28 2008
@@ -68,7 +68,11 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <inherited>true</inherited>
                 <configuration>
-                    <skip>true</skip>
+                    <skip>false</skip>
+                    <excludes>
+                        <exclude>**/UpdateStateTest.java</exclude>
+                        <exclude>**/ConfigurationManagerTest.java</exclude>
+                    </excludes>
                     <includes>
                         <include>**/*Test.java</include>
                     </includes>

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/configuration/DefaultConfigurationManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/configuration/DefaultConfigurationManager.java?rev=610437&r1=610436&r2=610437&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/configuration/DefaultConfigurationManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/configuration/DefaultConfigurationManager.java Wed Jan  9 08:25:28 2008
@@ -190,7 +190,9 @@
 
     public void setConfigurationContext(ConfigurationContext configurationContext) {
         this.configurationContext = configurationContext;
-        listener.setConfigurationContext(configurationContext);
+        if (listener != null) {
+            listener.setConfigurationContext(configurationContext);
+        }
     }
 
     public void addParameter(Parameter param) throws AxisFault {

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java?rev=610437&r1=610436&r2=610437&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java Wed Jan  9 08:25:28 2008
@@ -161,20 +161,19 @@
                 Map diffs = context.getPropertyDifferences();
                 for (Iterator iter = diffs.keySet().iterator(); iter.hasNext();) {
                     String key = (String) iter.next();
-                    Object prop = context.getPropertyNonReplicable(key);
+                    Object value = context.getPropertyNonReplicable(key);
 
-                    // First check whether it is serializable
-                    if (prop instanceof Serializable) {
+                    if (value instanceof Serializable || value == null) { // in the case of removing properties, the value can be null
 
                         // Next check whether it matches an excluded pattern
                         if (!isExcluded(key,
                                         context.getClass().getName(),
                                         excludedPropertyPatterns)) {
                             if (log.isDebugEnabled()) {
-                                log.debug("sending property =" + key + "-" + prop);
+                                log.debug("sending property =" + key + "-" + value);
                             }
                             PropertyDifference diff = (PropertyDifference) diffs.get(key);
-                            diff.setValue(prop);
+                            diff.setValue(value);
                             updateCmd.addProperty(diff);
                         }
                     }
@@ -184,15 +183,15 @@
             synchronized (context) {
                 for (Iterator iter = context.getPropertyNames(); iter.hasNext();) {
                     String key = (String) iter.next();
-                    Object prop = context.getPropertyNonReplicable(key);
-                    if (prop instanceof Serializable) { // First check whether it is serializable
+                    Object value = context.getPropertyNonReplicable(key);
+                    if (value instanceof Serializable || value == null) { // in the case of removing properties, the value can be null
 
                         // Next check whether it matches an excluded pattern
                         if (!isExcluded(key, context.getClass().getName(), excludedPropertyPatterns)) {
                             if (log.isDebugEnabled()) {
-                                log.debug("sending property =" + key + "-" + prop);
+                                log.debug("sending property =" + key + "-" + value);
                             }
-                            PropertyDifference diff = new PropertyDifference(key, prop, false);
+                            PropertyDifference diff = new PropertyDifference(key, value, false);
                             updateCmd.addProperty(diff);
                         }
                     }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java?rev=610437&r1=610436&r2=610437&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/DefaultContextManager.java Wed Jan  9 08:25:28 2008
@@ -37,6 +37,7 @@
 public class DefaultContextManager implements ContextManager {
 
     private ConfigurationContext configContext;
+    private ContextManagerListener listener;
 
     private Map parameters = new HashMap();
 
@@ -105,13 +106,17 @@
     }
 
     public void setContextManagerListener(ContextManagerListener listener) {
+        this.listener = listener;
         if (configContext != null) {
-            listener.setConfigurationContext(configContext);
+            this.listener.setConfigurationContext(configContext);
         }
     }
 
     public void setConfigurationContext(ConfigurationContext configurationContext) {
         this.configContext = configurationContext;
+        if(listener != null){
+            listener.setConfigurationContext(configContext);
+        }
     }
 
     public void setReplicationExcludePatterns(String contextType, List patterns) {

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateContextCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateContextCommand.java?rev=610437&r1=610436&r2=610437&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateContextCommand.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/commands/UpdateContextCommand.java Wed Jan  9 08:25:28 2008
@@ -42,7 +42,7 @@
     public void addProperty(PropertyDifference diff) {
         if (propertyUpdater.getProperties() == null) {
             propertyUpdater.setProperties(new HashMap());
-        }
+        }                                        
         propertyUpdater.addContextProperty(diff);
     }
 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java?rev=610437&r1=610436&r2=610437&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java Wed Jan  9 08:25:28 2008
@@ -81,12 +81,10 @@
         this.configurationContext = configurationContext;
         this.synchronizeAllMembers = synchronizeAllMembers;
 
-        if (synchronizeAllMembers) {
-            Timer cleanupTimer = new Timer();
-            cleanupTimer.scheduleAtFixedRate(new ReceivedMessageCleanupTask(),
-                                             TIME_TO_LIVE,
-                                             TIME_TO_LIVE);
-        }
+        Timer cleanupTimer = new Timer();
+        cleanupTimer.scheduleAtFixedRate(new ReceivedMessageCleanupTask(),
+                                         TIME_TO_LIVE,
+                                         TIME_TO_LIVE);
     }
 
     public void setContextManager(DefaultContextManager contextManager) {
@@ -138,12 +136,15 @@
             && !(msg instanceof GetStateResponseCommand) &&
             !(msg instanceof GetConfigurationResponseCommand)) {
 
-            log.warn("Received message before cluster initialization has been completed");
+            log.warn("Received message " + msg +
+                     " before cluster initialization has been completed from " +
+                     TribesUtil.getHost(sender));
             return;
         }
         if (log.isDebugEnabled()) {
             log.debug("Received message " + msg + " from " + TribesUtil.getHost(sender));
         }
+
         try {
             processMessage(msg, sender);
         } catch (Exception e) {
@@ -159,16 +160,14 @@
             String msgId = ctxCmd.getUniqueId();
 
             // Check for duplicate messages and ignore duplicates in order to support at-most-once semantics
-            if (synchronizeAllMembers) { // Duplicates can be received only if an ACK & retransmit mechanism is used
-                if (receivedMessages.containsKey(msgId)) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Received duplicate message " + ctxCmd);
-                    }
-                    return;
-                }
-                synchronized (receivedMessages) {
-                    receivedMessages.put(msgId, new Long(System.currentTimeMillis()));// Let's keep track of the message as well as the time at which it was first received
+            if (receivedMessages.containsKey(msgId)) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Received duplicate message " + ctxCmd);
                 }
+                return;
+            }
+            synchronized (receivedMessages) {
+                receivedMessages.put(msgId, new Long(System.currentTimeMillis()));// Let's keep track of the message as well as the time at which it was first received
             }
 
             // Process the message

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java?rev=610437&r1=610436&r2=610437&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java Wed Jan  9 08:25:28 2008
@@ -71,7 +71,6 @@
                         sendToMember(msg, member);
                     }
                 }
-
             } catch (Exception e) {
                 String message = "Error sending command message : " + msg +
                                  ". Reason " + e.getMessage();

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java?rev=610437&r1=610436&r2=610437&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java Wed Jan  9 08:25:28 2008
@@ -67,6 +67,7 @@
     private ConfigurationContext configurationContext;
     private TribesControlCommandProcessor controlCmdProcessor;
     private ChannelListener channelListener;
+    private ChannelSender channelSender;
 
     public TribesClusterManager() {
         parameters = new HashMap();
@@ -121,18 +122,19 @@
             }
         }
 
-        ChannelSender sender = new ChannelSender();
-
+        channelSender = new ChannelSender();
         channelListener = new ChannelListener(configurationContext,
                                               configurationManager,
                                               contextManager,
                                               controlCmdProcessor,
-                                              sender,
+                                              channelSender,
                                               synchronizeAllMembers());
 
-        controlCmdProcessor.setChannelSender(sender);
+        controlCmdProcessor.setChannelSender(channelSender);
         channel = new GroupChannel();
 
+
+
         // Set the IP address that will be advertised by this node
         String localIP = System.getProperty(ClusteringConstants.LOCAL_IP_ADDRESS);
         if (localIP != null) {
@@ -195,7 +197,7 @@
         } catch (ChannelException e) {
             throw new ClusteringFault("Error starting Tribes channel", e);
         }
-        sender.setChannel(channel);
+        channelSender.setChannel(channel);
 
 //        Member[] members = channel.getMembers();
         log.info("Local Tribes Member " + TribesUtil.getLocalHost(channel));
@@ -203,16 +205,16 @@
 
         // If configuration management is enabled, get the latest config from a neighbour
         if (configurationManager != null) {
-            configurationManager.setSender(sender);
-            getInitializationMessage(sender, new GetConfigurationCommand());
+            configurationManager.setSender(channelSender);
+            getInitializationMessage(channelSender, new GetConfigurationCommand());
         }
 
         // If context replication is enabled, get the latest state from a neighbour  
         if (contextManager != null) {
-            contextManager.setSender(sender);
+            contextManager.setSender(channelSender);
             channelListener.setContextManager(contextManager);
-            getInitializationMessage(sender, new GetStateCommand());
-            ClusteringContextListener contextListener = new ClusteringContextListener(sender);
+            getInitializationMessage(channelSender, new GetStateCommand());
+            ClusteringContextListener contextListener = new ClusteringContextListener(channelSender);
             configurationContext.addContextListener(contextListener);
         }
         configurationContext.
@@ -234,6 +236,7 @@
         // Keep track of members to whom we already sent an initialization command
         // Do not send another request to these members
         List sentMembersList = new ArrayList();
+        sentMembersList.add(TribesUtil.getLocalHost(channel));
         Member[] members = MembershipManager.getMembers();
         while (members.length > 0 &&
                configurationContext.
@@ -265,10 +268,12 @@
 
     public void setConfigurationManager(ConfigurationManager configurationManager) {
         this.configurationManager = (DefaultConfigurationManager) configurationManager;
+        this.configurationManager.setSender(channelSender);
     }
 
     public void setContextManager(ContextManager contextManager) {
         this.contextManager = (DefaultContextManager) contextManager;
+        this.contextManager.setSender(channelSender);
     }
 
     public void addParameter(Parameter param) throws AxisFault {
@@ -322,6 +327,12 @@
         controlCmdProcessor.setConfigurationContext(configurationContext);
         if (channelListener != null) {
             channelListener.setConfigurationContext(configurationContext);
+        }
+        if (configurationManager != null) {
+            configurationManager.setConfigurationContext(configurationContext);
+        }
+        if (contextManager != null) {
+            contextManager.setConfigurationContext(configurationContext);
         }
     }
 

Added: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java?rev=610437&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java (added)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java Wed Jan  9 08:25:28 2008
@@ -0,0 +1,232 @@
+/*                                                                             
+ * Copyright 2004,2005 The Apache Software Foundation.                         
+ *                                                                             
+ * Licensed under the Apache License, Version 2.0 (the "License");             
+ * you may not use this file except in compliance with the License.            
+ * You may obtain a copy of the License at                                     
+ *                                                                             
+ *      http://www.apache.org/licenses/LICENSE-2.0                             
+ *                                                                             
+ * Unless required by applicable law or agreed to in writing, software         
+ * distributed under the License is distributed on an "AS IS" BASIS,           
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.    
+ * See the License for the specific language governing permissions and         
+ * limitations under the License.                                              
+ */
+package org.apache.axis2.clustering;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.util.UUIDGenerator;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.clustering.configuration.ConfigurationManager;
+import org.apache.axis2.clustering.configuration.DefaultConfigurationManager;
+import org.apache.axis2.clustering.configuration.DefaultConfigurationManagerListener;
+import org.apache.axis2.clustering.context.ContextManager;
+import org.apache.axis2.clustering.context.DefaultContextManager;
+import org.apache.axis2.clustering.context.DefaultContextManagerListener;
+import org.apache.axis2.clustering.tribes.TribesClusterManager;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.transport.http.server.HttpUtils;
+
+/**
+ *
+ */
+public class ContextReplicationTest extends TestCase {
+
+    private static final String TEST_SERVICE_NAME = "testService";
+
+    private ClusterManager clusterManager1;
+    private ContextManager ctxMan1;
+    private ConfigurationManager configMan1;
+    private ConfigurationContext configurationContext1;
+    private AxisServiceGroup serviceGroup1;
+    private AxisService service1;
+
+    private ClusterManager clusterManager2;
+    private ContextManager ctxMan2;
+    private ConfigurationManager configMan2;
+    private ConfigurationContext configurationContext2;
+    private AxisServiceGroup serviceGroup2;
+    private AxisService service2;
+
+    protected void setUp() throws Exception {
+        System.setProperty(ClusteringConstants.LOCAL_IP_ADDRESS, HttpUtils.getIpAddress());
+
+        // First cluster
+        configurationContext1 =
+                ConfigurationContextFactory.createDefaultConfigurationContext();
+        serviceGroup1 = createAxisServiceGroup(configurationContext1);
+        service1 = createAxisService(serviceGroup1);
+        ctxMan1 = getContextManager();
+        configMan1 = getConfigurationManager();
+        clusterManager1 = getClusterManager(configurationContext1, ctxMan1, configMan1);
+        clusterManager1.init();
+        System.out.println("ClusterManager-1 successfully initialized");
+
+        // Second cluster
+        configurationContext2 =
+                ConfigurationContextFactory.createDefaultConfigurationContext();
+        serviceGroup2 = createAxisServiceGroup(configurationContext2);
+        service2 = createAxisService(serviceGroup2);
+        ctxMan2 = getContextManager();
+        configMan2 = getConfigurationManager();
+        clusterManager2 = getClusterManager(configurationContext2, ctxMan2, configMan2);
+        clusterManager2.init();
+        System.out.println("ClusterManager-2 successfully initialized");
+    }
+
+    protected ClusterManager getClusterManager(ConfigurationContext configCtx,
+                                               ContextManager contextManager,
+                                               ConfigurationManager configManager)
+            throws AxisFault {
+        ClusterManager clusterManager = new TribesClusterManager();
+        configCtx.getAxisConfiguration().setClusterManager(clusterManager);
+
+        configManager.
+                setConfigurationManagerListener(new DefaultConfigurationManagerListener());
+        clusterManager.setConfigurationManager(configManager);
+
+        contextManager.setContextManagerListener(new DefaultContextManagerListener());
+        clusterManager.setContextManager(contextManager);
+
+        clusterManager.setConfigurationContext(configCtx);
+
+        return clusterManager;
+    }
+
+    protected AxisServiceGroup createAxisServiceGroup(ConfigurationContext configCtx)
+            throws AxisFault {
+        AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
+        AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig);
+        axisConfig.addServiceGroup(serviceGroup);
+        return serviceGroup;
+    }
+
+    protected AxisService createAxisService(AxisServiceGroup serviceGroup) throws AxisFault {
+        AxisService service = new AxisService(TEST_SERVICE_NAME);
+        serviceGroup.addService(service);
+        return service;
+    }
+
+    protected ContextManager getContextManager() throws AxisFault {
+        ContextManager contextManager = new DefaultContextManager();
+        contextManager.setContextManagerListener(new DefaultContextManagerListener());
+        return contextManager;
+    }
+
+    protected ConfigurationManager getConfigurationManager() throws AxisFault {
+        ConfigurationManager contextManager = new DefaultConfigurationManager();
+        contextManager.setConfigurationManagerListener(new DefaultConfigurationManagerListener());
+        return contextManager;
+    }
+
+    public void testSetPropertyInConfigurationContext() throws Exception {
+        {
+            String key1 = "configCtxKey";
+            String val1 = "configCtxVal1";
+            configurationContext1.setProperty(key1, val1);
+            ctxMan1.updateContext(configurationContext1);
+            Thread.sleep(1000); // Give some time for the replication to take place
+
+            String value = (String) configurationContext2.getProperty(key1);
+            assertEquals(val1, value);
+        }
+
+        {
+            String key2 = "configCtxKey2";
+            String val2 = "configCtxVal1";
+            configurationContext2.setProperty(key2, val2);
+            ctxMan2.updateContext(configurationContext2);
+            Thread.sleep(1000); // Give some time for the replication to take place
+
+            String value = (String) configurationContext1.getProperty(key2);
+            assertEquals(val2, value);
+        }
+    }
+
+    public void testRemovePropertyFromConfigurationContext() throws Exception {
+        String key1 = "configCtxKey";
+        String val1 = "configCtxVal1";
+
+        // First set the property on a cluster 1 and replicate it
+        {
+            configurationContext1.setProperty(key1, val1);
+            ctxMan1.updateContext(configurationContext1);
+            Thread.sleep(1000); // Give some time for the replication to take place
+
+            String value = (String) configurationContext2.getProperty(key1);
+            assertEquals(val1, value);
+        }
+
+        // Next remove this property from cluster 2, replicate it, and check that it is unavailable in cluster 1
+        configurationContext2.removeProperty(key1);
+        ctxMan2.updateContext(configurationContext2);
+        Thread.sleep(1000); // Give some time for the replication to take place
+
+        String value = (String) configurationContext1.getProperty(key1);
+        assertNull(configurationContext2.getProperty(key1));
+        assertNull(value);
+    }
+
+    public void testSetPropertyInServiceGroupContext() throws Exception {
+//        String sgcID = UUIDGenerator.getUUID();
+
+        ServiceGroupContext serviceGroupContext1 =
+                configurationContext1.createServiceGroupContext(serviceGroup1);
+        serviceGroupContext1.setId(TEST_SERVICE_NAME);
+        configurationContext1.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext1);
+        assertNotNull(serviceGroupContext1);
+
+        ServiceGroupContext serviceGroupContext2 =
+                configurationContext2.createServiceGroupContext(serviceGroup2);
+        serviceGroupContext2.setId(TEST_SERVICE_NAME);
+        configurationContext2.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext2);
+        assertNotNull(serviceGroupContext2);
+
+        String key1 = "sgCtxKey";
+        String val1 = "sgCtxVal1";
+        serviceGroupContext1.setProperty(key1, val1);
+        ctxMan1.updateContext(serviceGroupContext1);
+
+        Thread.sleep(1000);
+        assertEquals(val1, serviceGroupContext2.getProperty(key1));
+    }
+
+    public void testSetPropertyInServiceGroupContext2() throws Exception {
+        String sgcID = UUIDGenerator.getUUID();
+
+        ServiceGroupContext serviceGroupContext1 =
+                configurationContext1.createServiceGroupContext(serviceGroup1);
+        serviceGroupContext1.setId(sgcID);
+        configurationContext1.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext1);
+        assertNotNull(serviceGroupContext1);
+
+        ServiceGroupContext serviceGroupContext2 =
+                configurationContext2.createServiceGroupContext(serviceGroup2);
+        serviceGroupContext2.setId(sgcID);
+        configurationContext2.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext2);
+        assertNotNull(serviceGroupContext2);
+
+        String key1 = "sgCtxKey";
+        String val1 = "sgCtxVal1";
+        serviceGroupContext1.setProperty(key1, val1);
+        ctxMan1.updateContext(serviceGroupContext1);
+
+        Thread.sleep(1000);
+        assertEquals(val1, serviceGroupContext2.getProperty(key1));
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        clusterManager1.shutdown();
+        clusterManager2.shutdown();
+    }
+    /*public void test2() {
+
+    }*/
+}

Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java?rev=610437&r1=610436&r2=610437&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java Wed Jan  9 08:25:28 2008
@@ -38,15 +38,12 @@
     String sgcID = null;
 
     String key1 = "key1";
-
-    String key2 = "key2";
-
-    String key3 = "key3";
-
     String val1 = "val1";
 
+    String key2 = "key2";
     String val2 = "val2";
 
+    String key3 = "key3";
     String val3 = "val3";
 
     public void setUp() throws Exception {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org