@Test(expectedExceptions = ParsingException.class, expectedExceptionsMessageRegExp = "\\Qline 1:9: mismatched input '.'. Expecting: ',', <EOF>\\E") public void testInvalidPath() { SqlEnvironmentConfig config = new SqlEnvironmentConfig().setPath("too.many.qualifiers"); new SqlPath(config.getPath()).getParsedPath(); } }
@Test public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("sql.path", "a.b, c.d") .build(); SqlEnvironmentConfig expected = new SqlEnvironmentConfig() .setPath("a.b, c.d"); assertFullMapping(properties, expected); }
@Inject public QuerySessionSupplier( TransactionManager transactionManager, AccessControl accessControl, SessionPropertyManager sessionPropertyManager, SqlEnvironmentConfig config) { this.transactionManager = requireNonNull(transactionManager, "transactionManager is null"); this.accessControl = requireNonNull(accessControl, "accessControl is null"); this.sessionPropertyManager = requireNonNull(sessionPropertyManager, "sessionPropertyManager is null"); this.path = requireNonNull(config.getPath(), "path is null"); }
new AllowAllAccessControl(), new SessionPropertyManager(), new SqlEnvironmentConfig()); Session session = sessionSupplier.createSession(new QueryId("test_query_id"), context);
@Test public void testDefaults() { assertRecordedDefaults(recordDefaults(SqlEnvironmentConfig.class) .setPath(null)); }
@Inject public QuerySessionSupplier( TransactionManager transactionManager, AccessControl accessControl, SessionPropertyManager sessionPropertyManager, SqlEnvironmentConfig config) { this.transactionManager = requireNonNull(transactionManager, "transactionManager is null"); this.accessControl = requireNonNull(accessControl, "accessControl is null"); this.sessionPropertyManager = requireNonNull(sessionPropertyManager, "sessionPropertyManager is null"); this.path = requireNonNull(config.getPath(), "path is null"); }
@Test public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("sql.path", "a.b, c.d") .build(); SqlEnvironmentConfig expected = new SqlEnvironmentConfig() .setPath("a.b, c.d"); assertFullMapping(properties, expected); }
new AllowAllAccessControl(), new SessionPropertyManager(), new SqlEnvironmentConfig()); Session session = sessionSupplier.createSession(new QueryId("test_query_id"), context);
@Test public void testDefaults() { assertRecordedDefaults(recordDefaults(SqlEnvironmentConfig.class) .setPath(null)); }
@Test(expectedExceptions = ParsingException.class, expectedExceptionsMessageRegExp = "\\Qline 1:9: mismatched input '.'. Expecting: ',', <EOF>\\E") public void testInvalidPath() { SqlEnvironmentConfig config = new SqlEnvironmentConfig().setPath("too.many.qualifiers"); new SqlPath(config.getPath()).getParsedPath(); } }
this.path = sqlEnvironmentConfig.getPath(); this.maxQueryLength = queryManagerConfig.getMaxQueryLength(); this.maxQueryCpuTime = queryManagerConfig.getQueryMaxCpuTime();
@Test(expectedExceptions = PrestoException.class) public void testInvalidTimeZone() { HttpServletRequest request = new MockHttpServletRequest( ImmutableListMultimap.<String, String>builder() .put(PRESTO_USER, "testUser") .put(PRESTO_TIME_ZONE, "unknown_timezone") .build(), "testRemote"); HttpRequestSessionContext context = new HttpRequestSessionContext(request); QuerySessionSupplier sessionSupplier = new QuerySessionSupplier( createTestTransactionManager(), new AllowAllAccessControl(), new SessionPropertyManager(), new SqlEnvironmentConfig()); sessionSupplier.createSession(new QueryId("test_query_id"), context); }
this.path = sqlEnvironmentConfig.getPath(); this.maxQueryLength = queryManagerConfig.getMaxQueryLength(); this.maxQueryCpuTime = queryManagerConfig.getQueryMaxCpuTime();
@Test(expectedExceptions = PrestoException.class) public void testInvalidTimeZone() { HttpServletRequest request = new MockHttpServletRequest( ImmutableListMultimap.<String, String>builder() .put(PRESTO_USER, "testUser") .put(PRESTO_TIME_ZONE, "unknown_timezone") .build(), "testRemote"); HttpRequestSessionContext context = new HttpRequestSessionContext(request); QuerySessionSupplier sessionSupplier = new QuerySessionSupplier( createTestTransactionManager(), new AllowAllAccessControl(), new SessionPropertyManager(), new SqlEnvironmentConfig()); sessionSupplier.createSession(new QueryId("test_query_id"), context); }