use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project activityinfo by bedatadriven.
the class TestConnectionProvider method openConnection.
static synchronized Connection openConnection() throws SQLException {
if (POOL == null) {
try {
if (!Boolean.getBoolean("skipDatabaseInit")) {
initializeDatabase();
}
POOL = new ComboPooledDataSource();
POOL.setDriverClass("com.mysql.jdbc.Driver");
POOL.setJdbcUrl(connectionUrl(DATABASE_NAME));
POOL.setUser(USERNAME);
POOL.setPassword(PASSWORD);
POOL.setMinPoolSize(2);
POOL.setAcquireIncrement(1);
POOL.setMaxPoolSize(5);
POOL.setUnreturnedConnectionTimeout(120);
POOL.setDebugUnreturnedConnectionStackTraces(true);
} catch (Exception e) {
throw new Error("Could not open connection to " + DATABASE_NAME, e);
}
}
return POOL.getConnection();
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project eap-additional-testsuite by jboss-set.
the class JaxbResourceDeserializationSecurityCheck method getComboPooledDataSource.
@GET
@Path("mchange")
@Produces(MediaType.APPLICATION_JSON)
public Response getComboPooledDataSource() throws RemoteException, IOException {
ComboPooledDataSource obj = new ComboPooledDataSource();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
// do various things, perhaps:
String objJsonString = mapper.writeValueAsString(obj);
return Response.ok().entity(objJsonString).build();
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project crawler4j by yasserg.
the class PgsqlTest method testPostgresRepository.
@Test
public void testPostgresRepository() throws Exception {
String jdbcurl = String.format("jdbc:postgresql://%s:%d/crawler4j", docker.containers().container("db").port(5432).getIp(), port);
String maxPagesToFetch = "20";
String numberOfCrawler = "1";
SampleLauncher.main(new String[] { maxPagesToFetch, jdbcurl, numberOfCrawler });
ComboPooledDataSource pool = getTestPool(jdbcurl);
int count = 0;
try (Connection connection = pool.getConnection()) {
ResultSet rs = connection.prepareStatement("SELECT COUNT (1) FROM webpage;").executeQuery();
rs.next();
count = rs.getInt(1);
rs.close();
}
pool.close();
Assert.assertThat(count, Matchers.greaterThan(0));
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project crawler4j by yasserg.
the class PgsqlTest method getTestPool.
private ComboPooledDataSource getTestPool(String jdbcurl) throws PropertyVetoException {
ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource();
comboPooledDataSource.setDriverClass("org.postgresql.Driver");
comboPooledDataSource.setJdbcUrl(jdbcurl);
comboPooledDataSource.setUser("crawler4j");
comboPooledDataSource.setPassword("crawler4j");
comboPooledDataSource.setMaxPoolSize(1);
comboPooledDataSource.setMinPoolSize(1);
comboPooledDataSource.setInitialPoolSize(1);
return comboPooledDataSource;
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project ignite by apache.
the class TcpDiscoveryJdbcIpFinderSelfTest method ipFinder.
/**
* {@inheritDoc}
*/
@Override
protected TcpDiscoveryJdbcIpFinder ipFinder() throws Exception {
TcpDiscoveryJdbcIpFinder finder = new TcpDiscoveryJdbcIpFinder();
assert finder.isShared() : "IP finder should be shared by default.";
dataSrc = new ComboPooledDataSource();
dataSrc.setDriverClass("org.h2.Driver");
if (initSchema)
dataSrc.setJdbcUrl("jdbc:h2:mem:./test");
else {
dataSrc.setJdbcUrl("jdbc:h2:mem:jdbc_ipfinder_not_initialized_schema");
finder.setInitSchema(false);
}
finder.setDataSource(dataSrc);
return finder;
}
Aggregations