01: package net.sourceforge.squirrel_sql.client.session;
02:
03: /*
04: * Copyright (C) 2007 Rob Manning
05: * manningr@users.sourceforge.net
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terdims of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: */
21: import static org.easymock.EasyMock.createMock;
22: import static org.easymock.EasyMock.expect;
23: import static org.easymock.EasyMock.replay;
24:
25: import java.sql.Connection;
26:
27: import net.sourceforge.squirrel_sql.BaseSQuirreLTestCase;
28: import net.sourceforge.squirrel_sql.fw.sql.IQueryTokenizer;
29: import net.sourceforge.squirrel_sql.fw.sql.ISQLDatabaseMetaData;
30: import net.sourceforge.squirrel_sql.fw.sql.ISQLDriver;
31: import net.sourceforge.squirrel_sql.fw.sql.SQLConnection;
32:
33: public class SQLExecuterTaskTest extends BaseSQuirreLTestCase {
34:
35: private ISession session = null;
36: private IQueryTokenizer tokenizer = null;
37: private ISQLDatabaseMetaData md = null;
38: private ISQLDriver driver = null;
39: private Connection con = null;
40: private SQLConnection sqlCon = null;
41:
42: protected void setUp() throws Exception {
43: super .setUp();
44: session = createMock(ISession.class);
45: tokenizer = createMock(IQueryTokenizer.class);
46: md = createMock(ISQLDatabaseMetaData.class);
47: con = createMock(Connection.class);
48: driver = createMock(ISQLDriver.class);
49: sqlCon = new SQLConnection(con, null, driver);
50: session.setQueryTokenizer(tokenizer);
51: expect(session.getMetaData()).andReturn(md);
52: expect(session.getSQLConnection()).andReturn(sqlCon);
53: expect(session.getQueryTokenizer()).andReturn(tokenizer);
54: replay(session);
55: }
56:
57: protected void tearDown() throws Exception {
58: super .tearDown();
59: }
60:
61: public void testNullSQL() {
62: SQLExecuterTask task = new SQLExecuterTask(session, null, null,
63: null);
64: task.run();
65: }
66: }
|