Revision: 16415
Author: [email protected]
Date: Thu Jan 13 09:31:54 2011
Log: Adding some non regression tests for use case reported offline but MSS behaves OK
http://code.google.com/p/mobicents/source/detail?r=16415

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/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootistTelURLSipServletTest.java

=======================================
--- /trunk/servers/sip-servlets/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServlet.java Wed Jan 12 06:05:49 2011 +++ /trunk/servers/sip-servlets/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServlet.java Thu Jan 13 09:31:54 2011
@@ -45,7 +45,6 @@
 import javax.sip.ListeningPoint;

 import org.apache.log4j.Logger;
-import org.mobicents.javax.servlet.sip.SipServletRequestExt;
 import org.mobicents.javax.servlet.sip.SipSessionExt;

 public class ShootistSipServlet
@@ -210,11 +209,25 @@
                }
                URI fromURI = sipFactory.createSipURI(userName, "here.com");
                URI toURI = null;
- if(ce.getServletContext().getInitParameter("urlType") != null && ce.getServletContext().getInitParameter("urlType").equalsIgnoreCase("tel")) {
-                       try {
-                               toURI = 
sipFactory.createURI("tel:+358-555-1234567");
-                       } catch (ServletParseException e) {
-                               logger.error("Impossible to create the tel 
URL", e);
+               if(ce.getServletContext().getInitParameter("urlType") != null) {
+ if(ce.getServletContext().getInitParameter("urlType").equalsIgnoreCase("tel")) {
+                               try {
+                                       toURI = 
sipFactory.createURI("tel:+358-555-1234567");
+                               } catch (ServletParseException e) {
+                                       logger.error("Impossible to create the tel 
URL", e);
+                               }
+ } else if(ce.getServletContext().getInitParameter("urlType").equalsIgnoreCase("telAsSip")) {
+                               try {
+                                       toURI = 
sipFactory.createURI("sip:[email protected]:5080");
+                               } catch (ServletParseException e) {
+                                       logger.error("Impossible to create the tel 
URL as SIP", e);
+                               }
+
+                               try {
+ toURI = sipFactory.createAddress("<sip:[email protected]:5080>").getURI();
+                               } catch (ServletParseException e) {
+                                       logger.error("Impossible to create the tel 
URL as SIP", e);
+                               }
                        }
                } else {
                        toURI = sipFactory.createSipURI("LittleGuy", 
"there.com");
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootistTelURLSipServletTest.java Thu Oct 28 13:12:24 2010 +++ /trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootistTelURLSipServletTest.java Thu Jan 13 09:31:54 2011
@@ -44,7 +44,12 @@
        }

        @Override
-       public void deployApplication() {
+       protected void deployApplication() {
+               // TODO Auto-generated method stub
+
+       }
+
+       public void deployApplication(String urlType) {
                SipStandardContext context = new SipStandardContext();
context.setDocBase(projectHome + "/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/sipapp");
                context.setName("sip-test-context");
@@ -53,7 +58,7 @@
                context.setManager(new SipStandardManager());
                ApplicationParameter applicationParameter = new 
ApplicationParameter();
                applicationParameter.setName("urlType");
-               applicationParameter.setValue("tel");
+               applicationParameter.setValue(urlType);
                context.addApplicationParameter(applicationParameter);
                assertTrue(tomcat.deployContext(context));
        }
@@ -79,10 +84,18 @@
                receiverProtocolObjects.start();
        }

-       public void testShootist() throws Exception {
+       public void testShootistTelURL() throws Exception {
 //             receiver.sendInvite();
                tomcat.startTomcat();
-               deployApplication();
+               deployApplication("tel");
+               Thread.sleep(TIMEOUT);
+               assertTrue(receiver.getByeReceived());
+       }
+
+       public void testShootistTelURLAsSIP() throws Exception {
+//             receiver.sendInvite();
+               tomcat.startTomcat();
+               deployApplication("telAsSip");
                Thread.sleep(TIMEOUT);
                assertTrue(receiver.getByeReceived());
        }

Reply via email to