Search in sources :

Example 81 with HikariDataSource

use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.

the class TestRecursive method openConnexionPool.

private HikariDataSource openConnexionPool() {
    HikariConfig config = new HikariConfig();
    config.setMinimumIdle(1);
    config.setMaximumPoolSize(100);
    config.setConnectionTestQuery("SELECT 1");
    config.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
    // Zoomathia
    config.addDataSourceProperty("user", "pactols");
    config.addDataSourceProperty("password", "frantiq2014");
    config.addDataSourceProperty("databaseName", "pactols");
    config.addDataSourceProperty("portNumber", "5432");
    config.addDataSourceProperty("serverName", "pactols.frantiq.fr");
    // Zoomathia
    /*    config.addDataSourceProperty("user", "opentheso");
        config.addDataSourceProperty("password", "opentheso");
        config.addDataSourceProperty("databaseName", "pactols");        
        config.addDataSourceProperty("portNumber", "5433");
        config.addDataSourceProperty("serverName", "localhost");        
      */
    /*      config.addDataSourceProperty("user", "pactols");
        config.addDataSourceProperty("password", "pactols");
        config.addDataSourceProperty("databaseName", "OTW");
  */
    /*      config.addDataSourceProperty("portNumber", "5432");
        config.addDataSourceProperty("user", "pactols");
        config.addDataSourceProperty("password", "frantiq2014");
        config.addDataSourceProperty("databaseName", "193.48.137.33");
*/
    // config.addDataSourceProperty("serverName", "localhost");
    /*config.addDataSourceProperty("portNumber", "5433");
        config.addDataSourceProperty("serverName", "localhost");
        //    config.addDataSourceProperty("serverName", "193.48.137.88");
                */
    HikariDataSource poolConnexion1 = new HikariDataSource(config);
    return poolConnexion1;
}
Also used : HikariDataSource(com.zaxxer.hikari.HikariDataSource) HikariConfig(com.zaxxer.hikari.HikariConfig)

Example 82 with HikariDataSource

use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.

the class TestRestService method testGetInvertPathConcept.

/**
 *  permet de retourner les concepts d'une branche à l'envers(en partant du concept jusqu'au concept TT)
 */
@org.junit.Test
public void testGetInvertPathConcept() {
    ArrayList<String> path = new ArrayList<>();
    ArrayList<ArrayList<String>> tabId = new ArrayList<>();
    String idTheso = "TH_1";
    String idConcept = "150082";
    HikariDataSource conn = openConnexionPool();
    ConceptHelper conceptHelper = new ConceptHelper();
    path.add(idConcept);
    tabId = conceptHelper.getPathOfConceptWithoutGroup(conn, idConcept, idTheso, path, tabId);
    ExportFromBDD exportFromBDD = new ExportFromBDD();
    exportFromBDD.setServerArk("http://ark.frantiq.fr/ark:/");
    exportFromBDD.setServerAdress("http://pactols.frantiq.fr/");
    StringBuffer skos = exportFromBDD.exportConceptByLot(conn, idTheso, tabId);
    if (skos == null)
        System.out.println("");
    else
        System.err.println(skos.toString());
    conn.close();
}
Also used : HikariDataSource(com.zaxxer.hikari.HikariDataSource) ArrayList(java.util.ArrayList) ExportFromBDD(mom.trd.opentheso.core.exports.old.ExportFromBDD)

Example 83 with HikariDataSource

use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.

the class NewEmptyJUnitTest method openConnexionPool.

private HikariDataSource openConnexionPool() {
    HikariConfig config = new HikariConfig();
    config.setMaximumPoolSize(1000);
    config.setConnectionTestQuery("SELECT 1");
    config.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
    config.setMinimumIdle(1);
    config.setAutoCommit(true);
    config.setIdleTimeout(30000);
    config.setConnectionTimeout(30000);
    config.addDataSourceProperty("portNumber", "5433");
    config.addDataSourceProperty("user", "opentheso");
    config.addDataSourceProperty("password", "opentheso");
    config.addDataSourceProperty("databaseName", "OTW2");
    config.addDataSourceProperty("serverName", "localhost");
    HikariDataSource poolConnexion1 = new HikariDataSource(config);
    return poolConnexion1;
}
Also used : HikariDataSource(com.zaxxer.hikari.HikariDataSource) HikariConfig(com.zaxxer.hikari.HikariConfig)

