Files
Druid/src/test/java/com/alibaba/druid/PoolTestCase.java
T
2017-11-20 15:00:26 +08:00

27 lines
925 B
Java

package com.alibaba.druid;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
import junit.framework.TestCase;
import org.junit.Assert;
import javax.management.openmbean.CompositeData;
public class PoolTestCase extends TestCase {
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
}
protected void tearDown() throws Exception {
int size = DruidDataSourceStatManager.getInstance().getDataSourceList().size();
String errorInfo = null;
if (size > 0) {
CompositeData compositeData = (CompositeData) DruidDataSourceStatManager.getInstance().getDataSourceList().values().iterator().next();
String name = (String) compositeData.get("Name");
String url = (String) compositeData.get("URL");
errorInfo = "Name " + name + ", URL " + url;
}
Assert.assertEquals(errorInfo, 0, size);
}
}