Search in sources :

Example 21 with Configuration

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

the class JAXRSClientIT method deepCopyConfigWebTargetLevelTest.

/*
   * @testName: deepCopyConfigWebTargetLevelTest
   * 
   * @assertion_ids: JAXRS:SPEC:68; JAXRS:SPEC:72; JAXRS:JAVADOC:988;
   * 
   * @test_Strategy: Note that changes to hello's configuration do not affect
   * base, i.e. configuration inheritance requires performing a deep copy of the
   * configuration.
   * 
   * The following Client API types are configurable: Client, Invocation,
   * Invocation.Builder and WebTarget.
   * 
   * Get access to the underlying Configuration configuration.
   */
@Test
public void deepCopyConfigWebTargetLevelTest() throws Fault {
    Client client = ClientBuilder.newClient();
    Configuration config = client.getConfiguration();
    int registeredInstances = config.getInstances().size();
    // WebTarget level inheritance
    WebTarget target1 = client.target("");
    WebTarget target2 = client.target("");
    target1.register(new StringBeanEntityProvider());
    config = target2.getConfiguration();
    assertTrue(config.getInstances().size() == registeredInstances, "configuration() does not perform deep copy");
}
Also used : Configuration(jakarta.ws.rs.core.Configuration) WebTarget(jakarta.ws.rs.client.WebTarget) JAXRSCommonClient(ee.jakarta.tck.ws.rs.common.JAXRSCommonClient) Client(jakarta.ws.rs.client.Client) StringBeanEntityProvider(ee.jakarta.tck.ws.rs.common.provider.StringBeanEntityProvider) Test(org.junit.jupiter.api.Test)

Aggregations

Configuration (jakarta.ws.rs.core.Configuration)21 Client (jakarta.ws.rs.client.Client)19 WebTarget (jakarta.ws.rs.client.WebTarget)17 Test (org.junit.jupiter.api.Test)17 JAXRSCommonClient (ee.jakarta.tck.ws.rs.common.JAXRSCommonClient)16 Assertable (ee.jakarta.tck.ws.rs.api.rs.core.configurable.Assertable)13 SingleCheckAssertable (ee.jakarta.tck.ws.rs.api.rs.core.configurable.SingleCheckAssertable)13 CallableProvider (ee.jakarta.tck.ws.rs.api.rs.core.configurable.CallableProvider)4 JaxrsCommonClient (ee.jakarta.tck.ws.rs.common.client.JaxrsCommonClient)3 Configurable (jakarta.ws.rs.core.Configurable)3 ConfigurableObject (ee.jakarta.tck.ws.rs.api.rs.core.configurable.ConfigurableObject)2 Invocation (jakarta.ws.rs.client.Invocation)2 StringBeanEntityProvider (ee.jakarta.tck.ws.rs.common.provider.StringBeanEntityProvider)1 ClientRequestContext (jakarta.ws.rs.client.ClientRequestContext)1 Response (jakarta.ws.rs.core.Response)1