Search in sources :

Example 1 with NiFiRegistryClientConfig

use of org.apache.nifi.registry.client.NiFiRegistryClientConfig in project nifi-registry by apache.

the class IntegrationTestBase method createClientFromConfig.

private static Client createClientFromConfig(NiFiRegistryClientConfig registryClientConfig) {
    final ClientConfig clientConfig = new ClientConfig();
    clientConfig.register(jacksonJaxbJsonProvider());
    final ClientBuilder clientBuilder = ClientBuilder.newBuilder().withConfig(clientConfig);
    final SSLContext sslContext = registryClientConfig.getSslContext();
    if (sslContext != null) {
        clientBuilder.sslContext(sslContext);
    }
    final HostnameVerifier hostnameVerifier = registryClientConfig.getHostnameVerifier();
    if (hostnameVerifier != null) {
        clientBuilder.hostnameVerifier(hostnameVerifier);
    }
    return clientBuilder.build();
}
Also used : SSLContext(javax.net.ssl.SSLContext) NiFiRegistryClientConfig(org.apache.nifi.registry.client.NiFiRegistryClientConfig) ClientConfig(org.glassfish.jersey.client.ClientConfig) ClientBuilder(javax.ws.rs.client.ClientBuilder) HostnameVerifier(javax.net.ssl.HostnameVerifier)

Example 2 with NiFiRegistryClientConfig

use of org.apache.nifi.registry.client.NiFiRegistryClientConfig in project nifi-registry by apache.

the class UnsecuredNiFiRegistryClientIT method setup.

@Before
public void setup() {
    final String baseUrl = createBaseURL();
    LOGGER.info("Using base url = " + baseUrl);
    final NiFiRegistryClientConfig clientConfig = new NiFiRegistryClientConfig.Builder().baseUrl(baseUrl).build();
    Assert.assertNotNull(clientConfig);
    final NiFiRegistryClient client = new JerseyNiFiRegistryClient.Builder().config(clientConfig).build();
    Assert.assertNotNull(client);
    this.client = client;
}
Also used : NiFiRegistryClient(org.apache.nifi.registry.client.NiFiRegistryClient) JerseyNiFiRegistryClient(org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient) NiFiRegistryClientConfig(org.apache.nifi.registry.client.NiFiRegistryClientConfig) Before(org.junit.Before)

Example 3 with NiFiRegistryClientConfig

use of org.apache.nifi.registry.client.NiFiRegistryClientConfig in project nifi by apache.

the class RestBasedFlowRegistry method getRegistryClient.

private synchronized NiFiRegistryClient getRegistryClient() {
    if (registryClient != null) {
        return registryClient;
    }
    final NiFiRegistryClientConfig config = new NiFiRegistryClientConfig.Builder().connectTimeout(30000).readTimeout(30000).sslContext(sslContext).baseUrl(url).build();
    registryClient = new JerseyNiFiRegistryClient.Builder().config(config).build();
    return registryClient;
}
Also used : NiFiRegistryClientConfig(org.apache.nifi.registry.client.NiFiRegistryClientConfig) JerseyNiFiRegistryClient(org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient)

Example 4 with NiFiRegistryClientConfig

use of org.apache.nifi.registry.client.NiFiRegistryClientConfig in project nifi-registry by apache.

the class SecureNiFiRegistryClientIT method setup.

@Before
public void setup() {
    final String baseUrl = createBaseURL();
    LOGGER.info("Using base url = " + baseUrl);
    final NiFiRegistryClientConfig clientConfig = createClientConfig(baseUrl);
    Assert.assertNotNull(clientConfig);
    final NiFiRegistryClient client = new JerseyNiFiRegistryClient.Builder().config(clientConfig).build();
    Assert.assertNotNull(client);
    this.client = client;
}
Also used : NiFiRegistryClient(org.apache.nifi.registry.client.NiFiRegistryClient) JerseyNiFiRegistryClient(org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient) NiFiRegistryClientConfig(org.apache.nifi.registry.client.NiFiRegistryClientConfig) Before(org.junit.Before)

Aggregations

NiFiRegistryClientConfig (org.apache.nifi.registry.client.NiFiRegistryClientConfig)4 JerseyNiFiRegistryClient (org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient)3 NiFiRegistryClient (org.apache.nifi.registry.client.NiFiRegistryClient)2 Before (org.junit.Before)2 HostnameVerifier (javax.net.ssl.HostnameVerifier)1 SSLContext (javax.net.ssl.SSLContext)1 ClientBuilder (javax.ws.rs.client.ClientBuilder)1 ClientConfig (org.glassfish.jersey.client.ClientConfig)1