Revision: 15598
Author: [email protected]
Date: Wed Dec  1 10:25:06 2010
Log: Update Issue 1875

test for stateful proxy use case working with checks for mem leaks
http://code.google.com/p/mobicents/source/detail?r=15598

Added:
/trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/DialogDataRemovalListener.java /trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/ServerTransactionDataRemovalListener.java
Deleted:
/trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/DataRemovalListener.java
Modified:
/trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/MobicentsSipCache.java /trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/ServerTransactionCacheData.java /trunk/servers/jain-sip-ha/jboss-5/src/test/java/org/mobicents/ha/javax/sip/ProxyEarlyDialogRecoveryOn1xxTest.java /trunk/servers/jain-sip-ha/jboss-5/src/test/java/org/mobicents/ha/javax/sip/SimpleStatefulProxy.java

=======================================
--- /dev/null
+++ /trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/DialogDataRemovalListener.java Wed Dec 1 10:25:06 2010
@@ -0,0 +1,57 @@
+package org.mobicents.ha.javax.sip.cache;
+
+import org.jboss.cache.Fqn;
+import org.mobicents.ha.javax.sip.ClusteredSipStack;
+
+/**
+ *
+ * @author martins
+ *
+ */
+public class DialogDataRemovalListener implements
+               org.mobicents.cluster.DataRemovalListener {
+
+       /**
+        *
+        */
+       private final Fqn baseFqn;
+
+       /**
+        *
+        */
+       private final ClusteredSipStack clusteredSipStack;
+
+       /**
+        *
+        * @param baseFqn
+        * @param clusteredSipStack
+        */
+       public DialogDataRemovalListener(Fqn baseFqn,
+                       ClusteredSipStack clusteredSipStack) {
+               this.baseFqn = baseFqn;
+               this.clusteredSipStack = clusteredSipStack;
+       }
+
+       /*
+        * (non-Javadoc)
+        *
+        * @see
+        * org.mobicents.cluster.DataRemovalListener#dataRemoved(org.jboss.cache
+        * .Fqn)
+        */
+       @SuppressWarnings("unchecked")
+       public void dataRemoved(Fqn fqn) {
+ clusteredSipStack.remoteServerTransactionRemoval((String) fqn.getLastElement());
+       }
+
+       /*
+        * (non-Javadoc)
+        *
+        * @see org.mobicents.cluster.DataRemovalListener#getBaseFqn()
+        */
+       @SuppressWarnings("unchecked")
+       public Fqn getBaseFqn() {
+               return baseFqn;
+       }
+
+}
=======================================
--- /dev/null
+++ /trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/ServerTransactionDataRemovalListener.java Wed Dec 1 10:25:06 2010
@@ -0,0 +1,57 @@
+package org.mobicents.ha.javax.sip.cache;
+
+import org.jboss.cache.Fqn;
+import org.mobicents.ha.javax.sip.ClusteredSipStack;
+
+/**
+ *
+ * @author martins
+ *
+ */
+public class ServerTransactionDataRemovalListener implements
+               org.mobicents.cluster.DataRemovalListener {
+
+       /**
+        *
+        */
+       private final Fqn baseFqn;
+
+       /**
+        *
+        */
+       private final ClusteredSipStack clusteredSipStack;
+
+       /**
+        *
+        * @param baseFqn
+        * @param clusteredSipStack
+        */
+       public ServerTransactionDataRemovalListener(Fqn baseFqn,
+                       ClusteredSipStack clusteredSipStack) {
+               this.baseFqn = baseFqn;
+               this.clusteredSipStack = clusteredSipStack;
+       }
+
+       /*
+        * (non-Javadoc)
+        *
+        * @see
+        * org.mobicents.cluster.DataRemovalListener#dataRemoved(org.jboss.cache
+        * .Fqn)
+        */
+       @SuppressWarnings("unchecked")
+       public void dataRemoved(Fqn fqn) {
+               clusteredSipStack.remoteDialogRemoval((String) 
fqn.getLastElement());
+       }
+
+       /*
+        * (non-Javadoc)
+        *
+        * @see org.mobicents.cluster.DataRemovalListener#getBaseFqn()
+        */
+       @SuppressWarnings("unchecked")
+       public Fqn getBaseFqn() {
+               return baseFqn;
+       }
+
+}
=======================================
--- /trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/DataRemovalListener.java Thu Apr 29 08:02:05 2010
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.mobicents.ha.javax.sip.cache;
-
-import org.jboss.cache.Fqn;
-import org.mobicents.ha.javax.sip.ClusteredSipStack;
-
-/**
- *
- * @author martins
- *
- */
-public class DataRemovalListener implements
-               org.mobicents.cluster.DataRemovalListener {
-
-       /**
-        *
-        */
-       private final Fqn baseFqn;
-
-       /**
-        *
-        */
-       private final ClusteredSipStack clusteredSipStack;
-
-       /**
-        *
-        * @param baseFqn
-        * @param clusteredSipStack
-        */
-       public DataRemovalListener(Fqn baseFqn,
-                       ClusteredSipStack clusteredSipStack) {
-               this.baseFqn = baseFqn;
-               this.clusteredSipStack = clusteredSipStack;
-       }
-
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * org.mobicents.cluster.DataRemovalListener#dataRemoved(org.jboss.cache
-        * .Fqn)
-        */
-       @SuppressWarnings("unchecked")
-       public void dataRemoved(Fqn fqn) {
-               clusteredSipStack.remoteDialogRemoval((String) 
fqn.getLastElement());
-       }
-
-       /*
-        * (non-Javadoc)
-        *
-        * @see org.mobicents.cluster.DataRemovalListener#getBaseFqn()
-        */
-       @SuppressWarnings("unchecked")
-       public Fqn getBaseFqn() {
-               return baseFqn;
-       }
-
-}
=======================================
--- /trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/MobicentsSipCache.java Fri Nov 26 13:41:33 2010 +++ /trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/MobicentsSipCache.java Wed Dec 1 10:25:06 2010
@@ -54,9 +54,9 @@
        private static final String DEFAULT_NAME = "jain-sip-ha";

        private SIPDialogCacheData dialogsCacheData;
