use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.
the class QueriesPostgresTest method modifyIdToNumeric.
@org.junit.Test
public void modifyIdToNumeric() {
HikariDataSource conn = openConnexionPool();
ConceptHelper conceptHelper = new ConceptHelper();
boolean status = conceptHelper.setIdConceptToNumeric(conn, "1", "Tz6caNb7Jg");
conn.close();
System.out.println("");
}
use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.
the class TestExportTabulate method openConnexionPool.
private HikariDataSource openConnexionPool() {
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(1000);
// config.setJdbc4ConnectionTest(false);
config.setConnectionTestQuery("SELECT 1");
config.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
/* config.addDataSourceProperty("user", "opentheso");
config.addDataSourceProperty("password", "opentheso");
config.addDataSourceProperty("databaseName", "OTW");
*/
config.addDataSourceProperty("user", "pactols");
config.addDataSourceProperty("password", "frantiq2014");
config.addDataSourceProperty("databaseName", "pactols");
// config.addDataSourceProperty("serverName", "localhost");
config.addDataSourceProperty("portNumber", "5432");
config.addDataSourceProperty("serverName", "opentheso.mom.fr");
// config.addDataSourceProperty("serverName", "193.48.137.88");
HikariDataSource poolConnexion1 = new HikariDataSource(config);
return poolConnexion1;
}
use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.
the class TestGetSiteMap method openConnexionPool.
private HikariDataSource openConnexionPool() {
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(1000);
config.setConnectionTestQuery("SELECT 1");
config.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
/* config.addDataSourceProperty("user", "opentheso");
config.addDataSourceProperty("password", "opentheso");
config.addDataSourceProperty("databaseName", "OTW");
*/
config.addDataSourceProperty("user", "pactols");
config.addDataSourceProperty("password", "pactols");
config.addDataSourceProperty("databaseName", "pactols");
// 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;
}
use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.
the class TestGetSiteMap method testExportAllDatas.
/**
* Test of Get datas for SiteMap.
*/
@org.junit.Test
public void testExportAllDatas() {
HikariDataSource conn = openConnexionPool();
ConceptHelper conceptHelper = new ConceptHelper();
ArrayList<NodeConceptArkId> nodeConceptArkIds = conceptHelper.getAllConceptArkIdOfThesaurus(conn, "TH_1");
// ArrayList<String> allIds = conceptHelper.getAllIdConceptOfThesaurus(conn, "TH_1");
String url;
Date actuelle = new Date();
// * Definition du format utilise pour les dates
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// * Donne la date au format "aaaa-mm-jj"
String dat = dateFormat.format(actuelle);
StringBuilder siteMap = new StringBuilder();
siteMap.append("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n");
for (NodeConceptArkId nodeConceptArkId : nodeConceptArkIds) {
// http://ark.frantiq.fr/ark:/26678/pcrtoBSSWiOt51
// c'est l'URL qu'il faut composer.
siteMap.append(" <url>\n");
siteMap.append(" <loc>");
// siteMap.append("http://pactols.frantiq.fr/opentheso/?idc=");
// if(nodeConceptArkId.getIdArk() == null || nodeConceptArkId.getIdArk().isEmpty()){
siteMap.append("http://pactols.frantiq.fr/opentheso/?idc=");
siteMap.append(nodeConceptArkId.getIdConcept());
siteMap.append("&idt=TH_1");
/* } else {
siteMap.append("http://ark.frantiq.fr/ark:/");
siteMap.append(nodeConceptArkId.getIdArk());
}*/
// siteMap.append(url);
siteMap.append("</loc>\n");
if (dat != null) {
siteMap.append(" <lastmod>");
siteMap.append(dat);
siteMap.append("</lastmod>\n");
siteMap.append(" <changefreq>");
siteMap.append("monthly");
siteMap.append("</changefreq>\n");
siteMap.append(" <priority>0.9</priority>\n");
}
siteMap.append(" </url>\n");
}
/* for (String allId : allIds) {
// http://pactols.frantiq.fr/opentheso/?idc=13412&idt=TH_1
// c'est l'URL qu'il faut composer.
url = conceptHelper.getIdArkOfConcept(conn, allId, "TH_1");
// date = conceptHelper.getModifiedDateOfConcept(conn, allId, "TH_1");
siteMap.append(" <url>\n");
siteMap.append(" <loc>");
siteMap.append("http://ark.frantiq.fr/ark:/");
// siteMap.append("http://pactols.frantiq.fr/opentheso/?idc=");
siteMap.append(allId);
siteMap.append("&idt=TH_1");
// siteMap.append(url);
siteMap.append("</loc>\n");
if(dat != null) {
siteMap.append(" <lastmod>");
siteMap.append(dat);
siteMap.append("</lastmod>\n");
}
siteMap.append(" </url>\n");
}
*/
siteMap.append("</urlset>");
System.out.println(siteMap.toString());
conn.close();
}
use of com.zaxxer.hikari.HikariDataSource in project opentheso by miledrousset.
the class TestImportBranch method TestImportMultiBranchUnderGroup.
/**
* Test of Tabulate reading.
*/
/* @org.junit.Test
public void testImportBranchAfterGroup() {
HikariDataSource conn = openConnexionPool();
String idTheso = "";
String idGroup = "";
String path = "/Users/Miled/ownCloud_cnrs/Projets/OpenTheso/artefacts/25.xml";
String dateFromat = "yyyy-MM-dd";
boolean useArk = false;
String adresseSite = "http://localhost";
int idUser = 1;
FileInputStream file = readFile(path);
SKOSXmlDocument sKOSXmlDocument = readSkosFile(conn,
file,
dateFromat,
useArk,
adresseSite);
// permet d'importer une branche entière sous un domaine avec l'alignement automatique à la source
WriteBranchSkosBDD writeBranchSkosBDD = new WriteBranchSkosBDD(conn);
//idGroup, idThesaurus, sKOSXmlDocument, dateFormat, ark, adressSite, user);
writeBranchSkosBDD.importBranchAfterGroup(
idGroup,
idTheso,
sKOSXmlDocument, dateFromat, useArk,
adresseSite, idUser);
}*/
/**
* Test of Tabulate reading.
*/
@org.junit.Test
public void TestImportMultiBranchUnderGroup() {
HikariDataSource conn = openConnexionPool();
String idTheso = "1";
String idGroup = "";
String path = "/Users/Miled/ownCloud_cnrs/GDS_FRANTIQ/Pactols/2016-11-15/Sujets.xml";
String dateFromat = "yyyy-MM-dd";
boolean useArk = false;
String adresseSite = "http://localhost";
int idUser = 1;
FileInputStream file = readFile(path);
SKOSXmlDocument sKOSXmlDocument = readSkosFile(conn, file, dateFromat, useArk, adresseSite);
// permet d'importer une branche entière avec son domaine en intégrant l'alignement à la source
WriteBranchSkosBDD writeBranchSkosBDD = new WriteBranchSkosBDD(conn);
// idGroup, idThesaurus, sKOSXmlDocument, dateFormat, ark, adressSite, user);
writeBranchSkosBDD.importMultiBranchUnderGroup(idTheso, idGroup, sKOSXmlDocument, dateFromat, useArk, adresseSite, idUser);
}
Aggregations