Search in sources :

Example 16 with Cookie

use of jakarta.ws.rs.core.Cookie in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method toCookieTest.

/*
   * @testName: toCookieTest
   * 
   * @assertion_ids: JAXRS:JAVADOC:109; JAXRS:JAVADOC:52; JAXRS:JAVADOC:58;
   * 
   * @test_Strategy: Create a Cookie instance using constructor Cookie(String,
   * String, String, String, int) and a NewCookie instance NewCokie(String name,
   * String value, String path, String domain, int version, String comment, int
   * maxAge, boolean secure) NewCookie(Cookie, String comment, int maxAge,
   * boolean secure) Verify that toCookie method works by using .equals and
   * hashCode method.
   */
@Test
public void toCookieTest() throws Fault {
    boolean pass = true;
    StringBuffer sb = new StringBuffer();
    String name = "name_1";
    String value = "value_1";
    String path = "/acme";
    String domain = "y.x.foo.com";
    int version = 1;
    String comment = "cts test comment";
    int maxage = 12345;
    boolean secure = false;
    Cookie ck30 = new Cookie(name, value, path, domain, version);
    NewCookie nck30 = new NewCookie(name, value, path, domain, version, comment, maxage, secure);
    Cookie ck31 = nck30.toCookie();
    if (!ck30.equals(ck31)) {
        pass = false;
        sb.append("Equal test failed.").append(newline);
        sb.append("First  :").append(ck30.toString()).append(newline);
        sb.append("Second :").append(ck31.toString()).append(newline);
    }
    if (ck30.hashCode() != ck31.hashCode()) {
        pass = false;
        sb.append("HashCode equal test failed.").append(newline);
    }
    assertTrue(pass, "At least one assertion failed: " + sb.toString());
}
Also used : Cookie(jakarta.ws.rs.core.Cookie) NewCookie(jakarta.ws.rs.core.NewCookie) NewCookie(jakarta.ws.rs.core.NewCookie) Test(org.junit.jupiter.api.Test)

Example 17 with Cookie

use of jakarta.ws.rs.core.Cookie in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorTest2.

/*
   * @testName: constructorTest2
   * 
   * @assertion_ids: JAXRS:JAVADOC:107; JAXRS:JAVADOC:100; JAXRS:JAVADOC:101;
   * JAXRS:JAVADOC:103; JAXRS:JAVADOC:50; JAXRS:JAVADOC:53; JAXRS:JAVADOC:54;
   * JAXRS:JAVADOC:55; JAXRS:JAVADOC:56;
   * 
   * @test_Strategy: Create a NewCookie instance using constructor
   * Cookie(String, String, String, String) NewCookie(Cookie)
   */
@Test
public void constructorTest2() throws Fault {
    String name = "name_1";
    String value = "value_1";
    String path = "/acme";
    String domain = "";
    String comment = "";
    int maxage = jakarta.ws.rs.core.NewCookie.DEFAULT_MAX_AGE;
    int version = 1;
    boolean secure = false;
    Cookie ck2 = new Cookie(name, value, path, domain);
    NewCookie nck2 = new NewCookie(ck2);
    verifyNewCookie(nck2, name, value, path, domain, version, comment, maxage, secure);
}
Also used : Cookie(jakarta.ws.rs.core.Cookie) NewCookie(jakarta.ws.rs.core.NewCookie) NewCookie(jakarta.ws.rs.core.NewCookie) Test(org.junit.jupiter.api.Test)

Example 18 with Cookie

use of jakarta.ws.rs.core.Cookie in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorTest4.

/*
   * @testName: constructorTest4
   * 
   * @assertion_ids: JAXRS:JAVADOC:107; JAXRS:JAVADOC:100; JAXRS:JAVADOC:101;
   * JAXRS:JAVADOC:103; JAXRS:JAVADOC:49; JAXRS:JAVADOC:53; JAXRS:JAVADOC:54;
   * JAXRS:JAVADOC:55; JAXRS:JAVADOC:56;
   * 
   * @test_Strategy: Create a version 1 NewCookie instance using constructor
   * Cookie(String, String, String, String, int) NewCookie(Cookie)
   */
