Source Code Cross Referenced for TestCallableStatement.java in  » Database-JDBC-Connection-Pool » HA-JDBC » net » sf » hajdbc » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » HA JDBC » net.sf.hajdbc.sql 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * HA-JDBC: High-Availability JDBC
0003:         * Copyright (c) 2004-2007 Paul Ferraro
0004:         * 
0005:         * This library is free software; you can redistribute it and/or modify it 
0006:         * under the terms of the GNU Lesser General Public License as published by the 
0007:         * Free Software Foundation; either version 2.1 of the License, or (at your 
0008:         * option) any later version.
0009:         * 
0010:         * This library is distributed in the hope that it will be useful, but WITHOUT
0011:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
0012:         * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 
0013:         * for more details.
0014:         * 
0015:         * You should have received a copy of the GNU Lesser General Public License
0016:         * along with this library; if not, write to the Free Software Foundation, 
0017:         * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0018:         * 
0019:         * Contact: ferraro@users.sourceforge.net
0020:         */
0021:        package net.sf.hajdbc.sql;
0022:
0023:        import java.io.ByteArrayInputStream;
0024:        import java.io.CharArrayReader;
0025:        import java.io.File;
0026:        import java.io.InputStream;
0027:        import java.io.Reader;
0028:        import java.io.StringReader;
0029:        import java.lang.reflect.Proxy;
0030:        import java.math.BigDecimal;
0031:        import java.net.MalformedURLException;
0032:        import java.net.URL;
0033:        import java.sql.Array;
0034:        import java.sql.Blob;
0035:        import java.sql.CallableStatement;
0036:        import java.sql.Clob;
0037:        import java.sql.Date;
0038:        import java.sql.NClob;
0039:        import java.sql.Ref;
0040:        import java.sql.RowId;
0041:        import java.sql.SQLException;
0042:        import java.sql.SQLXML;
0043:        import java.sql.Time;
0044:        import java.sql.Timestamp;
0045:        import java.sql.Types;
0046:        import java.util.Calendar;
0047:        import java.util.Collections;
0048:        import java.util.Map;
0049:        import java.util.TreeMap;
0050:
0051:        import javax.sql.rowset.serial.SerialBlob;
0052:        import javax.sql.rowset.serial.SerialClob;
0053:
0054:        import net.sf.hajdbc.Database;
0055:        import net.sf.hajdbc.util.reflect.ProxyFactory;
0056:
0057:        import org.easymock.EasyMock;
0058:        import org.testng.annotations.DataProvider;
0059:        import org.testng.annotations.Test;
0060:
0061:        /**
0062:         * Unit test for {@link CallableStatement}.
0063:         * 
0064:         * @author  Paul Ferraro
0065:         * @since   1.1
0066:         */
0067:        @Test
0068:        @SuppressWarnings({"unchecked","nls"})
0069:        public class TestCallableStatement extends TestPreparedStatement
0070:                implements  java.sql.CallableStatement {
0071:            @Override
0072:            protected Class<? extends java.sql.CallableStatement> getStatementClass() {
0073:                return java.sql.CallableStatement.class;
0074:            }
0075:
0076:            protected Class<? extends java.sql.CallableStatement> getCallableStatementClass() {
0077:                return java.sql.CallableStatement.class;
0078:            }
0079:
0080:            private CallableStatement getStatement() {
0081:                return CallableStatement.class.cast(this .statement);
0082:            }
0083:
0084:            private CallableStatement getStatement1() {
0085:                return CallableStatement.class.cast(this .statement1);
0086:            }
0087:
0088:            private CallableStatement getStatement2() {
0089:                return CallableStatement.class.cast(this .statement2);
0090:            }
0091:
0092:            @Override
0093:            protected AbstractStatementInvocationHandler getInvocationHandler(
0094:                    Map map) throws Exception {
0095:                return new CallableStatementInvocationHandler(this .connection,
0096:                        this .parent, EasyMock.createMock(Invoker.class), map,
0097:                        this .transactionContext, this .fileSupport);
0098:            }
0099:
0100:            /**
0101:             * @see net.sf.hajdbc.sql.TestStatement#recordConstructor()
0102:             */
0103:            @Override
0104:            protected void recordConstructor() throws SQLException {
0105:                this .parent.addChild(EasyMock
0106:                        .isA(CallableStatementInvocationHandler.class));
0107:            }
0108:
0109:            /**
0110:             * @see java.sql.CallableStatement#getArray(int)
0111:             */
0112:            @Test(dataProvider="int")
0113:            public Array getArray(int index) throws SQLException {
0114:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0115:
0116:                Array array = EasyMock.createMock(Array.class);
0117:
0118:                EasyMock.expect(this .getStatement1().getArray(index))
0119:                        .andReturn(array);
0120:
0121:                this .replay();
0122:
0123:                Array value = this .getStatement().getArray(index);
0124:
0125:                this .verify();
0126:
0127:                assert value == array;
0128:
0129:                return value;
0130:            }
0131:
0132:            /**
0133:             * @see java.sql.CallableStatement#getArray(java.lang.String)
0134:             */
0135:            @Test(dataProvider="string")
0136:            public Array getArray(String name) throws SQLException {
0137:                Array array = EasyMock.createMock(Array.class);
0138:
0139:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0140:
0141:                EasyMock.expect(this .getStatement1().getArray(name)).andReturn(
0142:                        array);
0143:
0144:                this .replay();
0145:
0146:                Array value = this .getStatement().getArray(name);
0147:
0148:                this .verify();
0149:
0150:                assert value == array;
0151:
0152:                return value;
0153:            }
0154:
0155:            /**
0156:             * @see java.sql.CallableStatement#getBigDecimal(int)
0157:             */
0158:            @Test(dataProvider="int")
0159:            public BigDecimal getBigDecimal(int index) throws SQLException {
0160:                BigDecimal decimal = new BigDecimal(10);
0161:
0162:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0163:
0164:                EasyMock.expect(this .getStatement1().getBigDecimal(index))
0165:                        .andReturn(decimal);
0166:
0167:                this .replay();
0168:
0169:                BigDecimal value = this .getStatement().getBigDecimal(index);
0170:
0171:                this .verify();
0172:
0173:                assert value == decimal;
0174:
0175:                return value;
0176:            }
0177:
0178:            /**
0179:             * @see java.sql.CallableStatement#getBigDecimal(int, int)
0180:             */
0181:            @SuppressWarnings("deprecation")
0182:            @Test(dataProvider="int-int")
0183:            @Deprecated
0184:            public BigDecimal getBigDecimal(int index, int scale)
0185:                    throws SQLException {
0186:                BigDecimal decimal = new BigDecimal(10);
0187:
0188:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0189:
0190:                EasyMock.expect(
0191:                        this .getStatement1().getBigDecimal(index, scale))
0192:                        .andReturn(decimal);
0193:
0194:                this .replay();
0195:
0196:                BigDecimal value = this .getStatement().getBigDecimal(index,
0197:                        scale);
0198:
0199:                this .verify();
0200:
0201:                assert value == decimal;
0202:
0203:                return value;
0204:            }
0205:
0206:            /**
0207:             * @see java.sql.CallableStatement#getBigDecimal(java.lang.String)
0208:             */
0209:            @Test(dataProvider="string")
0210:            public BigDecimal getBigDecimal(String name) throws SQLException {
0211:                BigDecimal decimal = new BigDecimal(10);
0212:
0213:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0214:
0215:                EasyMock.expect(this .getStatement1().getBigDecimal(name))
0216:                        .andReturn(decimal);
0217:
0218:                this .replay();
0219:
0220:                BigDecimal value = this .getStatement().getBigDecimal(name);
0221:
0222:                this .verify();
0223:
0224:                assert value == decimal;
0225:
0226:                return value;
0227:            }
0228:
0229:            /**
0230:             * @see java.sql.CallableStatement#getBlob(int)
0231:             */
0232:            @Test(dataProvider="int")
0233:            public Blob getBlob(int index) throws SQLException {
0234:                Blob blob = EasyMock.createMock(Blob.class);
0235:
0236:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0237:
0238:                EasyMock.expect(this .getStatement1().getBlob(index)).andReturn(
0239:                        blob);
0240:
0241:                this .replay();
0242:
0243:                Blob value = this .getStatement().getBlob(index);
0244:
0245:                this .verify();
0246:
0247:                assert value == blob;
0248:
0249:                return value;
0250:            }
0251:
0252:            /**
0253:             * @see java.sql.CallableStatement#getBlob(java.lang.String)
0254:             */
0255:            @Test(dataProvider="string")
0256:            public Blob getBlob(String name) throws SQLException {
0257:                Blob blob = EasyMock.createMock(Blob.class);
0258:
0259:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0260:
0261:                EasyMock.expect(this .getStatement1().getBlob(name)).andReturn(
0262:                        blob);
0263:
0264:                this .replay();
0265:
0266:                Blob value = this .getStatement().getBlob(name);
0267:
0268:                this .verify();
0269:
0270:                assert value == blob;
0271:
0272:                return value;
0273:            }
0274:
0275:            /**
0276:             * @see java.sql.CallableStatement#getBoolean(int)
0277:             */
0278:            @Test(dataProvider="int")
0279:            public boolean getBoolean(int index) throws SQLException {
0280:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0281:
0282:                EasyMock.expect(this .getStatement1().getBoolean(index))
0283:                        .andReturn(true);
0284:
0285:                this .replay();
0286:
0287:                boolean value = this .getStatement().getBoolean(index);
0288:
0289:                this .verify();
0290:
0291:                assert value;
0292:
0293:                return value;
0294:            }
0295:
0296:            /**
0297:             * @see java.sql.CallableStatement#getBoolean(java.lang.String)
0298:             */
0299:            @Test(dataProvider="string")
0300:            public boolean getBoolean(String name) throws SQLException {
0301:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0302:
0303:                EasyMock.expect(this .getStatement1().getBoolean(name))
0304:                        .andReturn(true);
0305:
0306:                this .replay();
0307:
0308:                boolean value = this .getStatement().getBoolean(name);
0309:
0310:                this .verify();
0311:
0312:                assert value;
0313:
0314:                return value;
0315:            }
0316:
0317:            /**
0318:             * @see java.sql.CallableStatement#getByte(int)
0319:             */
0320:            @Test(dataProvider="int")
0321:            public byte getByte(int index) throws SQLException {
0322:                byte b = Integer.valueOf(1).byteValue();
0323:
0324:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0325:
0326:                EasyMock.expect(this .getStatement1().getByte(index)).andReturn(
0327:                        b);
0328:
0329:                this .replay();
0330:
0331:                byte value = this .getStatement().getByte(index);
0332:
0333:                this .verify();
0334:
0335:                assert value == b;
0336:
0337:                return value;
0338:            }
0339:
0340:            /**
0341:             * @see java.sql.CallableStatement#getByte(java.lang.String)
0342:             */
0343:            @Test(dataProvider="string")
0344:            public byte getByte(String name) throws SQLException {
0345:                byte b = Integer.valueOf(1).byteValue();
0346:
0347:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0348:
0349:                EasyMock.expect(this .getStatement1().getByte(name))
0350:                        .andReturn(b);
0351:
0352:                this .replay();
0353:
0354:                byte value = this .getStatement().getByte(name);
0355:
0356:                this .verify();
0357:
0358:                assert value == b;
0359:
0360:                return value;
0361:            }
0362:
0363:            /**
0364:             * @see java.sql.CallableStatement#getBytes(int)
0365:             */
0366:            @Test(dataProvider="int")
0367:            public byte[] getBytes(int index) throws SQLException {
0368:                byte[] bytes = new byte[0];
0369:
0370:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0371:
0372:                EasyMock.expect(this .getStatement1().getBytes(index))
0373:                        .andReturn(bytes);
0374:
0375:                this .replay();
0376:
0377:                byte[] value = this .getStatement().getBytes(index);
0378:
0379:                this .verify();
0380:
0381:                assert value == bytes;
0382:
0383:                return value;
0384:            }
0385:
0386:            /**
0387:             * @see java.sql.CallableStatement#getBytes(java.lang.String)
0388:             */
0389:            @Test(dataProvider="string")
0390:            public byte[] getBytes(String name) throws SQLException {
0391:                byte[] bytes = new byte[0];
0392:
0393:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0394:
0395:                EasyMock.expect(this .getStatement1().getBytes(name)).andReturn(
0396:                        bytes);
0397:
0398:                this .replay();
0399:
0400:                byte[] value = this .getStatement().getBytes(name);
0401:
0402:                this .verify();
0403:
0404:                assert value == bytes;
0405:
0406:                return value;
0407:            }
0408:
0409:            /**
0410:             * @see java.sql.CallableStatement#getClob(int)
0411:             */
0412:            @Test(dataProvider="int")
0413:            public Clob getClob(int index) throws SQLException {
0414:                Clob clob = EasyMock.createMock(Clob.class);
0415:
0416:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0417:
0418:                EasyMock.expect(this .getStatement1().getClob(index)).andReturn(
0419:                        clob);
0420:
0421:                this .replay();
0422:
0423:                Clob value = this .getStatement().getClob(index);
0424:
0425:                this .verify();
0426:
0427:                assert value == clob;
0428:
0429:                return value;
0430:            }
0431:
0432:            /**
0433:             * @see java.sql.CallableStatement#getClob(java.lang.String)
0434:             */
0435:            @Test(dataProvider="string")
0436:            public Clob getClob(String name) throws SQLException {
0437:                Clob clob = EasyMock.createMock(Clob.class);
0438:
0439:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0440:
0441:                EasyMock.expect(this .getStatement1().getClob(name)).andReturn(
0442:                        clob);
0443:
0444:                this .replay();
0445:
0446:                Clob value = this .getStatement().getClob(name);
0447:
0448:                this .verify();
0449:
0450:                assert value == clob;
0451:
0452:                return value;
0453:            }
0454:
0455:            /**
0456:             * @see java.sql.CallableStatement#getDate(int)
0457:             */
0458:            @Test(dataProvider="int")
0459:            public Date getDate(int index) throws SQLException {
0460:                Date date = new Date(System.currentTimeMillis());
0461:
0462:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0463:
0464:                EasyMock.expect(this .getStatement1().getDate(index)).andReturn(
0465:                        date);
0466:
0467:                this .replay();
0468:
0469:                Date value = this .getStatement().getDate(index);
0470:
0471:                this .verify();
0472:
0473:                assert value == date;
0474:
0475:                return value;
0476:            }
0477:
0478:            @DataProvider(name="int-calendar")
0479:            Object[][] intCalendarProvider() {
0480:                return new Object[][] { new Object[] { 1,
0481:                        Calendar.getInstance() } };
0482:            }
0483:
0484:            /**
0485:             * @see java.sql.CallableStatement#getDate(int, java.util.Calendar)
0486:             */
0487:            @Test(dataProvider="int-calendar")
0488:            public Date getDate(int index, Calendar calendar)
0489:                    throws SQLException {
0490:                Date date = new Date(System.currentTimeMillis());
0491:
0492:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0493:
0494:                EasyMock.expect(this .getStatement1().getDate(index, calendar))
0495:                        .andReturn(date);
0496:
0497:                this .replay();
0498:
0499:                Date value = this .getStatement().getDate(index, calendar);
0500:
0501:                this .verify();
0502:
0503:                assert value == date;
0504:
0505:                return value;
0506:            }
0507:
0508:            /**
0509:             * @see java.sql.CallableStatement#getDate(java.lang.String)
0510:             */
0511:            @Test(dataProvider="string")
0512:            public Date getDate(String name) throws SQLException {
0513:                Date date = new Date(System.currentTimeMillis());
0514:
0515:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0516:
0517:                EasyMock.expect(this .getStatement1().getDate(name)).andReturn(
0518:                        date);
0519:
0520:                this .replay();
0521:
0522:                Date value = this .getStatement().getDate(name);
0523:
0524:                this .verify();
0525:
0526:                assert value == date;
0527:
0528:                return value;
0529:            }
0530:
0531:            @DataProvider(name="string-calendar")
0532:            Object[][] stringCalendarProvider() {
0533:                return new Object[][] { new Object[] { "column",
0534:                        Calendar.getInstance() } };
0535:            }
0536:
0537:            /**
0538:             * @see java.sql.CallableStatement#getDate(java.lang.String, java.util.Calendar)
0539:             */
0540:            @Test(dataProvider="string-calendar")
0541:            public Date getDate(String name, Calendar calendar)
0542:                    throws SQLException {
0543:                Date date = new Date(System.currentTimeMillis());
0544:
0545:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0546:
0547:                EasyMock.expect(this .getStatement1().getDate(name, calendar))
0548:                        .andReturn(date);
0549:
0550:                this .replay();
0551:
0552:                Date value = this .getStatement().getDate(name, calendar);
0553:
0554:                this .verify();
0555:
0556:                assert value == date;
0557:
0558:                return value;
0559:            }
0560:
0561:            /**
0562:             * @see java.sql.CallableStatement#getDouble(int)
0563:             */
0564:            @Test(dataProvider="int")
0565:            public double getDouble(int index) throws SQLException {
0566:                double d = 1.0;
0567:
0568:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0569:
0570:                EasyMock.expect(this .getStatement1().getDouble(index))
0571:                        .andReturn(d);
0572:
0573:                this .replay();
0574:
0575:                double value = this .getStatement().getDouble(index);
0576:
0577:                this .verify();
0578:
0579:                assert value == d;
0580:
0581:                return value;
0582:            }
0583:
0584:            /**
0585:             * @see java.sql.CallableStatement#getDouble(java.lang.String)
0586:             */
0587:            @Test(dataProvider="string")
0588:            public double getDouble(String name) throws SQLException {
0589:                double d = 1.0;
0590:
0591:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0592:
0593:                EasyMock.expect(this .getStatement1().getDouble(name))
0594:                        .andReturn(d);
0595:
0596:                this .replay();
0597:
0598:                double value = this .getStatement().getDouble(name);
0599:
0600:                this .verify();
0601:
0602:                assert value == d;
0603:
0604:                return value;
0605:            }
0606:
0607:            /**
0608:             * @see java.sql.CallableStatement#getFloat(int)
0609:             */
0610:            @Test(dataProvider="int")
0611:            public float getFloat(int index) throws SQLException {
0612:                float f = 1.0f;
0613:
0614:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0615:
0616:                EasyMock.expect(this .getStatement1().getFloat(index))
0617:                        .andReturn(f);
0618:
0619:                this .replay();
0620:
0621:                float value = this .getStatement().getFloat(index);
0622:
0623:                this .verify();
0624:
0625:                assert value == f;
0626:
0627:                return value;
0628:            }
0629:
0630:            /**
0631:             * @see java.sql.CallableStatement#getFloat(java.lang.String)
0632:             */
0633:            @Test(dataProvider="string")
0634:            public float getFloat(String name) throws SQLException {
0635:                float f = 1.0f;
0636:
0637:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0638:
0639:                EasyMock.expect(this .getStatement1().getFloat(name)).andReturn(
0640:                        f);
0641:
0642:                this .replay();
0643:
0644:                float value = this .getStatement().getFloat(name);
0645:
0646:                this .verify();
0647:
0648:                assert value == f;
0649:
0650:                return value;
0651:            }
0652:
0653:            /**
0654:             * @see java.sql.CallableStatement#getInt(int)
0655:             */
0656:            @Test(dataProvider="int")
0657:            public int getInt(int index) throws SQLException {
0658:                int i = 1;
0659:
0660:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0661:
0662:                EasyMock.expect(this .getStatement1().getInt(index))
0663:                        .andReturn(i);
0664:
0665:                this .replay();
0666:
0667:                int value = this .getStatement().getInt(index);
0668:
0669:                this .verify();
0670:
0671:                assert value == i;
0672:
0673:                return value;
0674:            }
0675:
0676:            /**
0677:             * @see java.sql.CallableStatement#getInt(java.lang.String)
0678:             */
0679:            @Test(dataProvider="string")
0680:            public int getInt(String name) throws SQLException {
0681:                int i = 1;
0682:
0683:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0684:
0685:                EasyMock.expect(this .getStatement1().getInt(name)).andReturn(i);
0686:
0687:                this .replay();
0688:
0689:                int value = this .getStatement().getInt(name);
0690:
0691:                this .verify();
0692:
0693:                assert value == i;
0694:
0695:                return value;
0696:            }
0697:
0698:            /**
0699:             * @see java.sql.CallableStatement#getLong(int)
0700:             */
0701:            @Test(dataProvider="int")
0702:            public long getLong(int index) throws SQLException {
0703:                long i = 1;
0704:
0705:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0706:
0707:                EasyMock.expect(this .getStatement1().getLong(index)).andReturn(
0708:                        i);
0709:
0710:                this .replay();
0711:
0712:                long value = this .getStatement().getLong(index);
0713:
0714:                this .verify();
0715:
0716:                assert value == i;
0717:
0718:                return value;
0719:            }
0720:
0721:            /**
0722:             * @see java.sql.CallableStatement#getLong(java.lang.String)
0723:             */
0724:            @Test(dataProvider="string")
0725:            public long getLong(String name) throws SQLException {
0726:                long i = 1;
0727:
0728:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0729:
0730:                EasyMock.expect(this .getStatement1().getLong(name))
0731:                        .andReturn(i);
0732:
0733:                this .replay();
0734:
0735:                long value = this .getStatement().getLong(name);
0736:
0737:                this .verify();
0738:
0739:                assert value == i;
0740:
0741:                return value;
0742:            }
0743:
0744:            /**
0745:             * @see java.sql.CallableStatement#getObject(int)
0746:             */
0747:            @Test(dataProvider="int")
0748:            public Object getObject(int index) throws SQLException {
0749:                Object object = new Object();
0750:
0751:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0752:
0753:                EasyMock.expect(this .getStatement1().getObject(index))
0754:                        .andReturn(object);
0755:
0756:                this .replay();
0757:
0758:                Object value = this .getStatement().getObject(index);
0759:
0760:                this .verify();
0761:
0762:                assert value == object;
0763:
0764:                return value;
0765:            }
0766:
0767:            @DataProvider(name="int-map")
0768:            Object[][] intMapProvider() {
0769:                return new Object[][] { new Object[] { 1, Collections.EMPTY_MAP } };
0770:            }
0771:
0772:            /**
0773:             * @see java.sql.CallableStatement#getObject(int, java.util.Map)
0774:             */
0775:            @Test(dataProvider="int-map")
0776:            public Object getObject(int index, Map<String, Class<?>> map)
0777:                    throws SQLException {
0778:                Object object = new Object();
0779:
0780:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0781:
0782:                EasyMock.expect(this .getStatement1().getObject(index, map))
0783:                        .andReturn(object);
0784:
0785:                this .replay();
0786:
0787:                Object value = this .getStatement().getObject(index, map);
0788:
0789:                this .verify();
0790:
0791:                assert value == object;
0792:
0793:                return value;
0794:            }
0795:
0796:            /**
0797:             * @see java.sql.CallableStatement#getObject(java.lang.String)
0798:             */
0799:            @Test(dataProvider="string")
0800:            public Object getObject(String name) throws SQLException {
0801:                Object object = new Object();
0802:
0803:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0804:
0805:                EasyMock.expect(this .getStatement1().getObject(name))
0806:                        .andReturn(object);
0807:
0808:                this .replay();
0809:
0810:                Object value = this .getStatement().getObject(name);
0811:
0812:                this .verify();
0813:
0814:                assert value == object;
0815:
0816:                return value;
0817:            }
0818:
0819:            @DataProvider(name="string-map")
0820:            Object[][] stringMapProvider() {
0821:                return new Object[][] { new Object[] { "column",
0822:                        Collections.EMPTY_MAP } };
0823:            }
0824:
0825:            /**
0826:             * @see java.sql.CallableStatement#getObject(java.lang.String, java.util.Map)
0827:             */
0828:            @Test(dataProvider="string-map")
0829:            public Object getObject(String name, Map<String, Class<?>> map)
0830:                    throws SQLException {
0831:                Object object = new Object();
0832:
0833:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0834:
0835:                EasyMock.expect(this .getStatement1().getObject(name, map))
0836:                        .andReturn(object);
0837:
0838:                this .replay();
0839:
0840:                Object value = this .getStatement().getObject(name, map);
0841:
0842:                this .verify();
0843:
0844:                assert value == object;
0845:
0846:                return value;
0847:            }
0848:
0849:            /**
0850:             * @see java.sql.CallableStatement#getRef(int)
0851:             */
0852:            @Test(dataProvider="int")
0853:            public Ref getRef(int index) throws SQLException {
0854:                Ref ref = EasyMock.createMock(Ref.class);
0855:
0856:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0857:
0858:                EasyMock.expect(this .getStatement1().getRef(index)).andReturn(
0859:                        ref);
0860:
0861:                this .replay();
0862:
0863:                Ref value = this .getStatement().getRef(index);
0864:
0865:                this .verify();
0866:
0867:                assert value == ref;
0868:
0869:                return value;
0870:            }
0871:
0872:            /**
0873:             * @see java.sql.CallableStatement#getRef(java.lang.String)
0874:             */
0875:            @Test(dataProvider="string")
0876:            public Ref getRef(String name) throws SQLException {
0877:                Ref ref = EasyMock.createMock(Ref.class);
0878:
0879:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0880:
0881:                EasyMock.expect(this .getStatement1().getRef(name)).andReturn(
0882:                        ref);
0883:
0884:                this .replay();
0885:
0886:                Ref value = this .getStatement().getRef(name);
0887:
0888:                this .verify();
0889:
0890:                assert value == ref;
0891:
0892:                return value;
0893:            }
0894:
0895:            /**
0896:             * @see java.sql.CallableStatement#getShort(int)
0897:             */
0898:            @Test(dataProvider="int")
0899:            public short getShort(int index) throws SQLException {
0900:                short s = Integer.valueOf(1).shortValue();
0901:
0902:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0903:
0904:                EasyMock.expect(this .getStatement1().getShort(index))
0905:                        .andReturn(s);
0906:
0907:                this .replay();
0908:
0909:                short value = this .getStatement().getShort(index);
0910:
0911:                this .verify();
0912:
0913:                assert value == s;
0914:
0915:                return value;
0916:            }
0917:
0918:            /**
0919:             * @see java.sql.CallableStatement#getShort(java.lang.String)
0920:             */
0921:            @Test(dataProvider="string")
0922:            public short getShort(String name) throws SQLException {
0923:                short s = Integer.valueOf(1).shortValue();
0924:
0925:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0926:
0927:                EasyMock.expect(this .getStatement1().getShort(name)).andReturn(
0928:                        s);
0929:
0930:                this .replay();
0931:
0932:                short value = this .getStatement().getShort(name);
0933:
0934:                this .verify();
0935:
0936:                assert value == s;
0937:
0938:                return value;
0939:            }
0940:
0941:            /**
0942:             * @see java.sql.CallableStatement#getString(int)
0943:             */
0944:            @Test(dataProvider="int")
0945:            public String getString(int index) throws SQLException {
0946:                String s = "";
0947:
0948:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0949:
0950:                EasyMock.expect(this .getStatement1().getString(index))
0951:                        .andReturn(s);
0952:
0953:                this .replay();
0954:
0955:                String value = this .getStatement().getString(index);
0956:
0957:                this .verify();
0958:
0959:                assert value == s;
0960:
0961:                return value;
0962:            }
0963:
0964:            /**
0965:             * @see java.sql.CallableStatement#getString(java.lang.String)
0966:             */
0967:            @Test(dataProvider="string")
0968:            public String getString(String name) throws SQLException {
0969:                String s = "";
0970:
0971:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0972:
0973:                EasyMock.expect(this .getStatement1().getString(name))
0974:                        .andReturn(s);
0975:
0976:                this .replay();
0977:
0978:                String value = this .getStatement().getString(name);
0979:
0980:                this .verify();
0981:
0982:                assert value == s;
0983:
0984:                return value;
0985:            }
0986:
0987:            /**
0988:             * @see java.sql.CallableStatement#getTime(int)
0989:             */
0990:            @Test(dataProvider="int")
0991:            public Time getTime(int index) throws SQLException {
0992:                Time time = new Time(System.currentTimeMillis());
0993:
0994:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0995:
0996:                EasyMock.expect(this .getStatement1().getTime(index)).andReturn(
0997:                        time);
0998:
0999:                this .replay();
1000:
1001:                Time value = this .getStatement().getTime(index);
1002:
1003:                this .verify();
1004:
1005:                assert value == time;
1006:
1007:                return value;
1008:            }
1009:
1010:            /**
1011:             * @see java.sql.CallableStatement#getTime(int, java.util.Calendar)
1012:             */
1013:            @Test(dataProvider="int-calendar")
1014:            public Time getTime(int index, Calendar calendar)
1015:                    throws SQLException {
1016:                Time time = new Time(System.currentTimeMillis());
1017:
1018:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1019:
1020:                EasyMock.expect(this .getStatement1().getTime(index, calendar))
1021:                        .andReturn(time);
1022:
1023:                this .replay();
1024:
1025:                Time value = this .getStatement().getTime(index, calendar);
1026:
1027:                this .verify();
1028:
1029:                assert value == time;
1030:
1031:                return value;
1032:            }
1033:
1034:            /**
1035:             * @see java.sql.CallableStatement#getTime(java.lang.String)
1036:             */
1037:            @Test(dataProvider="string")
1038:            public Time getTime(String name) throws SQLException {
1039:                Time time = new Time(System.currentTimeMillis());
1040:
1041:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1042:
1043:                EasyMock.expect(this .getStatement1().getTime(name)).andReturn(
1044:                        time);
1045:
1046:                this .replay();
1047:
1048:                Time value = this .getStatement().getTime(name);
1049:
1050:                this .verify();
1051:
1052:                assert value == time;
1053:
1054:                return value;
1055:            }
1056:
1057:            /**
1058:             * @see java.sql.CallableStatement#getTime(java.lang.String, java.util.Calendar)
1059:             */
1060:            @Test(dataProvider="string-calendar")
1061:            public Time getTime(String name, Calendar calendar)
1062:                    throws SQLException {
1063:                Time time = new Time(System.currentTimeMillis());
1064:
1065:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1066:
1067:                EasyMock.expect(this .getStatement1().getTime(name, calendar))
1068:                        .andReturn(time);
1069:
1070:                this .replay();
1071:
1072:                Time value = this .getStatement().getTime(name, calendar);
1073:
1074:                this .verify();
1075:
1076:                assert value == time;
1077:
1078:                return value;
1079:            }
1080:
1081:            /**
1082:             * @see java.sql.CallableStatement#getTimestamp(int)
1083:             */
1084:            @Test(dataProvider="int")
1085:            public Timestamp getTimestamp(int index) throws SQLException {
1086:                Timestamp timestamp = new Timestamp(System.currentTimeMillis());
1087:
1088:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1089:
1090:                EasyMock.expect(this .getStatement1().getTimestamp(index))
1091:                        .andReturn(timestamp);
1092:
1093:                this .replay();
1094:
1095:                Timestamp value = this .getStatement().getTimestamp(index);
1096:
1097:                this .verify();
1098:
1099:                assert value == timestamp;
1100:
1101:                return value;
1102:            }
1103:
1104:            /**
1105:             * @see java.sql.CallableStatement#getTimestamp(int, java.util.Calendar)
1106:             */
1107:            @Test(dataProvider="int-calendar")
1108:            public Timestamp getTimestamp(int index, Calendar cal)
1109:                    throws SQLException {
1110:                Timestamp timestamp = new Timestamp(System.currentTimeMillis());
1111:
1112:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1113:
1114:                EasyMock.expect(this .getStatement1().getTimestamp(index))
1115:                        .andReturn(timestamp);
1116:
1117:                this .replay();
1118:
1119:                Timestamp value = this .getStatement().getTimestamp(index);
1120:
1121:                this .verify();
1122:
1123:                assert value == timestamp;
1124:
1125:                return value;
1126:            }
1127:
1128:            /**
1129:             * @see java.sql.CallableStatement#getTimestamp(java.lang.String)
1130:             */
1131:            @Test(dataProvider="string")
1132:            public Timestamp getTimestamp(String name) throws SQLException {
1133:                Timestamp timestamp = new Timestamp(System.currentTimeMillis());
1134:
1135:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1136:
1137:                EasyMock.expect(this .getStatement1().getTimestamp(name))
1138:                        .andReturn(timestamp);
1139:
1140:                this .replay();
1141:
1142:                Timestamp value = this .getStatement().getTimestamp(name);
1143:
1144:                this .verify();
1145:
1146:                assert value == timestamp;
1147:
1148:                return value;
1149:            }
1150:
1151:            /**
1152:             * @see java.sql.CallableStatement#getTimestamp(java.lang.String, java.util.Calendar)
1153:             */
1154:            @Test(dataProvider="string-calendar")
1155:            public Timestamp getTimestamp(String name, Calendar calendar)
1156:                    throws SQLException {
1157:                Timestamp timestamp = new Timestamp(System.currentTimeMillis());
1158:
1159:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1160:
1161:                EasyMock.expect(
1162:                        this .getStatement1().getTimestamp(name, calendar))
1163:                        .andReturn(timestamp);
1164:
1165:                this .replay();
1166:
1167:                Timestamp value = this .getStatement().getTimestamp(name,
1168:                        calendar);
1169:
1170:                this .verify();
1171:
1172:                assert value == timestamp;
1173:
1174:                return value;
1175:            }
1176:
1177:            /**
1178:             * @see java.sql.CallableStatement#getURL(int)
1179:             */
1180:            @Test(dataProvider="int")
1181:            public URL getURL(int index) throws SQLException {
1182:                try {
1183:                    URL url = new URL("http://ha-jdbc.sf.net");
1184:
1185:                    EasyMock.expect(this .cluster.isActive()).andReturn(true);
1186:
1187:                    EasyMock.expect(this .getStatement1().getURL(index))
1188:                            .andReturn(url);
1189:
1190:                    this .replay();
1191:
1192:                    URL value = this .getStatement().getURL(index);
1193:
1194:                    this .verify();
1195:
1196:                    assert value == url;
1197:
1198:                    return value;
1199:                } catch (MalformedURLException e) {
1200:                    assert false : e;
1201:                    return null;
1202:                }
1203:            }
1204:
1205:            /**
1206:             * @see java.sql.CallableStatement#getURL(java.lang.String)
1207:             */
1208:            @Test(dataProvider="string")
1209:            public URL getURL(String name) throws SQLException {
1210:                try {
1211:                    URL url = new URL("http://ha-jdbc.sf.net");
1212:
1213:                    EasyMock.expect(this .cluster.isActive()).andReturn(true);
1214:
1215:                    EasyMock.expect(this .getStatement1().getURL(name))
1216:                            .andReturn(url);
1217:
1218:                    this .replay();
1219:
1220:                    URL value = this .getStatement().getURL(name);
1221:
1222:                    this .verify();
1223:
1224:                    assert value == url;
1225:
1226:                    return value;
1227:                } catch (MalformedURLException e) {
1228:                    assert false : e;
1229:                    return null;
1230:                }
1231:            }
1232:
1233:            /**
1234:             * @see java.sql.CallableStatement#registerOutParameter(int, int)
1235:             */
1236:            @Test(dataProvider="int-int")
1237:            public void registerOutParameter(int index, int sqlType)
1238:                    throws SQLException {
1239:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1240:
1241:                this .getStatement1().registerOutParameter(index, sqlType);
1242:                this .getStatement2().registerOutParameter(index, sqlType);
1243:
1244:                this .replay();
1245:
1246:                this .getStatement().registerOutParameter(index, sqlType);
1247:
1248:                this .verify();
1249:            }
1250:
1251:            @DataProvider(name="int-int-int")
1252:            Object[][] intIntIntProvider() {
1253:                return new Object[][] { new Object[] { 1, Types.INTEGER, 1 } };
1254:            }
1255:
1256:            /**
1257:             * @see java.sql.CallableStatement#registerOutParameter(int, int, int)
1258:             */
1259:            @Test(dataProvider="int-int-int")
1260:            public void registerOutParameter(int index, int sqlType, int scale)
1261:                    throws SQLException {
1262:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1263:
1264:                this .getStatement1()
1265:                        .registerOutParameter(index, sqlType, scale);
1266:                this .getStatement2()
1267:                        .registerOutParameter(index, sqlType, scale);
1268:
1269:                this .replay();
1270:
1271:                this .getStatement().registerOutParameter(index, sqlType, scale);
1272:
1273:                this .verify();
1274:            }
1275:
1276:            /**
1277:             * @see java.sql.CallableStatement#registerOutParameter(int, int, java.lang.String)
1278:             */
1279:            @Test(dataProvider="int-int-string")
1280:            public void registerOutParameter(int index, int sqlType,
1281:                    String typeName) throws SQLException {
1282:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1283:
1284:                this .getStatement1().registerOutParameter(index, sqlType,
1285:                        typeName);
1286:                this .getStatement2().registerOutParameter(index, sqlType,
1287:                        typeName);
1288:
1289:                this .replay();
1290:
1291:                this .getStatement().registerOutParameter(index, sqlType,
1292:                        typeName);
1293:
1294:                this .verify();
1295:            }
1296:
1297:            /**
1298:             * @see java.sql.CallableStatement#registerOutParameter(java.lang.String, int)
1299:             */
1300:            @Test(dataProvider="string-int")
1301:            public void registerOutParameter(String name, int sqlType)
1302:                    throws SQLException {
1303:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1304:
1305:                this .getStatement1().registerOutParameter(name, sqlType);
1306:                this .getStatement2().registerOutParameter(name, sqlType);
1307:
1308:                this .replay();
1309:
1310:                this .getStatement().registerOutParameter(name, sqlType);
1311:
1312:                this .verify();
1313:            }
1314:
1315:            @DataProvider(name="string-int-int")
1316:            Object[][] stringIntIntProvider() {
1317:                return new Object[][] { new Object[] { "column", Types.INTEGER,
1318:                        1 } };
1319:            }
1320:
1321:            /**
1322:             * @see java.sql.CallableStatement#registerOutParameter(java.lang.String, int, int)
1323:             */
1324:            @Test(dataProvider="string-int-int")
1325:            public void registerOutParameter(String name, int sqlType, int scale)
1326:                    throws SQLException {
1327:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1328:
1329:                this .getStatement1().registerOutParameter(name, sqlType, scale);
1330:                this .getStatement2().registerOutParameter(name, sqlType, scale);
1331:
1332:                this .replay();
1333:
1334:                this .getStatement().registerOutParameter(name, sqlType, scale);
1335:
1336:                this .verify();
1337:            }
1338:
1339:            @DataProvider(name="string-int-string")
1340:            Object[][] stringIntStringProvider() {
1341:                return new Object[][] { new Object[] { "column", Types.INTEGER,
1342:                        "int" } };
1343:            }
1344:
1345:            /**
1346:             * @see java.sql.CallableStatement#registerOutParameter(java.lang.String, int, java.lang.String)
1347:             */
1348:            @Test(dataProvider="string-int-string")
1349:            public void registerOutParameter(String name, int sqlType,
1350:                    String typeName) throws SQLException {
1351:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1352:
1353:                this .getStatement1().registerOutParameter(name, sqlType,
1354:                        typeName);
1355:                this .getStatement2().registerOutParameter(name, sqlType,
1356:                        typeName);
1357:
1358:                this .replay();
1359:
1360:                this .getStatement().registerOutParameter(name, sqlType,
1361:                        typeName);
1362:
1363:                this .verify();
1364:            }
1365:
1366:            @DataProvider(name="string-inputStream-int")
1367:            Object[][] stringInputStreamIntProvider() {
1368:                return new Object[][] { new Object[] { "column",
1369:                        new ByteArrayInputStream(new byte[0]), 0 } };
1370:            }
1371:
1372:            /**
1373:             * @see java.sql.CallableStatement#setAsciiStream(java.lang.String, java.io.InputStream, int)
1374:             */
1375:            @Test(dataProvider="string-inputStream-int")
1376:            public void setAsciiStream(String name, InputStream value,
1377:                    int length) throws SQLException {
1378:                InputStream inputStream1 = new ByteArrayInputStream(new byte[0]);
1379:                InputStream inputStream2 = new ByteArrayInputStream(new byte[0]);
1380:                File file = new File("");
1381:
1382:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1383:
1384:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
1385:                        file);
1386:
1387:                EasyMock.expect(this .fileSupport.getInputStream(file))
1388:                        .andReturn(inputStream1);
1389:
1390:                this .getStatement1().setAsciiStream(name, inputStream1, length);
1391:
1392:                EasyMock.expect(this .fileSupport.getInputStream(file))
1393:                        .andReturn(inputStream2);
1394:
1395:                this .getStatement2().setAsciiStream(name, inputStream2, length);
1396:
1397:                this .replay();
1398:
1399:                this .getStatement().setAsciiStream(name, value, length);
1400:
1401:                this .verify();
1402:            }
1403:
1404:            @DataProvider(name="string-bigDecimal")
1405:            Object[][] stringBigDecimalProvider() {
1406:                return new Object[][] { new Object[] { "column",
1407:                        new BigDecimal(1.0) } };
1408:            }
1409:
1410:            /**
1411:             * @see java.sql.CallableStatement#setBigDecimal(java.lang.String, java.math.BigDecimal)
1412:             */
1413:            @Test(dataProvider="string-bigDecimal")
1414:            public void setBigDecimal(String name, BigDecimal value)
1415:                    throws SQLException {
1416:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1417:
1418:                this .getStatement1().setBigDecimal(name, value);
1419:                this .getStatement2().setBigDecimal(name, value);
1420:
1421:                this .replay();
1422:
1423:                this .getStatement().setBigDecimal(name, value);
1424:
1425:                this .verify();
1426:            }
1427:
1428:            /**
1429:             * @see java.sql.CallableStatement#setBinaryStream(java.lang.String, java.io.InputStream, int)
1430:             */
1431:            @Test(dataProvider="string-inputStream-int")
1432:            public void setBinaryStream(String name, InputStream value,
1433:                    int length) throws SQLException {
1434:                InputStream inputStream1 = new ByteArrayInputStream(new byte[0]);
1435:                InputStream inputStream2 = new ByteArrayInputStream(new byte[0]);
1436:                File file = new File("");
1437:
1438:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1439:
1440:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
1441:                        file);
1442:
1443:                EasyMock.expect(this .fileSupport.getInputStream(file))
1444:                        .andReturn(inputStream1);
1445:
1446:                this .getStatement1()
1447:                        .setBinaryStream(name, inputStream1, length);
1448:
1449:                EasyMock.expect(this .fileSupport.getInputStream(file))
1450:                        .andReturn(inputStream2);
1451:
1452:                this .getStatement2()
1453:                        .setBinaryStream(name, inputStream2, length);
1454:
1455:                this .replay();
1456:
1457:                this .getStatement().setBinaryStream(name, value, length);
1458:
1459:                this .verify();
1460:            }
1461:
1462:            @DataProvider(name="string-boolean")
1463:            Object[][] stringBooleanProvider() {
1464:                return new Object[][] { new Object[] { "column", true } };
1465:            }
1466:
1467:            /**
1468:             * @see java.sql.CallableStatement#setBoolean(java.lang.String, boolean)
1469:             */
1470:            @Test(dataProvider="string-boolean")
1471:            public void setBoolean(String name, boolean value)
1472:                    throws SQLException {
1473:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1474:
1475:                this .getStatement1().setBoolean(name, value);
1476:                this .getStatement2().setBoolean(name, value);
1477:
1478:                this .replay();
1479:
1480:                this .getStatement().setBoolean(name, value);
1481:
1482:                this .verify();
1483:            }
1484:
1485:            @DataProvider(name="string-byte")
1486:            Object[][] stringByteProvider() {
1487:                return new Object[][] { new Object[] { "column",
1488:                        Integer.valueOf(1).byteValue() } };
1489:            }
1490:
1491:            /**
1492:             * @see java.sql.CallableStatement#setByte(java.lang.String, byte)
1493:             */
1494:            @Test(dataProvider="string-byte")
1495:            public void setByte(String name, byte value) throws SQLException {
1496:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1497:
1498:                this .getStatement1().setByte(name, value);
1499:                this .getStatement2().setByte(name, value);
1500:
1501:                this .replay();
1502:
1503:                this .getStatement().setByte(name, value);
1504:
1505:                this .verify();
1506:            }
1507:
1508:            @DataProvider(name="string-bytes")
1509:            Object[][] stringBytesProvider() {
1510:                return new Object[][] { new Object[] { "column", new byte[0] } };
1511:            }
1512:
1513:            /**
1514:             * @see java.sql.CallableStatement#setBytes(java.lang.String, byte[])
1515:             */
1516:            @Test(dataProvider="string-bytes")
1517:            public void setBytes(String name, byte[] value) throws SQLException {
1518:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1519:
1520:                this .getStatement1().setBytes(name, value);
1521:                this .getStatement2().setBytes(name, value);
1522:
1523:                this .replay();
1524:
1525:                this .getStatement().setBytes(name, value);
1526:
1527:                this .verify();
1528:            }
1529:
1530:            @DataProvider(name="string-reader-int")
1531:            Object[][] stringReaderIntProvider() {
1532:                return new Object[][] { new Object[] { "column",
1533:                        new CharArrayReader(new char[0]), 0 } };
1534:            }
1535:
1536:            /**
1537:             * @see java.sql.CallableStatement#setCharacterStream(java.lang.String, java.io.Reader, int)
1538:             */
1539:            @Test(dataProvider="string-reader-int")
1540:            public void setCharacterStream(String name, Reader value, int length)
1541:                    throws SQLException {
1542:                Reader reader1 = new CharArrayReader(new char[0]);
1543:                Reader reader2 = new CharArrayReader(new char[0]);
1544:                File file = new File("");
1545:
1546:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1547:
1548:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
1549:                        file);
1550:
1551:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
1552:                        reader1);
1553:
1554:                this .getStatement1().setCharacterStream(name, reader1, length);
1555:
1556:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
1557:                        reader2);
1558:
1559:                this .getStatement2().setCharacterStream(name, reader2, length);
1560:
1561:                this .replay();
1562:
1563:                this .getStatement().setCharacterStream(name, value, length);
1564:
1565:                this .verify();
1566:            }
1567:
1568:            @DataProvider(name="string-date")
1569:            Object[][] stringDateProvider() {
1570:                return new Object[][] { new Object[] { "column",
1571:                        new Date(System.currentTimeMillis()) } };
1572:            }
1573:
1574:            /**
1575:             * @see java.sql.CallableStatement#setDate(java.lang.String, java.sql.Date)
1576:             */
1577:            @Test(dataProvider="string-date")
1578:            public void setDate(String name, Date value) throws SQLException {
1579:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1580:
1581:                this .getStatement1().setDate(name, value);
1582:                this .getStatement2().setDate(name, value);
1583:
1584:                this .replay();
1585:
1586:                this .getStatement().setDate(name, value);
1587:
1588:                this .verify();
1589:            }
1590:
1591:            @DataProvider(name="string-date-calendar")
1592:            Object[][] stringDateCalendarProvider() {
1593:                return new Object[][] { new Object[] { "column",
1594:                        new Date(System.currentTimeMillis()),
1595:                        Calendar.getInstance() } };
1596:            }
1597:
1598:            /**
1599:             * @see java.sql.CallableStatement#setDate(java.lang.String, java.sql.Date, java.util.Calendar)
1600:             */
1601:            @Test(dataProvider="string-date-calendar")
1602:            public void setDate(String name, Date value, Calendar calendar)
1603:                    throws SQLException {
1604:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1605:
1606:                this .getStatement1().setDate(name, value, calendar);
1607:                this .getStatement2().setDate(name, value, calendar);
1608:
1609:                this .replay();
1610:
1611:                this .getStatement().setDate(name, value, calendar);
1612:
1613:                this .verify();
1614:            }
1615:
1616:            @DataProvider(name="string-double")
1617:            Object[][] stringDoubleProvider() {
1618:                return new Object[][] { new Object[] { "column", 1.0 } };
1619:            }
1620:
1621:            /**
1622:             * @see java.sql.CallableStatement#setDouble(java.lang.String, double)
1623:             */
1624:            @Test(dataProvider="string-double")
1625:            public void setDouble(String name, double value)
1626:                    throws SQLException {
1627:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1628:
1629:                this .getStatement1().setDouble(name, value);
1630:                this .getStatement2().setDouble(name, value);
1631:
1632:                this .replay();
1633:
1634:                this .getStatement().setDouble(name, value);
1635:
1636:                this .verify();
1637:            }
1638:
1639:            @DataProvider(name="string-float")
1640:            Object[][] stringFloatProvider() {
1641:                return new Object[][] { new Object[] { "column", 1.0F } };
1642:            }
1643:
1644:            /**
1645:             * @see java.sql.CallableStatement#setFloat(java.lang.String, float)
1646:             */
1647:            @Test(dataProvider="string-float")
1648:            public void setFloat(String name, float value) throws SQLException {
1649:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1650:
1651:                this .getStatement1().setFloat(name, value);
1652:                this .getStatement2().setFloat(name, value);
1653:
1654:                this .replay();
1655:
1656:                this .getStatement().setFloat(name, value);
1657:
1658:                this .verify();
1659:            }
1660:
1661:            /**
1662:             * @see java.sql.CallableStatement#setInt(java.lang.String, int)
1663:             */
1664:            @Test(dataProvider="string-int")
1665:            public void setInt(String name, int value) throws SQLException {
1666:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1667:
1668:                this .getStatement1().setInt(name, value);
1669:                this .getStatement2().setInt(name, value);
1670:
1671:                this .replay();
1672:
1673:                this .getStatement().setInt(name, value);
1674:
1675:                this .verify();
1676:            }
1677:
1678:            @DataProvider(name="string-long")
1679:            Object[][] stringLongProvider() {
1680:                return new Object[][] { new Object[] { "column", 1L } };
1681:            }
1682:
1683:            /**
1684:             * @see java.sql.CallableStatement#setLong(java.lang.String, long)
1685:             */
1686:            @Test(dataProvider="string-long")
1687:            public void setLong(String name, long value) throws SQLException {
1688:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1689:
1690:                this .getStatement1().setLong(name, value);
1691:                this .getStatement2().setLong(name, value);
1692:
1693:                this .replay();
1694:
1695:                this .getStatement().setLong(name, value);
1696:
1697:                this .verify();
1698:            }
1699:
1700:            /**
1701:             * @see java.sql.CallableStatement#setNull(java.lang.String, int)
1702:             */
1703:            @Test(dataProvider="string-int")
1704:            public void setNull(String name, int sqlType) throws SQLException {
1705:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1706:
1707:                this .getStatement1().setNull(name, sqlType);
1708:                this .getStatement2().setNull(name, sqlType);
1709:
1710:                this .replay();
1711:
1712:                this .getStatement().setNull(name, sqlType);
1713:
1714:                this .verify();
1715:            }
1716:
1717:            /**
1718:             * @see java.sql.CallableStatement#setNull(java.lang.String, int, java.lang.String)
1719:             */
1720:            @Test(dataProvider="string-int-string")
1721:            public void setNull(String name, int sqlType, String typeName)
1722:                    throws SQLException {
1723:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1724:
1725:                this .getStatement1().setNull(name, sqlType, typeName);
1726:                this .getStatement2().setNull(name, sqlType, typeName);
1727:
1728:                this .replay();
1729:
1730:                this .getStatement().setNull(name, sqlType, typeName);
1731:
1732:                this .verify();
1733:            }
1734:
1735:            @DataProvider(name="string-object")
1736:            Object[][] stringObjectProvider() {
1737:                return new Object[][] { new Object[] { "column", new Object() } };
1738:            }
1739:
1740:            /**
1741:             * @see java.sql.CallableStatement#setObject(java.lang.String, java.lang.Object)
1742:             */
1743:            @Test(dataProvider="string-object")
1744:            public void setObject(String name, Object value)
1745:                    throws SQLException {
1746:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1747:
1748:                this .getStatement1().setObject(name, value);
1749:                this .getStatement2().setObject(name, value);
1750:
1751:                this .replay();
1752:
1753:                this .getStatement().setObject(name, value);
1754:
1755:                this .verify();
1756:            }
1757:
1758:            @DataProvider(name="string-object-int")
1759:            Object[][] stringObjectIntProvider() {
1760:                return new Object[][] { new Object[] { "column", new Object(),
1761:                        Types.INTEGER } };
1762:            }
1763:
1764:            /**
1765:             * @see java.sql.CallableStatement#setObject(java.lang.String, java.lang.Object, int)
1766:             */
1767:            @Test(dataProvider="string-object-int")
1768:            public void setObject(String name, Object value, int targetSqlType)
1769:                    throws SQLException {
1770:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1771:
1772:                this .getStatement1().setObject(name, value, targetSqlType);
1773:                this .getStatement2().setObject(name, value, targetSqlType);
1774:
1775:                this .replay();
1776:
1777:                this .getStatement().setObject(name, value, targetSqlType);
1778:
1779:                this .verify();
1780:            }
1781:
1782:            @DataProvider(name="string-object-int-int")
1783:            Object[][] stringObjectIntIntProvider() {
1784:                return new Object[][] { new Object[] { "column", new Object(),
1785:                        Types.INTEGER, 1 } };
1786:            }
1787:
1788:            /**
1789:             * @see java.sql.CallableStatement#setObject(java.lang.String, java.lang.Object, int, int)
1790:             */
1791:            @Test(dataProvider="string-object-int-int")
1792:            public void setObject(String name, Object value, int targetSqlType,
1793:                    int scale) throws SQLException {
1794:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1795:
1796:                this .getStatement1().setObject(name, value, targetSqlType,
1797:                        scale);
1798:                this .getStatement2().setObject(name, value, targetSqlType,
1799:                        scale);
1800:
1801:                this .replay();
1802:
1803:                this .getStatement()
1804:                        .setObject(name, value, targetSqlType, scale);
1805:
1806:                this .verify();
1807:            }
1808:
1809:            @DataProvider(name="string-short")
1810:            Object[][] stringShortProvider() {
1811:                return new Object[][] { new Object[] { "column",
1812:                        Integer.valueOf(1).shortValue() } };
1813:            }
1814:
1815:            /**
1816:             * @see java.sql.CallableStatement#setShort(java.lang.String, short)
1817:             */
1818:            @Test(dataProvider="string-short")
1819:            public void setShort(String name, short value) throws SQLException {
1820:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1821:
1822:                this .getStatement1().setShort(name, value);
1823:                this .getStatement2().setShort(name, value);
1824:
1825:                this .replay();
1826:
1827:                this .getStatement().setShort(name, value);
1828:
1829:                this .verify();
1830:            }
1831:
1832:            @DataProvider(name="string-string")
1833:            Object[][] stringStringProvider() {
1834:                return new Object[][] { new Object[] { "column", "" } };
1835:            }
1836:
1837:            /**
1838:             * @see java.sql.CallableStatement#setString(java.lang.String, java.lang.String)
1839:             */
1840:            @Test(dataProvider="string-string")
1841:            public void setString(String name, String value)
1842:                    throws SQLException {
1843:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1844:
1845:                this .getStatement1().setString(name, value);
1846:                this .getStatement2().setString(name, value);
1847:
1848:                this .replay();
1849:
1850:                this .getStatement().setString(name, value);
1851:
1852:                this .verify();
1853:            }
1854:
1855:            @DataProvider(name="string-time")
1856:            Object[][] stringTimeProvider() {
1857:                return new Object[][] { new Object[] { "column",
1858:                        new Time(System.currentTimeMillis()) } };
1859:            }
1860:
1861:            /**
1862:             * @see java.sql.CallableStatement#setTime(java.lang.String, java.sql.Time)
1863:             */
1864:            @Test(dataProvider="string-time")
1865:            public void setTime(String name, Time value) throws SQLException {
1866:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1867:
1868:                this .getStatement1().setTime(name, value);
1869:                this .getStatement2().setTime(name, value);
1870:
1871:                this .replay();
1872:
1873:                this .getStatement().setTime(name, value);
1874:
1875:                this .verify();
1876:            }
1877:
1878:            @DataProvider(name="string-time-calendar")
1879:            Object[][] stringTimeCalendarProvider() {
1880:                return new Object[][] { new Object[] { "column",
1881:                        new Time(System.currentTimeMillis()),
1882:                        Calendar.getInstance() } };
1883:            }
1884:
1885:            /**
1886:             * @see java.sql.CallableStatement#setTime(java.lang.String, java.sql.Time, java.util.Calendar)
1887:             */
1888:            @Test(dataProvider="string-time-calendar")
1889:            public void setTime(String name, Time value, Calendar calendar)
1890:                    throws SQLException {
1891:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1892:
1893:                this .getStatement1().setTime(name, value, calendar);
1894:                this .getStatement2().setTime(name, value, calendar);
1895:
1896:                this .replay();
1897:
1898:                this .getStatement().setTime(name, value, calendar);
1899:
1900:                this .verify();
1901:            }
1902:
1903:            @DataProvider(name="string-timestamp")
1904:            Object[][] stringTimestampProvider() {
1905:                return new Object[][] { new Object[] { "column",
1906:                        new Timestamp(System.currentTimeMillis()) } };
1907:            }
1908:
1909:            /**
1910:             * @see java.sql.CallableStatement#setTimestamp(java.lang.String, java.sql.Timestamp)
1911:             */
1912:            @Test(dataProvider="string-timestamp")
1913:            public void setTimestamp(String name, Timestamp value)
1914:                    throws SQLException {
1915:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1916:
1917:                this .getStatement1().setTimestamp(name, value);
1918:                this .getStatement2().setTimestamp(name, value);
1919:
1920:                this .replay();
1921:
1922:                this .getStatement().setTimestamp(name, value);
1923:
1924:                this .verify();
1925:            }
1926:
1927:            @DataProvider(name="string-timestamp-calendar")
1928:            Object[][] stringTimestampCalendarProvider() {
1929:                return new Object[][] { new Object[] { "column",
1930:                        new Timestamp(System.currentTimeMillis()),
1931:                        Calendar.getInstance() } };
1932:            }
1933:
1934:            /**
1935:             * @see java.sql.CallableStatement#setTimestamp(java.lang.String, java.sql.Timestamp, java.util.Calendar)
1936:             */
1937:            @Test(dataProvider="string-timestamp-calendar")
1938:            public void setTimestamp(String name, Timestamp value,
1939:                    Calendar calendar) throws SQLException {
1940:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1941:
1942:                this .getStatement1().setTimestamp(name, value, calendar);
1943:                this .getStatement2().setTimestamp(name, value, calendar);
1944:
1945:                this .replay();
1946:
1947:                this .getStatement().setTimestamp(name, value, calendar);
1948:
1949:                this .verify();
1950:            }
1951:
1952:            @DataProvider(name="string-url")
1953:            Object[][] stringUrlProvider() throws MalformedURLException {
1954:                return new Object[][] { new Object[] { "column",
1955:                        new URL("http://ha-jdbc.sf.net") } };
1956:            }
1957:
1958:            /**
1959:             * @see java.sql.CallableStatement#setURL(java.lang.String, java.net.URL)
1960:             */
1961:            @Test(dataProvider="string-url")
1962:            public void setURL(String name, URL value) throws SQLException {
1963:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1964:
1965:                this .getStatement1().setURL(name, value);
1966:                this .getStatement2().setURL(name, value);
1967:
1968:                this .replay();
1969:
1970:                this .getStatement().setURL(name, value);
1971:
1972:                this .verify();
1973:            }
1974:
1975:            /**
1976:             * @see java.sql.CallableStatement#wasNull()
1977:             */
1978:            @Test
1979:            public boolean wasNull() throws SQLException {
1980:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1981:
1982:                EasyMock.expect(this .getStatement1().wasNull()).andReturn(true);
1983:
1984:                this .replay();
1985:
1986:                boolean result = this .getStatement().wasNull();
1987:
1988:                this .verify();
1989:
1990:                assert result;
1991:
1992:                return result;
1993:            }
1994:
1995:            /**
1996:             * @see java.sql.CallableStatement#getCharacterStream(int)
1997:             */
1998:            @Test(dataProvider="int")
1999:            public Reader getCharacterStream(int index) throws SQLException {
2000:                Reader reader = new StringReader("");
2001:
2002:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2003:
2004:                EasyMock.expect(this .getStatement1().getCharacterStream(index))
2005:                        .andReturn(reader);
2006:
2007:                this .replay();
2008:
2009:                Reader result = this .getStatement().getCharacterStream(index);
2010:
2011:                this .verify();
2012:
2013:                assert result == reader;
2014:
2015:                return result;
2016:            }
2017:
2018:            /**
2019:             * @see java.sql.CallableStatement#getCharacterStream(java.lang.String)
2020:             */
2021:            @Test(dataProvider="string")
2022:            public Reader getCharacterStream(String name) throws SQLException {
2023:                Reader reader = new StringReader("");
2024:
2025:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2026:
2027:                EasyMock.expect(this .getStatement1().getCharacterStream(name))
2028:                        .andReturn(reader);
2029:
2030:                this .replay();
2031:
2032:                Reader result = this .getStatement().getCharacterStream(name);
2033:
2034:                this .verify();
2035:
2036:                assert result == reader;
2037:
2038:                return result;
2039:            }
2040:
2041:            /**
2042:             * @see java.sql.CallableStatement#getNCharacterStream(int)
2043:             */
2044:            @Test(dataProvider="int")
2045:            public Reader getNCharacterStream(int index) throws SQLException {
2046:                Reader reader = new StringReader("");
2047:
2048:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2049:
2050:                EasyMock
2051:                        .expect(this .getStatement1().getNCharacterStream(index))
2052:                        .andReturn(reader);
2053:
2054:                this .replay();
2055:
2056:                Reader result = this .getStatement().getNCharacterStream(index);
2057:
2058:                this .verify();
2059:
2060:                assert result == reader;
2061:
2062:                return result;
2063:            }
2064:
2065:            /**
2066:             * @see java.sql.CallableStatement#getNCharacterStream(java.lang.String)
2067:             */
2068:            @Test(dataProvider="string")
2069:            public Reader getNCharacterStream(String name) throws SQLException {
2070:                Reader reader = new StringReader("");
2071:
2072:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2073:
2074:                EasyMock.expect(this .getStatement1().getNCharacterStream(name))
2075:                        .andReturn(reader);
2076:
2077:                this .replay();
2078:
2079:                Reader result = this .getStatement().getNCharacterStream(name);
2080:
2081:                this .verify();
2082:
2083:                assert result == reader;
2084:
2085:                return result;
2086:            }
2087:
2088:            /**
2089:             * @see java.sql.CallableStatement#getNClob(int)
2090:             */
2091:            @Test(dataProvider="int")
2092:            public NClob getNClob(int index) throws SQLException {
2093:                NClob clob = EasyMock.createMock(NClob.class);
2094:
2095:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2096:
2097:                EasyMock.expect(this .getStatement1().getNClob(index))
2098:                        .andReturn(clob);
2099:
2100:                this .replay();
2101:
2102:                NClob result = this .getStatement().getNClob(index);
2103:
2104:                this .verify();
2105:
2106:                assert result == clob;
2107:
2108:                return result;
2109:            }
2110:
2111:            /**
2112:             * @see java.sql.CallableStatement#getNClob(java.lang.String)
2113:             */
2114:            @Test(dataProvider="string")
2115:            public NClob getNClob(String name) throws SQLException {
2116:                NClob clob = EasyMock.createMock(NClob.class);
2117:
2118:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2119:
2120:                EasyMock.expect(this .getStatement1().getNClob(name)).andReturn(
2121:                        clob);
2122:
2123:                this .replay();
2124:
2125:                NClob result = this .getStatement().getNClob(name);
2126:
2127:                this .verify();
2128:
2129:                assert result == clob;
2130:
2131:                return result;
2132:            }
2133:
2134:            /**
2135:             * @see java.sql.CallableStatement#getNString(int)
2136:             */
2137:            @Test(dataProvider="int")
2138:            public String getNString(int index) throws SQLException {
2139:                String string = "";
2140:
2141:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2142:
2143:                EasyMock.expect(this .getStatement1().getNString(index))
2144:                        .andReturn(string);
2145:
2146:                this .replay();
2147:
2148:                String result = this .getStatement().getNString(index);
2149:
2150:                this .verify();
2151:
2152:                assert result == string;
2153:
2154:                return result;
2155:            }
2156:
2157:            /**
2158:             * @see java.sql.CallableStatement#getNString(java.lang.String)
2159:             */
2160:            @Test(dataProvider="string")
2161:            public String getNString(String name) throws SQLException {
2162:                String string = "";
2163:
2164:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2165:
2166:                EasyMock.expect(this .getStatement1().getNString(name))
2167:                        .andReturn(string);
2168:
2169:                this .replay();
2170:
2171:                String result = this .getStatement().getNString(name);
2172:
2173:                this .verify();
2174:
2175:                assert result == string;
2176:
2177:                return result;
2178:            }
2179:
2180:            /**
2181:             * @see java.sql.CallableStatement#getRowId(int)
2182:             */
2183:            @Test(dataProvider="int")
2184:            public RowId getRowId(int index) throws SQLException {
2185:                RowId rowId = EasyMock.createMock(RowId.class);
2186:
2187:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2188:
2189:                EasyMock.expect(this .getStatement1().getRowId(index))
2190:                        .andReturn(rowId);
2191:
2192:                this .replay();
2193:
2194:                RowId result = this .getStatement().getRowId(index);
2195:
2196:                this .verify();
2197:
2198:                assert result == rowId;
2199:
2200:                return result;
2201:            }
2202:
2203:            /**
2204:             * @see java.sql.CallableStatement#getRowId(java.lang.String)
2205:             */
2206:            @Test(dataProvider="string")
2207:            public RowId getRowId(String name) throws SQLException {
2208:                RowId rowId = EasyMock.createMock(RowId.class);
2209:
2210:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2211:
2212:                EasyMock.expect(this .getStatement1().getRowId(name)).andReturn(
2213:                        rowId);
2214:
2215:                this .replay();
2216:
2217:                RowId result = this .getStatement().getRowId(name);
2218:
2219:                this .verify();
2220:
2221:                assert result == rowId;
2222:
2223:                return result;
2224:            }
2225:
2226:            /**
2227:             * @see java.sql.CallableStatement#getSQLXML(int)
2228:             */
2229:            @Test(dataProvider="int")
2230:            public SQLXML getSQLXML(int index) throws SQLException {
2231:                SQLXML xml = EasyMock.createMock(SQLXML.class);
2232:
2233:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2234:
2235:                EasyMock.expect(this .getStatement1().getSQLXML(index))
2236:                        .andReturn(xml);
2237:
2238:                this .replay();
2239:
2240:                SQLXML result = this .getStatement().getSQLXML(index);
2241:
2242:                this .verify();
2243:
2244:                assert result == xml;
2245:
2246:                return result;
2247:            }
2248:
2249:            /**
2250:             * @see java.sql.CallableStatement#getSQLXML(java.lang.String)
2251:             */
2252:            @Test(dataProvider="string")
2253:            public SQLXML getSQLXML(String name) throws SQLException {
2254:                SQLXML xml = EasyMock.createMock(SQLXML.class);
2255:
2256:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2257:
2258:                EasyMock.expect(this .getStatement1().getSQLXML(name))
2259:                        .andReturn(xml);
2260:
2261:                this .replay();
2262:
2263:                SQLXML result = this .getStatement().getSQLXML(name);
2264:
2265:                this .verify();
2266:
2267:                assert result == xml;
2268:
2269:                return result;
2270:            }
2271:
2272:            @DataProvider(name="string-inputStream")
2273:            Object[][] stringInputStreamProvider() {
2274:                return new Object[][] { new Object[] { "",
2275:                        new ByteArrayInputStream(new byte[0]) } };
2276:            }
2277:
2278:            /**
2279:             * @see java.sql.CallableStatement#setAsciiStream(java.lang.String, java.io.InputStream)
2280:             */
2281:            @Test(dataProvider="string-inputStream")
2282:            public void setAsciiStream(String name, InputStream value)
2283:                    throws SQLException {
2284:                File file = new File("");
2285:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2286:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2287:
2288:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2289:
2290:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2291:                        file);
2292:
2293:                EasyMock.expect(this .fileSupport.getInputStream(file))
2294:                        .andReturn(input1);
2295:
2296:                this .getStatement1().setAsciiStream(name, input1);
2297:
2298:                EasyMock.expect(this .fileSupport.getInputStream(file))
2299:                        .andReturn(input2);
2300:
2301:                this .getStatement2().setAsciiStream(name, input2);
2302:
2303:                this .replay();
2304:
2305:                this .getStatement().setAsciiStream(name, value);
2306:
2307:                this .verify();
2308:            }
2309:
2310:            @DataProvider(name="string-inputStream-long")
2311:            Object[][] stringInputStreamLongProvider() {
2312:                return new Object[][] { new Object[] { "",
2313:                        new ByteArrayInputStream(new byte[0]), 1L } };
2314:            }
2315:
2316:            /**
2317:             * @see java.sql.CallableStatement#setAsciiStream(java.lang.String, java.io.InputStream, long)
2318:             */
2319:            @Test(dataProvider="string-inputStream-long")
2320:            public void setAsciiStream(String name, InputStream value,
2321:                    long length) throws SQLException {
2322:                File file = new File("");
2323:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2324:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2325:
2326:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2327:
2328:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2329:                        file);
2330:
2331:                EasyMock.expect(this .fileSupport.getInputStream(file))
2332:                        .andReturn(input1);
2333:
2334:                this .getStatement1().setAsciiStream(name, input1, length);
2335:
2336:                EasyMock.expect(this .fileSupport.getInputStream(file))
2337:                        .andReturn(input2);
2338:
2339:                this .getStatement2().setAsciiStream(name, input2, length);
2340:
2341:                this .replay();
2342:
2343:                this .getStatement().setAsciiStream(name, value, length);
2344:
2345:                this .verify();
2346:            }
2347:
2348:            /**
2349:             * @see java.sql.CallableStatement#setBinaryStream(java.lang.String, java.io.InputStream)
2350:             */
2351:            @Test(dataProvider="string-inputStream")
2352:            public void setBinaryStream(String name, InputStream value)
2353:                    throws SQLException {
2354:                File file = new File("");
2355:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2356:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2357:
2358:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2359:
2360:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2361:                        file);
2362:
2363:                EasyMock.expect(this .fileSupport.getInputStream(file))
2364:                        .andReturn(input1);
2365:
2366:                this .getStatement1().setBinaryStream(name, input1);
2367:
2368:                EasyMock.expect(this .fileSupport.getInputStream(file))
2369:                        .andReturn(input2);
2370:
2371:                this .getStatement2().setBinaryStream(name, input2);
2372:
2373:                this .replay();
2374:
2375:                this .getStatement().setBinaryStream(name, value);
2376:
2377:                this .verify();
2378:            }
2379:
2380:            /**
2381:             * @see java.sql.CallableStatement#setBinaryStream(java.lang.String, java.io.InputStream, long)
2382:             */
2383:            @Test(dataProvider="string-inputStream-long")
2384:            public void setBinaryStream(String name, InputStream value,
2385:                    long length) throws SQLException {
2386:                File file = new File("");
2387:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2388:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2389:
2390:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2391:
2392:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2393:                        file);
2394:
2395:                EasyMock.expect(this .fileSupport.getInputStream(file))
2396:                        .andReturn(input1);
2397:
2398:                this .getStatement1().setBinaryStream(name, input1, length);
2399:
2400:                EasyMock.expect(this .fileSupport.getInputStream(file))
2401:                        .andReturn(input2);
2402:
2403:                this .getStatement2().setBinaryStream(name, input2, length);
2404:
2405:                this .replay();
2406:
2407:                this .getStatement().setBinaryStream(name, value, length);
2408:
2409:                this .verify();
2410:            }
2411:
2412:            @DataProvider(name="string-blob")
2413:            Object[][] stringBlobProvider() throws Exception {
2414:                Map<Database, Blob> map = new TreeMap<Database, Blob>();
2415:
2416:                map.put(this .database1, this .blob1);
2417:                map.put(this .database2, this .blob2);
2418:
2419:                EasyMock.expect(this .parent.getDatabaseCluster()).andReturn(
2420:                        this .cluster);
2421:
2422:                this .parent.addChild(EasyMock.isA(BlobInvocationHandler.class));
2423:
2424:                this .replay();
2425:
2426:                Blob blob = ProxyFactory
2427:                        .createProxy(Blob.class, new BlobInvocationHandler(
2428:                                null, this .parent, null, map));
2429:
2430:                this .verify();
2431:                this .reset();
2432:
2433:                return new Object[][] { new Object[] { "", new MockBlob() },
2434:                        new Object[] { "", blob } };
2435:            }
2436:
2437:            /**
2438:             * @see java.sql.CallableStatement#setBlob(java.lang.String, java.sql.Blob)
2439:             */
2440:            @Test(dataProvider="string-blob")
2441:            public void setBlob(String name, Blob value) throws SQLException {
2442:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2443:
2444:                if (Proxy.isProxyClass(value.getClass())) {
2445:                    this .getStatement1().setBlob(name, this .blob1);
2446:                    this .getStatement2().setBlob(name, this .blob2);
2447:                } else {
2448:                    this .getStatement1().setBlob(EasyMock.eq(name),
2449:                            EasyMock.isA(SerialBlob.class));
2450:                    this .getStatement2().setBlob(EasyMock.eq(name),
2451:                            EasyMock.isA(SerialBlob.class));
2452:                }
2453:
2454:                this .replay();
2455:
2456:                this .getStatement().setBlob(name, value);
2457:
2458:                this .verify();
2459:            }
2460:
2461:            /**
2462:             * @see java.sql.CallableStatement#setBlob(java.lang.String, java.io.InputStream)
2463:             */
2464:            @Test(dataProvider="string-inputStream")
2465:            public void setBlob(String name, InputStream value)
2466:                    throws SQLException {
2467:                File file = new File("");
2468:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2469:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2470:
2471:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2472:
2473:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2474:                        file);
2475:
2476:                EasyMock.expect(this .fileSupport.getInputStream(file))
2477:                        .andReturn(input1);
2478:
2479:                this .getStatement1().setBlob(name, input1);
2480:
2481:                EasyMock.expect(this .fileSupport.getInputStream(file))
2482:                        .andReturn(input2);
2483:
2484:                this .getStatement2().setBlob(name, input2);
2485:
2486:                this .replay();
2487:
2488:                this .getStatement().setBlob(name, value);
2489:
2490:                this .verify();
2491:            }
2492:
2493:            /**
2494:             * @see java.sql.CallableStatement#setBlob(java.lang.String, java.io.InputStream, long)
2495:             */
2496:            @Test(dataProvider="string-inputStream-long")
2497:            public void setBlob(String name, InputStream value, long length)
2498:                    throws SQLException {
2499:                File file = new File("");
2500:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2501:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2502:
2503:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2504:
2505:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2506:                        file);
2507:
2508:                EasyMock.expect(this .fileSupport.getInputStream(file))
2509:                        .andReturn(input1);
2510:
2511:                this .getStatement1().setBlob(name, input1, length);
2512:
2513:                EasyMock.expect(this .fileSupport.getInputStream(file))
2514:                        .andReturn(input2);
2515:
2516:                this .getStatement2().setBlob(name, input2, length);
2517:
2518:                this .replay();
2519:
2520:                this .getStatement().setBlob(name, value, length);
2521:
2522:                this .verify();
2523:            }
2524:
2525:            @DataProvider(name="string-reader")
2526:            Object[][] stringReaderProvider() {
2527:                return new Object[][] { new Object[] { "", new StringReader("") } };
2528:            }
2529:
2530:            /**
2531:             * @see java.sql.CallableStatement#setCharacterStream(java.lang.String, java.io.Reader)
2532:             */
2533:            @Test(dataProvider="string-reader")
2534:            public void setCharacterStream(String name, Reader value)
2535:                    throws SQLException {
2536:                File file = new File("");
2537:                Reader reader1 = new CharArrayReader(new char[0]);
2538:                Reader reader2 = new CharArrayReader(new char[0]);
2539:
2540:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2541:
2542:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2543:                        file);
2544:
2545:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2546:                        reader1);
2547:
2548:                this .getStatement1().setCharacterStream(name, reader1);
2549:
2550:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2551:                        reader2);
2552:
2553:                this .getStatement2().setCharacterStream(name, reader2);
2554:
2555:                this .replay();
2556:
2557:                this .getStatement().setCharacterStream(name, value);
2558:
2559:                this .verify();
2560:            }
2561:
2562:            @DataProvider(name="string-reader-long")
2563:            Object[][] stringReaderLongProvider() {
2564:                return new Object[][] { new Object[] { "",
2565:                        new StringReader(""), 1L } };
2566:            }
2567:
2568:            /**
2569:             * @see java.sql.CallableStatement#setCharacterStream(java.lang.String, java.io.Reader, long)
2570:             */
2571:            @Test(dataProvider="string-reader-long")
2572:            public void setCharacterStream(String name, Reader value,
2573:                    long length) throws SQLException {
2574:                File file = new File("");
2575:                Reader reader1 = new CharArrayReader(new char[0]);
2576:                Reader reader2 = new CharArrayReader(new char[0]);
2577:
2578:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2579:
2580:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2581:                        file);
2582:
2583:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2584:                        reader1);
2585:
2586:                this .getStatement1().setCharacterStream(name, reader1, length);
2587:
2588:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2589:                        reader2);
2590:
2591:                this .getStatement2().setCharacterStream(name, reader2, length);
2592:
2593:                this .replay();
2594:
2595:                this .getStatement().setCharacterStream(name, value, length);
2596:
2597:                this .verify();
2598:            }
2599:
2600:            @DataProvider(name="string-clob")
2601:            Object[][] stringClobProvider() throws Exception {
2602:                Map<Database, Clob> map = new TreeMap<Database, Clob>();
2603:
2604:                map.put(this .database1, this .clob1);
2605:                map.put(this .database2, this .clob2);
2606:
2607:                EasyMock.expect(this .parent.getDatabaseCluster()).andReturn(
2608:                        this .cluster);
2609:
2610:                this .parent.addChild(EasyMock.isA(ClobInvocationHandler.class));
2611:
2612:                this .replay();
2613:
2614:                Clob clob = ProxyFactory
2615:                        .createProxy(Clob.class, new ClobInvocationHandler(
2616:                                null, this .parent, null, map));
2617:
2618:                this .verify();
2619:                this .reset();
2620:
2621:                return new Object[][] { new Object[] { "", new MockClob() },
2622:                        new Object[] { "", clob } };
2623:            }
2624:
2625:            /**
2626:             * @see java.sql.CallableStatement#setClob(java.lang.String, java.sql.Clob)
2627:             */
2628:            @Test(dataProvider="string-clob")
2629:            public void setClob(String name, Clob value) throws SQLException {
2630:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2631:
2632:                if (Proxy.isProxyClass(value.getClass())) {
2633:                    this .getStatement1().setClob(name, this .clob1);
2634:                    this .getStatement2().setClob(name, this .clob2);
2635:                } else {
2636:                    this .getStatement1().setClob(EasyMock.eq(name),
2637:                            EasyMock.isA(SerialClob.class));
2638:                    this .getStatement2().setClob(EasyMock.eq(name),
2639:                            EasyMock.isA(SerialClob.class));
2640:                }
2641:
2642:                this .replay();
2643:
2644:                this .getStatement().setClob(name, value);
2645:
2646:                this .verify();
2647:            }
2648:
2649:            /**
2650:             * @see java.sql.CallableStatement#setClob(java.lang.String, java.io.Reader)
2651:             */
2652:            @Test(dataProvider="string-reader")
2653:            public void setClob(String name, Reader value) throws SQLException {
2654:                File file = new File("");
2655:                Reader reader1 = new CharArrayReader(new char[0]);
2656:                Reader reader2 = new CharArrayReader(new char[0]);
2657:
2658:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2659:
2660:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2661:                        file);
2662:
2663:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2664:                        reader1);
2665:
2666:                this .getStatement1().setClob(name, reader1);
2667:
2668:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2669:                        reader2);
2670:
2671:                this .getStatement2().setClob(name, reader2);
2672:
2673:                this .replay();
2674:
2675:                this .getStatement().setClob(name, value);
2676:
2677:                this .verify();
2678:            }
2679:
2680:            /**
2681:             * @see java.sql.CallableStatement#setClob(java.lang.String, java.io.Reader, long)
2682:             */
2683:            @Test(dataProvider="string-reader-long")
2684:            public void setClob(String name, Reader value, long length)
2685:                    throws SQLException {
2686:                File file = new File("");
2687:                Reader reader1 = new CharArrayReader(new char[0]);
2688:                Reader reader2 = new CharArrayReader(new char[0]);
2689:
2690:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2691:
2692:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2693:                        file);
2694:
2695:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2696:                        reader1);
2697:
2698:                this .getStatement1().setClob(name, reader1, length);
2699:
2700:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2701:                        reader2);
2702:
2703:                this .getStatement2().setClob(name, reader2, length);
2704:
2705:                this .replay();
2706:
2707:                this .getStatement().setClob(name, value, length);
2708:
2709:                this .verify();
2710:            }
2711:
2712:            /**
2713:             * @see java.sql.CallableStatement#setNCharacterStream(java.lang.String, java.io.Reader)
2714:             */
2715:            @Test(dataProvider="string-reader")
2716:            public void setNCharacterStream(String name, Reader value)
2717:                    throws SQLException {
2718:                File file = new File("");
2719:                Reader reader1 = new CharArrayReader(new char[0]);
2720:                Reader reader2 = new CharArrayReader(new char[0]);
2721:
2722:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2723:
2724:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2725:                        file);
2726:
2727:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2728:                        reader1);
2729:
2730:                this .getStatement1().setNCharacterStream(name, reader1);
2731:
2732:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2733:                        reader2);
2734:
2735:                this .getStatement2().setNCharacterStream(name, reader2);
2736:
2737:                this .replay();
2738:
2739:                this .getStatement().setNCharacterStream(name, value);
2740:
2741:                this .verify();
2742:            }
2743:
2744:            /**
2745:             * @see java.sql.CallableStatement#setNCharacterStream(java.lang.String, java.io.Reader, long)
2746:             */
2747:            @Test(dataProvider="string-reader-long")
2748:            public void setNCharacterStream(String name, Reader value,
2749:                    long length) throws SQLException {
2750:                File file = new File("");
2751:                Reader reader1 = new CharArrayReader(new char[0]);
2752:                Reader reader2 = new CharArrayReader(new char[0]);
2753:
2754:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2755:
2756:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2757:                        file);
2758:
2759:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2760:                        reader1);
2761:
2762:                this .getStatement1().setNCharacterStream(name, reader1, length);
2763:
2764:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2765:                        reader2);
2766:
2767:                this .getStatement2().setNCharacterStream(name, reader2, length);
2768:
2769:                this .replay();
2770:
2771:                this .getStatement().setNCharacterStream(name, value, length);
2772:
2773:                this .verify();
2774:            }
2775:
2776:            @DataProvider(name="string-nclob")
2777:            Object[][] stringNClobProvider() throws Exception {
2778:                Map<Database, NClob> map = new TreeMap<Database, NClob>();
2779:
2780:                map.put(this .database1, this .nClob1);
2781:                map.put(this .database2, this .nClob2);
2782:
2783:                EasyMock.expect(this .parent.getDatabaseCluster()).andReturn(
2784:                        this .cluster);
2785:
2786:                this .parent.addChild(EasyMock.isA(ClobInvocationHandler.class));
2787:
2788:                this .replay();
2789:
2790:                NClob nClob = ProxyFactory
2791:                        .createProxy(NClob.class, new ClobInvocationHandler(
2792:                                null, this .parent, null, map));
2793:
2794:                this .verify();
2795:                this .reset();
2796:
2797:                return new Object[][] { new Object[] { "", new MockClob() },
2798:                        new Object[] { "", nClob } };
2799:            }
2800:
2801:            /**
2802:             * @see java.sql.CallableStatement#setNClob(java.lang.String, java.sql.NClob)
2803:             */
2804:            @Test(dataProvider="string-nclob")
2805:            public void setNClob(String name, NClob value) throws SQLException {
2806:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2807:
2808:                if (Proxy.isProxyClass(value.getClass())) {
2809:                    this .getStatement1().setNClob(name, this .nClob1);
2810:                    this .getStatement2().setNClob(name, this .nClob2);
2811:                } else {
2812:                    this .getStatement1().setNClob(EasyMock.eq(name),
2813:                            EasyMock.isA(NClob.class));
2814:                    this .getStatement2().setNClob(EasyMock.eq(name),
2815:                            EasyMock.isA(NClob.class));
2816:                }
2817:
2818:                this .replay();
2819:
2820:                this .getStatement().setNClob(name, value);
2821:
2822:                this .verify();
2823:            }
2824:
2825:            /**
2826:             * @see java.sql.CallableStatement#setNClob(java.lang.String, java.io.Reader)
2827:             */
2828:            @Test(dataProvider="string-reader")
2829:            public void setNClob(String name, Reader value) throws SQLException {
2830:                File file = new File("");
2831:                Reader reader1 = new CharArrayReader(new char[0]);
2832:                Reader reader2 = new CharArrayReader(new char[0]);
2833:
2834:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2835:
2836:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2837:                        file);
2838:
2839:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2840:                        reader1);
2841:
2842:                this .getStatement1().setNClob(name, reader1);
2843:
2844:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2845:                        reader2);
2846:
2847:                this .getStatement2().setNClob(name, reader2);
2848:
2849:                this .replay();
2850:
2851:                this .getStatement().setNClob(name, value);
2852:
2853:                this .verify();
2854:            }
2855:
2856:            /**
2857:             * @see java.sql.CallableStatement#setNClob(java.lang.String, java.io.Reader, long)
2858:             */
2859:            @Test(dataProvider="string-reader-long")
2860:            public void setNClob(String name, Reader value, long length)
2861:                    throws SQLException {
2862:                File file = new File("");
2863:                Reader reader1 = new CharArrayReader(new char[0]);
2864:                Reader reader2 = new CharArrayReader(new char[0]);
2865:
2866:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2867:
2868:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2869:                        file);
2870:
2871:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2872:                        reader1);
2873:
2874:                this .getStatement1().setNClob(name, reader1, length);
2875:
2876:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2877:                        reader2);
2878:
2879:                this .getStatement2().setNClob(name, reader2, length);
2880:
2881:                this .replay();
2882:
2883:                this .getStatement().setNClob(name, value, length);
2884:
2885:                this .verify();
2886:            }
2887:
2888:            /**
2889:             * @see java.sql.CallableStatement#setNString(java.lang.String, java.lang.String)
2890:             */
2891:            @Test(dataProvider="string-string")
2892:            public void setNString(String name, String value)
2893:                    throws SQLException {
2894:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2895:
2896:                this .getStatement1().setNString(name, value);
2897:                this .getStatement2().setNString(name, value);
2898:
2899:                this .replay();
2900:
2901:                this .getStatement().setNString(name, value);
2902:
2903:                this .verify();
2904:            }
2905:
2906:            @DataProvider(name="string-rowId")
2907:            Object[][] stringRowIdProvider() {
2908:                return new Object[][] { new Object[] { "",
2909:                        EasyMock.createMock(RowId.class) } };
2910:            }
2911:
2912:            /**
2913:             * @see java.sql.CallableStatement#setRowId(java.lang.String, java.sql.RowId)
2914:             */
2915:            @Test(dataProvider="string-rowId")
2916:            public void setRowId(String name, RowId value) throws SQLException {
2917:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2918:
2919:                this .getStatement1().setRowId(name, value);
2920:                this .getStatement2().setRowId(name, value);
2921:
2922:                this .replay();
2923:
2924:                this .getStatement().setRowId(name, value);
2925:
2926:                this .verify();
2927:            }
2928:
2929:            @DataProvider(name="string-xml")
2930:            Object[][] stringSQLXMLProvider() {
2931:                return new Object[][] { new Object[] { "",
2932:                        EasyMock.createMock(SQLXML.class) } };
2933:            }
2934:
2935:            /**
2936:             * @see java.sql.CallableStatement#setSQLXML(java.lang.String, java.sql.SQLXML)
2937:             */
2938:            @Test(dataProvider="string-xml")
2939:            public void setSQLXML(String name, SQLXML value)
2940:                    throws SQLException {
2941:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2942:
2943:                this.getStatement1().setSQLXML(name, value);
2944:                this.getStatement2().setSQLXML(name, value);
2945:
2946:                this.replay();
2947:
2948:                this.getStatement().setSQLXML(name, value);
2949:
2950:                this.verify();
2951:            }
2952:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.