コード例 #1
0
 // ////////////////////////////////////////////////
 // ////////////////////////////////////////////////
 // Test Methods
 // ////////////////////////////////////////////////
 // ////////////////////////////////////////////////
 @Test
 public void LemnaTecDatabaseConfigurationFileConfiguredCorrectly() throws IOException {
   try {
     DataSource lemnaTecDatabase = Config.experimentDataSource("LTSystem");
     assertNotNull(lemnaTecDatabase);
   } catch (MalformedConfigException e) {
     fail("Configuration file missing fields.");
   }
 }
コード例 #2
0
  // ////////////////////////////////////////////////
  // ////////////////////////////////////////////////
  // Database Access Helper Methods
  // ////////////////////////////////////////////////
  // ////////////////////////////////////////////////
  private List<String> GetDatabaseNames() throws MalformedConfigException, IOException {
    DataSource lemnaTecDatabase = Config.experimentDataSource("LTSystem");

    String getDatabases = "SELECT name FROM ltdbs WHERE removed = FALSE";

    JdbcTemplate jdbcTemplate = new JdbcTemplate(lemnaTecDatabase);
    List<String> databaseNames = jdbcTemplate.query(getDatabases, new ParseLemnaTecDatabaseNames());

    return databaseNames;
  }
コード例 #3
0
  private List<String> GetTableNames(String databaseName)
      throws MalformedConfigException, IOException {
    DataSource experimentDatabase = Config.experimentDataSource(databaseName);

    String getTables = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES";

    JdbcTemplate jdbcTemplate = new JdbcTemplate(experimentDatabase);
    List<String> tableNames = jdbcTemplate.query(getTables, new ParsePostgreSQLTableNames());

    return tableNames;
  }
コード例 #4
0
  private List<String> GetColumnNames(String table, String databaseName)
      throws MalformedConfigException, IOException {
    DataSource experimentDatabase = Config.experimentDataSource(databaseName);

    String getColumns =
        "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '" + table + "'";

    JdbcTemplate jdbcTemplate = new JdbcTemplate(experimentDatabase);
    List<String> columnNames = jdbcTemplate.query(getColumns, new ParsePostgreSQLColumnNames());

    return columnNames;
  }