@Override public FieldType load(String key) throws Exception { return configManager.setConfigOnce(key, InternalConfig.USER_TYPE.name(), STRING); } });
@Override public Object setOnce(String configName, Object value) { return configManager.setConfigOnce(project, prefix + configName, value); } }
@Test public void testMultipleReferenceGrouping() throws Exception { QueryResult test = getEventExplorer().analyze(new RequestContext(PROJECT_NAME, null), of("test"), new EventExplorer.Measure("teststr", AggregationType.APPROXIMATE_UNIQUE), new EventExplorer.Reference(EventExplorer.ReferenceType.REFERENCE, DAY_OF_MONTH.getPrettyName()), new EventExplorer.Reference(EventExplorer.ReferenceType.REFERENCE, DAY_OF_MONTH.getPrettyName()), null, LocalDate.ofEpochDay(0), LocalDate.ofEpochDay(SCALE_FACTOR), ZoneOffset.UTC).getResult().join(); assertFalse(test.isFailed()); assertEquals(copyOf(test.getResult()), ImmutableSet.of(of("1th day", "1th day", 100L))); } }
@Test public void testCreateApiKeys() throws Exception { ApiKeyService.ProjectApiKeys testing = getApiKeyService().createApiKeys(PROJECT_NAME); assertEquals(getApiKeyService().getProjectOfApiKey(testing.readKey(), AccessKeyType.READ_KEY), PROJECT_NAME); assertEquals(getApiKeyService().getProjectOfApiKey(testing.writeKey(), AccessKeyType.WRITE_KEY), PROJECT_NAME); assertEquals(getApiKeyService().getProjectOfApiKey(testing.masterKey(), AccessKeyType.MASTER_KEY), PROJECT_NAME); }
@Test public void testSetOnce() throws Exception { getConfigManager().setConfig(PROJECT_NAME, "test", "naber"); getConfigManager().setConfigOnce(PROJECT_NAME, "test", "naber2"); assertEquals(getConfigManager().getConfig(PROJECT_NAME, "test", String.class), "naber"); }
@Override public JDBCPoolDataSource get() { return JDBCPoolDataSource.getOrCreateDataSource(asyncClientConfig); } }
@Test public void testSet() throws Exception { getConfigManager().setConfig(PROJECT_NAME, "test", "naber"); assertEquals(getConfigManager().getConfig(PROJECT_NAME, "test", String.class), "naber"); }
@Override public List<Set<String>> load(String project) throws Exception { try (Connection conn = connectionPool.getConnection()) { return getKeys(conn, project); } } });
@AfterMethod public void tearDownMethod() throws Exception { getApiKeyService().revokeAllKeys(PROJECT_NAME); }
@Override public Object get(String configName) { return configManager.getConfig(project, prefix + configName, Object.class); }
@Override public void set(String configName, Object value) { configManager.setConfig(project, prefix + configName, value); }
@BeforeMethod public void setupMethod() throws Exception { metastore.createProject("test"); apiKeys = apiKeyService.createApiKeys("test"); }
@Test public void testInvalidAvgAggregation() throws Exception { QueryResult test = getEventExplorer().analyze(new RequestContext(PROJECT_NAME, null), of("test"), new EventExplorer.Measure("teststr", AVERAGE), new EventExplorer.Reference(COLUMN, "testbool"), null, null, LocalDate.ofEpochDay(0), LocalDate.ofEpochDay(SCALE_FACTOR), ZoneOffset.UTC).getResult().join(); assertTrue(test.isFailed()); }
@Test public void testSetOnceOtherProject() throws Exception { getConfigManager().setConfig(PROJECT_NAME, "test", "naber"); getConfigManager().setConfigOnce(PROJECT_NAME + "i", "test", "naber2"); assertEquals(getConfigManager().getConfig(PROJECT_NAME, "test", String.class), "naber"); assertEquals(getConfigManager().getConfig(PROJECT_NAME + "i", "test", String.class), "naber2"); } }
@Override public Connection getConnection() throws SQLException { return getConnection(disablePool); }
@Test public void testCountUniqueAggregation() throws Exception { QueryResult test = getEventExplorer().analyze(new RequestContext(PROJECT_NAME, null), of("test"), new EventExplorer.Measure("testnumber", AggregationType.COUNT_UNIQUE), new EventExplorer.Reference(COLUMN, "testbool"), null, null, LocalDate.ofEpochDay(0), LocalDate.ofEpochDay(SCALE_FACTOR), ZoneOffset.UTC).getResult().join(); assertFalse(test.isFailed()); assertEquals(copyOf(test.getResult()), ImmutableSet.of(of("true", "test", 50L), of("false", "test", 50L))); }
public Connection getConnection() throws SQLException { return connectionPool.getConnection(); }
@Test public void testApproxAggregation() throws Exception { QueryResult test = getEventExplorer().analyze(new RequestContext(PROJECT_NAME, null), of("test"), new EventExplorer.Measure("teststr", AggregationType.APPROXIMATE_UNIQUE), new EventExplorer.Reference(COLUMN, "testbool"), null, null, LocalDate.ofEpochDay(0), LocalDate.ofEpochDay(SCALE_FACTOR), ZoneOffset.UTC).getResult().join(); assertFalse(test.isFailed()); assertEquals(copyOf(test.getResult()), ImmutableSet.of(of("true", "test", 50L), of("false", "test", 50L))); }