Examples of MysqlConnection


Examples of database.MySQLConnection

  public void analyzeAll() throws Exception {

    // Database connection
    System.out.println("connecting to server");
    MySQLConnection conn = new MySQLConnection();
    conn.connect();

    // Get the project repository details
    ResultSet rs = conn.SQLSelect("SELECT * FROM projects");

    while (rs.next()) {

      String url = rs.getString("repos_url");
      String user = rs.getString("repos_user");
      if (rs.wasNull())
        user = "";

      String password = rs.getString("repos_password");
      if (rs.wasNull())
        password = "";

      String name = rs.getString("name");

      int idProject = rs.getInt("id");
      int lastVersion = 1;
      ResultSet rs2 = conn
          .SQLSelect("select max(version)+1 as last_version from versions where project = "
              + idProject);

      while (rs2.next()) {
        lastVersion = Math.max(lastVersion, rs2.getInt("last_version"));
      }

      int idVersion = 1;
      conn.SQLUpdate("insert into versions (project , version , creation_date) values ("
          + idProject + "," + lastVersion + " , sysdate())");

      ResultSet rs3 = conn
          .SQLSelect("select id from versions where version = "
              + lastVersion + " and project = " + idProject);

      while (rs3.next()) {
        idVersion = rs3.getInt("id");
      }

      System.out.println("Checking out project : " + name + " ...");

      checkoutProject(url, user, password, CHECKOUT_DESTINATION_PATH
          + "/" + name);

      deleteDirectory(new File(REPORTS_PATH));

      File reportsDir = new File(REPORTS_PATH);

      if (reportsDir.mkdir()) {
        System.out.println("Reports directory created");
      }

      ExecuteScript javaNcssThread = new ExecuteScript(JNCSS_SCRIPT_PATH,
          CHECKOUT_DESTINATION_PATH + "/" + name + "/src");

      ExecuteScript pmdThread = new ExecuteScript(PMD_SCRIPT_PATH,
          CHECKOUT_DESTINATION_PATH + "/" + name + "/src");

      ExecuteScript clocThread = new ExecuteScript(CLOC_SCRIPT_PATH,
          CHECKOUT_DESTINATION_PATH + "/" + name + "/src");

      ExecuteScript findBugsThread = new ExecuteScript(
          FINDBUGS_SCRIPT_PATH, CHECKOUT_DESTINATION_PATH + "/"
              + name + "/bin");

      ExecuteScript coberturaThread = new ExecuteScript(
          COBERTURA_SCRIPT_PATH, CHECKOUT_DESTINATION_PATH + "/"
              + name + "/bin");

      System.out.println("Analyzing ...");

      System.out.println("Starting JavaNCSS ...");
      javaNcssThread.start();
      System.out.println("Starting PMD /CPD ...");
      pmdThread.start();
      System.out.println("Starting CLOC ...");
      clocThread.start();
      System.out.println("Starting FindBugs ...");
      findBugsThread.start();

      javaNcssThread.join();
      pmdThread.join();
      clocThread.join();
      findBugsThread.join();
      System.out.println("JavaNCSS ended");
      System.out.println("PMD /CPD ended");
      System.out.println("CLOC ended");
      System.out.println("FindBugs ended");

      System.out.println("Starting Cobertura ...");
      coberturaThread.start();
      coberturaThread.join();
      System.out.println("Cobertura ended");

      System.out.println("Analyzing done");

      GeneralParserThread generalParser = new GeneralParserThread(
          XML_FILE_PATH + "/" + JNCSS_XML_FILE, XML_FILE_PATH + "/"
              + PMD_XML_FILE,
          XML_FILE_PATH + "/" + CLOC_XML_FILE, CLOC_LANGUAGE,
          idVersion);

      CoberturaParserThread coberturaParserThread = new CoberturaParserThread(
          XML_FILE_PATH + "/" + this.COBERTURA_XML_FILE, idVersion);

      FindbugsParserThread findBugsParserThread = new FindbugsParserThread(
          XML_FILE_PATH + "/" + this.FINDBUGS_XML_FILE, idVersion);

      System.out.println("Parsing reports ...");

      generalParser.start();
      coberturaParserThread.start();
      findBugsParserThread.start();

      generalParser.join();
      coberturaParserThread.join();
      findBugsParserThread.join();

      System.out.println("Parsing of the reports done");

      System.out.println("Deleting directories ...");

      File path = new File(CHECKOUT_DESTINATION_PATH);
      deleteDirectory(path);
      path = new File(XML_FILE_PATH);
      deleteDirectory(path);

      System.out.println("Directories deleted");
    }

    conn.disconnect();
  }
View Full Code Here

