test/java/net/CookieHandler/CookieManagerTest.java

Print this page




 109     //
 110     // these two must match each other, i.e. testCases.length == testPolicies.length
 111     //
 112     public static CookieTestCase[][] testCases = null;  // the test cases to run; each test case may contain multiple roundtrips
 113     public static CookiePolicy[] testPolicies = null;   // indicates what CookiePolicy to use with each test cases
 114 
 115     CookieHttpTransaction() {
 116         testCases = new CookieTestCase[testCount][];
 117         testPolicies = new CookiePolicy[testCount];
 118 
 119         try {
 120             localHostAddr = InetAddress.getLocalHost().getHostAddress();
 121         } catch (Exception ignored) {
 122         };
 123         int count = 0;
 124 
 125         // an http session with Netscape cookies exchanged
 126         testPolicies[count] = CookiePolicy.ACCEPT_ORIGINAL_SERVER;
 127         testCases[count++] = new CookieTestCase[]{
 128                 new CookieTestCase("Set-Cookie",
 129                 "CUSTOMER=WILE:BOB; path=/; expires=Wednesday, 09-Nov-2030 23:12:40 GMT;" + "domain=." + localHostAddr,
 130                 "CUSTOMER=WILE:BOB",
 131                 "/"
 132                 ),
 133                 new CookieTestCase("Set-Cookie",
 134                 "PART_NUMBER=ROCKET_LAUNCHER_0001; path=/;" + "domain=." + localHostAddr,
 135                 "CUSTOMER=WILE:BOB; PART_NUMBER=ROCKET_LAUNCHER_0001",
 136                 "/"
 137                 ),
 138                 new CookieTestCase("Set-Cookie",
 139                 "SHIPPING=FEDEX; path=/foo;" + "domain=." + localHostAddr,
 140                 "CUSTOMER=WILE:BOB; PART_NUMBER=ROCKET_LAUNCHER_0001",
 141                 "/"
 142                 ),
 143                 new CookieTestCase("Set-Cookie",
 144                 "SHIPPING=FEDEX; path=/foo;" + "domain=." + localHostAddr,
 145                 "CUSTOMER=WILE:BOB; PART_NUMBER=ROCKET_LAUNCHER_0001; SHIPPING=FEDEX",
 146                 "/foo"
 147                 )
 148                 };
 149 




 109     //
 110     // these two must match each other, i.e. testCases.length == testPolicies.length
 111     //
 112     public static CookieTestCase[][] testCases = null;  // the test cases to run; each test case may contain multiple roundtrips
 113     public static CookiePolicy[] testPolicies = null;   // indicates what CookiePolicy to use with each test cases
 114 
 115     CookieHttpTransaction() {
 116         testCases = new CookieTestCase[testCount][];
 117         testPolicies = new CookiePolicy[testCount];
 118 
 119         try {
 120             localHostAddr = InetAddress.getLocalHost().getHostAddress();
 121         } catch (Exception ignored) {
 122         };
 123         int count = 0;
 124 
 125         // an http session with Netscape cookies exchanged
 126         testPolicies[count] = CookiePolicy.ACCEPT_ORIGINAL_SERVER;
 127         testCases[count++] = new CookieTestCase[]{
 128                 new CookieTestCase("Set-Cookie",
 129                 "CUSTOMER=WILE:BOB; path=/; expires=Sat, 09-Nov-2030 23:12:40 GMT;" + "domain=." + localHostAddr,
 130                 "CUSTOMER=WILE:BOB",
 131                 "/"
 132                 ),
 133                 new CookieTestCase("Set-Cookie",
 134                 "PART_NUMBER=ROCKET_LAUNCHER_0001; path=/;" + "domain=." + localHostAddr,
 135                 "CUSTOMER=WILE:BOB; PART_NUMBER=ROCKET_LAUNCHER_0001",
 136                 "/"
 137                 ),
 138                 new CookieTestCase("Set-Cookie",
 139                 "SHIPPING=FEDEX; path=/foo;" + "domain=." + localHostAddr,
 140                 "CUSTOMER=WILE:BOB; PART_NUMBER=ROCKET_LAUNCHER_0001",
 141                 "/"
 142                 ),
 143                 new CookieTestCase("Set-Cookie",
 144                 "SHIPPING=FEDEX; path=/foo;" + "domain=." + localHostAddr,
 145                 "CUSTOMER=WILE:BOB; PART_NUMBER=ROCKET_LAUNCHER_0001; SHIPPING=FEDEX",
 146                 "/foo"
 147                 )
 148                 };
 149