use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project uavstack by uavorg.
the class C3P0HookProxy method collectDBPoolMetrics.
@SuppressWarnings("rawtypes")
@Override
public void collectDBPoolMetrics(MonitorElement clientElem) {
Set dsList = C3P0Registry.getPooledDataSources();
if (dsList == null || dsList.size() == 0) {
return;
}
/**
* Step 2: 匹配对应的jdbc url
*/
for (Object ds : dsList) {
if (!ComboPooledDataSource.class.isAssignableFrom(ds.getClass())) {
continue;
}
ComboPooledDataSource pds = (ComboPooledDataSource) ds;
String jdbcURL = pds.getJdbcUrl();
/**
* 匹配客户端应用
*/
MonitorElementInstance inst = this.matchElemInstance(clientElem, jdbcURL);
if (inst == null) {
continue;
}
collectDataSourceStat(inst, pds);
}
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project jfinal by jfinal.
the class C3p0Plugin method start.
public boolean start() {
if (isStarted)
return true;
dataSource = new ComboPooledDataSource();
dataSource.setJdbcUrl(jdbcUrl);
dataSource.setUser(user);
dataSource.setPassword(password);
try {
dataSource.setDriverClass(driverClass);
} catch (PropertyVetoException e) {
dataSource = null;
System.err.println("C3p0Plugin start error");
throw new RuntimeException(e);
}
dataSource.setMaxPoolSize(maxPoolSize);
dataSource.setMinPoolSize(minPoolSize);
dataSource.setInitialPoolSize(initialPoolSize);
dataSource.setMaxIdleTime(maxIdleTime);
dataSource.setAcquireIncrement(acquireIncrement);
isStarted = true;
return true;
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project eap-additional-testsuite by jboss-set.
the class JaxbProviderDeserializationSecurityCheck3TestCase method testMChangeV2C3p0.
@Test
public void testMChangeV2C3p0() throws Exception {
String result = performCall("rest/jaxb/mchange");
try {
ComboPooledDataSource jaxbModel = new ObjectMapper().configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false).readValue(result, ComboPooledDataSource.class);
Assert.fail("Should prevente json deserialization because of security reasons.");
} catch (JsonMappingException e) {
Assert.assertTrue("Should prevente json deserialization because of security reasons.", e.getMessage().contains("Illegal type"));
}
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project eap-additional-testsuite by jboss-set.
the class JaxbResourceDeserializationSecurityCheck3 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 eap-additional-testsuite by jboss-set.
the class JaxbProviderDeserializationSecurityCheckTestCase method testMChangeV2C3p0.
@ATTest({ "modules/testcases/jdkAll/Wildfly/jaxrs/src/main/java#13.0.0.Alpha1", "modules/testcases/jdkAll/WildflyRelease-17.0.0.Final/jaxrs/src/main/java", "modules/testcases/jdkAll/Eap71x/jaxrs/src/main/java#7.1.3", "modules/testcases/jdkAll/Eap71x-Proposed/jaxrs/src/main/java#7.1.3", "modules/testcases/jdkAll/Eap7/jaxrs/src/main/java#7.1.2", "modules/testcases/jdkAll/Eap72x/jaxrs/src/main/java", "modules/testcases/jdkAll/Eap72x-Proposed/jaxrs/src/main/java" })
@Test
public void testMChangeV2C3p0() throws Exception {
String result = performCall("rest/jaxb/mchange");
try {
ComboPooledDataSource jaxbModel = new ObjectMapper().configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false).readValue(result, ComboPooledDataSource.class);
Assert.fail("Should prevente json deserialization because of security reasons.");
} catch (JsonMappingException e) {
Assert.assertTrue("Should prevente json deserialization because of security reasons.", e.getMessage().contains("Illegal type"));
}
}
Aggregations