@Test
public void constructorTest4() throws Fault {
    String name = "name_1";
    String value = "value_1";
    String path = "/acme";
    String domain = "y.x.foo.com";
    String comment = "";
    int maxage = jakarta.ws.rs.core.NewCookie.DEFAULT_MAX_AGE;
    int version = 1;
    boolean secure = false;
    Cookie ck4 = new Cookie(name, value, path, domain, version);
    NewCookie nck4 = new NewCookie(ck4);
    verifyNewCookie(nck4, name, value, path, domain, version, comment, maxage, secure);
}
Also used : Cookie(jakarta.ws.rs.core.Cookie) NewCookie(jakarta.ws.rs.core.NewCookie) NewCookie(jakarta.ws.rs.core.NewCookie) Test(org.junit.jupiter.api.Test)

Example 19 with Cookie

use of jakarta.ws.rs.core.Cookie in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorTest18.

/*
   * @testName: constructorTest18
   * 
   * @assertion_ids: JAXRS:JAVADOC:108; JAXRS:JAVADOC:100; JAXRS:JAVADOC:101;
   * JAXRS:JAVADOC:103; JAXRS:JAVADOC:51; JAXRS:JAVADOC:53; JAXRS:JAVADOC:54;
   * JAXRS:JAVADOC:55; JAXRS:JAVADOC:56;
   * 
   * @test_Strategy: Create a NewCookie instance using constructor
   * Cookie(String, String) NewCookie(Cookie, String comment, int maxAge,
   * boolean secure)
   */
@Test
public void constructorTest18() throws Fault {
    String name = "name_1";
    String value = "value_1";
    String comment = "";
    String domain = "";
    String path = "";
    int maxage = jakarta.ws.rs.core.NewCookie.DEFAULT_MAX_AGE;
    int version = 1;
    boolean secure = false;
    Cookie ck18 = new Cookie(name, value);
    NewCookie nck18 = new NewCookie(ck18, comment, maxage, secure);
    verifyNewCookie(nck18, name, value, path, domain, version, comment, maxage, secure);
}
Also used : Cookie(jakarta.ws.rs.core.Cookie) NewCookie(jakarta.ws.rs.core.NewCookie) NewCookie(jakarta.ws.rs.core.NewCookie) Test(org.junit.jupiter.api.Test)

Example 20 with Cookie

use of jakarta.ws.rs.core.Cookie in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method constructorTest5.

/*
   * @testName: constructorTest5
   * 
   * @assertion_ids: JAXRS:JAVADOC:107; JAXRS:JAVADOC:100; JAXRS:JAVADOC:101;
   * JAXRS:JAVADOC:103; JAXRS:JAVADOC:49; JAXRS:JAVADOC:53; JAXRS:JAVADOC:54;
   * JAXRS:JAVADOC:55; JAXRS:JAVADOC:56;
   * 
   * @test_Strategy: Create a version 0 NewCookie instance using constructor
   * Cookie(String, String, String, String, int) NewCookie(Cookie)
   */
@Test
public void constructorTest5() throws Fault {
    String name = "name_1";
    String value = "value_1";
    String path = "/acme";
    String domain = "y.x.foo.com";
    int version = 0;
    String comment = "";
    int maxage = jakarta.ws.rs.core.NewCookie.DEFAULT_MAX_AGE;
    boolean secure = false;
    Cookie ck5 = new Cookie(name, value, path, domain, version);
    NewCookie nck5 = new NewCookie(ck5);
    verifyNewCookie(nck5, name, value, path, domain, version, comment, maxage, secure);
}
Also used : Cookie(jakarta.ws.rs.core.Cookie) NewCookie(jakarta.ws.rs.core.NewCookie) NewCookie(jakarta.ws.rs.core.NewCookie) Test(org.junit.jupiter.api.Test)

Aggregations

Cookie (jakarta.ws.rs.core.Cookie)36 Test (org.junit.jupiter.api.Test)31 NewCookie (jakarta.ws.rs.core.NewCookie)21 Response (jakarta.ws.rs.core.Response)7 Invocation (jakarta.ws.rs.client.Invocation)3 ParamEntityWithFromString (ee.jakarta.tck.ws.rs.ee.rs.ParamEntityWithFromString)2 GET (jakarta.ws.rs.GET)2 ClientRequestContext (jakarta.ws.rs.client.ClientRequestContext)2 Path (jakarta.ws.rs.Path)1 Client (jakarta.ws.rs.client.Client)1 WebTarget (jakarta.ws.rs.client.WebTarget)1 ResponseBuilder (jakarta.ws.rs.core.Response.ResponseBuilder)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 ThrottledClient (jaxrs.examples.client.custom.ThrottledClient)1