All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test.tck.factory.FactoryTestHarness Maven / Gradle / Ivy

There is a newer version: 1.3.0-91
Show newest version
package test.tck.factory;

import javax.sip.header.*;
import test.tck.*;

public class FactoryTestHarness extends TestHarness {

    protected static String hosts[] =
        {
            "herbivore.ncsl.nist.gov",
            "foo.bar.com",
            "129.6.55.181",
            "herbivore.ncsl.nist.gov:5070",
            "big.com",
            "big.com",
            "big.com",
            "gateway.com",
            "10.1.2.3",
            "example.com",
            "alice",
            "registrar.com",
            "10.10.30.186:666",
            "abc123.xyz-test." };

    static protected String urls[] =
        {
            "sip:herbivore.ncsl.nist.gov:5070;maddr=129.6.55.251;lr",
            "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:[email protected]?subject=",
            "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",
            "http://10.10.30.186:8080/examples/pin.vxml",
            "sip:&=+$,;?/%00-_.!~*'()@abc123.xyz-test.:12345;weird123[]/:&+$=weird123[]/:&+$?[]/?:+$=[]/?:+$",
            "sip:[2001:db8::9:1];real=[2001:db8::9:255]\n",
            "sip:user;par=u%[email protected]\n"
        };

    protected static String telUrls[] =
        { "tel:+463-1701-4291", "tel:46317014291;phone-context=+5", "tel:+1-212-555-1212" };

    protected static String phoneNumbers[] =
        { "+463-1701-4291", "46317014291;phone-context=+5", "+1-212-555-1212" };

    protected static String addresses[] =
        {
            "herbivore.ncsl.nist.gov",
            "[email protected]",
            "129.6.55.181",
            "herbivore.ncsl.nist.gov:5070",
            "[email protected]",
            "[email protected]",
            "[email protected]",
            "[email protected]",
            "[email protected]",
            "[email protected]",
            "alice",
            "[email protected]",
            "[email protected]:666" // 666 is the sign of the beast. heh. heh.
    };
    protected static String msgString =
        "INVITE sip:[email protected]:5060 SIP/2.0\r\n"
            + "Via: SIP/2.0/UDP 65.243.118.100:5050\r\n"
            + "From: Me  ;tag=1234\r\n"
            + "To: \"[email protected]\"  \r\n"
            + "Call-ID: [email protected] \r\n"
            + "CSeq: 1 INVITE \r\n"
            // BUG submitted by Ben Evans (opencloud):
            //  was missing \r\n on Accept and Accept-Language headers
            // (works OK in NIST-SIP but not valid SIP syntax)
            + "Accept: application/sdp;level=1\r\n"
            + "Accept-Language: da\r\n"
            + "Authentication-Info: nextnonce=\"47364c23432d2e131a5fb210812c\"\r\n"
            + "Accept-Encoding: identity; q=0.5\r\n"
            + "Authorization: Digest username=\"UserB\", realm=\"MCI WorldCom SIP\","
            + " nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\", opaque=\"\","
            + " uri=\"sip:ss2.wcom.com\", "
            + "response=\"dfe56131d1958046689cd83306477ecc\"\r\n"
            + "Contact:;expires=3600\r\n"
            + "Content-Type: text/html; charset=ISO-8859-4\r\n"
            + "Date: Sun, 07 Jan 2001 19:05:06 GMT\r\n"
            + "Organization: Boxes by Bob\r\n"
            + "Content-Length: 0\r\n\r\n";

    protected static String multiHeaders[] =
        {
            "Allow: INVITE , FooBar\r\n",
            "Accept-Encoding: compress;q=0.5,gzip;q=1.0\r\n",
            "Accept: application/sdp;level=1,application/x-private,text/html\r\n",
            "Contact: Bo Bob Biggs "
                // BUG submitted by Ben Evans (opencloud): SIP syntax does not
                // permit space between < and URI
                + ","
                + "Joe Bob Briggs \r\n",
            "Proxy-Require: foo, 1234 \r\n",
            "Record-Route: ,"
                + ","
                + "\r\n",

        // JvB: added, bug report by Young-Geun Park on 17-8-2009              
        "Record-Route: sip:[email protected],tel:07077005000\r\n",

        // JvB: removed this one, P-Asserted-Identity isn't officially part of the TCK
        // "P-Asserted-Identity: sip:[email protected],tel:07077005000\r\n",
        };

