private static void setupBasicAuth( OkHttpClient.Builder clientBuilder, ClientSession session, Optional<String> user, Optional<String> password) { if (user.isPresent() && password.isPresent()) { checkArgument(session.getServer().getScheme().equalsIgnoreCase("https"), "Authentication using username/password requires HTTPS to be enabled"); clientBuilder.addInterceptor(basicAuth(user.get(), password.get())); } }
private static void setupTokenAuth( OkHttpClient.Builder clientBuilder, ClientSession session, Optional<String> accessToken) { if (accessToken.isPresent()) { checkArgument(session.getServer().getScheme().equalsIgnoreCase("https"), "Authentication using an access token requires HTTPS to be enabled"); clientBuilder.addInterceptor(tokenAuth(accessToken.get())); } } }
private static void setupTokenAuth( OkHttpClient.Builder clientBuilder, ClientSession session, Optional<String> accessToken) { if (accessToken.isPresent()) { checkArgument(session.getServer().getScheme().equalsIgnoreCase("https"), "Authentication using an access token requires HTTPS to be enabled"); clientBuilder.addInterceptor(tokenAuth(accessToken.get())); } } }
private static void setupBasicAuth( OkHttpClient.Builder clientBuilder, ClientSession session, Optional<String> user, Optional<String> password) { if (user.isPresent() && password.isPresent()) { checkArgument(session.getServer().getScheme().equalsIgnoreCase("https"), "Authentication using username/password requires HTTPS to be enabled"); clientBuilder.addInterceptor(basicAuth(user.get(), password.get())); } }
public BenchmarkDriver(BenchmarkResultsStore resultsStore, ClientSession clientSession, Iterable<BenchmarkQuery> queries, int warm, int runs, boolean debug, int maxFailures, Optional<HostAndPort> socksProxy) { this.resultsStore = requireNonNull(resultsStore, "resultsStore is null"); this.clientSession = requireNonNull(clientSession, "clientSession is null"); this.queries = ImmutableList.copyOf(requireNonNull(queries, "queries is null")); queryRunner = new BenchmarkQueryRunner(warm, runs, debug, maxFailures, clientSession.getServer(), socksProxy); }
@Test public void testServerHostOnly() { ClientOptions options = new ClientOptions(); options.server = "localhost"; ClientSession session = options.toClientSession(); assertEquals(session.getServer().toString(), "http://localhost:80"); }
@Test public void testServerHttpsUri() { ClientOptions options = new ClientOptions(); options.server = "https://localhost/foo"; ClientSession session = options.toClientSession(); assertEquals(session.getServer().toString(), "https://localhost/foo"); }
@Test public void testServerHttpsUri() { ClientOptions options = new ClientOptions(); options.server = "https://localhost/foo"; ClientSession session = options.toClientSession(); assertEquals(session.getServer().toString(), "https://localhost/foo"); }
@Test public void testServerHttpUri() { ClientOptions options = new ClientOptions(); options.server = "http://localhost/foo"; ClientSession session = options.toClientSession(); assertEquals(session.getServer().toString(), "http://localhost/foo"); }
@Test public void testServerHostOnly() { ClientOptions options = new ClientOptions(); options.server = "localhost"; ClientSession session = options.toClientSession(); assertEquals(session.getServer().toString(), "http://localhost:80"); }
@Test public void testServerHostPort() { ClientOptions options = new ClientOptions(); options.server = "localhost:8888"; ClientSession session = options.toClientSession(); assertEquals(session.getServer().toString(), "http://localhost:8888"); }
@Test public void testServerHostPort() { ClientOptions options = new ClientOptions(); options.server = "localhost:8888"; ClientSession session = options.toClientSession(); assertEquals(session.getServer().toString(), "http://localhost:8888"); }
@Test public void testServerHttpUri() { ClientOptions options = new ClientOptions(); options.server = "http://localhost/foo"; ClientSession session = options.toClientSession(); assertEquals(session.getServer().toString(), "http://localhost/foo"); }
@Test public void testDefault() { ClientSession session = new ClientOptions().toClientSession(); assertEquals(session.getServer().toString(), "http://localhost:8080"); assertEquals(session.getSource(), "presto-cli"); }
checkArgument(session.getServer().getScheme().equalsIgnoreCase("https"), "Authentication using Kerberos requires HTTPS to be enabled"); setupKerberos(
checkArgument(session.getServer().getScheme().equalsIgnoreCase("https"), "Authentication using Kerberos requires HTTPS to be enabled"); setupKerberos(
@Test public void testDefault() { ClientSession session = new ClientOptions().toClientSession(); assertEquals(session.getServer().toString(), "http://localhost:8080"); assertEquals(session.getSource(), "presto-cli"); }
private Builder(ClientSession clientSession) { requireNonNull(clientSession, "clientSession is null"); server = clientSession.getServer(); user = clientSession.getUser(); source = clientSession.getSource(); traceToken = clientSession.getTraceToken(); clientTags = clientSession.getClientTags(); clientInfo = clientSession.getClientInfo(); catalog = clientSession.getCatalog(); schema = clientSession.getSchema(); path = clientSession.getPath(); timeZone = clientSession.getTimeZone(); locale = clientSession.getLocale(); resourceEstimates = clientSession.getResourceEstimates(); properties = clientSession.getProperties(); preparedStatements = clientSession.getPreparedStatements(); roles = clientSession.getRoles(); transactionId = clientSession.getTransactionId(); clientRequestTimeout = clientSession.getClientRequestTimeout(); }