亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? datasourceregressiontest.java

?? mysql jdbc驅動程序 mysql jdbc驅動程序 mysql jdbc驅動程序 mysql jdbc驅動程序
?? JAVA
字號:
/* Copyright (C) 2002-2006 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as  published by the Free Software Foundation. There are special exceptions to the terms and conditions of the GPL  as it is applied to this software. View the full text of the  exception in file EXCEPTIONS-CONNECTOR-J in the directory of this  software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */package testsuite.regression;import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;import java.io.File;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.lang.reflect.Method;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.SQLException;import java.sql.Statement;import java.util.Hashtable;import java.util.Properties;import javax.naming.Context;import javax.naming.InitialContext;import javax.naming.Name;import javax.naming.NameParser;import javax.naming.RefAddr;import javax.naming.Reference;import javax.naming.spi.ObjectFactory;import javax.sql.ConnectionPoolDataSource;import javax.sql.DataSource;import javax.sql.PooledConnection;import testsuite.BaseTestCase;import testsuite.simple.DataSourceTest;import com.mysql.jdbc.NonRegisteringDriver;import com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker;import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;import com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory;import com.mysql.jdbc.jdbc2.optional.MysqlXADataSource;/** * Tests fixes for bugs related to datasources. *  * @author Mark Matthews *  * @version $Id: DataSourceRegressionTest.java,v 1.1.2.1 2005/05/13 18:58:38 *          mmatthews Exp $ */public class DataSourceRegressionTest extends BaseTestCase {	public final static String DS_DATABASE_PROP_NAME = "com.mysql.jdbc.test.ds.db";	public final static String DS_HOST_PROP_NAME = "com.mysql.jdbc.test.ds.host";	public final static String DS_PASSWORD_PROP_NAME = "com.mysql.jdbc.test.ds.password";	public final static String DS_PORT_PROP_NAME = "com.mysql.jdbc.test.ds.port";	public final static String DS_USER_PROP_NAME = "com.mysql.jdbc.test.ds.user";	private Context ctx;	private File tempDir;	/**	 * Creates a new DataSourceRegressionTest suite for the given test name	 * 	 * @param name	 *            the name of the testcase to run.	 */	public DataSourceRegressionTest(String name) {		super(name);		// TODO Auto-generated constructor stub	}	/**	 * Runs all test cases in this test suite	 * 	 * @param args	 */	public static void main(String[] args) {		junit.textui.TestRunner.run(DataSourceTest.class);	}	/**	 * Sets up this test, calling registerDataSource() to bind a DataSource into	 * JNDI, using the FSContext JNDI provider from Sun	 * 	 * @throws Exception	 *             if an error occurs.	 */	public void setUp() throws Exception {		super.setUp();		createJNDIContext();	}	/**	 * Un-binds the DataSource, and cleans up the filesystem	 * 	 * @throws Exception	 *             if an error occurs	 */	public void tearDown() throws Exception {		this.ctx.unbind(this.tempDir.getAbsolutePath() + "/test");		this.ctx.unbind(this.tempDir.getAbsolutePath() + "/testNoUrl");		this.ctx.close();		this.tempDir.delete();		super.tearDown();	}	/**	 * Tests fix for BUG#4808- Calling .close() twice on a PooledConnection	 * causes NPE.	 * 	 * @throws Exception	 *             if an error occurs.	 */	public void testBug4808() throws Exception {		MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();		ds.setURL(BaseTestCase.dbUrl);		PooledConnection closeMeTwice = ds.getPooledConnection();		closeMeTwice.close();		closeMeTwice.close();	}	/**	 * Tests fix for Bug#3848, port # alone parsed incorrectly	 * 	 * @throws Exception	 *             ...	 */	public void testBug3848() throws Exception {		String jndiName = "/testBug3848";		String databaseName = System.getProperty(DS_DATABASE_PROP_NAME);		String userName = System.getProperty(DS_USER_PROP_NAME);		String password = System.getProperty(DS_PASSWORD_PROP_NAME);		String port = System.getProperty(DS_PORT_PROP_NAME);		// Only run this test if at least one of the above are set		if ((databaseName != null) || (userName != null) || (password != null)				|| (port != null)) {			MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();			if (databaseName != null) {				ds.setDatabaseName(databaseName);			}			if (userName != null) {				ds.setUser(userName);			}			if (password != null) {				ds.setPassword(password);			}			if (port != null) {				ds.setPortNumber(Integer.parseInt(port));			}			bindDataSource(jndiName, ds);			ConnectionPoolDataSource boundDs = null;			try {				boundDs = (ConnectionPoolDataSource) lookupDatasourceInJNDI(jndiName);				assertTrue("Datasource not bound", boundDs != null);				Connection dsConn = null;				try {					dsConn = boundDs.getPooledConnection().getConnection();				} finally {					if (dsConn != null) {						dsConn.close();					}				}			} finally {				if (boundDs != null) {					this.ctx.unbind(jndiName);				}			}		}	}	/**	 * Tests that we can get a connection from the DataSource bound in JNDI	 * during test setup	 * 	 * @throws Exception	 *             if an error occurs	 */	public void testBug3920() throws Exception {		String jndiName = "/testBug3920";		String databaseName = System.getProperty(DS_DATABASE_PROP_NAME);		String userName = System.getProperty(DS_USER_PROP_NAME);		String password = System.getProperty(DS_PASSWORD_PROP_NAME);		String port = System.getProperty(DS_PORT_PROP_NAME);		String serverName = System.getProperty(DS_HOST_PROP_NAME);		// Only run this test if at least one of the above are set		if ((databaseName != null) || (serverName != null)				|| (userName != null) || (password != null) || (port != null)) {			MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();			if (databaseName != null) {				ds.setDatabaseName(databaseName);			}			if (userName != null) {				ds.setUser(userName);			}			if (password != null) {				ds.setPassword(password);			}			if (port != null) {				ds.setPortNumber(Integer.parseInt(port));			}			if (serverName != null) {				ds.setServerName(serverName);			}			bindDataSource(jndiName, ds);			ConnectionPoolDataSource boundDs = null;			try {				boundDs = (ConnectionPoolDataSource) lookupDatasourceInJNDI(jndiName);				assertTrue("Datasource not bound", boundDs != null);				Connection dsCon = null;				Statement dsStmt = null;				try {					dsCon = boundDs.getPooledConnection().getConnection();					dsStmt = dsCon.createStatement();					dsStmt.executeUpdate("DROP TABLE IF EXISTS testBug3920");					dsStmt							.executeUpdate("CREATE TABLE testBug3920 (field1 varchar(32))");					assertTrue(							"Connection can not be obtained from data source",							dsCon != null);				} finally {					dsStmt.executeUpdate("DROP TABLE IF EXISTS testBug3920");					dsStmt.close();					dsCon.close();				}			} finally {				if (boundDs != null) {					this.ctx.unbind(jndiName);				}			}		}	}	/** 	 * Tests fix for BUG#19169 - ConnectionProperties (and thus some	 * subclasses) are not serializable, even though some J2EE containers	 * expect them to be.	 * 	 * @throws Exception if the test fails.	 */	public void testBug19169() throws Exception {		MysqlDataSource toSerialize = new MysqlDataSource();		toSerialize.setZeroDateTimeBehavior("convertToNull");				boolean testBooleanFlag = !toSerialize.getAllowLoadLocalInfile();		toSerialize.setAllowLoadLocalInfile(testBooleanFlag);				int testIntFlag = toSerialize.getBlobSendChunkSize() + 1;		toSerialize.setBlobSendChunkSize(String.valueOf(testIntFlag));				ByteArrayOutputStream bOut = new ByteArrayOutputStream();		ObjectOutputStream objOut = new ObjectOutputStream(bOut);		objOut.writeObject(toSerialize);		objOut.flush();				ObjectInputStream objIn = new ObjectInputStream(new ByteArrayInputStream(bOut.toByteArray()));				MysqlDataSource thawedDs = (MysqlDataSource)objIn.readObject();				assertEquals("convertToNull", thawedDs.getZeroDateTimeBehavior());		assertEquals(testBooleanFlag, thawedDs.getAllowLoadLocalInfile());		assertEquals(testIntFlag, thawedDs.getBlobSendChunkSize());	}		/**	 * Tests fix for BUG#20242 - MysqlValidConnectionChecker for JBoss doesn't	 * work with MySQLXADataSources.	 * 	 * @throws Exception if the test fails.	 */	public void testBug20242() throws Exception {		if (versionMeetsMinimum(5, 0)) {			try {				Class.forName("org.jboss.resource.adapter.jdbc.ValidConnectionChecker");			} catch (Exception ex) {				return; // class not available for testing			}						MysqlXADataSource xaDs = new MysqlXADataSource();			xaDs.setUrl(dbUrl);						MysqlValidConnectionChecker checker = new MysqlValidConnectionChecker();			assertNull(checker.isValidConnection(xaDs.getXAConnection().getConnection()));		}		}		private void bindDataSource(String name, DataSource ds) throws Exception {		this.ctx.bind(this.tempDir.getAbsolutePath() + name, ds);	}	/**	 * This method is separated from the rest of the example since you normally	 * would NOT register a JDBC driver in your code. It would likely be	 * configered into your naming and directory service using some GUI.	 * 	 * @throws Exception	 *             if an error occurs	 */	private void createJNDIContext() throws Exception {		this.tempDir = File.createTempFile("jnditest", null);		this.tempDir.delete();		this.tempDir.mkdir();		this.tempDir.deleteOnExit();		MysqlConnectionPoolDataSource ds;		Hashtable env = new Hashtable();		env.put(Context.INITIAL_CONTEXT_FACTORY,				"com.sun.jndi.fscontext.RefFSContextFactory");		this.ctx = new InitialContext(env);		assertTrue("Naming Context not created", this.ctx != null);		ds = new MysqlConnectionPoolDataSource();		ds.setUrl(dbUrl); // from BaseTestCase		ds.setDatabaseName("test");		this.ctx.bind(this.tempDir.getAbsolutePath() + "/test", ds);	}	private DataSource lookupDatasourceInJNDI(String jndiName) throws Exception {		NameParser nameParser = this.ctx.getNameParser("");		Name datasourceName = nameParser.parse(this.tempDir.getAbsolutePath()				+ jndiName);		Object obj = this.ctx.lookup(datasourceName);		DataSource boundDs = null;		if (obj instanceof DataSource) {			boundDs = (DataSource) obj;		} else if (obj instanceof Reference) {			//			// For some reason, this comes back as a Reference			// instance under CruiseControl !?			//			Reference objAsRef = (Reference) obj;			ObjectFactory factory = (ObjectFactory) Class.forName(					objAsRef.getFactoryClassName()).newInstance();			boundDs = (DataSource) factory.getObjectInstance(objAsRef,					datasourceName, this.ctx, new Hashtable());		}		return boundDs;	}	public void testCSC4616() throws Exception {		MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();		ds.setURL(BaseTestCase.dbUrl);		PooledConnection pooledConn = ds.getPooledConnection();		Connection physConn = pooledConn.getConnection();		Statement physStatement = physConn.createStatement();		Method enableStreamingResultsMethodStmt = Class.forName(				"com.mysql.jdbc.jdbc2.optional.StatementWrapper").getMethod(				"enableStreamingResults", new Class[0]);		enableStreamingResultsMethodStmt.invoke(physStatement, new Class[0]);		this.rs = physStatement.executeQuery("SELECT 1");		try {			physConn.createStatement().executeQuery("SELECT 2");			fail("Should have caught a streaming exception here");		} catch (SQLException sqlEx) {			assertTrue(sqlEx.getMessage() != null					&& sqlEx.getMessage().indexOf("Streaming") != -1);		} finally {			if (this.rs != null) {				this.rs.close();				this.rs = null;			}		}		PreparedStatement physPrepStmt = physConn.prepareStatement("SELECT 1");		Method enableStreamingResultsMethodPstmt = Class.forName(				"com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper")				.getMethod("enableStreamingResults", new Class[0]);		enableStreamingResultsMethodPstmt.invoke(physPrepStmt, new Class[0]);		this.rs = physPrepStmt.executeQuery();		try {			physConn.createStatement().executeQuery("SELECT 2");			fail("Should have caught a streaming exception here");		} catch (SQLException sqlEx) {			assertTrue(sqlEx.getMessage() != null					&& sqlEx.getMessage().indexOf("Streaming") != -1);		} finally {			if (this.rs != null) {				this.rs.close();				this.rs = null;			}		}	}	/**	 * Tests fix for BUG#16791 - NullPointerException in MysqlDataSourceFactory	 * due to Reference containing RefAddrs with null content.	 * 	 * @throws Exception if the test fails	 */	public void testBug16791() throws Exception {		MysqlDataSource myDs = new MysqlDataSource();		myDs.setUrl(dbUrl);		Reference asRef = myDs.getReference();		System.out.println(asRef);				removeFromRef(asRef, "port");		removeFromRef(asRef, NonRegisteringDriver.USER_PROPERTY_KEY);		removeFromRef(asRef, NonRegisteringDriver.PASSWORD_PROPERTY_KEY);		removeFromRef(asRef, "serverName");		removeFromRef(asRef, "databaseName");				MysqlDataSource newDs = (MysqlDataSource)new MysqlDataSourceFactory().getObjectInstance(asRef, null, null, null);	}	private void removeFromRef(Reference ref, String key) {		int size = ref.size();				for (int i = 0; i < size; i++) {			RefAddr refAddr = ref.get(i);			if (refAddr.getType().equals(key)) {				ref.remove(i);				break;			}		}	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久网站| 91国内精品野花午夜精品| 亚洲国产日韩a在线播放| 中文字幕精品三区| 国产午夜亚洲精品不卡| 国产日韩成人精品| 久久精品视频在线看| 久久精品免费在线观看| 亚洲国产经典视频| 成人免费视频在线观看| 亚洲成国产人片在线观看| 亚洲午夜久久久久中文字幕久| 亚洲一区二区三区四区中文字幕| 亚洲综合激情另类小说区| 日韩 欧美一区二区三区| 久久99热这里只有精品| 国产电影精品久久禁18| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 最新高清无码专区| 亚洲国产综合色| 人人爽香蕉精品| 国产不卡视频一区二区三区| 91美女精品福利| 欧美精品乱人伦久久久久久| 精品国产91九色蝌蚪| 国产精品电影院| 亚洲3atv精品一区二区三区| 黑人精品欧美一区二区蜜桃| eeuss鲁片一区二区三区在线观看| 91久久精品一区二区三| 26uuu久久天堂性欧美| 中文字幕亚洲欧美在线不卡| 性做久久久久久免费观看| 国产麻豆一精品一av一免费| 色综合久久88色综合天天免费| 日韩一区二区视频| 中文字幕亚洲视频| 九九**精品视频免费播放| 色综合天天综合网国产成人综合天 | 在线观看网站黄不卡| 欧美videos大乳护士334| 日韩久久一区二区| 国产综合久久久久久鬼色| 欧美性大战久久| 中文一区在线播放| 奇米在线7777在线精品| 色偷偷久久人人79超碰人人澡| 精品国产1区二区| 亚洲国产成人porn| 成人深夜福利app| 精品久久久久久最新网址| 亚洲国产一区二区三区| kk眼镜猥琐国模调教系列一区二区 | 亚洲主播在线观看| 成人一区二区三区中文字幕| 日韩三级免费观看| 一区二区三区在线视频免费观看| 国产成人日日夜夜| www国产成人| 六月丁香综合在线视频| 欧美日韩另类一区| 亚洲另类中文字| 成人动漫中文字幕| 国产日韩欧美精品一区| 国产精品自拍三区| 久久亚洲影视婷婷| 国产精品综合在线视频| 欧美变态tickle挠乳网站| 蜜臀a∨国产成人精品| 欧美日韩成人综合在线一区二区 | 男人的j进女人的j一区| 色视频成人在线观看免| 美女被吸乳得到大胸91| 久久综合色综合88| 日日摸夜夜添夜夜添精品视频| jvid福利写真一区二区三区| 777奇米成人网| 欧美日本高清视频在线观看| 一区二区三区小说| 91福利视频久久久久| 精品日产卡一卡二卡麻豆| 国产综合色产在线精品| 国产蜜臀97一区二区三区 | 欧美极品aⅴ影院| 成人午夜精品一区二区三区| 中文字幕佐山爱一区二区免费| 99riav久久精品riav| 一区二区视频在线| 69av一区二区三区| 久久99热这里只有精品| 中文字幕av一区二区三区| 一本大道久久精品懂色aⅴ | 久久国产三级精品| 亚洲精品在线观看视频| 国产成人av电影在线| 中文字幕在线不卡一区二区三区| a4yy欧美一区二区三区| 亚洲成人免费影院| 精品日韩欧美在线| 成人黄色在线看| 亚洲一区二区三区三| 日韩一卡二卡三卡四卡| 国产成人在线看| 亚洲精品网站在线观看| 日韩视频不卡中文| 国产91精品免费| 亚洲午夜久久久久中文字幕久| 日韩精品综合一本久道在线视频| 成人免费毛片嘿嘿连载视频| 性久久久久久久久久久久| 久久女同互慰一区二区三区| 欧美午夜不卡视频| 国产一区二区h| 亚洲成av人片一区二区| 中文字幕电影一区| 日韩一区二区三区四区| 91麻豆6部合集magnet| 寂寞少妇一区二区三区| 亚洲一二三四在线| 国产女同性恋一区二区| 日韩一级二级三级| 91色|porny| 国产一区二区三区美女| 日韩在线a电影| 亚洲欧美偷拍三级| 国产欧美一区二区精品忘忧草| 3751色影院一区二区三区| 色婷婷综合在线| 丁香激情综合五月| 久久www免费人成看片高清| 亚洲综合久久av| 亚洲视频网在线直播| 久久久久国产精品麻豆ai换脸 | 国产日韩欧美高清在线| 日韩一级片网站| 精品视频在线免费观看| 99精品欧美一区二区蜜桃免费| 国内精品久久久久影院薰衣草 | 色婷婷久久久久swag精品| 成人性生交大片免费看中文网站| 免费视频最近日韩| 丝袜美腿一区二区三区| 亚洲高清免费在线| 亚洲柠檬福利资源导航| 国产精品不卡在线观看| 国产人成亚洲第一网站在线播放 | 中文字幕日韩一区二区| 中文字幕第一区| 国产精品五月天| 国产精品情趣视频| 欧美国产成人精品| 亚洲国产精品ⅴa在线观看| 国产区在线观看成人精品| 久久精品视频在线免费观看| 久久色在线视频| 国产午夜久久久久| 国产欧美日韩视频在线观看| 国产日产精品一区| 中文字幕一区二区三区四区不卡| 国产精品久久久久久久久图文区| 国产精品网站在线播放| 亚洲欧美怡红院| 亚洲欧美偷拍卡通变态| 亚洲国产中文字幕在线视频综合| 天天综合日日夜夜精品| 麻豆91在线看| 高清免费成人av| 99国产精品99久久久久久| 欧美吞精做爰啪啪高潮| 日韩欧美一级精品久久| 国产视频一区二区在线| 亚洲三级免费电影| 视频一区视频二区中文| 国内成人免费视频| av高清久久久| 91精品国产丝袜白色高跟鞋| 久久久综合精品| 亚洲激情综合网| 美腿丝袜在线亚洲一区| 丰满少妇久久久久久久| 欧美图区在线视频| 亚洲精品在线观看网站| 亚洲人成网站精品片在线观看| 视频一区二区欧美| 成人性色生活片免费看爆迷你毛片| 91免费视频大全| 欧美mv日韩mv亚洲| 亚洲女爱视频在线| 极品美女销魂一区二区三区| 色系网站成人免费| 欧美哺乳videos| 亚洲精品免费在线播放| 久久国产三级精品| 欧美在线观看一二区| 国产日韩欧美高清在线| 香蕉加勒比综合久久| av福利精品导航| 欧美mv日韩mv国产网站app| 亚洲一级二级三级| 成人看片黄a免费看在线|