-       private DataRemovalListener dialogDataRemovalListener;
+       private DialogDataRemovalListener dialogDataRemovalListener;
        private ServerTransactionCacheData serverTransactionCacheData;
-       private DataRemovalListener serverTransactionDataRemovalListener;
+       private DialogDataRemovalListener serverTransactionDataRemovalListener;

        /**
         *
@@ -147,12 +147,12 @@
        public void start() throws SipCacheException {
dialogsCacheData = new SIPDialogCacheData(Fqn.fromElements(name,SipCache.DIALOG_PARENT_FQN_ELEMENT),cluster.getMobicentsCache(), clusteredSipStack);
                dialogsCacheData.create();
- dialogDataRemovalListener = new DataRemovalListener(dialogsCacheData.getNodeFqn(), clusteredSipStack); + dialogDataRemovalListener = new DialogDataRemovalListener(dialogsCacheData.getNodeFqn(), clusteredSipStack);
                cluster.addDataRemovalListener(dialogDataRemovalListener);
if(clusteredSipStack.getReplicationStrategy() == ReplicationStrategy.EarlyDialog) { serverTransactionCacheData = new ServerTransactionCacheData(Fqn.fromElements(name,SipCache.SERVER_TX_PARENT_FQN_ELEMENT),cluster.getMobicentsCache(), clusteredSipStack);
                        serverTransactionCacheData.create();
- serverTransactionDataRemovalListener = new DataRemovalListener(serverTransactionCacheData.getNodeFqn(), clusteredSipStack); + serverTransactionDataRemovalListener = new DialogDataRemovalListener(serverTransactionCacheData.getNodeFqn(), clusteredSipStack);
                        
cluster.addDataRemovalListener(serverTransactionDataRemovalListener);
                }
                if (serializationClassLoader != null) {
=======================================
--- /trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/ServerTransactionCacheData.java Mon Nov 29 08:28:57 2010 +++ /trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/ServerTransactionCacheData.java Wed Dec 1 10:25:06 2010
@@ -86,7 +86,7 @@
                                }
jbossCache.getInvocationContext().getOptionOverrides().setForceDataGravitation(true);
                        }
-
+ // not sure why but whatever we do the transactionId is always set to lower case in the cache final Node<String,Object> childNode = getNode().getChild(txId.toLowerCase());
                        if(childNode != null) {
                                try {
@@ -232,7 +232,8 @@
                                }
                                transactionManager.begin();
                                doTx = true;
-               }
+               }
+ // not sure why but whatever we do the transactionId is always set to lower case in the cache final Node childNode = getNode().addChild(Fqn.fromElements(transactionId.toLowerCase())); for (Entry<String, Object> metaData : haServerTransaction.getMetaDataToReplicate().entrySet()) {
                                childNode.put(metaData.getKey(), 
metaData.getValue());
@@ -299,6 +300,7 @@
                                transactionManager.begin();
                                doTx = true;
                }
+ // not sure why but whatever we do the transactionId is always set to lower case in the cache
                        succeeded = 
getNode().removeChild(transactionId.toLowerCase());
                } catch (Exception ex) {
                        try {
=======================================
--- /trunk/servers/jain-sip-ha/jboss-5/src/test/java/org/mobicents/ha/javax/sip/ProxyEarlyDialogRecoveryOn1xxTest.java Wed Dec 1 08:25:59 2010 +++ /trunk/servers/jain-sip-ha/jboss-5/src/test/java/org/mobicents/ha/javax/sip/ProxyEarlyDialogRecoveryOn1xxTest.java Wed Dec 1 10:25:06 2010
@@ -1273,11 +1273,14 @@

         shootme.init();
         shootist.init("ReInvite");
-        Thread.sleep(60000);
+        Thread.sleep(100000);

         shootme.checkState(false);
         shootist.checkState(false);

+        assertTrue(proxyNode1.checkTransactionsRemoved());
+        assertTrue(proxyNode2.checkTransactionsRemoved());
+
         balancer.stop();
         proxyNode1.stop();
         proxyNode2.stop();
@@ -1348,11 +1351,14 @@

         shootme.init();
         shootist.init("ReInvite");
-        Thread.sleep(60000);
+        Thread.sleep(100000);

         shootme.checkState(false);
         shootist.checkState(false);

+        assertTrue(proxyNode1.checkTransactionsRemoved());
+        assertTrue(proxyNode2.checkTransactionsRemoved());
+
         balancer.stop();
         proxyNode1.stop();
         proxyNode2.stop();
@@ -1423,11 +1429,14 @@

         shootme.init();
         shootist.init("ReInvite");
-        Thread.sleep(60000);
+        Thread.sleep(100000);

         shootme.checkState(false);
         shootist.checkState(false);

+        assertTrue(proxyNode1.checkTransactionsRemoved());
+        assertTrue(proxyNode2.checkTransactionsRemoved());
+
         balancer.stop();
         proxyNode1.stop();
         proxyNode2.stop();
=======================================
--- /trunk/servers/jain-sip-ha/jboss-5/src/test/java/org/mobicents/ha/javax/sip/SimpleStatefulProxy.java Wed Dec 1 08:25:59 2010 +++ /trunk/servers/jain-sip-ha/jboss-5/src/test/java/org/mobicents/ha/javax/sip/SimpleStatefulProxy.java Wed Dec 1 10:25:06 2010
@@ -622,5 +622,17 @@
        public void processTimeout(TimeoutEvent timeoutEvent) {}

public void processTransactionTerminated(TransactionTerminatedEvent transactionTerminatedEvent) {}
+
+       public boolean checkTransactionsRemoved() {
+ System.out.println("client transaction table size " + ((SipStackImpl)sipStack).getClientTransactionTableSize());
+               if(((SipStackImpl)sipStack).getClientTransactionTableSize() > 
0) {
+                       return false;
+               }
+ System.out.println("server transaction table size " + ((SipStackImpl)sipStack).getServerTransactionTableSize());
+               if(((SipStackImpl)sipStack).getServerTransactionTableSize() > 
0) {
+                       return false;
+               }
+               return true;
+       }

 }

Reply via email to