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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? datasourceregressiontest.java

?? 用于JAVA數(shù)據(jù)庫連接.解壓就可用,方便得很
?? 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 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;			}		}	}}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品每日更新在线播放网址| 亚洲美女免费视频| 99久久99久久精品免费观看| 视频一区二区中文字幕| 国产精品视频yy9299一区| 欧美日韩不卡一区二区| 成人黄动漫网站免费app| 日本视频免费一区| 一区二区三区在线视频免费观看| 久久蜜桃av一区二区天堂| 欧洲av在线精品| 不卡一卡二卡三乱码免费网站| 免费高清不卡av| 亚洲福利一区二区| 亚洲色图在线播放| 国产日韩欧美高清在线| 91精品在线麻豆| 欧美日韩高清在线播放| 一本色道久久综合精品竹菊| 国产经典欧美精品| 国产中文字幕一区| 亚洲在线免费播放| 国产精品午夜电影| 久久久亚洲精品石原莉奈| 欧美一区二区女人| 欧美午夜理伦三级在线观看| 成人久久18免费网站麻豆 | 精品国精品自拍自在线| 欧美日韩国产中文| 在线观看中文字幕不卡| 91浏览器在线视频| www.欧美.com| 96av麻豆蜜桃一区二区| 99久久久久久| 91免费视频观看| 色综合久久久久综合体| 色综合网站在线| 91香蕉国产在线观看软件| www.欧美.com| 91丝袜高跟美女视频| 99国产精品一区| 一本一本大道香蕉久在线精品| 暴力调教一区二区三区| av电影在线不卡| 色综合久久久久| 欧美中文字幕一区二区三区| 色婷婷综合久久久中文字幕| 91麻豆6部合集magnet| 色婷婷综合久久久久中文一区二区 | 91精品国产免费久久综合| 欧美日韩成人综合天天影院| 欧美久久久一区| 欧美电影免费提供在线观看| 精品日韩在线观看| 欧美激情一区二区三区不卡| 中文字幕中文字幕一区二区 | 一区二区高清视频在线观看| 一区二区三区毛片| 日韩电影在线一区二区三区| 另类小说一区二区三区| 国产精品一区二区三区网站| 成人av网址在线观看| 91久久线看在观草草青青| 欧美人动与zoxxxx乱| 精品国内二区三区| 国产精品国产三级国产| 一区二区三区中文字幕电影| 日韩激情一二三区| 国产露脸91国语对白| 色婷婷综合久久久中文一区二区 | 一区二区三区国产精华| 日韩高清国产一区在线| 国产成人aaa| 在线视频一区二区三区| 欧美一区二区免费视频| 国产肉丝袜一区二区| 夜夜亚洲天天久久| 国产一区二区三区在线观看精品| 99精品热视频| 日韩欧美一级特黄在线播放| 欧美国产一区视频在线观看| 亚洲国产视频在线| 国产在线麻豆精品观看| 99亚偷拍自图区亚洲| 欧美精品aⅴ在线视频| 久久精品一区四区| 午夜伦理一区二区| 成人午夜视频免费看| 欧美精品高清视频| 最新不卡av在线| 美女一区二区在线观看| av电影在线不卡| 日韩欧美成人午夜| 亚洲制服欧美中文字幕中文字幕| 精品一区二区久久| 欧美性受极品xxxx喷水| 中文字幕第一页久久| 日韩中文字幕区一区有砖一区| 国产精品主播直播| 欧美剧情片在线观看| 中文字幕一区在线观看| 麻豆91免费看| 欧美浪妇xxxx高跟鞋交| 亚洲欧美日韩成人高清在线一区| 国产伦精品一区二区三区免费迷 | 欧美成人精品二区三区99精品| 亚洲欧洲日产国码二区| 精品一二线国产| 91精品国产综合久久婷婷香蕉| 亚洲欧洲另类国产综合| 高清视频一区二区| 久久嫩草精品久久久久| 日本不卡不码高清免费观看| 色噜噜狠狠色综合欧洲selulu | 日韩国产在线观看一区| av色综合久久天堂av综合| 欧美精品一区在线观看| 日本强好片久久久久久aaa| 色婷婷激情久久| 国产精品精品国产色婷婷| 国产成人aaaa| 日本一区二区三级电影在线观看| 另类人妖一区二区av| 欧美一区二区三区免费| 首页欧美精品中文字幕| 欧美日韩午夜在线| 一区二区三区在线高清| 91亚洲资源网| 亚洲欧美在线另类| 99在线视频精品| 日韩美女视频一区| av一二三不卡影片| 综合av第一页| 成人av集中营| 中文字幕中文字幕中文字幕亚洲无线| 国产高清在线观看免费不卡| 久久久午夜精品| 国产一区二区免费在线| 久久免费视频色| 国产成人激情av| 综合色中文字幕| 91国偷自产一区二区三区观看 | 在线不卡一区二区| 日韩av不卡在线观看| 91精品国产一区二区三区| 美女视频一区二区| 精品国产伦一区二区三区免费| 国产一区啦啦啦在线观看| 亚洲精品在线观看网站| 国产999精品久久| 亚洲男人天堂av网| 欧美精品久久99久久在免费线 | 一区二区三区加勒比av| 欧美无人高清视频在线观看| 日韩av中文字幕一区二区| 欧美成人精品1314www| 国产精品夜夜嗨| 1区2区3区国产精品| 日本韩国欧美国产| 青青草国产精品亚洲专区无| 2020国产精品| 99久久er热在这里只有精品66| 亚洲一区二区三区四区在线| 欧美一区二区三区小说| 国产·精品毛片| 亚洲一区二区高清| 欧美videossexotv100| 丰满亚洲少妇av| 亚洲成av人影院| 精品久久久久久亚洲综合网 | 菠萝蜜视频在线观看一区| 亚洲欧美经典视频| 欧美成人欧美edvon| 99精品视频一区二区| 毛片不卡一区二区| 亚洲视频香蕉人妖| 日韩欧美三级在线| 波多野结衣91| 老司机免费视频一区二区| 亚洲图片你懂的| 精品成人在线观看| 在线视频你懂得一区| 国产高清在线观看免费不卡| 亚洲一区在线观看网站| 国产欧美综合色| 91精品中文字幕一区二区三区| 99久久国产综合精品色伊| 久久99精品视频| 香蕉成人啪国产精品视频综合网| 国产欧美日产一区| 日韩欧美国产一区在线观看| 91在线免费播放| 国内精品国产成人国产三级粉色| 亚洲免费在线电影| 久久先锋资源网| 宅男在线国产精品| 一本久久综合亚洲鲁鲁五月天| 经典三级一区二区| 中文字幕一区免费在线观看| wwwwxxxxx欧美|