Merge pull request #233 from wenshao/master

add jboss-datasource benchmark
This commit is contained in:
温高铁
2012-12-13 19:14:53 -08:00
18 changed files with 358 additions and 1 deletions
@@ -0,0 +1,179 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.taobao</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0.1</version>
<name>parent pom for tb</name>
<repositories>
<repository>
<id>central</id>
<url>http://mvnrepo.taobao.ali.com/mvn/repository</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://mvnrepo.taobao.ali.com/mvn/repository</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://mvnrepo.taobao.ali.com/mvn/repository</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>http://mvnrepo.taobao.ali.com/mvn/repository</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://mvnrepo.taobao.ali.com/mvn/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://mvnrepo.taobao.ali.com/mvn/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- compile plugin -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>GBK</encoding>
</configuration>
</plugin>
<!--Javadoc plugin-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<charset>UTF16</charset>
<aggregate>true</aggregate>
</configuration>
</plugin>
<!-- clover plugin -->
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<licenseLocation>${clover.license}</licenseLocation>
<generateHistorical>true</generateHistorical>
<encoding>GBK</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<!-- taobao -->
<plugin>
<groupId>com.taobao.scm</groupId>
<artifactId>scm-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
<!--
<plugin>
<groupId>com.taobao.maventool</groupId>
<artifactId>maven-car-plugin</artifactId>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>com.taobao.maventool</groupId>
<artifactId>maven-tbwar-plugin</artifactId>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>com.taobao.maventool</groupId>
<artifactId>maven-tbear-plugin</artifactId>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>com.taobao.maventool</groupId>
<artifactId>maven-tbdeploy-plugin</artifactId>
<extensions>true</extensions>
</plugin>
-->
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**/*</include>
</includes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
<includes>
<include>**/*</include>
</includes>
</testResource>
</testResources>
</build>
</project>
@@ -0,0 +1 @@
dc05668192b5726439cf98e75a15b1ccc2ff69c1
@@ -0,0 +1 @@
01899596a36b40dc7d5570830248bc42a14dffd3
@@ -0,0 +1 @@
8be62df4341ba19690261a61b4c04d70472040bb
@@ -0,0 +1,122 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>com.taobao</groupId>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.taobao.tbdatasource</groupId>
<artifactId>tbdatasource</artifactId>
<name>tbdatasource</name>
<version>2.0.2</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>GBK</encoding>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>jboss.common</groupId>
<artifactId>jboss-common</artifactId>
<version>1.2.1.GA</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-j2ee</artifactId>
<version>4.2.2.GA</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.0b3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1 @@
de09f1978fe0edb43cc9504e8744dc2136117423
@@ -0,0 +1 @@
3817e27bab440d02e370c430e15d545803b0c9cf
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project>
<modelVersion>4.0.0</modelVersion>
<groupId>jboss.common</groupId>
<artifactId>jboss-common</artifactId>
<version>1.2.1.GA</version>
</project>
@@ -0,0 +1 @@
d4af82986b37cf9a9fdd06ad84b68b8f4bf0aed0
@@ -0,0 +1 @@
c4e0e7f56f0d82fd0c4ad25e9cdc62c085bd8546
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?><project>
<modelVersion>4.0.0</modelVersion>
<groupId>jboss</groupId>
<artifactId>jboss-j2ee</artifactId>
<version>4.2.2.GA</version>
<description>POM was created from install:install-file</description>
</project>
@@ -0,0 +1 @@
ef455d3e860297685b8484310619bd35b8341c1a
+12
View File
@@ -522,6 +522,12 @@
<artifactId>hibernate-core</artifactId>
<version>4.1.8.Final</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId> org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@@ -544,5 +550,11 @@
<version>1.b.46</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.taobao.tbdatasource</groupId>
<artifactId>tbdatasource</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
@@ -32,6 +32,9 @@ import com.alibaba.druid.TestUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.jolbox.bonecp.BoneCPDataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.taobao.datasource.LocalTxDataSourceDO;
import com.taobao.datasource.TaobaoDataSourceFactory;
import com.taobao.datasource.resource.adapter.jdbc.local.LocalTxDataSource;
/**
* TestOnBo 类Case1.java的实现描述:TODO 类实现描述
@@ -59,7 +62,7 @@ public class Case1 extends TestCase {
password = "dragoon25";
driverClass = "org.h2.Driver";
}
public void test_druid() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
@@ -81,6 +84,26 @@ public class Case1 extends TestCase {
}
System.out.println();
}
public void test_jobss() throws Exception {
LocalTxDataSourceDO dataSourceDO = new LocalTxDataSourceDO();
dataSourceDO.setBlockingTimeoutMillis(1000 * 60);
dataSourceDO.setMaxPoolSize(maxPoolSize);
dataSourceDO.setMinPoolSize(minPoolSize);
dataSourceDO.setDriverClass(driverClass);
dataSourceDO.setConnectionURL(jdbcUrl);
dataSourceDO.setUserName(user);
dataSourceDO.setPassword(password);
LocalTxDataSource tx = TaobaoDataSourceFactory.createLocalTxDataSource(dataSourceDO);
DataSource dataSource = tx.getDatasource();
for (int i = 0; i < loopCount; ++i) {
p0(dataSource, "jboss-datasource", threadCount);
}
System.out.println();
}
public void test_dbcp() throws Exception {
final BasicDataSource dataSource = new BasicDataSource();