use of org.eclipse.microprofile.rest.client.RestClientBuilder in project cxf by apache.
the class MicroProfileClientFactoryBeanTest method testCreateClientEnabledFeature.
@Test
@SuppressWarnings("unchecked")
public void testCreateClientEnabledFeature() throws Exception {
final MicroProfileClientConfigurableImpl<RestClientBuilder> configurable = new MicroProfileClientConfigurableImpl<>(RestClientBuilder.newBuilder());
final MicroProfileClientFactoryBean bean = new MicroProfileClientFactoryBean(configurable, "http://bar", MyClient.class, null, new TLSConfiguration());
final SomeFeature feature = new SomeFeature(true);
bean.setProvider(feature);
assertTrue(bean.create() instanceof MyClient);
assertTrue(configurable.getConfiguration().isRegistered(SomeFeature.class));
assertTrue(configurable.getConfiguration().isRegistered(TestClientRequestFilter.class));
assertTrue(configurable.getConfiguration().isEnabled(SomeFeature.class));
assertThat((List<Object>) bean.getProviders(), hasItem(instanceOf(TestClientRequestFilter.class)));
}
use of org.eclipse.microprofile.rest.client.RestClientBuilder in project cxf by apache.
the class MicroProfileClientFactoryBeanTest method testCreateClientDisabledFeature.
@Test
@SuppressWarnings("unchecked")
public void testCreateClientDisabledFeature() throws Exception {
final MicroProfileClientConfigurableImpl<RestClientBuilder> configurable = new MicroProfileClientConfigurableImpl<>(RestClientBuilder.newBuilder());
final MicroProfileClientFactoryBean bean = new MicroProfileClientFactoryBean(configurable, "http://bar", MyClient.class, null, new TLSConfiguration());
final SomeFeature feature = new SomeFeature(false);
bean.setProvider(feature);
assertTrue(bean.create() instanceof MyClient);
assertTrue(configurable.getConfiguration().isRegistered(SomeFeature.class));
assertTrue(configurable.getConfiguration().isRegistered(TestClientRequestFilter.class));
assertFalse(configurable.getConfiguration().isEnabled(SomeFeature.class));
assertThat((List<Object>) bean.getProviders(), hasItem(instanceOf(TestClientRequestFilter.class)));
}
Aggregations