test.unit.gov.nist.javax.sip.parser.URLParserTest Maven / Gradle / Ivy
/*
* Conditions Of Use
*
* This software was developed by employees of the National Institute of
* Standards and Technology (NIST), and others.
* This software is has been contributed to the public domain.
* As a result, a formal license is not needed to use the software.
*
* This software is provided "AS IS."
* NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
* AND DATA ACCURACY. NIST does not warrant or make any representations
* regarding the use of the software or the results thereof, including but
* not limited to the correctness, accuracy, reliability or usefulness of
* the software.
*
*
*/
/*
* Created on Jul 25, 2004
*
*The JAIN-SIP project.
*/
package test.unit.gov.nist.javax.sip.parser;
import gov.nist.javax.sip.address.*;
import gov.nist.javax.sip.parser.*;
import junit.framework.TestCase;
/**
*
*/
public class URLParserTest extends TestCase {
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
System.out.println("begin test " + getClass().getName());
}
/*
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
System.out.println("end test " + getClass().getName());
}
public void testURLParser() {
String urls[] =
{
"sip:[email protected];lr",
"sip:[email protected];xyz=pqd",
"sip:herbivore.ncsl.nist.gov:5070;maddr=129.6.55.251;lc",
"sip:[email protected];user=phone", "sip:129.6.55.181",
"sip:herbivore.ncsl.nist.gov:5070;maddr=129.6.55.251?method=INVITE&contact=sip:foo.bar.com",
"sip:[email protected]",
"sip:j.doe:[email protected];transport=tcp",
"sip:[email protected]?subject=project",
"sip:+1-212-555-1212:[email protected];user=phone" ,
"sip:[email protected]",
"sip:[email protected]",
"sip:[email protected]",
"sip:alice",
"sip:[email protected];method=REGISTER",
"sip:[email protected]:6666;early=no;play=http://10.10.30.186:8080/examples/pin.vxml",
"tel:+463-1701-4291" ,
"tel:46317014291" ,
"http://10.10.30.186:8080/examples/pin.vxml"
};
try {
for (int i = 0; i < urls.length; i++) {
String url = urls[i];
URLParser urlParser = new URLParser(url);
GenericURI uri = urlParser.parse();
assertEquals(uri,new URLParser(uri.encode()).parse());
}
} catch (Exception ex) {
fail(getClass().getName());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy