use of jakarta.ws.rs.core.Feature in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method registerFeatureInstanceReturningFalseTest.
/*
* @testName: registerFeatureInstanceReturningFalseTest
*
* @assertion_ids: JAXRS:JAVADOC:758;
*
* @test_Strategy: Register a feature. In case the registered provider is a
* client-side Feature feature, this object instantiates the feature and invokes
* the Feature#configure(FeatureContext) method and lets the feature update it's
* internal configuration state.
*/
@Test
public void registerFeatureInstanceReturningFalseTest() throws Fault {
final Feature feature = new FeatureReturningFalse();
Assertable assertable = new SingleCheckAssertable() {
@Override
protected void check(Configurable<?> configurable) throws Fault {
assertSizeAndLog(configurable);
}
void assertSizeAndLog(Configurable<?> config) throws Fault {
int cnt = config.getConfiguration().getInstances().size();
assertEqualsInt(cnt, 1 + registeredInstancesCnt, "unexpected number of registered instances found:", cnt, getLocation());
logMsg("Found", cnt, "features");
}
};
Object[] features = new Object[] { feature, feature };
checkConfig(assertable, features);
}
use of jakarta.ws.rs.core.Feature 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);
}
Aggregations