Example 84 with HikariDataSource

use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.

the class NewEmptyJUnitTest method apple.

// TODO add test methods here.
// The methods must be annotated with annotation @Test. For example:
// 
@Test
public void apple() throws SQLException {
    HikariDataSource conn = openConnexionPool();
    recuperatefils(conn);
}
Also used : HikariDataSource(com.zaxxer.hikari.HikariDataSource) Test(org.junit.Test)

Example 85 with HikariDataSource

use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.

the class TestExportPrivatesDatas method testWriteUsersIntoXML1.

@Test
public void testWriteUsersIntoXML1() {
    HikariDataSource conn = openConnexionPool();
    ExportPrivatesDatas exportPrivatesDatas = new ExportPrivatesDatas();
    ArrayList<Table> usersList = exportPrivatesDatas.getDatasOfTable(conn, "alignement_type");
    // ArrayList <Proposition> listPropo = exportPrivatesDatas.getProposition(conn);
    // ArrayList <Concept_Candidat> listConceptC = exportPrivatesDatas.getconceptCandidat(conn);
    // ArrayList <Term_Candidat> listTermC = exportPrivatesDatas.getTermeCandidat(conn);
    // ArrayList <Concept_orphan> list_userRol = exportPrivatesDatas.getConceptOrphelin(conn);
    // ArrayList <Concept_Fusion> list_userRol = exportPrivatesDatas.getconceptFusion(conn);
    // ArrayList <Images> list_userRol = exportPrivatesDatas.getImages(conn);
    // ArrayList <Preferences> list_userRol = exportPrivatesDatas.getPreferences(conn);
    // ArrayList <Concept_Group_Historique> list_userRol = exportPrivatesDatas.getConceptGroupHist(conn);
    // ArrayList <Concept_Group_Label_Historique> list_userRol = exportPrivatesDatas.getconceptGroupLabelH(conn);
    // ArrayList <Concept_Historique> list_userRol = exportPrivatesDatas.getConceptHistorique(conn);
    // ArrayList <Hierarchical_Relationship_Historique> list_userRol = exportPrivatesDatas.getHierarchicalRelationshipH(conn);
    // ArrayList <Non_Preferred_Term> list_userRol = exportPrivatesDatas.getNonPreferredTerm(conn);
    // ArrayList <Note_Historique> list_userRol = exportPrivatesDatas.getNoteHistorique(conn);
    // ArrayList <Term_Historique> list_userRol = exportPrivatesDatas.getTermHistorique(conn);
    conn.close();
    writeHead();
    startTable("users");
    for (Table user : usersList) {
        startLine();
        for (LineOfData lineOfData : user.getLineOfDatas()) {
            writeLine(lineOfData.getColomne(), lineOfData.getValue());
        }
        endLine();
    }
    endTable("users");
    System.out.println(xml);
}
Also used : HikariDataSource(com.zaxxer.hikari.HikariDataSource) Table(mom.trd.opentheso.core.exports.privatesdatas.tables.Table) LineOfData(mom.trd.opentheso.core.exports.privatesdatas.LineOfData) ExportPrivatesDatas(mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas) Test(org.junit.Test)

Aggregations

HikariDataSource (com.zaxxer.hikari.HikariDataSource)185 HikariConfig (com.zaxxer.hikari.HikariConfig)109 Test (org.junit.Test)106 Connection (java.sql.Connection)61 TestElf.newHikariConfig (com.zaxxer.hikari.pool.TestElf.newHikariConfig)57 SQLException (java.sql.SQLException)33 StubConnection (com.zaxxer.hikari.mocks.StubConnection)30 TestElf.newHikariDataSource (com.zaxxer.hikari.pool.TestElf.newHikariDataSource)18 StubDataSource (com.zaxxer.hikari.mocks.StubDataSource)11 MetricRegistry (com.codahale.metrics.MetricRegistry)9 DataSource (javax.sql.DataSource)8 Statement (java.sql.Statement)7 ArrayList (java.util.ArrayList)7 FacesMessage (javax.faces.application.FacesMessage)7 BoneCPDataSource (com.jolbox.bonecp.BoneCPDataSource)6 PoolInitializationException (com.zaxxer.hikari.pool.HikariPool.PoolInitializationException)6 Properties (java.util.Properties)6 ConnexionTest (connexion.ConnexionTest)5 File (java.io.File)5 FileInputStream (java.io.FileInputStream)5