Examples of database.MySQLConnection

  }

  @Override
  public void saveResults(int idVersion) throws Exception {

    MySQLConnection conn = new MySQLConnection();
    conn.connect();

    conn.SQLUpdate("insert into test_stats (version , ncovl) values ("
        + idVersion + " , " + (numLines.equals("") ? "NULL" : numLines)
        + ")");

    conn.disconnect();
  }
View Full Code Here

Examples of database.MySQLConnection

  }

  public void saveResults(int idVersion) throws Exception {

    MySQLConnection conn = new MySQLConnection();
    conn.connect();
    Iterator<InsertList> i = insertList.iterator();
    while (i.hasNext()) {
      InsertList e = i.next();

      // Mandatory info on the error has been successfully retrieved
      if (!e.abbrev.isEmpty() && !e.category.isEmpty()
          && !e.type.isEmpty()) {

        conn.SQLUpdate("insert into findbugs_stats (version , category , abbrev , type , file , line) values ("
            + idVersion
            + ",'"
            + e.category
            + "',"
            + "'"
            + e.abbrev
            + "',"
            + "'"
            + e.type
            + "',"
            + (e.file.equals("") ? "NULL," : "'" + e.file + "',")
            + (e.line.equals("") ? "NULL" : e.line) + ")");
      }
      // Couldn't retrieve enough info on the error
      else {

        System.err
            .println("Findbugs error skipped because of lack of info");
      }
    }

    conn.disconnect();
  }
View Full Code Here

Examples of net.sourceforge.guacamole.net.auth.mysql.MySQLConnection

        for (ConnectionParameter parameter : connectionParameters)
            config.setParameter(parameter.getParameter_name(),
                    parameter.getParameter_value());

        // Create new MySQLConnection from retrieved data
        MySQLConnection mySQLConnection = mySQLConnectionProvider.get();
        mySQLConnection.init(
            connection.getConnection_id(),
            connection.getParent_id(),
            connection.getConnection_name(),
            Integer.toString(connection.getConnection_id()),
            config,
View Full Code Here

Examples of net.sourceforge.guacamole.net.auth.mysql.MySQLConnection

                    && activeConnectionMap.isConnectionGroupUserActive(group.getConnectionGroupID(), userID))
                throw new GuacamoleClientTooManyException
                        ("Cannot connect. Connection group already in use by this user.");

            // Get the connection
            MySQLConnection connection = connectionService
                    .retrieveConnection(leastUsedConnectionID, userID);
           
            // Connect to the connection
            return connectionService.connect(connection, info, userID, group.getConnectionGroupID());
View Full Code Here

Examples of org.dbunit.ext.mysql.MySqlConnection

   
    JdbcMetaDataExtractor extractor = new JdbcMetaDataExtractor(jdbcConnection);
    String userName = extractor.getUserName();
   
    try {
      IDatabaseConnection dbUnitConn = new MySqlConnection(jdbcConnection, userName);
      return dbUnitConn;
    } catch (DatabaseUnitException e) {
      throw new IllegalStateException(
          "It's not possible to create a MySql DbUnit connection: "
              + e.getMessage(), e);
View Full Code Here

Examples of org.dbunit.ext.mysql.MySqlConnection

        Class.forName("com.mysql.jdbc.Driver");
        cloudConn = createConnection("cloud");
        usageConn = createConnection("usage");

        dbuCloudConn = new MySqlConnection(cloudConn, properties.getProperty("db.cloud.name"));
        dbuUsageConn = new MySqlConnection(usageConn, properties.getProperty("db.usage.name"));
        cloudDataSet = getCloudDataSet();
        usageDataSet = getUsageDataSet();
        DatabaseOperation.CLEAN_INSERT.execute(dbuCloudConn, cloudDataSet);
        DatabaseOperation.CLEAN_INSERT.execute(dbuUsageConn, usageDataSet);
    }
View Full Code Here

Examples of org.dbunit.ext.mysql.MySqlConnection

        Connection connection = dataSource.getConnection();
        String jdbcUrl = connection.getMetaData().getURL();
        if (StringUtils.contains(jdbcUrl, ":h2:")) {
            return new H2Connection(connection, null);
        } else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
            return new MySqlConnection(connection, null);
        } else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
            return new OracleConnection(connection, null);
        } else {
            return new DatabaseConnection(connection);
        }
View Full Code Here

Examples of org.dbunit.ext.mysql.MySqlConnection

  @Override
  protected IDatabaseConnection getDbUnitConnection()
      throws DatabaseUnitException, SQLException {
    DatabaseMetaData databaseMetaData = getConnection().getMetaData();
   
    IDatabaseConnection dbconn = new MySqlConnection(getConnection(), databaseMetaData.getUserName());
    return dbconn;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.