    protected static String headers[] =
        {
            "Accept: application/sdp;level=1\n",
            "Accept: application/x-private\n",
            "Accept: text/html\n",
            "Accept: text/*\n",
            "Accept: text/*strange_extension*\n",
            "Accept: application/sdp;level=1;q=1.0\n",
            "Accept-Encoding: compress\n",
            "Accept-Encoding: gzip\n",
            "Accept-Encoding:\n",
            "Accept-Encoding: *\n",
            "Accept-Encoding: *special*\n",
            "Accept-Encoding: compress;q=0.5\n",
            "Accept-Encoding: gzip;q=1.0\n",
            "Accept-Encoding: identity; q=0.5\n",
            "Accept-Language: da\n",
            "Accept-Language:\n",
            "Accept-Language: en-gb;q=0.8\n",
            "Accept-Language: *\n",

            "Alert-Info: ;purpose=icon\n",
            "Alert-Info:  ;purpose=info\n",
            "Alert-Info: \n",
            "Allow: INVITE \r\n",
            "Allow: FooBars\r\n",
            "Allow-Events: pack1.pack2\n",
            "Allow-Events: pack1\n",

            // JvB: added
            "u: pack1\n", "U: pack1\n",

            "Authentication-Info: nextnonce=\"47364c23432d2e131a5fb210812c\"\n",
            // Issue 4 posted by Larry B
            "Authentication-Info: nextnonce=\"47364c23432d2e131a5fb210812c\",rspauth=\"hello\"\n",
            "Authorization: Digest username=\"UserB\", realm=\"MCI WorldCom SIP\","
                + " nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\", opaque=\"\","
                + " uri=\"sip:ss2.wcom.com\","
                + " response=\"dfe56131d1958046689cd83306477ecc\"\n",
            "Authorization: Digest username=\"apro,kop\","
                + "realm=\"Realm\","
                + "nonce=\"MTA1MDMzMjE5ODUzMjUwM2QyMzBhOTJlMTkxYjIxYWY1NDlhYzk4YzNiMGYz\""
                + ",uri=\"sip:nortelnetworks.com:5060\","
                + "response=\"dbfba6c0e9664b45b7d224d2b52a1d01\","
                + "algorithm=MD5,"
                + "cnonce=\"VG05eWRHVnNJRTVsZEhkdmNtdHpNVEExTURNek16WTFOREUyTUE9PQ==\","
                + "qop=auth-int,nc=00000001\n",
            "Call-ID: [email protected]\n",
            "Call-ID: [email protected]\n",
            "i:[email protected]\n",
            "I:[email protected]\n",
            "Call-ID: [email protected]\n",
            "Call-ID: kl24ahsd546folnyt2vbak9sad98u23naodiunzds09a3bqw0sdfbsk34poouymnae0043nsed09mfkvc74bd0cuwnms05dknw87hjpobd76f\n",
            "Call-Id: 281794\n",
            "Call-Info:  ;purpose=icon\n",
            "Call-Info:  ;purpose=info\n",
            "Call-Info: \n",
            "Contact:;expires=3600\n",
            "Contact:BigGuy;expires=3600\n",
            "Contact: sip:[email protected]:5060\n",
            "Contact: sip:[email protected]\n",
        // BUG reported by Ben Evans (opencloud): SIP syntax
        // does not permit space between < and URI
            "Contact: Bo Bob Biggs"
                + "\n",
            "Contact: Joe Bob Briggs \n",
            "Contact: \"Mr. Watson\" "
                + " ; q=0.7; expires=3600",
            "Contact: \"Mr. Watson\" ;q=0.1\n",
            "Contact: LittleGuy \n",
            "Contact: \n",
            "Contact: \n",
            "Contact:*\n",
            "Contact: *displayname* \n",
            "Contact:BigGuy;Expires=3600\n",

            // JvB: added
            "m:BigGuy;Expires=3600\n",
            "M:BigGuy;Expires=3600\n",

            "Content-Disposition: session\n",
            "Content-Disposition: render;handling=hand;optional=opt \n",
            "Content-Encoding: gzip \n",

            // JvB: added
            "e: gzip \n",
            "E: gzip \n",
            "Content-Language: fr \n",
            "l: 345\n",
            "L: 345\n",
            "Content-Length: 3495\n",
            "Content-Length: 0 \n",
            "c: text/html; charset=ISO-8859-4\n",
            "Content-Type: text/html; charset=ISO-8859-4\n",
            "Content-Type: application/sdp\n",
            "Content-Type: application/sdp; o=we ;l=ek ; i=end \n",
            "CSeq: 17 INVITE\n",
            "CSeq: 17 ACK\n",
            "CSeq : 18   BYE\n",
            "CSeq:1 CANCEL\n",
            "CSeq: 3 BYE\n",
            "Date: Sun, 07 Jan 2001 19:05:06 GMT\n",

            // JvB: Date is officially 1 or 2 digits
            "Date: Mon, 8 Jan 2001 19:05:06 GMT\n",
            "Error-Info: \n",
            "Error-Info: ;param1=oli\n",

            // JvB: These ones were missing
            "Expires: 3600\n",
            "Event: register\n",
            "o: presence\n",
            "O: presence\n",

            // BUG from Ben Evans (opencloud): space before >
            "From: foobar at com ;tag=1024181795\n",
            "From: sip:[email protected]\n",
            "From: sip:[email protected]\n",
            "from: sip:localhost\n",
            "from: * \n",// '*' is a token in from

            // JvB: test short form too
            "f: sip:[email protected]\n",
            "F: sip:[email protected]\n",

            "FROM: \"A. G. Bell\"  ;tag=a48s\n",
            "In-Reply-To: [email protected]\n",
            "In-Reply-To: 70710 \n",
            "Max-Forwards: 34\n",
            "Max-Forwards: 10 \n",
            "MIME-Version: 1.0 \n",
            "Min-Expires: 60 \n",
            "Organization: Boxes by Bob\n",
            "Priority: emergency\n",
            "Proxy-Authenticate: Digest realm=\"MCI WorldCom SIP\","
                + "domain=\"sip:ss2.wcom.com\", "
                + "nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\","
                + "opaque=\"\", stale=FALSE, algorithm=MD5\n",
            "Proxy-Authorization: Digest realm=\"MCI WorldCom SIP\","
                + "domain=\"sip:ss2.wcom.com\", "
                + "nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\","
                + "opaque=\"\", stale=FALSE, algorithm=MD5\n",
            "Proxy-Require: foo \n",
            "Proxy-Require: 1234 \n",
            "RAck: 776656 1 INVITE\n",
            "Reason: SIP ;cause=200 ;text=\"Call completed elsewhere\"\n",
            "Reason: Q.850 ;cause=16 ;text=\"Terminated\"\n",
            "Reason: SIP ;cause=600 ;text=\"Busy Everywhere\"\n",
            // API BUG: what should the default cause code be? - NIST uses -1 but this is not specified.
            // TBD -- documentation fix in jain-sip 1.2 should specify the default cause to be -1
            "Reason: SIP \n",
            "Record-Route: ",
            "Record-Route: ",
            "Record-Route: \n",
            "Refer-To: ;tag=5617\n",
            "Refer-To: T. A. Watson \n",
            "Refer-To: LittleGuy \n",
            "Refer-To: sip:[email protected]\n",
            "Refer-To: sip:[email protected] ; tag=696928473514.129.6.55.9\n",

            // JvB: added
            "r: sip:[email protected]\n",
            "R: sip:[email protected]\n",

            "Reply-To: Bob \n",
            "Require: 100rel \n",
            "Retry-After: 18000;duration=3600\n",
            "Retry-After: 120;duration=3600;ra=oli\n",
            // BUG reported by Ben Evans, opencloud:
            // javadoc says default duration is 0 but RI returns -1,
            // The RI was fixed to return 0
            "Retry-After: 1230 (I'm in a meeting);fg=der;duration=23\n",
            "Route: \n",
            "Route: \n",
            "RSeq: 988789 \n",
            "Server: Softphone/Beta1.5 \n",
            "Server: HomeServer v2\n",
            "Server: Nist/Beta1 (beta version) \n",
            "Server: Nist proxy (beta version)\n",
            "Server: Nist1.0/Beta2 UbiServer/vers.1.0 (new stuff) (Cool) \n",

            // JvB: added for 1.2 to support RFC3903
            "SIP-ETag: tag123\n",
            "SIP-If-Match: tag123\n",

            "Subject: Where is the Moscone?\n",
            "Subject: Need more boxes\n",

            // JvB: added
            "s: Need more boxes\n",
            "S: Need more boxes\n",

            // API BUG: default value of retry-after param not specified.
            // TBD -- documentation bug in JAIN-SIP to be fixed in 1.2
            "Subscription-State: active \n",
            "Subscription-State: terminated;reason=rejected \n",
            "Subscription-State: pending;reason=probation;expires=36\n",
            "Subscription-State: pending;retry-after=10;expires=36\n",
            "Subscription-State: pending;generic=void\n",
            "Supported: 100rel \n",
            "Supported: foo1\n",
            "Supported:\n",   // JvB: it may be empty! bug in parser

            // JvB: added
            "k: foo1\n",
            "K: foo1\n",

            "Timestamp: 54 \n",
            "Timestamp: 52.34 34.5 \n",
            "Timestamp: 52.34 .5 \n",       // JvB: also valid syntax!

            "To: ;tag=5617\n",
            "To: T. A. Watson \n",
            "To: LittleGuy \n",
            "To: sip:[email protected]\n",
            "To: sip:[email protected] ; tag=696928473514.129.6.55.9\n",

            // JvB: added
            "t: sip:[email protected]\n",
            "T: sip:[email protected]\n",

            "Unsupported: foo \n",
            "User-Agent: Softphone/Beta1.5 \n",
            "User-Agent: Nist/Beta1 (beta version) \n",
            "User-Agent: Nist UA (beta version)\n",
            "User-Agent: Nist1.0/Beta2 Ubi/vers.1.0 (very cool) \n",
            "Via: SIP/2.0/UDP 135.180.130.133\n",
            "Via: SIP/2.0/UDP 166.34.120.100;branch=0000045d-00000001\n",
            "Via: SIP/2.0/UDP host.example.com;received=135.180.130.133\n",
            "Via: SIP/2.0/UDP [2001:db8::9:1];received=[2001:db8::9:255];branch=z9hG4bKas3-111\n",

            // JvB: added
            "v: SIP/2.0/UDP 135.180.130.133\n",
            "V: SIP/2.0/UDP 135.180.130.133\n",

            "WWW-Authenticate: Digest realm=\"MCI WorldCom SIP\","
                + "domain=\"sip:ss2.wcom.com\","
                + "nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\","
                + "opaque=\"\", stale=FALSE, algorithm=MD5\n",
            "WWW-Authenticate: Digest realm=\"MCI WorldCom SIP\","
                + "qop=\"auth\" , nonce-value=\"oli\"\n",
            "Warning: 307 isi.edu \"Session parameter 'foo' not understood\"\n",
            "Warning: 301 isi.edu \"Incompatible network address type 'E.164'\"\n",
            "Route: \"displayname\\\\\";x=\"\";y=\"\\\"\\\\\"\n"
            };

    protected Header createRiHeaderFromString(String hdr) {
        try {
            StringBuffer name = new StringBuffer();
            StringBuffer body = new StringBuffer();
            int n = 0;
            for (n = 0; n < hdr.length(); n++) {
                if (hdr.charAt(n) != ':') {
                    name.append(hdr.charAt(n));
                } else
                    break;
            }
            n++;

            for (; n < hdr.length(); n++) {
                body.append(hdr.charAt(n));
            }
            Header riHeader =
                riHeaderFactory.createHeader(
                    name.toString().trim(),
                    body.toString().trim());
            return riHeader;
        } catch (java.text.ParseException ex) {
            return null;
        }
    }

    public FactoryTestHarness(String name) {
        super(name);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy