Author: jean.deruelle
Date: Wed Mar 18 01:58:29 2009
New Revision: 5101

Added:
     
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/reinvite/UACReInviteSipServletTest.java
Modified:
     
trunk/servers/sip-servlets/sip-servlets-bootstrap/src/site/xdoc/roadmap.xml
     
trunk/servers/sip-servlets/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServlet.java
     
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/AllTests.java
     
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/composition/SpeedDialLocationServiceJunitTest.java
     
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/failover/BasicFailoverTest.java

Log:
adding regression test for reinvite with lb

Modified:  
trunk/servers/sip-servlets/sip-servlets-bootstrap/src/site/xdoc/roadmap.xml
==============================================================================
---  
trunk/servers/sip-servlets/sip-servlets-bootstrap/src/site/xdoc/roadmap.xml     
 
(original)
+++  
trunk/servers/sip-servlets/sip-servlets-bootstrap/src/site/xdoc/roadmap.xml     
 
Wed Mar 18 01:58:29 2009
@@ -848,6 +848,13 @@
                                                                        Allow 
different call ids within a Sip Application Session
                                                                </a>            
                                                
                                                        </li>
+                                                       <li>
+                                                               <img 
src="green.jpeg" />
+                                                               <a
+                                                                       
href="http://code.google.com/p/mobicents/issues/detail?id=622";>
+                                                                       Move to 
JBoss AS 5.0.1.GA
+                                                               </a>            
                                                
+                                                       </li>
                                                </ul>
                                        </p>
                                </subsection>

Modified:  
trunk/servers/sip-servlets/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServlet.java
==============================================================================
---  
trunk/servers/sip-servlets/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServlet.java
   
(original)
+++  
trunk/servers/sip-servlets/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServlet.java
   
Wed Mar 18 01:58:29 2009
@@ -43,7 +43,7 @@
                extends SipServlet
                implements SipServletListener,TimerListener {

-       private static Log logger = LogFactory.getLog(ShootistSipServlet.class);
+       private static Log logger = 
LogFactory.getLog(ShootistSipServlet.class);        
        @Resource
        TimerService timerService;
        
@@ -66,9 +66,14 @@
                if (status == SipServletResponse.SC_OK  
&& "INVITE".equalsIgnoreCase(sipServletResponse.getMethod())) {
                        SipServletRequest ackRequest = 
sipServletResponse.createAck();
                        ackRequest.send();
-                       SipServletRequest sipServletRequest =  
sipServletResponse.getSession().createRequest("BYE");
-                       ServletTimer timer =  
timerService.createTimer(sipServletResponse.getApplicationSession(), 2000,  
false, (Serializable)sipServletRequest);
-                       
sipServletResponse.getApplicationSession().setAttribute("timer", timer);
+                       if(sipServletResponse.getRequest().isInitial()) {
+                               SipServletRequest  
request=sipServletResponse.getSession().createRequest("INVITE");                
                
+                               request.send();
+                       }  else {
+                               SipServletRequest sipServletRequest =  
sipServletResponse.getSession().createRequest("BYE");
+                               ServletTimer timer =  
timerService.createTimer(sipServletResponse.getApplicationSession(), 2000,  
false, (Serializable)sipServletRequest);
+                               
sipServletResponse.getApplicationSession().setAttribute("timer",  
timer);
+                       }
                }
        }

@@ -89,7 +94,11 @@
                SipFactory sipFactory =  
(SipFactory)ce.getServletContext().getAttribute(SIP_FACTORY);
                SipApplicationSession sipApplicationSession =  
sipFactory.createApplicationSession();
                
-               URI fromURI = sipFactory.createSipURI("BigGuy", "here.com");
+               String userName = 
ce.getServletContext().getInitParameter("username");
+               if(userName == null || userName.length() < 1) {
+                       userName = "BigGuy";
+               }
+               URI fromURI = sipFactory.createSipURI(userName, "here.com");
                URI toURI = null;
                if(ce.getServletContext().getInitParameter("urlType") != null 
&&  
ce.getServletContext().getInitParameter("urlType").equalsIgnoreCase("tel"))  
{
                        try {

Modified:  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/AllTests.java
==============================================================================
---  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/AllTests.java
     
(original)
+++  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/AllTests.java
     
Wed Mar 18 01:58:29 2009
@@ -50,6 +50,7 @@
  import org.mobicents.servlet.sip.testsuite.publish.PublishSipServletTest;
  import org.mobicents.servlet.sip.testsuite.refer.ReferSipServletTest;
  import org.mobicents.servlet.sip.testsuite.reinvite.ReInviteSipServletTest;
+import  
org.mobicents.servlet.sip.testsuite.reinvite.UACReInviteSipServletTest;
  import org.mobicents.servlet.sip.testsuite.replaces.ReplacesSipServletTest;
  import  
org.mobicents.servlet.sip.testsuite.routing.ExternalApplicationRoutingTest;
  import  
org.mobicents.servlet.sip.testsuite.routing.ExternalRoutingServletTest;
@@ -125,6 +126,7 @@
                suite.addTestSuite(InDialogNotifierSipServletTest.class);
                suite.addTestSuite(InDialogSubscriberSipServletTest.class);
                suite.addTestSuite(ReInviteSipServletTest.class);
+               suite.addTestSuite(UACReInviteSipServletTest.class);
                suite.addTestSuite(UpdateSipServletTest.class);
                suite.addTestSuite(PublishSipServletTest.class);
                suite.addTestSuite(ReferSipServletTest.class);

Modified:  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/composition/SpeedDialLocationServiceJunitTest.java
==============================================================================
---  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/composition/SpeedDialLocationServiceJunitTest.java
        
(original)
+++  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/composition/SpeedDialLocationServiceJunitTest.java
        
Wed Mar 18 01:58:29 2009
@@ -31,7 +31,7 @@

        private static final String TRANSPORT = "udp";
        private static final boolean AUTODIALOG = true;
-       private static final int TIMEOUT = 5000;        
+       private static final int TIMEOUT = 10000;       
  //    private static final int TIMEOUT = 100000000;
        
        TestSipListener sender;

Modified:  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/failover/BasicFailoverTest.java
==============================================================================
---  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/failover/BasicFailoverTest.java
   
(original)
+++  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/failover/BasicFailoverTest.java
   
Wed Mar 18 01:58:29 2009
@@ -143,7 +143,7 @@
                                 
+ 
"org/mobicents/servlet/sip/testsuite/callcontroller/call-forwarding-b2bua-servlet-dar.properties";
        }
        
-       public void deployShootistApplication(SipEmbedded sipEmbedded) {
+       public void deployShootistApplication(SipEmbedded sipEmbedded, boolean  
reInvite) {
                SipStandardContext context = new SipStandardContext();
                context.setDocBase(projectHome  
+ "/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/sipapp");
                context.setName("sip-test-context");
@@ -154,8 +154,14 @@
                applicationParameter.setName("encodeRequestURI");
                applicationParameter.setValue("true");
                context.addApplicationParameter(applicationParameter);
+               if(reInvite) {
+                       ApplicationParameter applicationParameter2 = new 
ApplicationParameter();
+                       applicationParameter2.setName("username");
+                       applicationParameter2.setValue("reinvite");
+                       context.addApplicationParameter(applicationParameter2);
+               }
                assertTrue(sipEmbedded.deployContext(context));
-       }
+       }               

        protected String getDarConfigurationFileShootist() {
                return "file:///"
@@ -265,17 +271,17 @@
                secondTomcatServer.startTomcat();
                //first test
                Thread.sleep(TIMEOUT);
-               deployShootistApplication(tomcat);
+               deployShootistApplication(tomcat, false);
                Thread.sleep(TIMEOUT);
                
                assertTrue(receiver.getByeReceived());
                
                tomcat.stopTomcat();
                receiver.setByeReceived(false);
-               deployShootistApplication(secondTomcatServer);  
+               deployShootistApplication(secondTomcatServer, false);   
                Thread.sleep(TIMEOUT);
                assertTrue(receiver.getByeReceived());
-       }
+       }               
        
        public void testBasicFailoverUACCalleeSendsBye() throws Exception {
                receiverProtocolObjects =new ProtocolObjects(
@@ -307,16 +313,58 @@
                secondTomcatServer.startTomcat();
                //first test
                Thread.sleep(TIMEOUT);
-               deployShootistApplication(tomcat);
+               deployShootistApplication(tomcat, false);
                Thread.sleep(TIMEOUT);
                
                assertTrue(receiver.getOkToByeReceived());
                
                tomcat.stopTomcat();
                receiver.setOkToByeReceived(false);
-               deployShootistApplication(secondTomcatServer);  
+               deployShootistApplication(secondTomcatServer, false);   
                Thread.sleep(TIMEOUT);
                assertTrue(receiver.getOkToByeReceived());
+       }
+       
+       public void testBasicFailoverUACReInvite() throws Exception {
+               receiverProtocolObjects =new ProtocolObjects(
+                               "failover-receiver", "gov.nist", TRANSPORT, 
AUTODIALOG);
+               receiver = new TestSipListener(5080, BALANCER_EXTERNAL_PORT,  
receiverProtocolObjects, false);
+               SipProvider receiverProvider = receiver.createProvider();       
                
+               receiverProvider.addSipListener(receiver);
+               receiverProtocolObjects.start();        
+               //start the sip balancer
+               startSipBalancer();                             
+               //starts the first server
+                
((SipStandardBalancerNodeService)tomcat.getSipService()).setBalancers(balancerAddress.getHostAddress());
+               
tomcat.setDarConfigurationFilePath(getDarConfigurationFileShootist());
+               tomcat.startTomcat();                   
+               //starts the second server
+               secondTomcatServer = new SipEmbedded(SECOND_SERVER_NAME,  
SIP_SERVICE_CLASS_NAME);
+               secondTomcatServer.setLoggingFilePath(
+                               projectHome + File.separatorChar + 
"sip-servlets-test-suite" +
+                               File.separatorChar + "testsuite" +
+                               File.separatorChar + "src" +
+                               File.separatorChar + "test" +
+                               File.separatorChar + "resources" + 
File.separatorChar);
+               logger.info("Log4j path is : " +  
secondTomcatServer.getLoggingFilePath());
+                
secondTomcatServer.setDarConfigurationFilePath(getDarConfigurationFileShootist());
+               getTomcatBackupHomePath();
+               secondTomcatServer.initTomcat(getTomcatBackupHomePath());       
                                        
+               secondTomcatServer.addSipConnector(SECOND_SERVER_NAME, 
sipIpAddress,  
5071, ListeningPoint.UDP);
+                
((SipStandardBalancerNodeService)secondTomcatServer.getSipService()).setBalancers(balancerAddress.getHostAddress());
+               secondTomcatServer.startTomcat();
+               //first test
+               Thread.sleep(TIMEOUT);
+               deployShootistApplication(tomcat, true);
+               Thread.sleep(TIMEOUT);
+               
+               assertTrue(receiver.getByeReceived());
+               
+               tomcat.stopTomcat();
+               receiver.setByeReceived(false);
+               deployShootistApplication(secondTomcatServer, true);    
+               Thread.sleep(TIMEOUT);
+               assertTrue(receiver.getByeReceived());
        }
        
        public void testBasicFailoverCancelTest() throws Exception {

Added:  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/reinvite/UACReInviteSipServletTest.java
==============================================================================
--- (empty file)
+++  
trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/reinvite/UACReInviteSipServletTest.java
   
Wed Mar 18 01:58:29 2009
@@ -0,0 +1,96 @@
+/*
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.mobicents.servlet.sip.testsuite.reinvite;
+import javax.sip.SipProvider;
+
+import org.apache.catalina.deploy.ApplicationParameter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mobicents.servlet.sip.SipServletTestCase;
+import org.mobicents.servlet.sip.core.session.SipStandardManager;
+import org.mobicents.servlet.sip.startup.SipContextConfig;
+import org.mobicents.servlet.sip.startup.SipStandardContext;
+import org.mobicents.servlet.sip.testsuite.ProtocolObjects;
+import org.mobicents.servlet.sip.testsuite.TestSipListener;
+
+public class UACReInviteSipServletTest extends SipServletTestCase {
+       private static Log logger =  
LogFactory.getLog(UACReInviteSipServletTest.class);             
+       private static final String TRANSPORT = "udp";
+       private static final boolean AUTODIALOG = true;
+       private static final int TIMEOUT = 10000;       
+//     private static final int TIMEOUT = 100000000;
+       
+       TestSipListener receiver;
+       
+       ProtocolObjects receiverProtocolObjects;
+       
+       public UACReInviteSipServletTest(String name) {
+               super(name);
+               startTomcatOnStartup = false;
+               autoDeployOnStartup = false;
+       }
+
+       @Override
+       public void deployApplication() {
+               SipStandardContext context = new SipStandardContext();
+               context.setDocBase(projectHome  
+ "/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/sipapp");
+               context.setName("sip-test-context");
+               context.setPath("sip-test");
+               context.addLifecycleListener(new SipContextConfig());
+               context.setManager(new SipStandardManager());
+               ApplicationParameter applicationParameter = new 
ApplicationParameter();
+               applicationParameter.setName("username");
+               applicationParameter.setValue("reinvite");
+               context.addApplicationParameter(applicationParameter);
+               assertTrue(tomcat.deployContext(context));
+       }
+
+       @Override
+       protected String getDarConfigurationFile() {
+               return "file:///" + projectHome  
+ "/sip-servlets-test-suite/testsuite/src/test/resources/" +
+                        
        
"org/mobicents/servlet/sip/testsuite/simple/shootist-sip-servlet-dar.properties";
+       }
+       
+       @Override
+       protected void setUp() throws Exception {
+               super.setUp();                                                  
                                        
+       }
+       
+       public void testShootistReInvite() throws Exception {
+//             receiver.sendInvite();
+               receiverProtocolObjects =new ProtocolObjects(
+                               "sender", "gov.nist", TRANSPORT, AUTODIALOG);
+                                       
+               receiver = new TestSipListener(5080, 5070, 
receiverProtocolObjects,  
false);
+               SipProvider senderProvider = receiver.createProvider();         
        
+               
+               senderProvider.addSipListener(receiver);
+               
+               receiverProtocolObjects.start();
+               tomcat.startTomcat();
+               deployApplication();
+               Thread.sleep(TIMEOUT);
+               assertTrue(receiver.getByeReceived());          
+       }       
+
+       @Override
+       protected void tearDown() throws Exception {                            
        
+               receiverProtocolObjects.destroy();                      
+               logger.info("Test completed");
+               super.tearDown();
+       }
+}
\ No newline at end of file

Reply via email to