Search in sources :

Example 1 with TLSConfiguration

use of org.apache.cxf.jaxrs.client.spec.TLSConfiguration 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)));
}
Also used : TLSConfiguration(org.apache.cxf.jaxrs.client.spec.TLSConfiguration) MyClient(org.apache.cxf.microprofile.client.mock.MyClient) RestClientBuilder(org.eclipse.microprofile.rest.client.RestClientBuilder) TestClientRequestFilter(org.eclipse.microprofile.rest.client.tck.providers.TestClientRequestFilter) Test(org.junit.Test)

Example 2 with TLSConfiguration

use of org.apache.cxf.jaxrs.client.spec.TLSConfiguration 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)));
}
Also used : TLSConfiguration(org.apache.cxf.jaxrs.client.spec.TLSConfiguration) MyClient(org.apache.cxf.microprofile.client.mock.MyClient) RestClientBuilder(org.eclipse.microprofile.rest.client.RestClientBuilder) TestClientRequestFilter(org.eclipse.microprofile.rest.client.tck.providers.TestClientRequestFilter) Test(org.junit.Test)

Aggregations

TLSConfiguration (org.apache.cxf.jaxrs.client.spec.TLSConfiguration)2 MyClient (org.apache.cxf.microprofile.client.mock.MyClient)2 RestClientBuilder (org.eclipse.microprofile.rest.client.RestClientBuilder)2 TestClientRequestFilter (org.eclipse.microprofile.rest.client.tck.providers.TestClientRequestFilter)2 Test (org.junit.Test)2