Search in sources :

Example 1 with ExploreDriver

use of co.cask.cdap.explore.jdbc.ExploreDriver in project cdap by caskdata.

the class IntegrationTestManager method getQueryClient.

@Override
public Connection getQueryClient(NamespaceId namespace) throws Exception {
    Map<String, String> connParams = new HashMap<>();
    connParams.put(ExploreConnectionParams.Info.NAMESPACE.getName(), namespace.getNamespace());
    AccessToken accessToken = clientConfig.getAccessToken();
    if (accessToken != null) {
        connParams.put(ExploreConnectionParams.Info.EXPLORE_AUTH_TOKEN.getName(), accessToken.getValue());
    }
    connParams.put(ExploreConnectionParams.Info.SSL_ENABLED.getName(), Boolean.toString(clientConfig.getConnectionConfig().isSSLEnabled()));
    connParams.put(ExploreConnectionParams.Info.VERIFY_SSL_CERT.getName(), Boolean.toString(clientConfig.isVerifySSLCert()));
    ConnectionConfig connConfig = clientConfig.getConnectionConfig();
    String url = String.format("%s%s:%d?%s", Constants.Explore.Jdbc.URL_PREFIX, connConfig.getHostname(), connConfig.getPort(), Joiner.on("&").withKeyValueSeparator("=").join(connParams));
    return new ExploreDriver().connect(url, new Properties());
}
Also used : ExploreDriver(co.cask.cdap.explore.jdbc.ExploreDriver) HashMap(java.util.HashMap) AccessToken(co.cask.cdap.security.authentication.client.AccessToken) DatasetProperties(co.cask.cdap.api.dataset.DatasetProperties) Properties(java.util.Properties) ConnectionConfig(co.cask.cdap.client.config.ConnectionConfig)

Aggregations

DatasetProperties (co.cask.cdap.api.dataset.DatasetProperties)1 ConnectionConfig (co.cask.cdap.client.config.ConnectionConfig)1 ExploreDriver (co.cask.cdap.explore.jdbc.ExploreDriver)1 AccessToken (co.cask.cdap.security.authentication.client.AccessToken)1 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1