/** * Determines if this query has substitutable parameters, and whether * it should be run once for each table. * * @return If the query is to be run over each table */ public boolean isQueryOver() { final Set<String> keys = extractTemplateVariables(query); return keys.contains("table"); }
/** * Determines if this query has substitutable parameters, and whether * it should be run once for each table. * * @return If the query is to be run over each table */ public boolean isQueryOver() { final Set<String> keys = extractTemplateVariables(query); return keys.contains("table"); }
@Override public String getConnectionUrl() { final String oldConnectionUrl = connectionProperties.get(URL); // Substitute parameters TemplatingUtility.substituteVariables(connectionProperties); final String connectionUrl = connectionProperties.get(URL); // Check that all required parameters have been substituted final Set<String> unmatchedVariables = TemplatingUtility .extractTemplateVariables(connectionUrl); if (!unmatchedVariables.isEmpty()) { throw new IllegalArgumentException(String .format("Insufficient parameters for database connection URL: missing %s", unmatchedVariables)); } // Reset old connection URL connectionProperties.put(URL, oldConnectionUrl); return connectionUrl; }
variables = TemplatingUtility.extractTemplateVariables("No variables"); assertThat("Incorrect number of variables found", variables, is(empty())); variables = TemplatingUtility.extractTemplateVariables("${one} variable"); sortedVariables = getSortedVariables(variables); assertThat("Incorrect number of variables found", variables, hasSize(1)); .extractTemplateVariables("Has ${one} variable, and ${another} variable"); sortedVariables = getSortedVariables(variables); assertThat("Incorrect number of variables found", variables, hasSize(2)); .extractTemplateVariables("Has $${unusual} variable"); sortedVariables = getSortedVariables(variables); assertThat("Incorrect number of variables found", variables, hasSize(1)); .extractTemplateVariables("Has ${unusual}} variable"); sortedVariables = getSortedVariables(variables); assertThat("Incorrect number of variables found", variables, hasSize(1)); .extractTemplateVariables("Has ${bad variable"); sortedVariables = getSortedVariables(variables); assertThat("Incorrect number of variables found", variables, is(empty())); .extractTemplateVariables("Has ${good} and ${bad variable"); sortedVariables = getSortedVariables(variables); assertThat("Incorrect number of variables found", variables, hasSize(1)); .extractTemplateVariables("Has ${bad and ${good} variable"); sortedVariables = getSortedVariables(variables);
/** * Determines if this query has substitutable parameters, and whether * it should be run once for each table. * * @return If the query is to be run over each table */ public boolean isQueryOver() { final Set<String> keys = TemplatingUtility.extractTemplateVariables(query); return keys.contains("table"); }
/** * Determines if this query has substitutable parameters, and whether * it should be run once for each table. * * @return If the query is to be run over each table */ public boolean isQueryOver() { final Set<String> keys = extractTemplateVariables(query); return keys.contains("table"); }
/** * Determines if this query has substitutable parameters, and whether * it should be run once for each table. * * @return If the query is to be run over each table */ public boolean isQueryOver() { final Set<String> keys = extractTemplateVariables(query); return keys.contains("table"); }
@Override public String getConnectionUrl() { final Map<String, String> properties = new HashMap<>(this.properties); TemplatingUtility.substituteVariables(properties); final String connectionUrl = properties.get(URL); // Check that all required parameters have been substituted final Set<String> unmatchedVariables = TemplatingUtility .extractTemplateVariables(connectionUrl); if (!unmatchedVariables.isEmpty()) { throw new IllegalArgumentException(String.format("Insufficient parameters for database connection URL: missing %s", unmatchedVariables)); } return connectionUrl; }
@Override public String getConnectionUrl() { final String oldConnectionUrl = connectionProperties.get(URL); // Substitute parameters TemplatingUtility.substituteVariables(connectionProperties); final String connectionUrl = connectionProperties.get(URL); // Check that all required parameters have been substituted final Set<String> unmatchedVariables = TemplatingUtility .extractTemplateVariables(connectionUrl); if (!unmatchedVariables.isEmpty()) { throw new IllegalArgumentException(String .format("Insufficient parameters for database connection URL: missing %s", unmatchedVariables)); } // Reset old connection URL connectionProperties.put(URL, oldConnectionUrl); return connectionUrl; }
@Override public String getConnectionUrl() { final String oldConnectionUrl = connectionProperties.get(URL); // Substitute parameters TemplatingUtility.substituteVariables(connectionProperties); final String connectionUrl = connectionProperties.get(URL); // Check that all required parameters have been substituted final Set<String> unmatchedVariables = TemplatingUtility .extractTemplateVariables(connectionUrl); if (!unmatchedVariables.isEmpty()) { throw new IllegalArgumentException(String .format("Insufficient parameters for database connection URL: missing %s", unmatchedVariables)); } // Reset old connection URL connectionProperties.put(URL, oldConnectionUrl); return connectionUrl; }