use of ee.jakarta.tck.ws.rs.common.provider.StringBeanEntityProvider in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method clientConfiguredTest.
/*
* @testName: clientConfiguredTest
*
* @assertion_ids: JAXRS:SPEC:73;
*
* @test_Strategy: This interface supports configuration of: Features,
* Properties, Providers
*/
@Test
public void clientConfiguredTest() throws Fault {
Client client = ClientBuilder.newClient();
client.register(new StringBeanEntityProvider());
checkConfig(client, 1 + registeredProviderCnt, registeredPropertyCnt);
client = ClientBuilder.newClient();
client.property(getClass().getName(), getClass().getName());
checkConfig(client, registeredProviderCnt, 1 + registeredPropertyCnt);
client = ClientBuilder.newClient();
client.register(new Feature() {
@Override
public boolean configure(FeatureContext context) {
return true;
}
});
checkConfig(client, 1 + registeredProviderCnt, registeredPropertyCnt);
}
use of ee.jakarta.tck.ws.rs.common.provider.StringBeanEntityProvider in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method closeOnClientRegisterObjectWithMapTest.
/*
* @testName: closeOnClientRegisterObjectWithMapTest
*
* @assertion_ids: JAXRS:JAVADOC:409;
*
* @test_Strategy: Close client instance and all it's associated resources.
* Subsequent calls have no effect and are ignored. Once the client is closed,
* invoking any other method on the client instance would result in an
* IllegalStateException being thrown. Calling this method effectively
* invalidates all WebTarget resource targets produced by the client instance.
* Invoking any method on such targets once the client is closed would result
* in an IllegalStateException being thrown.
*/
@Test
public void closeOnClientRegisterObjectWithMapTest() throws Fault {
client.close();
Map<Class<?>, Integer> contracts = new HashMap<Class<?>, Integer>();
contracts.put(MessageBodyReader.class, 100);
assertException(IllegalStateException.class, client, "register", new StringBeanEntityProvider(), contracts);
}
use of ee.jakarta.tck.ws.rs.common.provider.StringBeanEntityProvider in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method closeOnWebTargetRegisterObjectWithMapTest.
/*
* @testName: closeOnWebTargetRegisterObjectWithMapTest
*
* @assertion_ids: JAXRS:JAVADOC:409;
*
* @test_Strategy: Close client instance and all it's associated resources.
* Subsequent calls have no effect and are ignored. Once the client is closed,
* invoking any other method on the client instance would result in an
* IllegalStateException being thrown. Calling this method effectively
* invalidates all WebTarget resource targets produced by the client instance.
* Invoking any method on such targets once the client is closed would result
* in an IllegalStateException being thrown.
*/
@Test
public void closeOnWebTargetRegisterObjectWithMapTest() throws Fault {
client.close();
Map<Class<?>, Integer> contracts = new HashMap<Class<?>, Integer>();
contracts.put(MessageBodyReader.class, 100);
assertException(IllegalStateException.class, target, "register", new StringBeanEntityProvider(), contracts);
}
use of ee.jakarta.tck.ws.rs.common.provider.StringBeanEntityProvider in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method closeOnClientRegisterObjectWithContractsTest.
/*
* @testName: closeOnClientRegisterObjectWithContractsTest
*
* @assertion_ids: JAXRS:JAVADOC:409;
*
* @test_Strategy: Close client instance and all it's associated resources.
* Subsequent calls have no effect and are ignored. Once the client is closed,
* invoking any other method on the client instance would result in an
* IllegalStateException being thrown. Calling this method effectively
* invalidates all WebTarget resource targets produced by the client instance.
* Invoking any method on such targets once the client is closed would result
* in an IllegalStateException being thrown.
*/
@Test
public void closeOnClientRegisterObjectWithContractsTest() throws Fault {
client.close();
assertException(IllegalStateException.class, client, "register", new StringBeanEntityProvider(), new Class[] { MessageBodyReader.class });
}
use of ee.jakarta.tck.ws.rs.common.provider.StringBeanEntityProvider 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");
}
Aggregations