Source Code Cross Referenced for TestResultSet.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.Clob;
0036:        import java.sql.Connection;
0037:        import java.sql.Date;
0038:        import java.sql.NClob;
0039:        import java.sql.Ref;
0040:        import java.sql.ResultSet;
0041:        import java.sql.ResultSetMetaData;
0042:        import java.sql.RowId;
0043:        import java.sql.SQLException;
0044:        import java.sql.SQLWarning;
0045:        import java.sql.SQLXML;
0046:        import java.sql.Statement;
0047:        import java.sql.Time;
0048:        import java.sql.Timestamp;
0049:        import java.util.Calendar;
0050:        import java.util.Collections;
0051:        import java.util.Map;
0052:        import java.util.Set;
0053:        import java.util.TreeMap;
0054:        import java.util.concurrent.ExecutorService;
0055:        import java.util.concurrent.Executors;
0056:        import java.util.concurrent.locks.Lock;
0057:
0058:        import javax.sql.rowset.serial.SerialBlob;
0059:        import javax.sql.rowset.serial.SerialClob;
0060:
0061:        import net.sf.hajdbc.Balancer;
0062:        import net.sf.hajdbc.ColumnProperties;
0063:        import net.sf.hajdbc.Database;
0064:        import net.sf.hajdbc.DatabaseCluster;
0065:        import net.sf.hajdbc.DatabaseMetaDataCache;
0066:        import net.sf.hajdbc.DatabaseProperties;
0067:        import net.sf.hajdbc.Dialect;
0068:        import net.sf.hajdbc.LockManager;
0069:        import net.sf.hajdbc.MockDatabase;
0070:        import net.sf.hajdbc.TableProperties;
0071:        import net.sf.hajdbc.util.reflect.ProxyFactory;
0072:
0073:        import org.easymock.EasyMock;
0074:        import org.easymock.IAnswer;
0075:        import org.testng.annotations.AfterMethod;
0076:        import org.testng.annotations.BeforeClass;
0077:        import org.testng.annotations.DataProvider;
0078:        import org.testng.annotations.Test;
0079:
0080:        /***
0081:         * @author  Paul Ferraro
0082:         * @since   1.0
0083:         */
0084:        @SuppressWarnings({"unchecked","nls"})
0085:        public class TestResultSet implements  ResultSet {
0086:            private Connection connection = EasyMock
0087:                    .createStrictMock(Connection.class);
0088:            private TransactionContext transactionContext = EasyMock
0089:                    .createStrictMock(TransactionContext.class);
0090:            private Balancer balancer = EasyMock
0091:                    .createStrictMock(Balancer.class);
0092:            private DatabaseCluster cluster = EasyMock
0093:                    .createStrictMock(DatabaseCluster.class);
0094:            private FileSupport fileSupport = EasyMock
0095:                    .createStrictMock(FileSupport.class);
0096:            private Lock writeLock1 = EasyMock.createStrictMock(Lock.class);
0097:            private Lock writeLock2 = EasyMock.createStrictMock(Lock.class);
0098:            private LockManager lockManager = EasyMock
0099:                    .createStrictMock(LockManager.class);
0100:            private Dialect dialect = EasyMock.createStrictMock(Dialect.class);
0101:            private DatabaseMetaDataCache metaData = EasyMock
0102:                    .createStrictMock(DatabaseMetaDataCache.class);
0103:            private DatabaseProperties databaseProperties = EasyMock
0104:                    .createStrictMock(DatabaseProperties.class);
0105:            private TableProperties tableProperties = EasyMock
0106:                    .createStrictMock(TableProperties.class);
0107:            private ColumnProperties columnProperties = EasyMock
0108:                    .createStrictMock(ColumnProperties.class);
0109:            private ResultSet resultSet1 = EasyMock
0110:                    .createStrictMock(ResultSet.class);
0111:            private ResultSet resultSet2 = EasyMock
0112:                    .createStrictMock(ResultSet.class);
0113:            private SQLProxy parent = EasyMock.createStrictMock(SQLProxy.class);
0114:            private SQLProxy root = EasyMock.createStrictMock(SQLProxy.class);
0115:            private Blob blob1 = EasyMock.createMock(Blob.class);
0116:            private Blob blob2 = EasyMock.createMock(Blob.class);
0117:            private Clob clob1 = EasyMock.createMock(Clob.class);
0118:            private Clob clob2 = EasyMock.createMock(Clob.class);
0119:            private NClob nClob1 = EasyMock.createMock(NClob.class);
0120:            private NClob nClob2 = EasyMock.createMock(NClob.class);
0121:
0122:            private Database database1 = new MockDatabase("1");
0123:            private Database database2 = new MockDatabase("2");
0124:            private Set<Database> databaseSet;
0125:            private ExecutorService executor = Executors
0126:                    .newSingleThreadExecutor();
0127:            private Statement statement = EasyMock.createMock(Statement.class);
0128:            private ResultSet resultSet;
0129:            private ResultSetInvocationHandler handler;
0130:            private IAnswer<InvocationStrategy> anwser = new IAnswer<InvocationStrategy>() {
0131:                @Override
0132:                public InvocationStrategy answer() throws Throwable {
0133:                    return (InvocationStrategy) EasyMock.getCurrentArguments()[0];
0134:                }
0135:            };
0136:
0137:            @BeforeClass
0138:            void init() throws Exception {
0139:                Map<Database, ResultSet> map = new TreeMap<Database, ResultSet>();
0140:                map.put(this .database1, this .resultSet1);
0141:                map.put(this .database2, this .resultSet2);
0142:
0143:                this .databaseSet = map.keySet();
0144:
0145:                EasyMock.expect(this .parent.getDatabaseCluster()).andReturn(
0146:                        this .cluster);
0147:
0148:                this .parent.addChild(EasyMock
0149:                        .isA(ResultSetInvocationHandler.class));
0150:
0151:                this .replay();
0152:
0153:                this .handler = new ResultSetInvocationHandler(this .statement,
0154:                        this .parent, EasyMock.createMock(Invoker.class), map,
0155:                        this .transactionContext, this .fileSupport);
0156:                this .resultSet = ProxyFactory.createProxy(ResultSet.class,
0157:                        this .handler);
0158:
0159:                this .verify();
0160:                this .reset();
0161:            }
0162:
0163:            private Object[] objects() {
0164:                return new Object[] { this .cluster, this .balancer,
0165:                        this .resultSet1, this .resultSet2, this .fileSupport,
0166:                        this .writeLock1, this .writeLock2, this .lockManager,
0167:                        this .parent, this .root, this .dialect, this .metaData,
0168:                        this .databaseProperties, this .tableProperties,
0169:                        this .columnProperties, this .connection,
0170:                        this .transactionContext, this .statement };
0171:            }
0172:
0173:            void replay() {
0174:                EasyMock.replay(this .objects());
0175:            }
0176:
0177:            void verify() {
0178:                EasyMock.verify(this .objects());
0179:            }
0180:
0181:            @AfterMethod
0182:            void reset() {
0183:                EasyMock.reset(this .objects());
0184:            }
0185:
0186:            @DataProvider(name="int")
0187:            Object[][] intProvider() {
0188:                return new Object[][] { new Object[] { 1 } };
0189:            }
0190:
0191:            /**
0192:             * @see java.sql.ResultSet#absolute(int)
0193:             */
0194:            @Test(dataProvider="int")
0195:            public boolean absolute(int row) throws SQLException {
0196:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0197:
0198:                EasyMock.expect(this .resultSet1.absolute(row)).andReturn(true);
0199:                EasyMock.expect(this .resultSet2.absolute(row)).andReturn(true);
0200:
0201:                this .replay();
0202:
0203:                boolean valid = this .resultSet.absolute(row);
0204:
0205:                this .verify();
0206:
0207:                assert valid;
0208:
0209:                return valid;
0210:            }
0211:
0212:            /**
0213:             * @see java.sql.ResultSet#afterLast()
0214:             */
0215:            @Test
0216:            public void afterLast() throws SQLException {
0217:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0218:
0219:                this .resultSet1.afterLast();
0220:                this .resultSet2.afterLast();
0221:
0222:                this .replay();
0223:
0224:                this .resultSet.afterLast();
0225:
0226:                this .verify();
0227:            }
0228:
0229:            /**
0230:             * @see java.sql.ResultSet#beforeFirst()
0231:             */
0232:            @Test
0233:            public void beforeFirst() throws SQLException {
0234:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0235:
0236:                this .resultSet1.beforeFirst();
0237:                this .resultSet2.beforeFirst();
0238:
0239:                this .replay();
0240:
0241:                this .resultSet.beforeFirst();
0242:
0243:                this .verify();
0244:            }
0245:
0246:            /**
0247:             * @see java.sql.ResultSet#cancelRowUpdates()
0248:             */
0249:            @Test
0250:            public void cancelRowUpdates() throws SQLException {
0251:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0252:
0253:                this .resultSet1.cancelRowUpdates();
0254:                this .resultSet2.cancelRowUpdates();
0255:
0256:                this .replay();
0257:
0258:                this .resultSet.cancelRowUpdates();
0259:
0260:                this .verify();
0261:            }
0262:
0263:            /**
0264:             * @see java.sql.ResultSet#clearWarnings()
0265:             */
0266:            @Test
0267:            public void clearWarnings() throws SQLException {
0268:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0269:
0270:                this .resultSet1.clearWarnings();
0271:                this .resultSet2.clearWarnings();
0272:
0273:                this .replay();
0274:
0275:                this .resultSet.clearWarnings();
0276:
0277:                this .verify();
0278:            }
0279:
0280:            /**
0281:             * @see java.sql.ResultSet#close()
0282:             */
0283:            @Test
0284:            public void close() throws SQLException {
0285:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0286:
0287:                EasyMock.expect(this .cluster.getNonTransactionalExecutor())
0288:                        .andReturn(this .executor);
0289:
0290:                EasyMock.expect(this .cluster.getBalancer()).andReturn(
0291:                        this .balancer);
0292:                EasyMock.expect(this .balancer.all())
0293:                        .andReturn(this .databaseSet);
0294:
0295:                EasyMock.expect(this .parent.getRoot()).andReturn(this .root);
0296:
0297:                this .root.retain(this .databaseSet);
0298:
0299:                this .resultSet1.close();
0300:                this .resultSet2.close();
0301:
0302:                this .parent.removeChild(this .handler);
0303:
0304:                this .replay();
0305:
0306:                this .resultSet.close();
0307:
0308:                this .verify();
0309:            }
0310:
0311:            /**
0312:             * @see java.sql.ResultSet#deleteRow()
0313:             */
0314:            @Test
0315:            public void deleteRow() throws SQLException {
0316:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0317:
0318:                EasyMock.expect(this .statement.getConnection()).andReturn(
0319:                        this .connection);
0320:                EasyMock.expect(
0321:                        this .transactionContext.start(EasyMock
0322:                                .isA(InvocationStrategy.class), EasyMock
0323:                                .same(this .connection))).andAnswer(this .anwser);
0324:
0325:                EasyMock.expect(this .cluster.getTransactionalExecutor())
0326:                        .andReturn(this .executor);
0327:
0328:                EasyMock.expect(this .cluster.getBalancer()).andReturn(
0329:                        this .balancer);
0330:                EasyMock.expect(this .balancer.all())
0331:                        .andReturn(this .databaseSet);
0332:
0333:                EasyMock.expect(this .parent.getRoot()).andReturn(this .root);
0334:
0335:                this .root.retain(this .databaseSet);
0336:
0337:                this .resultSet1.deleteRow();
0338:                this .resultSet2.deleteRow();
0339:
0340:                this .replay();
0341:
0342:                this .resultSet.deleteRow();
0343:
0344:                this .verify();
0345:            }
0346:
0347:            @DataProvider(name="string")
0348:            Object[][] stringProvider() {
0349:                return new Object[][] { new Object[] { "" } };
0350:            }
0351:
0352:            /**
0353:             * @see java.sql.ResultSet#findColumn(java.lang.String)
0354:             */
0355:            @Test(dataProvider="string")
0356:            public int findColumn(String name) throws SQLException {
0357:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0358:
0359:                EasyMock.expect(this .resultSet1.findColumn(name)).andReturn(1);
0360:
0361:                this .replay();
0362:
0363:                int result = this .resultSet.findColumn(name);
0364:
0365:                this .verify();
0366:
0367:                assert result == 1 : result;
0368:
0369:                return result;
0370:            }
0371:
0372:            /**
0373:             * @see java.sql.ResultSet#first()
0374:             */
0375:            @Test
0376:            public boolean first() throws SQLException {
0377:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0378:
0379:                EasyMock.expect(this .resultSet1.first()).andReturn(true);
0380:                EasyMock.expect(this .resultSet2.first()).andReturn(true);
0381:
0382:                this .replay();
0383:
0384:                boolean result = this .resultSet.first();
0385:
0386:                this .verify();
0387:
0388:                assert result;
0389:
0390:                return result;
0391:            }
0392:
0393:            /**
0394:             * @see java.sql.ResultSet#getArray(int)
0395:             */
0396:            @Test(dataProvider="int")
0397:            public Array getArray(int index) throws SQLException {
0398:                Array array = EasyMock.createMock(Array.class);
0399:
0400:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0401:
0402:                EasyMock.expect(this .resultSet1.getArray(index)).andReturn(
0403:                        array);
0404:
0405:                this .replay();
0406:
0407:                Array result = this .resultSet.getArray(index);
0408:
0409:                this .verify();
0410:
0411:                assert array == result;
0412:
0413:                return result;
0414:            }
0415:
0416:            /**
0417:             * @see java.sql.ResultSet#getArray(java.lang.String)
0418:             */
0419:            @Test(dataProvider="string")
0420:            public Array getArray(String name) throws SQLException {
0421:                Array array = EasyMock.createMock(Array.class);
0422:
0423:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0424:
0425:                EasyMock.expect(this .resultSet1.getArray(name))
0426:                        .andReturn(array);
0427:
0428:                this .replay();
0429:
0430:                Array result = this .resultSet.getArray(name);
0431:
0432:                this .verify();
0433:
0434:                assert array == result;
0435:
0436:                return result;
0437:            }
0438:
0439:            /**
0440:             * @see java.sql.ResultSet#getAsciiStream(int)
0441:             */
0442:            @Test(dataProvider="int")
0443:            public InputStream getAsciiStream(int index) throws SQLException {
0444:                InputStream inputStream = new ByteArrayInputStream(new byte[0]);
0445:
0446:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0447:
0448:                EasyMock.expect(this .resultSet1.getAsciiStream(index))
0449:                        .andReturn(inputStream);
0450:
0451:                this .replay();
0452:
0453:                InputStream result = this .resultSet.getAsciiStream(index);
0454:
0455:                this .verify();
0456:
0457:                assert inputStream == result;
0458:
0459:                return result;
0460:            }
0461:
0462:            /**
0463:             * @see java.sql.ResultSet#getAsciiStream(java.lang.String)
0464:             */
0465:            @Test(dataProvider="string")
0466:            public InputStream getAsciiStream(String name) throws SQLException {
0467:                InputStream inputStream = new ByteArrayInputStream(new byte[0]);
0468:
0469:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0470:
0471:                EasyMock.expect(this .resultSet1.getAsciiStream(name))
0472:                        .andReturn(inputStream);
0473:
0474:                this .replay();
0475:
0476:                InputStream result = this .resultSet.getAsciiStream(name);
0477:
0478:                this .verify();
0479:
0480:                assert inputStream == result;
0481:
0482:                return result;
0483:            }
0484:
0485:            /**
0486:             * @see java.sql.ResultSet#getBigDecimal(int)
0487:             */
0488:            @Test(dataProvider="int")
0489:            public BigDecimal getBigDecimal(int index) throws SQLException {
0490:                BigDecimal decimal = new BigDecimal(1.0);
0491:
0492:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0493:
0494:                EasyMock.expect(this .resultSet1.getBigDecimal(index))
0495:                        .andReturn(decimal);
0496:
0497:                this .replay();
0498:
0499:                BigDecimal result = this .resultSet.getBigDecimal(index);
0500:
0501:                this .verify();
0502:
0503:                assert decimal == result;
0504:
0505:                return result;
0506:            }
0507:
0508:            /**
0509:             * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
0510:             */
0511:            @Test(dataProvider="string")
0512:            public BigDecimal getBigDecimal(String name) throws SQLException {
0513:                BigDecimal decimal = new BigDecimal(1.0);
0514:
0515:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0516:
0517:                EasyMock.expect(this .resultSet1.getBigDecimal(name)).andReturn(
0518:                        decimal);
0519:
0520:                this .replay();
0521:
0522:                BigDecimal result = this .resultSet.getBigDecimal(name);
0523:
0524:                this .verify();
0525:
0526:                assert decimal == result;
0527:
0528:                return result;
0529:            }
0530:
0531:            @DataProvider(name="int-int")
0532:            Object[][] intIntProvider() {
0533:                return new Object[][] { new Object[] { 1, 1 } };
0534:            }
0535:
0536:            /**
0537:             * @see java.sql.ResultSet#getBigDecimal(int, int)
0538:             */
0539:            @SuppressWarnings("deprecation")
0540:            @Test(dataProvider="int-int")
0541:            @Deprecated
0542:            public BigDecimal getBigDecimal(int index, int scale)
0543:                    throws SQLException {
0544:                BigDecimal decimal = new BigDecimal(1.0);
0545:
0546:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0547:
0548:                EasyMock.expect(this .resultSet1.getBigDecimal(index, scale))
0549:                        .andReturn(decimal);
0550:
0551:                this .replay();
0552:
0553:                BigDecimal result = this .resultSet.getBigDecimal(index, scale);
0554:
0555:                this .verify();
0556:
0557:                assert decimal == result;
0558:
0559:                return result;
0560:            }
0561:
0562:            @DataProvider(name="string-int")
0563:            Object[][] stringIntProvider() {
0564:                return new Object[][] { new Object[] { "", 1 } };
0565:            }
0566:
0567:            /**
0568:             * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
0569:             */
0570:            @SuppressWarnings("deprecation")
0571:            @Test(dataProvider="string-int")
0572:            @Deprecated
0573:            public BigDecimal getBigDecimal(String name, int scale)
0574:                    throws SQLException {
0575:                BigDecimal decimal = new BigDecimal(1.0);
0576:
0577:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0578:
0579:                EasyMock.expect(this .resultSet1.getBigDecimal(name, scale))
0580:                        .andReturn(decimal);
0581:
0582:                this .replay();
0583:
0584:                BigDecimal result = this .resultSet.getBigDecimal(name, scale);
0585:
0586:                this .verify();
0587:
0588:                assert decimal == result;
0589:
0590:                return result;
0591:            }
0592:
0593:            /**
0594:             * @see java.sql.ResultSet#getBinaryStream(int)
0595:             */
0596:            @Test(dataProvider="int")
0597:            public InputStream getBinaryStream(int index) throws SQLException {
0598:                InputStream inputStream = new ByteArrayInputStream(new byte[0]);
0599:
0600:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0601:
0602:                EasyMock.expect(this .resultSet1.getBinaryStream(index))
0603:                        .andReturn(inputStream);
0604:
0605:                this .replay();
0606:
0607:                InputStream result = this .resultSet.getBinaryStream(index);
0608:
0609:                this .verify();
0610:
0611:                assert inputStream == result;
0612:
0613:                return result;
0614:            }
0615:
0616:            /**
0617:             * @see java.sql.ResultSet#getBinaryStream(java.lang.String)
0618:             */
0619:            @Test(dataProvider="string")
0620:            public InputStream getBinaryStream(String name) throws SQLException {
0621:                InputStream inputStream = new ByteArrayInputStream(new byte[0]);
0622:
0623:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0624:
0625:                EasyMock.expect(this .resultSet1.getBinaryStream(name))
0626:                        .andReturn(inputStream);
0627:
0628:                this .replay();
0629:
0630:                InputStream result = this .resultSet.getBinaryStream(name);
0631:
0632:                this .verify();
0633:
0634:                assert inputStream == result;
0635:
0636:                return result;
0637:            }
0638:
0639:            /**
0640:             * @see java.sql.ResultSet#getBlob(int)
0641:             */
0642:            @Test(dataProvider="int")
0643:            public Blob getBlob(int index) throws SQLException {
0644:                Blob blob1 = EasyMock.createMock(Blob.class);
0645:                Blob blob2 = EasyMock.createMock(Blob.class);
0646:
0647:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0648:
0649:                EasyMock.expect(this .cluster.getNonTransactionalExecutor())
0650:                        .andReturn(this .executor);
0651:
0652:                EasyMock.expect(this .cluster.getBalancer()).andReturn(
0653:                        this .balancer);
0654:                EasyMock.expect(this .balancer.all())
0655:                        .andReturn(this .databaseSet);
0656:
0657:                EasyMock.expect(this .parent.getRoot()).andReturn(this .root);
0658:
0659:                this .root.retain(this .databaseSet);
0660:
0661:                EasyMock.expect(this .resultSet1.getBlob(index))
0662:                        .andReturn(blob1);
0663:                EasyMock.expect(this .resultSet2.getBlob(index))
0664:                        .andReturn(blob2);
0665:
0666:                this .replay();
0667:
0668:                Blob result = this .resultSet.getBlob(index);
0669:
0670:                this .verify();
0671:
0672:                assert Proxy.isProxyClass(result.getClass());
0673:
0674:                BlobInvocationHandler handler = BlobInvocationHandler.class
0675:                        .cast(Proxy.getInvocationHandler(result));
0676:
0677:                assert handler.getObject(this .database1) == blob1;
0678:                assert handler.getObject(this .database2) == blob2;
0679:
0680:                return result;
0681:            }
0682:
0683:            /**
0684:             * @see java.sql.ResultSet#getBlob(java.lang.String)
0685:             */
0686:            @Test(dataProvider="string")
0687:            public Blob getBlob(String name) throws SQLException {
0688:                Blob blob1 = EasyMock.createMock(Blob.class);
0689:                Blob blob2 = EasyMock.createMock(Blob.class);
0690:
0691:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0692:
0693:                EasyMock.expect(this .cluster.getNonTransactionalExecutor())
0694:                        .andReturn(this .executor);
0695:
0696:                EasyMock.expect(this .cluster.getBalancer()).andReturn(
0697:                        this .balancer);
0698:                EasyMock.expect(this .balancer.all())
0699:                        .andReturn(this .databaseSet);
0700:
0701:                EasyMock.expect(this .parent.getRoot()).andReturn(this .root);
0702:
0703:                this .root.retain(this .databaseSet);
0704:
0705:                EasyMock.expect(this .resultSet1.getBlob(name)).andReturn(blob1);
0706:                EasyMock.expect(this .resultSet2.getBlob(name)).andReturn(blob2);
0707:
0708:                this .replay();
0709:
0710:                Blob result = this .resultSet.getBlob(name);
0711:
0712:                this .verify();
0713:
0714:                assert Proxy.isProxyClass(result.getClass());
0715:
0716:                BlobInvocationHandler handler = BlobInvocationHandler.class
0717:                        .cast(Proxy.getInvocationHandler(result));
0718:
0719:                assert handler.getObject(this .database1) == blob1;
0720:                assert handler.getObject(this .database2) == blob2;
0721:
0722:                return result;
0723:            }
0724:
0725:            /**
0726:             * @see java.sql.ResultSet#getBoolean(int)
0727:             */
0728:            @Test(dataProvider="int")
0729:            public boolean getBoolean(int index) throws SQLException {
0730:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0731:
0732:                EasyMock.expect(this .resultSet1.getBoolean(index)).andReturn(
0733:                        true);
0734:
0735:                this .replay();
0736:
0737:                boolean result = this .resultSet.getBoolean(index);
0738:
0739:                this .verify();
0740:
0741:                assert result;
0742:
0743:                return result;
0744:            }
0745:
0746:            /**
0747:             * @see java.sql.ResultSet#getBoolean(java.lang.String)
0748:             */
0749:            @Test(dataProvider="string")
0750:            public boolean getBoolean(String name) throws SQLException {
0751:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0752:
0753:                EasyMock.expect(this .resultSet1.getBoolean(name)).andReturn(
0754:                        true);
0755:
0756:                this .replay();
0757:
0758:                boolean result = this .resultSet.getBoolean(name);
0759:
0760:                this .verify();
0761:
0762:                assert result;
0763:
0764:                return result;
0765:            }
0766:
0767:            /**
0768:             * @see java.sql.ResultSet#getByte(int)
0769:             */
0770:            @Test(dataProvider="int")
0771:            public byte getByte(int index) throws SQLException {
0772:                byte b = Integer.valueOf(1).byteValue();
0773:
0774:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0775:
0776:                EasyMock.expect(this .resultSet1.getByte(index)).andReturn(b);
0777:
0778:                this .replay();
0779:
0780:                byte result = this .resultSet.getByte(index);
0781:
0782:                this .verify();
0783:
0784:                assert b == result;
0785:
0786:                return result;
0787:            }
0788:
0789:            /**
0790:             * @see java.sql.ResultSet#getByte(java.lang.String)
0791:             */
0792:            @Test(dataProvider="string")
0793:            public byte getByte(String name) throws SQLException {
0794:                byte b = Integer.valueOf(1).byteValue();
0795:
0796:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0797:
0798:                EasyMock.expect(this .resultSet1.getByte(name)).andReturn(b);
0799:
0800:                this .replay();
0801:
0802:                byte result = this .resultSet.getByte(name);
0803:
0804:                this .verify();
0805:
0806:                assert b == result;
0807:
0808:                return result;
0809:            }
0810:
0811:            /**
0812:             * @see java.sql.ResultSet#getBytes(int)
0813:             */
0814:            @Test(dataProvider="int")
0815:            public byte[] getBytes(int index) throws SQLException {
0816:                byte[] bytes = new byte[0];
0817:
0818:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0819:
0820:                EasyMock.expect(this .resultSet1.getBytes(index)).andReturn(
0821:                        bytes);
0822:
0823:                this .replay();
0824:
0825:                byte[] result = this .resultSet.getBytes(index);
0826:
0827:                this .verify();
0828:
0829:                assert bytes == result;
0830:
0831:                return result;
0832:            }
0833:
0834:            /**
0835:             * @see java.sql.ResultSet#getBytes(java.lang.String)
0836:             */
0837:            @Test(dataProvider="string")
0838:            public byte[] getBytes(String name) throws SQLException {
0839:                byte[] bytes = new byte[0];
0840:
0841:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0842:
0843:                EasyMock.expect(this .resultSet1.getBytes(name))
0844:                        .andReturn(bytes);
0845:
0846:                this .replay();
0847:
0848:                byte[] result = this .resultSet.getBytes(name);
0849:
0850:                this .verify();
0851:
0852:                assert bytes == result;
0853:
0854:                return result;
0855:            }
0856:
0857:            /**
0858:             * @see java.sql.ResultSet#getCharacterStream(int)
0859:             */
0860:            @Test(dataProvider="int")
0861:            public Reader getCharacterStream(int index) throws SQLException {
0862:                Reader reader = new CharArrayReader(new char[0]);
0863:
0864:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0865:
0866:                EasyMock.expect(this .resultSet1.getCharacterStream(index))
0867:                        .andReturn(reader);
0868:
0869:                this .replay();
0870:
0871:                Reader result = this .resultSet.getCharacterStream(index);
0872:
0873:                this .verify();
0874:
0875:                assert result == reader;
0876:
0877:                return result;
0878:            }
0879:
0880:            /**
0881:             * @see java.sql.ResultSet#getCharacterStream(java.lang.String)
0882:             */
0883:            @Test(dataProvider="string")
0884:            public Reader getCharacterStream(String name) throws SQLException {
0885:                Reader reader = new CharArrayReader(new char[0]);
0886:
0887:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0888:
0889:                EasyMock.expect(this .resultSet1.getCharacterStream(name))
0890:                        .andReturn(reader);
0891:
0892:                this .replay();
0893:
0894:                Reader result = this .resultSet.getCharacterStream(name);
0895:
0896:                this .verify();
0897:
0898:                assert result == reader;
0899:
0900:                return result;
0901:            }
0902:
0903:            /**
0904:             * @see java.sql.ResultSet#getClob(int)
0905:             */
0906:            @Test(dataProvider="int")
0907:            public Clob getClob(int index) throws SQLException {
0908:                Clob clob1 = EasyMock.createMock(Clob.class);
0909:                Clob clob2 = EasyMock.createMock(Clob.class);
0910:
0911:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0912:
0913:                EasyMock.expect(this .cluster.getNonTransactionalExecutor())
0914:                        .andReturn(this .executor);
0915:
0916:                EasyMock.expect(this .cluster.getBalancer()).andReturn(
0917:                        this .balancer);
0918:                EasyMock.expect(this .balancer.all())
0919:                        .andReturn(this .databaseSet);
0920:
0921:                EasyMock.expect(this .parent.getRoot()).andReturn(this .root);
0922:
0923:                this .root.retain(this .databaseSet);
0924:
0925:                EasyMock.expect(this .resultSet1.getClob(index))
0926:                        .andReturn(clob1);
0927:                EasyMock.expect(this .resultSet2.getClob(index))
0928:                        .andReturn(clob2);
0929:
0930:                this .replay();
0931:
0932:                Clob result = this .resultSet.getClob(index);
0933:
0934:                this .verify();
0935:
0936:                assert Proxy.isProxyClass(result.getClass());
0937:
0938:                ClobInvocationHandler handler = ClobInvocationHandler.class
0939:                        .cast(Proxy.getInvocationHandler(result));
0940:
0941:                assert handler.getObject(this .database1) == clob1;
0942:                assert handler.getObject(this .database2) == clob2;
0943:
0944:                return result;
0945:            }
0946:
0947:            /**
0948:             * @see java.sql.ResultSet#getClob(java.lang.String)
0949:             */
0950:            @Test(dataProvider="string")
0951:            public Clob getClob(String name) throws SQLException {
0952:                Clob clob1 = EasyMock.createMock(Clob.class);
0953:                Clob clob2 = EasyMock.createMock(Clob.class);
0954:
0955:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0956:
0957:                EasyMock.expect(this .cluster.getNonTransactionalExecutor())
0958:                        .andReturn(this .executor);
0959:
0960:                EasyMock.expect(this .cluster.getBalancer()).andReturn(
0961:                        this .balancer);
0962:                EasyMock.expect(this .balancer.all())
0963:                        .andReturn(this .databaseSet);
0964:
0965:                EasyMock.expect(this .parent.getRoot()).andReturn(this .root);
0966:
0967:                this .root.retain(this .databaseSet);
0968:
0969:                EasyMock.expect(this .resultSet1.getClob(name)).andReturn(clob1);
0970:                EasyMock.expect(this .resultSet2.getClob(name)).andReturn(clob2);
0971:
0972:                this .replay();
0973:
0974:                Clob result = this .resultSet.getClob(name);
0975:
0976:                this .verify();
0977:
0978:                assert Proxy.isProxyClass(result.getClass());
0979:
0980:                ClobInvocationHandler handler = ClobInvocationHandler.class
0981:                        .cast(Proxy.getInvocationHandler(result));
0982:
0983:                assert handler.getObject(this .database1) == clob1;
0984:                assert handler.getObject(this .database2) == clob2;
0985:
0986:                return result;
0987:            }
0988:
0989:            /**
0990:             * @see java.sql.ResultSet#getConcurrency()
0991:             */
0992:            @Test
0993:            public int getConcurrency() throws SQLException {
0994:                int concurrency = java.sql.ResultSet.CONCUR_READ_ONLY;
0995:
0996:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
0997:
0998:                EasyMock.expect(this .resultSet1.getConcurrency()).andReturn(
0999:                        concurrency);
1000:
1001:                this .replay();
1002:
1003:                int result = this .resultSet.getConcurrency();
1004:
1005:                this .verify();
1006:
1007:                assert result == concurrency;
1008:
1009:                return result;
1010:            }
1011:
1012:            /**
1013:             * @see java.sql.ResultSet#getCursorName()
1014:             */
1015:            @Test
1016:            public String getCursorName() throws SQLException {
1017:                String cursor = "cursor";
1018:
1019:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1020:
1021:                EasyMock.expect(this .resultSet1.getCursorName()).andReturn(
1022:                        cursor);
1023:
1024:                this .replay();
1025:
1026:                String result = this .resultSet.getCursorName();
1027:
1028:                this .verify();
1029:
1030:                assert result == cursor;
1031:
1032:                return result;
1033:            }
1034:
1035:            /**
1036:             * @see java.sql.ResultSet#getDate(int)
1037:             */
1038:            @Test(dataProvider="int")
1039:            public Date getDate(int index) throws SQLException {
1040:                Date date = new Date(System.currentTimeMillis());
1041:
1042:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1043:
1044:                EasyMock.expect(this .resultSet1.getDate(index)).andReturn(date);
1045:
1046:                this .replay();
1047:
1048:                Date result = this .resultSet.getDate(index);
1049:
1050:                this .verify();
1051:
1052:                assert result == date;
1053:
1054:                return result;
1055:            }
1056:
1057:            /**
1058:             * @see java.sql.ResultSet#getDate(java.lang.String)
1059:             */
1060:            @Test(dataProvider="string")
1061:            public Date getDate(String name) throws SQLException {
1062:                Date date = new Date(System.currentTimeMillis());
1063:
1064:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1065:
1066:                EasyMock.expect(this .resultSet1.getDate(name)).andReturn(date);
1067:
1068:                this .replay();
1069:
1070:                Date result = this .resultSet.getDate(name);
1071:
1072:                this .verify();
1073:
1074:                assert result == date;
1075:
1076:                return result;
1077:            }
1078:
1079:            @DataProvider(name="int-calendar")
1080:            Object[][] intCalendarProvider() {
1081:                return new Object[][] { new Object[] { 1,
1082:                        Calendar.getInstance() } };
1083:            }
1084:
1085:            /**
1086:             * @see java.sql.ResultSet#getDate(int, java.util.Calendar)
1087:             */
1088:            @Test(dataProvider="int-calendar")
1089:            public Date getDate(int index, Calendar calendar)
1090:                    throws SQLException {
1091:                Date date = new Date(System.currentTimeMillis());
1092:
1093:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1094:
1095:                EasyMock.expect(this .resultSet1.getDate(index, calendar))
1096:                        .andReturn(date);
1097:
1098:                this .replay();
1099:
1100:                Date result = this .resultSet.getDate(index, calendar);
1101:
1102:                this .verify();
1103:
1104:                assert result == date;
1105:
1106:                return result;
1107:            }
1108:
1109:            @DataProvider(name="string-calendar")
1110:            Object[][] stringCalendarProvider() {
1111:                return new Object[][] { new Object[] { "",
1112:                        Calendar.getInstance() } };
1113:            }
1114:
1115:            /**
1116:             * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar)
1117:             */
1118:            @Test(dataProvider="string-calendar")
1119:            public Date getDate(String name, Calendar calendar)
1120:                    throws SQLException {
1121:                Date date = new Date(System.currentTimeMillis());
1122:
1123:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1124:
1125:                EasyMock.expect(this .resultSet1.getDate(name, calendar))
1126:                        .andReturn(date);
1127:
1128:                this .replay();
1129:
1130:                Date result = this .resultSet.getDate(name, calendar);
1131:
1132:                this .verify();
1133:
1134:                assert result == date;
1135:
1136:                return result;
1137:            }
1138:
1139:            /**
1140:             * @see java.sql.ResultSet#getDouble(int)
1141:             */
1142:            @Test(dataProvider="int")
1143:            public double getDouble(int index) throws SQLException {
1144:                double d = 1.0;
1145:
1146:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1147:
1148:                EasyMock.expect(this .resultSet1.getDouble(index)).andReturn(d);
1149:
1150:                this .replay();
1151:
1152:                double result = this .resultSet.getDouble(index);
1153:
1154:                this .verify();
1155:
1156:                assert result == d;
1157:
1158:                return result;
1159:            }
1160:
1161:            /**
1162:             * @see java.sql.ResultSet#getDouble(java.lang.String)
1163:             */
1164:            @Test(dataProvider="string")
1165:            public double getDouble(String name) throws SQLException {
1166:                double d = 1.0;
1167:
1168:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1169:
1170:                EasyMock.expect(this .resultSet1.getDouble(name)).andReturn(d);
1171:
1172:                this .replay();
1173:
1174:                double result = this .resultSet.getDouble(name);
1175:
1176:                this .verify();
1177:
1178:                assert result == d;
1179:
1180:                return result;
1181:            }
1182:
1183:            /**
1184:             * @see java.sql.ResultSet#getFetchDirection()
1185:             */
1186:            @Test
1187:            public int getFetchDirection() throws SQLException {
1188:                int direction = java.sql.ResultSet.FETCH_FORWARD;
1189:
1190:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1191:
1192:                EasyMock.expect(this .resultSet1.getFetchDirection()).andReturn(
1193:                        direction);
1194:
1195:                this .replay();
1196:
1197:                int result = this .resultSet.getFetchDirection();
1198:
1199:                this .verify();
1200:
1201:                assert result == direction;
1202:
1203:                return result;
1204:            }
1205:
1206:            /**
1207:             * @see java.sql.ResultSet#getFetchSize()
1208:             */
1209:            @Test
1210:            public int getFetchSize() throws SQLException {
1211:                int size = 10;
1212:
1213:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1214:
1215:                EasyMock.expect(this .resultSet1.getFetchSize()).andReturn(size);
1216:
1217:                this .replay();
1218:
1219:                int result = this .resultSet.getFetchSize();
1220:
1221:                this .verify();
1222:
1223:                assert result == size;
1224:
1225:                return result;
1226:            }
1227:
1228:            /**
1229:             * @see java.sql.ResultSet#getFloat(int)
1230:             */
1231:            @Test(dataProvider="int")
1232:            public float getFloat(int index) throws SQLException {
1233:                float f = 1.0F;
1234:
1235:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1236:
1237:                EasyMock.expect(this .resultSet1.getFloat(index)).andReturn(f);
1238:
1239:                this .replay();
1240:
1241:                float result = this .resultSet.getFloat(index);
1242:
1243:                this .verify();
1244:
1245:                assert result == f;
1246:
1247:                return result;
1248:            }
1249:
1250:            /**
1251:             * @see java.sql.ResultSet#getFloat(java.lang.String)
1252:             */
1253:            @Test(dataProvider="string")
1254:            public float getFloat(String name) throws SQLException {
1255:                float f = 1.0F;
1256:
1257:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1258:
1259:                EasyMock.expect(this .resultSet1.getFloat(name)).andReturn(f);
1260:
1261:                this .replay();
1262:
1263:                float result = this .resultSet.getFloat(name);
1264:
1265:                this .verify();
1266:
1267:                assert result == f;
1268:
1269:                return result;
1270:            }
1271:
1272:            /**
1273:             * @see java.sql.ResultSet#getInt(int)
1274:             */
1275:            @Test(dataProvider="int")
1276:            public int getInt(int index) throws SQLException {
1277:                int i = 1;
1278:
1279:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1280:
1281:                EasyMock.expect(this .resultSet1.getInt(index)).andReturn(i);
1282:
1283:                this .replay();
1284:
1285:                int result = this .resultSet.getInt(index);
1286:
1287:                this .verify();
1288:
1289:                assert result == i;
1290:
1291:                return result;
1292:            }
1293:
1294:            /**
1295:             * @see java.sql.ResultSet#getInt(java.lang.String)
1296:             */
1297:            @Test(dataProvider="string")
1298:            public int getInt(String name) throws SQLException {
1299:                int i = 1;
1300:
1301:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1302:
1303:                EasyMock.expect(this .resultSet1.getInt(name)).andReturn(i);
1304:
1305:                this .replay();
1306:
1307:                int result = this .resultSet.getInt(name);
1308:
1309:                this .verify();
1310:
1311:                assert result == i;
1312:
1313:                return result;
1314:            }
1315:
1316:            /**
1317:             * @see java.sql.ResultSet#getLong(int)
1318:             */
1319:            @Test(dataProvider="int")
1320:            public long getLong(int index) throws SQLException {
1321:                long l = 1;
1322:
1323:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1324:
1325:                EasyMock.expect(this .resultSet1.getLong(index)).andReturn(l);
1326:
1327:                this .replay();
1328:
1329:                long result = this .resultSet.getLong(index);
1330:
1331:                this .verify();
1332:
1333:                assert result == l;
1334:
1335:                return result;
1336:            }
1337:
1338:            /**
1339:             * @see java.sql.ResultSet#getLong(java.lang.String)
1340:             */
1341:            @Test(dataProvider="string")
1342:            public long getLong(String name) throws SQLException {
1343:                long l = 1;
1344:
1345:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1346:
1347:                EasyMock.expect(this .resultSet1.getLong(name)).andReturn(l);
1348:
1349:                this .replay();
1350:
1351:                long result = this .resultSet.getLong(name);
1352:
1353:                this .verify();
1354:
1355:                assert result == l;
1356:
1357:                return result;
1358:            }
1359:
1360:            /**
1361:             * @see java.sql.ResultSet#getMetaData()
1362:             */
1363:            @Test
1364:            public ResultSetMetaData getMetaData() throws SQLException {
1365:                ResultSetMetaData metaData = EasyMock
1366:                        .createMock(ResultSetMetaData.class);
1367:
1368:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1369:
1370:                EasyMock.expect(this .resultSet1.getMetaData()).andReturn(
1371:                        metaData);
1372:
1373:                this .replay();
1374:
1375:                ResultSetMetaData result = this .resultSet.getMetaData();
1376:
1377:                this .verify();
1378:
1379:                assert result == metaData;
1380:
1381:                return result;
1382:            }
1383:
1384:            /**
1385:             * @see java.sql.ResultSet#getObject(int)
1386:             */
1387:            @Test(dataProvider="int")
1388:            public Object getObject(int index) throws SQLException {
1389:                Object object = new Object();
1390:
1391:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1392:
1393:                EasyMock.expect(this .resultSet1.getObject(index)).andReturn(
1394:                        object);
1395:
1396:                this .replay();
1397:
1398:                Object result = this .resultSet.getObject(index);
1399:
1400:                this .verify();
1401:
1402:                assert result == object;
1403:
1404:                return result;
1405:            }
1406:
1407:            /**
1408:             * @see java.sql.ResultSet#getObject(java.lang.String)
1409:             */
1410:            @Test(dataProvider="string")
1411:            public Object getObject(String name) throws SQLException {
1412:                Object object = new Object();
1413:
1414:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1415:
1416:                EasyMock.expect(this .resultSet1.getObject(name)).andReturn(
1417:                        object);
1418:
1419:                this .replay();
1420:
1421:                Object result = this .resultSet.getObject(name);
1422:
1423:                this .verify();
1424:
1425:                assert result == object;
1426:
1427:                return result;
1428:            }
1429:
1430:            @DataProvider(name="int-map")
1431:            Object[][] intMapProvider() {
1432:                return new Object[][] { new Object[] { 1, Collections.EMPTY_MAP } };
1433:            }
1434:
1435:            /**
1436:             * @see java.sql.ResultSet#getObject(int, java.util.Map)
1437:             */
1438:            @Test(dataProvider="int-map")
1439:            public Object getObject(int index, Map<String, Class<?>> map)
1440:                    throws SQLException {
1441:                Object object = new Object();
1442:
1443:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1444:
1445:                EasyMock.expect(this .resultSet1.getObject(index, map))
1446:                        .andReturn(object);
1447:
1448:                this .replay();
1449:
1450:                Object result = this .resultSet.getObject(index, map);
1451:
1452:                this .verify();
1453:
1454:                assert result == object;
1455:
1456:                return result;
1457:            }
1458:
1459:            @DataProvider(name="string-map")
1460:            Object[][] stringMapProvider() {
1461:                return new Object[][] { new Object[] { "",
1462:                        Collections.EMPTY_MAP } };
1463:            }
1464:
1465:            /**
1466:             * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map)
1467:             */
1468:            @Test(dataProvider="string-map")
1469:            public Object getObject(String name, Map<String, Class<?>> map)
1470:                    throws SQLException {
1471:                Object object = new Object();
1472:
1473:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1474:
1475:                EasyMock.expect(this .resultSet1.getObject(name, map))
1476:                        .andReturn(object);
1477:
1478:                this .replay();
1479:
1480:                Object result = this .resultSet.getObject(name, map);
1481:
1482:                this .verify();
1483:
1484:                assert result == object;
1485:
1486:                return result;
1487:            }
1488:
1489:            /**
1490:             * @see java.sql.ResultSet#getRef(int)
1491:             */
1492:            @Test(dataProvider="int")
1493:            public Ref getRef(int index) throws SQLException {
1494:                Ref ref = EasyMock.createMock(Ref.class);
1495:
1496:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1497:
1498:                EasyMock.expect(this .resultSet1.getRef(index)).andReturn(ref);
1499:
1500:                this .replay();
1501:
1502:                Ref result = this .resultSet.getRef(index);
1503:
1504:                this .verify();
1505:
1506:                assert result == ref;
1507:
1508:                return result;
1509:            }
1510:
1511:            /**
1512:             * @see java.sql.ResultSet#getRef(java.lang.String)
1513:             */
1514:            @Test(dataProvider="string")
1515:            public Ref getRef(String name) throws SQLException {
1516:                Ref ref = EasyMock.createMock(Ref.class);
1517:
1518:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1519:
1520:                EasyMock.expect(this .resultSet1.getRef(name)).andReturn(ref);
1521:
1522:                this .replay();
1523:
1524:                Ref result = this .resultSet.getRef(name);
1525:
1526:                this .verify();
1527:
1528:                assert result == ref;
1529:
1530:                return result;
1531:            }
1532:
1533:            /**
1534:             * @see java.sql.ResultSet#getRow()
1535:             */
1536:            @Test
1537:            public int getRow() throws SQLException {
1538:                int row = 1;
1539:
1540:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1541:
1542:                EasyMock.expect(this .resultSet1.getRow()).andReturn(row);
1543:
1544:                this .replay();
1545:
1546:                int result = this .resultSet.getRow();
1547:
1548:                this .verify();
1549:
1550:                assert result == row;
1551:
1552:                return result;
1553:            }
1554:
1555:            /**
1556:             * @see java.sql.ResultSet#getShort(int)
1557:             */
1558:            @Test(dataProvider="int")
1559:            public short getShort(int index) throws SQLException {
1560:                short s = Integer.valueOf(1).shortValue();
1561:
1562:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1563:
1564:                EasyMock.expect(this .resultSet1.getShort(index)).andReturn(s);
1565:
1566:                this .replay();
1567:
1568:                short result = this .resultSet.getShort(index);
1569:
1570:                this .verify();
1571:
1572:                assert result == s;
1573:
1574:                return result;
1575:            }
1576:
1577:            /**
1578:             * @see java.sql.ResultSet#getShort(java.lang.String)
1579:             */
1580:            @Test(dataProvider="string")
1581:            public short getShort(String name) throws SQLException {
1582:                short s = Integer.valueOf(1).shortValue();
1583:
1584:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1585:
1586:                EasyMock.expect(this .resultSet1.getShort(name)).andReturn(s);
1587:
1588:                this .replay();
1589:
1590:                short result = this .resultSet.getShort(name);
1591:
1592:                this .verify();
1593:
1594:                assert result == s;
1595:
1596:                return result;
1597:            }
1598:
1599:            /**
1600:             * @see java.sql.ResultSet#getStatement()
1601:             */
1602:            @Test
1603:            public java.sql.Statement getStatement() throws SQLException {
1604:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1605:
1606:                this .replay();
1607:
1608:                java.sql.Statement result = this .resultSet.getStatement();
1609:
1610:                this .verify();
1611:
1612:                assert result == this .statement;
1613:
1614:                return result;
1615:            }
1616:
1617:            /**
1618:             * @see java.sql.ResultSet#getString(int)
1619:             */
1620:            @Test(dataProvider="int")
1621:            public String getString(int index) throws SQLException {
1622:                String string = "";
1623:
1624:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1625:
1626:                EasyMock.expect(this .resultSet1.getString(index)).andReturn(
1627:                        string);
1628:
1629:                this .replay();
1630:
1631:                String result = this .resultSet.getString(index);
1632:
1633:                this .verify();
1634:
1635:                assert result == string;
1636:
1637:                return result;
1638:            }
1639:
1640:            /**
1641:             * @see java.sql.ResultSet#getString(java.lang.String)
1642:             */
1643:            @Test(dataProvider="string")
1644:            public String getString(String name) throws SQLException {
1645:                String string = "";
1646:
1647:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1648:
1649:                EasyMock.expect(this .resultSet1.getString(name)).andReturn(
1650:                        string);
1651:
1652:                this .replay();
1653:
1654:                String result = this .resultSet.getString(name);
1655:
1656:                this .verify();
1657:
1658:                assert result == string;
1659:
1660:                return result;
1661:            }
1662:
1663:            /**
1664:             * @see java.sql.ResultSet#getTime(int)
1665:             */
1666:            @Test(dataProvider="int")
1667:            public Time getTime(int index) throws SQLException {
1668:                Time time = new Time(System.currentTimeMillis());
1669:
1670:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1671:
1672:                EasyMock.expect(this .resultSet1.getTime(index)).andReturn(time);
1673:
1674:                this .replay();
1675:
1676:                Time result = this .resultSet.getTime(index);
1677:
1678:                this .verify();
1679:
1680:                assert result == time;
1681:
1682:                return result;
1683:            }
1684:
1685:            /**
1686:             * @see java.sql.ResultSet#getTime(java.lang.String)
1687:             */
1688:            @Test(dataProvider="string")
1689:            public Time getTime(String name) throws SQLException {
1690:                Time time = new Time(System.currentTimeMillis());
1691:
1692:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1693:
1694:                EasyMock.expect(this .resultSet1.getTime(name)).andReturn(time);
1695:
1696:                this .replay();
1697:
1698:                Time result = this .resultSet.getTime(name);
1699:
1700:                this .verify();
1701:
1702:                assert result == time;
1703:
1704:                return result;
1705:            }
1706:
1707:            /**
1708:             * @see java.sql.ResultSet#getTime(int, java.util.Calendar)
1709:             */
1710:            @Test(dataProvider="int-calendar")
1711:            public Time getTime(int index, Calendar calendar)
1712:                    throws SQLException {
1713:                Time time = new Time(System.currentTimeMillis());
1714:
1715:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1716:
1717:                EasyMock.expect(this .resultSet1.getTime(index, calendar))
1718:                        .andReturn(time);
1719:
1720:                this .replay();
1721:
1722:                Time result = this .resultSet.getTime(index, calendar);
1723:
1724:                this .verify();
1725:
1726:                assert result == time;
1727:
1728:                return result;
1729:            }
1730:
1731:            /**
1732:             * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar)
1733:             */
1734:            @Test(dataProvider="string-calendar")
1735:            public Time getTime(String name, Calendar calendar)
1736:                    throws SQLException {
1737:                Time time = new Time(System.currentTimeMillis());
1738:
1739:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1740:
1741:                EasyMock.expect(this .resultSet1.getTime(name, calendar))
1742:                        .andReturn(time);
1743:
1744:                this .replay();
1745:
1746:                Time result = this .resultSet.getTime(name, calendar);
1747:
1748:                this .verify();
1749:
1750:                assert result == time;
1751:
1752:                return result;
1753:            }
1754:
1755:            /**
1756:             * @see java.sql.ResultSet#getTimestamp(int)
1757:             */
1758:            @Test(dataProvider="int")
1759:            public Timestamp getTimestamp(int index) throws SQLException {
1760:                Timestamp timestamp = new Timestamp(System.currentTimeMillis());
1761:
1762:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1763:
1764:                EasyMock.expect(this .resultSet1.getTimestamp(index)).andReturn(
1765:                        timestamp);
1766:
1767:                this .replay();
1768:
1769:                Timestamp result = this .resultSet.getTimestamp(index);
1770:
1771:                this .verify();
1772:
1773:                assert result == timestamp;
1774:
1775:                return result;
1776:            }
1777:
1778:            /**
1779:             * @see java.sql.ResultSet#getTimestamp(java.lang.String)
1780:             */
1781:            @Test(dataProvider="string")
1782:            public Timestamp getTimestamp(String name) throws SQLException {
1783:                Timestamp timestamp = new Timestamp(System.currentTimeMillis());
1784:
1785:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1786:
1787:                EasyMock.expect(this .resultSet1.getTimestamp(name)).andReturn(
1788:                        timestamp);
1789:
1790:                this .replay();
1791:
1792:                Timestamp result = this .resultSet.getTimestamp(name);
1793:
1794:                this .verify();
1795:
1796:                assert result == timestamp;
1797:
1798:                return result;
1799:            }
1800:
1801:            /**
1802:             * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
1803:             */
1804:            @Test(dataProvider="int-calendar")
1805:            public Timestamp getTimestamp(int index, Calendar calendar)
1806:                    throws SQLException {
1807:                Timestamp timestamp = new Timestamp(System.currentTimeMillis());
1808:
1809:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1810:
1811:                EasyMock.expect(this .resultSet1.getTimestamp(index, calendar))
1812:                        .andReturn(timestamp);
1813:
1814:                this .replay();
1815:
1816:                Timestamp result = this .resultSet.getTimestamp(index, calendar);
1817:
1818:                this .verify();
1819:
1820:                assert result == timestamp;
1821:
1822:                return result;
1823:            }
1824:
1825:            /**
1826:             * @see java.sql.ResultSet#getTimestamp(java.lang.String, java.util.Calendar)
1827:             */
1828:            @Test(dataProvider="string-calendar")
1829:            public Timestamp getTimestamp(String name, Calendar calendar)
1830:                    throws SQLException {
1831:                Timestamp timestamp = new Timestamp(System.currentTimeMillis());
1832:
1833:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1834:
1835:                EasyMock.expect(this .resultSet1.getTimestamp(name, calendar))
1836:                        .andReturn(timestamp);
1837:
1838:                this .replay();
1839:
1840:                Timestamp result = this .resultSet.getTimestamp(name, calendar);
1841:
1842:                this .verify();
1843:
1844:                assert result == timestamp;
1845:
1846:                return result;
1847:            }
1848:
1849:            /**
1850:             * @see java.sql.ResultSet#getType()
1851:             */
1852:            @Test
1853:            public int getType() throws SQLException {
1854:                int type = java.sql.ResultSet.TYPE_FORWARD_ONLY;
1855:
1856:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1857:
1858:                EasyMock.expect(this .resultSet1.getType()).andReturn(type);
1859:
1860:                this .replay();
1861:
1862:                int result = this .resultSet.getType();
1863:
1864:                this .verify();
1865:
1866:                assert result == type;
1867:
1868:                return result;
1869:            }
1870:
1871:            /**
1872:             * @see java.sql.ResultSet#getURL(int)
1873:             */
1874:            @Test(dataProvider="int")
1875:            public URL getURL(int index) throws SQLException {
1876:                try {
1877:                    URL url = new URL("http://ha-jdbc.sf.net");
1878:
1879:                    EasyMock.expect(this .cluster.isActive()).andReturn(true);
1880:
1881:                    EasyMock.expect(this .resultSet1.getURL(index)).andReturn(
1882:                            url);
1883:
1884:                    this .replay();
1885:
1886:                    URL result = this .resultSet.getURL(index);
1887:
1888:                    this .verify();
1889:
1890:                    assert result == url;
1891:
1892:                    return result;
1893:                } catch (MalformedURLException e) {
1894:                    assert false;
1895:                    return null;
1896:                }
1897:            }
1898:
1899:            /**
1900:             * @see java.sql.ResultSet#getURL(java.lang.String)
1901:             */
1902:            @Test(dataProvider="string")
1903:            public URL getURL(String name) throws SQLException {
1904:                try {
1905:                    URL url = new URL("http://ha-jdbc.sf.net");
1906:
1907:                    EasyMock.expect(this .cluster.isActive()).andReturn(true);
1908:
1909:                    EasyMock.expect(this .resultSet1.getURL(name))
1910:                            .andReturn(url);
1911:
1912:                    this .replay();
1913:
1914:                    URL result = this .resultSet.getURL(name);
1915:
1916:                    this .verify();
1917:
1918:                    assert result == url;
1919:
1920:                    return result;
1921:                } catch (MalformedURLException e) {
1922:                    assert false;
1923:                    return null;
1924:                }
1925:            }
1926:
1927:            /**
1928:             * @see java.sql.ResultSet#getUnicodeStream(int)
1929:             */
1930:            @SuppressWarnings("deprecation")
1931:            @Test(dataProvider="int")
1932:            @Deprecated
1933:            public InputStream getUnicodeStream(int index) throws SQLException {
1934:                InputStream inputStream = new ByteArrayInputStream(new byte[0]);
1935:
1936:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1937:
1938:                EasyMock.expect(this .resultSet1.getUnicodeStream(index))
1939:                        .andReturn(inputStream);
1940:
1941:                this .replay();
1942:
1943:                InputStream result = this .resultSet.getUnicodeStream(index);
1944:
1945:                this .verify();
1946:
1947:                assert result == inputStream;
1948:
1949:                return result;
1950:            }
1951:
1952:            /**
1953:             * @see java.sql.ResultSet#getUnicodeStream(java.lang.String)
1954:             */
1955:            @SuppressWarnings("deprecation")
1956:            @Test(dataProvider="string")
1957:            @Deprecated
1958:            public InputStream getUnicodeStream(String name)
1959:                    throws SQLException {
1960:                InputStream inputStream = new ByteArrayInputStream(new byte[0]);
1961:
1962:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1963:
1964:                EasyMock.expect(this .resultSet1.getUnicodeStream(name))
1965:                        .andReturn(inputStream);
1966:
1967:                this .replay();
1968:
1969:                InputStream result = this .resultSet.getUnicodeStream(name);
1970:
1971:                this .verify();
1972:
1973:                assert result == inputStream;
1974:
1975:                return result;
1976:            }
1977:
1978:            /**
1979:             * @see java.sql.ResultSet#getWarnings()
1980:             */
1981:            @Test
1982:            public SQLWarning getWarnings() throws SQLException {
1983:                SQLWarning warning = new SQLWarning();
1984:
1985:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
1986:
1987:                EasyMock.expect(this .resultSet1.getWarnings()).andReturn(
1988:                        warning);
1989:
1990:                this .replay();
1991:
1992:                SQLWarning result = this .resultSet.getWarnings();
1993:
1994:                this .verify();
1995:
1996:                assert result == warning;
1997:
1998:                return result;
1999:            }
2000:
2001:            /**
2002:             * @see java.sql.ResultSet#insertRow()
2003:             */
2004:            @Test
2005:            public void insertRow() throws SQLException {
2006:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2007:
2008:                EasyMock.expect(this .statement.getConnection()).andReturn(
2009:                        this .connection);
2010:                EasyMock.expect(
2011:                        this .transactionContext.start(EasyMock
2012:                                .isA(InvocationStrategy.class), EasyMock
2013:                                .same(this .connection))).andAnswer(this .anwser);
2014:
2015:                EasyMock.expect(this .cluster.getTransactionalExecutor())
2016:                        .andReturn(this .executor);
2017:
2018:                EasyMock.expect(this .cluster.getBalancer()).andReturn(
2019:                        this .balancer);
2020:                EasyMock.expect(this .balancer.all())
2021:                        .andReturn(this .databaseSet);
2022:
2023:                EasyMock.expect(this .parent.getRoot()).andReturn(this .root);
2024:
2025:                this .root.retain(this .databaseSet);
2026:
2027:                this .resultSet1.insertRow();
2028:                this .resultSet2.insertRow();
2029:
2030:                this .replay();
2031:
2032:                this .resultSet.insertRow();
2033:
2034:                this .verify();
2035:            }
2036:
2037:            /**
2038:             * @see java.sql.ResultSet#isAfterLast()
2039:             */
2040:            @Test
2041:            public boolean isAfterLast() throws SQLException {
2042:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2043:
2044:                EasyMock.expect(this .resultSet1.isAfterLast()).andReturn(true);
2045:
2046:                this .replay();
2047:
2048:                boolean result = this .resultSet.isAfterLast();
2049:
2050:                this .verify();
2051:
2052:                assert result;
2053:
2054:                return result;
2055:            }
2056:
2057:            /**
2058:             * @see java.sql.ResultSet#isBeforeFirst()
2059:             */
2060:            @Test
2061:            public boolean isBeforeFirst() throws SQLException {
2062:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2063:
2064:                EasyMock.expect(this .resultSet1.isBeforeFirst())
2065:                        .andReturn(true);
2066:
2067:                this .replay();
2068:
2069:                boolean result = this .resultSet.isBeforeFirst();
2070:
2071:                this .verify();
2072:
2073:                assert result;
2074:
2075:                return result;
2076:            }
2077:
2078:            /**
2079:             * @see java.sql.ResultSet#isFirst()
2080:             */
2081:            @Test
2082:            public boolean isFirst() throws SQLException {
2083:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2084:
2085:                EasyMock.expect(this .resultSet1.isFirst()).andReturn(true);
2086:
2087:                this .replay();
2088:
2089:                boolean result = this .resultSet.isFirst();
2090:
2091:                this .verify();
2092:
2093:                assert result;
2094:
2095:                return result;
2096:            }
2097:
2098:            /**
2099:             * @see java.sql.ResultSet#isLast()
2100:             */
2101:            @Test
2102:            public boolean isLast() throws SQLException {
2103:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2104:
2105:                EasyMock.expect(this .resultSet1.isLast()).andReturn(true);
2106:
2107:                this .replay();
2108:
2109:                boolean result = this .resultSet.isLast();
2110:
2111:                this .verify();
2112:
2113:                assert result;
2114:
2115:                return result;
2116:            }
2117:
2118:            /**
2119:             * @see java.sql.ResultSet#last()
2120:             */
2121:            @Test
2122:            public boolean last() throws SQLException {
2123:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2124:
2125:                EasyMock.expect(this .resultSet1.last()).andReturn(true);
2126:                EasyMock.expect(this .resultSet2.last()).andReturn(true);
2127:
2128:                this .replay();
2129:
2130:                boolean result = this .resultSet.last();
2131:
2132:                this .verify();
2133:
2134:                assert result;
2135:
2136:                return result;
2137:            }
2138:
2139:            /**
2140:             * @see java.sql.ResultSet#moveToCurrentRow()
2141:             */
2142:            @Test
2143:            public void moveToCurrentRow() throws SQLException {
2144:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2145:
2146:                this .resultSet1.moveToCurrentRow();
2147:                this .resultSet2.moveToCurrentRow();
2148:
2149:                this .replay();
2150:
2151:                this .resultSet.moveToCurrentRow();
2152:
2153:                this .verify();
2154:            }
2155:
2156:            /**
2157:             * @see java.sql.ResultSet#moveToInsertRow()
2158:             */
2159:            @Test
2160:            public void moveToInsertRow() throws SQLException {
2161:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2162:
2163:                this .resultSet1.moveToInsertRow();
2164:                this .resultSet2.moveToInsertRow();
2165:
2166:                this .replay();
2167:
2168:                this .resultSet.moveToInsertRow();
2169:
2170:                this .verify();
2171:            }
2172:
2173:            /**
2174:             * @see java.sql.ResultSet#next()
2175:             */
2176:            @Test
2177:            public boolean next() throws SQLException {
2178:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2179:
2180:                EasyMock.expect(this .resultSet1.next()).andReturn(true);
2181:                EasyMock.expect(this .resultSet2.next()).andReturn(true);
2182:
2183:                this .replay();
2184:
2185:                boolean result = this .resultSet.next();
2186:
2187:                this .verify();
2188:
2189:                assert result;
2190:
2191:                return result;
2192:            }
2193:
2194:            /**
2195:             * @see java.sql.ResultSet#previous()
2196:             */
2197:            @Test
2198:            public boolean previous() throws SQLException {
2199:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2200:
2201:                EasyMock.expect(this .resultSet1.previous()).andReturn(true);
2202:                EasyMock.expect(this .resultSet2.previous()).andReturn(true);
2203:
2204:                this .replay();
2205:
2206:                boolean result = this .resultSet.previous();
2207:
2208:                this .verify();
2209:
2210:                assert result;
2211:
2212:                return result;
2213:            }
2214:
2215:            /**
2216:             * @see java.sql.ResultSet#refreshRow()
2217:             */
2218:            @Test
2219:            public void refreshRow() throws SQLException {
2220:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2221:
2222:                EasyMock.expect(this .cluster.getNonTransactionalExecutor())
2223:                        .andReturn(this .executor);
2224:
2225:                EasyMock.expect(this .cluster.getBalancer()).andReturn(
2226:                        this .balancer);
2227:                EasyMock.expect(this .balancer.all())
2228:                        .andReturn(this .databaseSet);
2229:
2230:                EasyMock.expect(this .parent.getRoot()).andReturn(this .root);
2231:
2232:                this .root.retain(this .databaseSet);
2233:
2234:                this .resultSet1.refreshRow();
2235:                this .resultSet2.refreshRow();
2236:
2237:                this .replay();
2238:
2239:                this .resultSet.refreshRow();
2240:
2241:                this .verify();
2242:            }
2243:
2244:            /**
2245:             * @see java.sql.ResultSet#relative(int)
2246:             */
2247:            @Test(dataProvider="int")
2248:            public boolean relative(int rows) throws SQLException {
2249:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2250:
2251:                EasyMock.expect(this .resultSet1.relative(rows)).andReturn(true);
2252:                EasyMock.expect(this .resultSet2.relative(rows)).andReturn(true);
2253:
2254:                this .replay();
2255:
2256:                boolean result = this .resultSet.relative(rows);
2257:
2258:                this .verify();
2259:
2260:                assert result;
2261:
2262:                return result;
2263:            }
2264:
2265:            /**
2266:             * @see java.sql.ResultSet#rowDeleted()
2267:             */
2268:            @Test
2269:            public boolean rowDeleted() throws SQLException {
2270:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2271:
2272:                EasyMock.expect(this .resultSet1.rowDeleted()).andReturn(true);
2273:
2274:                this .replay();
2275:
2276:                boolean result = this .resultSet.rowDeleted();
2277:
2278:                this .verify();
2279:
2280:                assert result;
2281:
2282:                return result;
2283:            }
2284:
2285:            /**
2286:             * @see java.sql.ResultSet#rowInserted()
2287:             */
2288:            @Test
2289:            public boolean rowInserted() throws SQLException {
2290:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2291:
2292:                EasyMock.expect(this .resultSet1.rowInserted()).andReturn(true);
2293:
2294:                this .replay();
2295:
2296:                boolean result = this .resultSet.rowInserted();
2297:
2298:                this .verify();
2299:
2300:                assert result;
2301:
2302:                return result;
2303:            }
2304:
2305:            /**
2306:             * @see java.sql.ResultSet#rowUpdated()
2307:             */
2308:            @Test
2309:            public boolean rowUpdated() throws SQLException {
2310:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2311:
2312:                EasyMock.expect(this .resultSet1.rowUpdated()).andReturn(true);
2313:
2314:                this .replay();
2315:
2316:                boolean result = this .resultSet.rowUpdated();
2317:
2318:                this .verify();
2319:
2320:                assert result;
2321:
2322:                return result;
2323:            }
2324:
2325:            /**
2326:             * @see java.sql.ResultSet#setFetchDirection(int)
2327:             */
2328:            @Test(dataProvider="int")
2329:            public void setFetchDirection(int direction) throws SQLException {
2330:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2331:
2332:                this .resultSet1.setFetchDirection(direction);
2333:                this .resultSet2.setFetchDirection(direction);
2334:
2335:                this .replay();
2336:
2337:                this .resultSet.setFetchDirection(direction);
2338:
2339:                this .verify();
2340:            }
2341:
2342:            /**
2343:             * @see java.sql.ResultSet#setFetchSize(int)
2344:             */
2345:            @Test(dataProvider="int")
2346:            public void setFetchSize(int rows) throws SQLException {
2347:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2348:
2349:                this .resultSet1.setFetchSize(rows);
2350:                this .resultSet2.setFetchSize(rows);
2351:
2352:                this .replay();
2353:
2354:                this .resultSet.setFetchSize(rows);
2355:
2356:                this .verify();
2357:            }
2358:
2359:            @DataProvider(name="int-array")
2360:            Object[][] intArrayProvider() {
2361:                return new Object[][] { new Object[] { 1,
2362:                        EasyMock.createMock(Array.class) } };
2363:            }
2364:
2365:            /**
2366:             * @see java.sql.ResultSet#updateArray(int, java.sql.Array)
2367:             */
2368:            @Test(dataProvider="int-array")
2369:            public void updateArray(int index, Array value) throws SQLException {
2370:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2371:
2372:                this .resultSet1.updateArray(index, value);
2373:                this .resultSet2.updateArray(index, value);
2374:
2375:                this .replay();
2376:
2377:                this .resultSet.updateArray(index, value);
2378:
2379:                this .verify();
2380:            }
2381:
2382:            @DataProvider(name="string-array")
2383:            Object[][] stringArrayProvider() {
2384:                return new Object[][] { new Object[] { "",
2385:                        EasyMock.createMock(Array.class) } };
2386:            }
2387:
2388:            /**
2389:             * @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array)
2390:             */
2391:            @Test(dataProvider="string-array")
2392:            public void updateArray(String name, Array value)
2393:                    throws SQLException {
2394:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2395:
2396:                this .resultSet1.updateArray(name, value);
2397:                this .resultSet2.updateArray(name, value);
2398:
2399:                this .replay();
2400:
2401:                this .resultSet.updateArray(name, value);
2402:
2403:                this .verify();
2404:            }
2405:
2406:            @DataProvider(name="int-inputStream-int")
2407:            Object[][] intInputStreamIntProvider() {
2408:                return new Object[][] { new Object[] { 1,
2409:                        new ByteArrayInputStream(new byte[0]), 1 } };
2410:            }
2411:
2412:            /**
2413:             * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int)
2414:             */
2415:            @Test(dataProvider="int-inputStream-int")
2416:            public void updateAsciiStream(int index, InputStream value,
2417:                    int length) throws SQLException {
2418:                File file = new File("");
2419:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2420:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2421:
2422:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2423:
2424:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2425:                        file);
2426:
2427:                EasyMock.expect(this .fileSupport.getInputStream(file))
2428:                        .andReturn(input1);
2429:
2430:                this .resultSet1.updateAsciiStream(index, input1, length);
2431:
2432:                EasyMock.expect(this .fileSupport.getInputStream(file))
2433:                        .andReturn(input2);
2434:
2435:                this .resultSet2.updateAsciiStream(index, input2, length);
2436:
2437:                this .replay();
2438:
2439:                this .resultSet.updateAsciiStream(index, value, length);
2440:
2441:                this .verify();
2442:            }
2443:
2444:            @DataProvider(name="string-inputStream-int")
2445:            Object[][] stringInputStreamIntProvider() {
2446:                return new Object[][] { new Object[] { "",
2447:                        new ByteArrayInputStream(new byte[0]), 1 } };
2448:            }
2449:
2450:            /**
2451:             * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, int)
2452:             */
2453:            @Test(dataProvider="string-inputStream-int")
2454:            public void updateAsciiStream(String name, InputStream value,
2455:                    int length) throws SQLException {
2456:                File file = new File("");
2457:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2458:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2459:
2460:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2461:
2462:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2463:                        file);
2464:
2465:                EasyMock.expect(this .fileSupport.getInputStream(file))
2466:                        .andReturn(input1);
2467:
2468:                this .resultSet1.updateAsciiStream(name, input1, length);
2469:
2470:                EasyMock.expect(this .fileSupport.getInputStream(file))
2471:                        .andReturn(input2);
2472:
2473:                this .resultSet2.updateAsciiStream(name, input2, length);
2474:
2475:                this .replay();
2476:
2477:                this .resultSet.updateAsciiStream(name, value, length);
2478:
2479:                this .verify();
2480:            }
2481:
2482:            @DataProvider(name="int-bigDecimal")
2483:            Object[][] intBigDecimalProvider() {
2484:                return new Object[][] { new Object[] { 1, new BigDecimal(1.0) } };
2485:            }
2486:
2487:            /**
2488:             * @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal)
2489:             */
2490:            @Test(dataProvider="int-bigDecimal")
2491:            public void updateBigDecimal(int index, BigDecimal value)
2492:                    throws SQLException {
2493:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2494:
2495:                this .resultSet1.updateBigDecimal(index, value);
2496:                this .resultSet2.updateBigDecimal(index, value);
2497:
2498:                this .replay();
2499:
2500:                this .resultSet.updateBigDecimal(index, value);
2501:
2502:                this .verify();
2503:            }
2504:
2505:            @DataProvider(name="string-bigDecimal")
2506:            Object[][] stringBigDecimalProvider() {
2507:                return new Object[][] { new Object[] { "", new BigDecimal(1.0) } };
2508:            }
2509:
2510:            /**
2511:             * @see java.sql.ResultSet#updateBigDecimal(java.lang.String, java.math.BigDecimal)
2512:             */
2513:            @Test(dataProvider="string-bigDecimal")
2514:            public void updateBigDecimal(String name, BigDecimal value)
2515:                    throws SQLException {
2516:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2517:
2518:                this .resultSet1.updateBigDecimal(name, value);
2519:                this .resultSet2.updateBigDecimal(name, value);
2520:
2521:                this .replay();
2522:
2523:                this .resultSet.updateBigDecimal(name, value);
2524:
2525:                this .verify();
2526:            }
2527:
2528:            /**
2529:             * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int)
2530:             */
2531:            @Test(dataProvider="int-inputStream-int")
2532:            public void updateBinaryStream(int index, InputStream value,
2533:                    int length) throws SQLException {
2534:                File file = new File("");
2535:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2536:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2537:
2538:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2539:
2540:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2541:                        file);
2542:
2543:                EasyMock.expect(this .fileSupport.getInputStream(file))
2544:                        .andReturn(input1);
2545:
2546:                this .resultSet1.updateBinaryStream(index, input1, length);
2547:
2548:                EasyMock.expect(this .fileSupport.getInputStream(file))
2549:                        .andReturn(input2);
2550:
2551:                this .resultSet2.updateBinaryStream(index, input2, length);
2552:
2553:                this .replay();
2554:
2555:                this .resultSet.updateBinaryStream(index, value, length);
2556:
2557:                this .verify();
2558:            }
2559:
2560:            /**
2561:             * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, int)
2562:             */
2563:            @Test(dataProvider="string-inputStream-int")
2564:            public void updateBinaryStream(String name, InputStream value,
2565:                    int length) throws SQLException {
2566:                File file = new File("");
2567:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
2568:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
2569:
2570:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2571:
2572:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2573:                        file);
2574:
2575:                EasyMock.expect(this .fileSupport.getInputStream(file))
2576:                        .andReturn(input1);
2577:
2578:                this .resultSet1.updateBinaryStream(name, input1, length);
2579:
2580:                EasyMock.expect(this .fileSupport.getInputStream(file))
2581:                        .andReturn(input2);
2582:
2583:                this .resultSet2.updateBinaryStream(name, input2, length);
2584:
2585:                this .replay();
2586:
2587:                this .resultSet.updateBinaryStream(name, value, length);
2588:
2589:                this .verify();
2590:            }
2591:
2592:            @DataProvider(name="int-blob")
2593:            Object[][] intBlobProvider() throws Exception {
2594:                Map<Database, Blob> map = new TreeMap<Database, Blob>();
2595:
2596:                map.put(this .database1, this .blob1);
2597:                map.put(this .database2, this .blob2);
2598:
2599:                Blob blob = ProxyFactory
2600:                        .createProxy(Blob.class, new BlobInvocationHandler(
2601:                                null, this .handler, null, map));
2602:
2603:                return new Object[][] { new Object[] { 1, new MockBlob() },
2604:                        new Object[] { 1, blob } };
2605:            }
2606:
2607:            /**
2608:             * @see java.sql.ResultSet#updateBlob(int, java.sql.Blob)
2609:             */
2610:            @Test(dataProvider="int-blob")
2611:            public void updateBlob(int index, Blob value) throws SQLException {
2612:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2613:
2614:                if (Proxy.isProxyClass(value.getClass())) {
2615:                    this .resultSet1.updateBlob(index, this .blob1);
2616:                    this .resultSet2.updateBlob(index, this .blob2);
2617:                } else {
2618:                    this .resultSet1.updateBlob(EasyMock.eq(index), EasyMock
2619:                            .isA(SerialBlob.class));
2620:                    this .resultSet2.updateBlob(EasyMock.eq(index), EasyMock
2621:                            .isA(SerialBlob.class));
2622:                }
2623:
2624:                this .replay();
2625:
2626:                this .resultSet.updateBlob(index, value);
2627:
2628:                this .verify();
2629:            }
2630:
2631:            @DataProvider(name="string-blob")
2632:            Object[][] stringBlobProvider() throws Exception {
2633:                Map<Database, Blob> map = new TreeMap<Database, Blob>();
2634:
2635:                map.put(this .database1, this .blob1);
2636:                map.put(this .database2, this .blob2);
2637:
2638:                Blob blob = ProxyFactory
2639:                        .createProxy(Blob.class, new BlobInvocationHandler(
2640:                                null, this .handler, null, map));
2641:
2642:                return new Object[][] { new Object[] { "", new MockBlob() },
2643:                        new Object[] { "", blob } };
2644:            }
2645:
2646:            /**
2647:             * @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob)
2648:             */
2649:            @Test(dataProvider="string-blob")
2650:            public void updateBlob(String name, Blob value) throws SQLException {
2651:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2652:
2653:                if (Proxy.isProxyClass(value.getClass())) {
2654:                    this .resultSet1.updateBlob(name, this .blob1);
2655:                    this .resultSet2.updateBlob(name, this .blob2);
2656:                } else {
2657:                    this .resultSet1.updateBlob(EasyMock.eq(name), EasyMock
2658:                            .isA(SerialBlob.class));
2659:                    this .resultSet2.updateBlob(EasyMock.eq(name), EasyMock
2660:                            .isA(SerialBlob.class));
2661:                }
2662:
2663:                this .replay();
2664:
2665:                this .resultSet.updateBlob(name, value);
2666:
2667:                this .verify();
2668:            }
2669:
2670:            @DataProvider(name="int-boolean")
2671:            Object[][] intBooleanProvider() {
2672:                return new Object[][] { new Object[] { 1, true } };
2673:            }
2674:
2675:            /**
2676:             * @see java.sql.ResultSet#updateBoolean(int, boolean)
2677:             */
2678:            @Test(dataProvider="int-boolean")
2679:            public void updateBoolean(int index, boolean value)
2680:                    throws SQLException {
2681:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2682:
2683:                this .resultSet1.updateBoolean(index, value);
2684:                this .resultSet2.updateBoolean(index, value);
2685:
2686:                this .replay();
2687:
2688:                this .resultSet.updateBoolean(index, value);
2689:
2690:                this .verify();
2691:            }
2692:
2693:            @DataProvider(name="string-boolean")
2694:            Object[][] stringBooleanProvider() {
2695:                return new Object[][] { new Object[] { "", true } };
2696:            }
2697:
2698:            /**
2699:             * @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean)
2700:             */
2701:            @Test(dataProvider="string-boolean")
2702:            public void updateBoolean(String name, boolean value)
2703:                    throws SQLException {
2704:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2705:
2706:                this .resultSet1.updateBoolean(name, value);
2707:                this .resultSet2.updateBoolean(name, value);
2708:
2709:                this .replay();
2710:
2711:                this .resultSet.updateBoolean(name, value);
2712:
2713:                this .verify();
2714:            }
2715:
2716:            @DataProvider(name="int-byte")
2717:            Object[][] intByteProvider() {
2718:                return new Object[][] { new Object[] { 1,
2719:                        Integer.valueOf(1).byteValue() } };
2720:            }
2721:
2722:            /**
2723:             * @see java.sql.ResultSet#updateByte(int, byte)
2724:             */
2725:            @Test(dataProvider="int-byte")
2726:            public void updateByte(int index, byte value) throws SQLException {
2727:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2728:
2729:                this .resultSet1.updateByte(index, value);
2730:                this .resultSet2.updateByte(index, value);
2731:
2732:                this .replay();
2733:
2734:                this .resultSet.updateByte(index, value);
2735:
2736:                this .verify();
2737:            }
2738:
2739:            @DataProvider(name="string-byte")
2740:            Object[][] stringByteProvider() {
2741:                return new Object[][] { new Object[] { "",
2742:                        Integer.valueOf(1).byteValue() } };
2743:            }
2744:
2745:            /**
2746:             * @see java.sql.ResultSet#updateByte(java.lang.String, byte)
2747:             */
2748:            @Test(dataProvider="string-byte")
2749:            public void updateByte(String name, byte value) throws SQLException {
2750:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2751:
2752:                this .resultSet1.updateByte(name, value);
2753:                this .resultSet2.updateByte(name, value);
2754:
2755:                this .replay();
2756:
2757:                this .resultSet.updateByte(name, value);
2758:
2759:                this .verify();
2760:            }
2761:
2762:            @DataProvider(name="int-bytes")
2763:            Object[][] intBytesProvider() {
2764:                return new Object[][] { new Object[] { 1, new byte[0] } };
2765:            }
2766:
2767:            /**
2768:             * @see java.sql.ResultSet#updateBytes(int, byte[])
2769:             */
2770:            @Test(dataProvider="int-bytes")
2771:            public void updateBytes(int index, byte[] value)
2772:                    throws SQLException {
2773:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2774:
2775:                this .resultSet1.updateBytes(index, value);
2776:                this .resultSet2.updateBytes(index, value);
2777:
2778:                this .replay();
2779:
2780:                this .resultSet.updateBytes(index, value);
2781:
2782:                this .verify();
2783:            }
2784:
2785:            @DataProvider(name="string-bytes")
2786:            Object[][] stringBytesProvider() {
2787:                return new Object[][] { new Object[] { "", new byte[0] } };
2788:            }
2789:
2790:            /**
2791:             * @see java.sql.ResultSet#updateBytes(java.lang.String, byte[])
2792:             */
2793:            @Test(dataProvider="string-bytes")
2794:            public void updateBytes(String name, byte[] value)
2795:                    throws SQLException {
2796:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2797:
2798:                this .resultSet1.updateBytes(name, value);
2799:                this .resultSet2.updateBytes(name, value);
2800:
2801:                this .replay();
2802:
2803:                this .resultSet.updateBytes(name, value);
2804:
2805:                this .verify();
2806:            }
2807:
2808:            @DataProvider(name="int-reader-int")
2809:            Object[][] intReaderIntProvider() {
2810:                return new Object[][] { new Object[] { 1,
2811:                        new CharArrayReader(new char[0]), 0 } };
2812:            }
2813:
2814:            /**
2815:             * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int)
2816:             */
2817:            @Test(dataProvider="int-reader-int")
2818:            public void updateCharacterStream(int index, Reader value,
2819:                    int length) throws SQLException {
2820:                File file = new File("");
2821:                Reader reader1 = new CharArrayReader(new char[0]);
2822:                Reader reader2 = new CharArrayReader(new char[0]);
2823:
2824:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2825:
2826:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2827:                        file);
2828:
2829:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2830:                        reader1);
2831:
2832:                this .resultSet1.updateCharacterStream(index, reader1, length);
2833:
2834:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2835:                        reader2);
2836:
2837:                this .resultSet2.updateCharacterStream(index, reader2, length);
2838:
2839:                this .replay();
2840:
2841:                this .resultSet.updateCharacterStream(index, value, length);
2842:
2843:                this .verify();
2844:            }
2845:
2846:            @DataProvider(name="string-reader-int")
2847:            Object[][] stringReaderIntProvider() {
2848:                return new Object[][] { new Object[] { "",
2849:                        new CharArrayReader(new char[0]), 0 } };
2850:            }
2851:
2852:            /**
2853:             * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, int)
2854:             */
2855:            @Test(dataProvider="string-reader-int")
2856:            public void updateCharacterStream(String name, Reader value,
2857:                    int length) throws SQLException {
2858:                File file = new File("");
2859:                Reader reader1 = new CharArrayReader(new char[0]);
2860:                Reader reader2 = new CharArrayReader(new char[0]);
2861:
2862:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2863:
2864:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
2865:                        file);
2866:
2867:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2868:                        reader1);
2869:
2870:                this .resultSet1.updateCharacterStream(name, reader1, length);
2871:
2872:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
2873:                        reader2);
2874:
2875:                this .resultSet2.updateCharacterStream(name, reader2, length);
2876:
2877:                this .replay();
2878:
2879:                this .resultSet.updateCharacterStream(name, value, length);
2880:
2881:                this .verify();
2882:            }
2883:
2884:            @DataProvider(name="int-clob")
2885:            Object[][] intClobProvider() throws Exception {
2886:                Map<Database, Clob> map = new TreeMap<Database, Clob>();
2887:
2888:                map.put(this .database1, this .clob1);
2889:                map.put(this .database2, this .clob2);
2890:
2891:                Clob clob = ProxyFactory
2892:                        .createProxy(Clob.class, new ClobInvocationHandler(
2893:                                null, this .handler, null, map));
2894:
2895:                return new Object[][] { new Object[] { 1, new MockClob() },
2896:                        new Object[] { 1, clob } };
2897:            }
2898:
2899:            /**
2900:             * @see java.sql.ResultSet#updateClob(int, java.sql.Clob)
2901:             */
2902:            @Test(dataProvider="int-clob")
2903:            public void updateClob(int index, Clob value) throws SQLException {
2904:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2905:
2906:                if (Proxy.isProxyClass(value.getClass())) {
2907:                    this .resultSet1.updateClob(index, this .clob1);
2908:                    this .resultSet2.updateClob(index, this .clob2);
2909:                } else {
2910:                    this .resultSet1.updateClob(EasyMock.eq(index), EasyMock
2911:                            .isA(SerialClob.class));
2912:                    this .resultSet2.updateClob(EasyMock.eq(index), EasyMock
2913:                            .isA(SerialClob.class));
2914:                }
2915:
2916:                this .replay();
2917:
2918:                this .resultSet.updateClob(index, value);
2919:
2920:                this .verify();
2921:            }
2922:
2923:            @DataProvider(name="string-clob")
2924:            Object[][] stringClobProvider() throws Exception {
2925:                Map<Database, Clob> map = new TreeMap<Database, Clob>();
2926:
2927:                map.put(this .database1, this .clob1);
2928:                map.put(this .database2, this .clob2);
2929:
2930:                Clob clob = ProxyFactory
2931:                        .createProxy(Clob.class, new ClobInvocationHandler(
2932:                                null, this .handler, null, map));
2933:
2934:                return new Object[][] { new Object[] { "", new MockClob() },
2935:                        new Object[] { "", clob } };
2936:            }
2937:
2938:            /**
2939:             * @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob)
2940:             */
2941:            @Test(dataProvider="string-clob")
2942:            public void updateClob(String name, Clob value) throws SQLException {
2943:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2944:
2945:                if (Proxy.isProxyClass(value.getClass())) {
2946:                    this .resultSet1.updateClob(name, this .clob1);
2947:                    this .resultSet2.updateClob(name, this .clob2);
2948:                } else {
2949:                    this .resultSet1.updateClob(EasyMock.eq(name), EasyMock
2950:                            .isA(SerialClob.class));
2951:                    this .resultSet2.updateClob(EasyMock.eq(name), EasyMock
2952:                            .isA(SerialClob.class));
2953:                }
2954:
2955:                this .replay();
2956:
2957:                this .resultSet.updateClob(name, value);
2958:
2959:                this .verify();
2960:            }
2961:
2962:            @DataProvider(name="int-date")
2963:            Object[][] intDateProvider() {
2964:                return new Object[][] { new Object[] { 1,
2965:                        new Date(System.currentTimeMillis()) } };
2966:            }
2967:
2968:            /**
2969:             * @see java.sql.ResultSet#updateDate(int, java.sql.Date)
2970:             */
2971:            @Test(dataProvider="int-date")
2972:            public void updateDate(int index, Date value) throws SQLException {
2973:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2974:
2975:                this .resultSet1.updateDate(index, value);
2976:                this .resultSet2.updateDate(index, value);
2977:
2978:                this .replay();
2979:
2980:                this .resultSet.updateDate(index, value);
2981:
2982:                this .verify();
2983:            }
2984:
2985:            @DataProvider(name="string-date")
2986:            Object[][] stringDateProvider() {
2987:                return new Object[][] { new Object[] { "",
2988:                        new Date(System.currentTimeMillis()) } };
2989:            }
2990:
2991:            /**
2992:             * @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date)
2993:             */
2994:            @Test(dataProvider="string-date")
2995:            public void updateDate(String name, Date value) throws SQLException {
2996:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
2997:
2998:                this .resultSet1.updateDate(name, value);
2999:                this .resultSet2.updateDate(name, value);
3000:
3001:                this .replay();
3002:
3003:                this .resultSet.updateDate(name, value);
3004:
3005:                this .verify();
3006:            }
3007:
3008:            @DataProvider(name="int-double")
3009:            Object[][] intDoubleProvider() {
3010:                return new Object[][] { new Object[] { 1, 1.0 } };
3011:            }
3012:
3013:            /**
3014:             * @see java.sql.ResultSet#updateDouble(int, double)
3015:             */
3016:            @Test(dataProvider="int-double")
3017:            public void updateDouble(int index, double value)
3018:                    throws SQLException {
3019:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3020:
3021:                this .resultSet1.updateDouble(index, value);
3022:                this .resultSet2.updateDouble(index, value);
3023:
3024:                this .replay();
3025:
3026:                this .resultSet.updateDouble(index, value);
3027:
3028:                this .verify();
3029:            }
3030:
3031:            @DataProvider(name="string-double")
3032:            Object[][] stringDoubleProvider() {
3033:                return new Object[][] { new Object[] { "", 1.0 } };
3034:            }
3035:
3036:            /**
3037:             * @see java.sql.ResultSet#updateDouble(java.lang.String, double)
3038:             */
3039:            @Test(dataProvider="string-double")
3040:            public void updateDouble(String name, double value)
3041:                    throws SQLException {
3042:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3043:
3044:                this .resultSet1.updateDouble(name, value);
3045:                this .resultSet2.updateDouble(name, value);
3046:
3047:                this .replay();
3048:
3049:                this .resultSet.updateDouble(name, value);
3050:
3051:                this .verify();
3052:            }
3053:
3054:            @DataProvider(name="int-float")
3055:            Object[][] intFloatProvider() {
3056:                return new Object[][] { new Object[] { 1, 1.0F } };
3057:            }
3058:
3059:            /**
3060:             * @see java.sql.ResultSet#updateFloat(int, float)
3061:             */
3062:            @Test(dataProvider="int-float")
3063:            public void updateFloat(int index, float value) throws SQLException {
3064:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3065:
3066:                this .resultSet1.updateFloat(index, value);
3067:                this .resultSet2.updateFloat(index, value);
3068:
3069:                this .replay();
3070:
3071:                this .resultSet.updateFloat(index, value);
3072:
3073:                this .verify();
3074:            }
3075:
3076:            @DataProvider(name="string-float")
3077:            Object[][] stringFloatProvider() {
3078:                return new Object[][] { new Object[] { "", 1.0F } };
3079:            }
3080:
3081:            /**
3082:             * @see java.sql.ResultSet#updateFloat(java.lang.String, float)
3083:             */
3084:            @Test(dataProvider="string-float")
3085:            public void updateFloat(String name, float value)
3086:                    throws SQLException {
3087:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3088:
3089:                this .resultSet1.updateFloat(name, value);
3090:                this .resultSet2.updateFloat(name, value);
3091:
3092:                this .replay();
3093:
3094:                this .resultSet.updateFloat(name, value);
3095:
3096:                this .verify();
3097:            }
3098:
3099:            /**
3100:             * @see java.sql.ResultSet#updateInt(int, int)
3101:             */
3102:            @Test(dataProvider="int-int")
3103:            public void updateInt(int index, int value) throws SQLException {
3104:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3105:
3106:                this .resultSet1.updateInt(index, value);
3107:                this .resultSet2.updateInt(index, value);
3108:
3109:                this .replay();
3110:
3111:                this .resultSet.updateInt(index, value);
3112:
3113:                this .verify();
3114:            }
3115:
3116:            /**
3117:             * @see java.sql.ResultSet#updateInt(java.lang.String, int)
3118:             */
3119:            @Test(dataProvider="string-int")
3120:            public void updateInt(String name, int value) throws SQLException {
3121:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3122:
3123:                this .resultSet1.updateInt(name, value);
3124:                this .resultSet2.updateInt(name, value);
3125:
3126:                this .replay();
3127:
3128:                this .resultSet.updateInt(name, value);
3129:
3130:                this .verify();
3131:            }
3132:
3133:            @DataProvider(name="int-long")
3134:            Object[][] intLongProvider() {
3135:                return new Object[][] { new Object[] { 1, 1L } };
3136:            }
3137:
3138:            /**
3139:             * @see java.sql.ResultSet#updateLong(int, long)
3140:             */
3141:            @Test(dataProvider="int-long")
3142:            public void updateLong(int index, long value) throws SQLException {
3143:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3144:
3145:                this .resultSet1.updateLong(index, value);
3146:                this .resultSet2.updateLong(index, value);
3147:
3148:                this .replay();
3149:
3150:                this .resultSet.updateLong(index, value);
3151:
3152:                this .verify();
3153:            }
3154:
3155:            @DataProvider(name="string-long")
3156:            Object[][] stringLongProvider() {
3157:                return new Object[][] { new Object[] { "", 1L } };
3158:            }
3159:
3160:            /**
3161:             * @see java.sql.ResultSet#updateLong(java.lang.String, long)
3162:             */
3163:            @Test(dataProvider="string-long")
3164:            public void updateLong(String name, long value) throws SQLException {
3165:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3166:
3167:                this .resultSet1.updateLong(name, value);
3168:                this .resultSet2.updateLong(name, value);
3169:
3170:                this .replay();
3171:
3172:                this .resultSet.updateLong(name, value);
3173:
3174:                this .verify();
3175:            }
3176:
3177:            /**
3178:             * @see java.sql.ResultSet#updateNull(int)
3179:             */
3180:            @Test(dataProvider="int")
3181:            public void updateNull(int index) throws SQLException {
3182:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3183:
3184:                this .resultSet1.updateNull(index);
3185:                this .resultSet2.updateNull(index);
3186:
3187:                this .replay();
3188:
3189:                this .resultSet.updateNull(index);
3190:
3191:                this .verify();
3192:            }
3193:
3194:            /**
3195:             * @see java.sql.ResultSet#updateNull(java.lang.String)
3196:             */
3197:            @Test(dataProvider="string")
3198:            public void updateNull(String name) throws SQLException {
3199:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3200:
3201:                this .resultSet1.updateNull(name);
3202:                this .resultSet2.updateNull(name);
3203:
3204:                this .replay();
3205:
3206:                this .resultSet.updateNull(name);
3207:
3208:                this .verify();
3209:            }
3210:
3211:            @DataProvider(name="int-object")
3212:            Object[][] intObjectProvider() {
3213:                return new Object[][] { new Object[] { 1, new Object() } };
3214:            }
3215:
3216:            /**
3217:             * @see java.sql.ResultSet#updateObject(int, java.lang.Object)
3218:             */
3219:            @Test(dataProvider="int-object")
3220:            public void updateObject(int index, Object value)
3221:                    throws SQLException {
3222:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3223:
3224:                this .resultSet1.updateObject(index, value);
3225:                this .resultSet2.updateObject(index, value);
3226:
3227:                this .replay();
3228:
3229:                this .resultSet.updateObject(index, value);
3230:
3231:                this .verify();
3232:            }
3233:
3234:            @DataProvider(name="string-object")
3235:            Object[][] stringObjectProvider() {
3236:                return new Object[][] { new Object[] { "", new Object() } };
3237:            }
3238:
3239:            /**
3240:             * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object)
3241:             */
3242:            @Test(dataProvider="string-object")
3243:            public void updateObject(String name, Object value)
3244:                    throws SQLException {
3245:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3246:
3247:                this .resultSet1.updateObject(name, value);
3248:                this .resultSet2.updateObject(name, value);
3249:
3250:                this .replay();
3251:
3252:                this .resultSet.updateObject(name, value);
3253:
3254:                this .verify();
3255:            }
3256:
3257:            @DataProvider(name="int-object-int")
3258:            Object[][] intObjectIntProvider() {
3259:                return new Object[][] { new Object[] { 1, new Object(), 1 } };
3260:            }
3261:
3262:            /**
3263:             * @see java.sql.ResultSet#updateObject(int, java.lang.Object, int)
3264:             */
3265:            @Test(dataProvider="int-object-int")
3266:            public void updateObject(int index, Object value, int scale)
3267:                    throws SQLException {
3268:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3269:
3270:                this .resultSet1.updateObject(index, value, scale);
3271:                this .resultSet2.updateObject(index, value, scale);
3272:
3273:                this .replay();
3274:
3275:                this .resultSet.updateObject(index, value, scale);
3276:
3277:                this .verify();
3278:            }
3279:
3280:            @DataProvider(name="string-object-int")
3281:            Object[][] stringObjectIntProvider() {
3282:                return new Object[][] { new Object[] { "", new Object(), 1 } };
3283:            }
3284:
3285:            /**
3286:             * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object, int)
3287:             */
3288:            @Test(dataProvider="string-object-int")
3289:            public void updateObject(String name, Object value, int scale)
3290:                    throws SQLException {
3291:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3292:
3293:                this .resultSet1.updateObject(name, value, scale);
3294:                this .resultSet2.updateObject(name, value, scale);
3295:
3296:                this .replay();
3297:
3298:                this .resultSet.updateObject(name, value, scale);
3299:
3300:                this .verify();
3301:            }
3302:
3303:            @DataProvider(name="int-ref")
3304:            Object[][] intRefProvider() {
3305:                return new Object[][] { new Object[] { 1,
3306:                        EasyMock.createMock(Ref.class) } };
3307:            }
3308:
3309:            /**
3310:             * @see java.sql.ResultSet#updateRef(int, java.sql.Ref)
3311:             */
3312:            @Test(dataProvider="int-ref")
3313:            public void updateRef(int index, Ref value) throws SQLException {
3314:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3315:
3316:                this .resultSet1.updateRef(index, value);
3317:                this .resultSet2.updateRef(index, value);
3318:
3319:                this .replay();
3320:
3321:                this .resultSet.updateRef(index, value);
3322:
3323:                this .verify();
3324:            }
3325:
3326:            @DataProvider(name="string-ref")
3327:            Object[][] stringRefProvider() {
3328:                return new Object[][] { new Object[] { "",
3329:                        EasyMock.createMock(Ref.class) } };
3330:            }
3331:
3332:            /**
3333:             * @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref)
3334:             */
3335:            @Test(dataProvider="string-ref")
3336:            public void updateRef(String name, Ref value) throws SQLException {
3337:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3338:
3339:                this .resultSet1.updateRef(name, value);
3340:                this .resultSet2.updateRef(name, value);
3341:
3342:                this .replay();
3343:
3344:                this .resultSet.updateRef(name, value);
3345:
3346:                this .verify();
3347:            }
3348:
3349:            /**
3350:             * @see java.sql.ResultSet#updateRow()
3351:             */
3352:            @Test
3353:            public void updateRow() throws SQLException {
3354:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3355:
3356:                EasyMock.expect(this .statement.getConnection()).andReturn(
3357:                        this .connection);
3358:                EasyMock.expect(
3359:                        this .transactionContext.start(EasyMock
3360:                                .isA(InvocationStrategy.class), EasyMock
3361:                                .same(this .connection))).andAnswer(this .anwser);
3362:
3363:                EasyMock.expect(this .cluster.getTransactionalExecutor())
3364:                        .andReturn(this .executor);
3365:
3366:                EasyMock.expect(this .cluster.getBalancer()).andReturn(
3367:                        this .balancer);
3368:                EasyMock.expect(this .balancer.all())
3369:                        .andReturn(this .databaseSet);
3370:
3371:                EasyMock.expect(this .parent.getRoot()).andReturn(this .root);
3372:
3373:                this .root.retain(this .databaseSet);
3374:
3375:                this .resultSet1.updateRow();
3376:                this .resultSet2.updateRow();
3377:
3378:                this .replay();
3379:
3380:                this .resultSet.updateRow();
3381:
3382:                this .verify();
3383:            }
3384:
3385:            @DataProvider(name="int-short")
3386:            Object[][] intShortProvider() {
3387:                return new Object[][] { new Object[] { 1,
3388:                        Integer.valueOf(1).shortValue() } };
3389:            }
3390:
3391:            /**
3392:             * @see java.sql.ResultSet#updateShort(int, short)
3393:             */
3394:            @Test(dataProvider="int-short")
3395:            public void updateShort(int index, short value) throws SQLException {
3396:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3397:
3398:                this .resultSet1.updateShort(index, value);
3399:                this .resultSet2.updateShort(index, value);
3400:
3401:                this .replay();
3402:
3403:                this .resultSet.updateShort(index, value);
3404:
3405:                this .verify();
3406:            }
3407:
3408:            @DataProvider(name="string-short")
3409:            Object[][] stringShortProvider() {
3410:                return new Object[][] { new Object[] { "",
3411:                        Integer.valueOf(1).shortValue() } };
3412:            }
3413:
3414:            /**
3415:             * @see java.sql.ResultSet#updateShort(java.lang.String, short)
3416:             */
3417:            @Test(dataProvider="string-short")
3418:            public void updateShort(String name, short value)
3419:                    throws SQLException {
3420:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3421:
3422:                this .resultSet1.updateShort(name, value);
3423:                this .resultSet2.updateShort(name, value);
3424:
3425:                this .replay();
3426:
3427:                this .resultSet.updateShort(name, value);
3428:
3429:                this .verify();
3430:            }
3431:
3432:            @DataProvider(name="int-string")
3433:            Object[][] intStringProvider() {
3434:                return new Object[][] { new Object[] { 1, "" } };
3435:            }
3436:
3437:            /**
3438:             * @see java.sql.ResultSet#updateString(int, java.lang.String)
3439:             */
3440:            @Test(dataProvider="int-string")
3441:            public void updateString(int index, String value)
3442:                    throws SQLException {
3443:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3444:
3445:                this .resultSet1.updateString(index, value);
3446:                this .resultSet2.updateString(index, value);
3447:
3448:                this .replay();
3449:
3450:                this .resultSet.updateString(index, value);
3451:
3452:                this .verify();
3453:            }
3454:
3455:            @DataProvider(name="string-string")
3456:            Object[][] stringStringProvider() {
3457:                return new Object[][] { new Object[] { "", "" } };
3458:            }
3459:
3460:            /**
3461:             * @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String)
3462:             */
3463:            @Test(dataProvider="string-string")
3464:            public void updateString(String name, String value)
3465:                    throws SQLException {
3466:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3467:
3468:                this .resultSet1.updateString(name, value);
3469:                this .resultSet2.updateString(name, value);
3470:
3471:                this .replay();
3472:
3473:                this .resultSet.updateString(name, value);
3474:
3475:                this .verify();
3476:            }
3477:
3478:            @DataProvider(name="int-time")
3479:            Object[][] intTimeProvider() {
3480:                return new Object[][] { new Object[] { 1,
3481:                        new Time(System.currentTimeMillis()) } };
3482:            }
3483:
3484:            /**
3485:             * @see java.sql.ResultSet#updateTime(int, java.sql.Time)
3486:             */
3487:            @Test(dataProvider="int-time")
3488:            public void updateTime(int index, Time value) throws SQLException {
3489:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3490:
3491:                this .resultSet1.updateTime(index, value);
3492:                this .resultSet2.updateTime(index, value);
3493:
3494:                this .replay();
3495:
3496:                this .resultSet.updateTime(index, value);
3497:
3498:                this .verify();
3499:            }
3500:
3501:            @DataProvider(name="string-time")
3502:            Object[][] stringTimeProvider() {
3503:                return new Object[][] { new Object[] { "",
3504:                        new Time(System.currentTimeMillis()) } };
3505:            }
3506:
3507:            /**
3508:             * @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time)
3509:             */
3510:            @Test(dataProvider="string-time")
3511:            public void updateTime(String name, Time value) throws SQLException {
3512:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3513:
3514:                this .resultSet1.updateTime(name, value);
3515:                this .resultSet2.updateTime(name, value);
3516:
3517:                this .replay();
3518:
3519:                this .resultSet.updateTime(name, value);
3520:
3521:                this .verify();
3522:            }
3523:
3524:            @DataProvider(name="int-timestamp")
3525:            Object[][] intTimestampProvider() {
3526:                return new Object[][] { new Object[] { 1,
3527:                        new Timestamp(System.currentTimeMillis()) } };
3528:            }
3529:
3530:            /**
3531:             * @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp)
3532:             */
3533:            @Test(dataProvider="int-timestamp")
3534:            public void updateTimestamp(int index, Timestamp value)
3535:                    throws SQLException {
3536:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3537:
3538:                this .resultSet1.updateTimestamp(index, value);
3539:                this .resultSet2.updateTimestamp(index, value);
3540:
3541:                this .replay();
3542:
3543:                this .resultSet.updateTimestamp(index, value);
3544:
3545:                this .verify();
3546:            }
3547:
3548:            @DataProvider(name="string-timestamp")
3549:            Object[][] stringTimestampProvider() {
3550:                return new Object[][] { new Object[] { "",
3551:                        new Timestamp(System.currentTimeMillis()) } };
3552:            }
3553:
3554:            /**
3555:             * @see java.sql.ResultSet#updateTimestamp(java.lang.String, java.sql.Timestamp)
3556:             */
3557:            @Test(dataProvider="string-timestamp")
3558:            public void updateTimestamp(String name, Timestamp value)
3559:                    throws SQLException {
3560:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3561:
3562:                this .resultSet1.updateTimestamp(name, value);
3563:                this .resultSet2.updateTimestamp(name, value);
3564:
3565:                this .replay();
3566:
3567:                this .resultSet.updateTimestamp(name, value);
3568:
3569:                this .verify();
3570:            }
3571:
3572:            /**
3573:             * @see java.sql.ResultSet#wasNull()
3574:             */
3575:            @Test
3576:            public boolean wasNull() throws SQLException {
3577:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3578:
3579:                EasyMock.expect(this .resultSet1.wasNull()).andReturn(true);
3580:
3581:                this .replay();
3582:
3583:                boolean result = this .resultSet.wasNull();
3584:
3585:                this .verify();
3586:
3587:                assert result;
3588:
3589:                return result;
3590:            }
3591:
3592:            /**
3593:             * @see java.sql.ResultSet#getHoldability()
3594:             */
3595:            @Test
3596:            public int getHoldability() throws SQLException {
3597:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3598:
3599:                EasyMock.expect(this .resultSet1.getHoldability()).andReturn(1);
3600:
3601:                this .replay();
3602:
3603:                int result = this .resultSet.getHoldability();
3604:
3605:                this .verify();
3606:
3607:                assert result == 1 : result;
3608:
3609:                return result;
3610:            }
3611:
3612:            /**
3613:             * @see java.sql.ResultSet#getNCharacterStream(int)
3614:             */
3615:            @Test(dataProvider="int")
3616:            public Reader getNCharacterStream(int index) throws SQLException {
3617:                Reader reader = new StringReader("");
3618:
3619:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3620:
3621:                EasyMock.expect(this .resultSet1.getNCharacterStream(index))
3622:                        .andReturn(reader);
3623:
3624:                this .replay();
3625:
3626:                Reader result = this .resultSet.getNCharacterStream(index);
3627:
3628:                this .verify();
3629:
3630:                assert result == reader;
3631:
3632:                return result;
3633:            }
3634:
3635:            /**
3636:             * @see java.sql.ResultSet#getNCharacterStream(java.lang.String)
3637:             */
3638:            @Test(dataProvider="string")
3639:            public Reader getNCharacterStream(String name) throws SQLException {
3640:                Reader reader = new StringReader("");
3641:
3642:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3643:
3644:                EasyMock.expect(this .resultSet1.getNCharacterStream(name))
3645:                        .andReturn(reader);
3646:
3647:                this .replay();
3648:
3649:                Reader result = this .resultSet.getNCharacterStream(name);
3650:
3651:                this .verify();
3652:
3653:                assert result == reader;
3654:
3655:                return result;
3656:            }
3657:
3658:            /**
3659:             * @see java.sql.ResultSet#getNClob(int)
3660:             */
3661:            public NClob getNClob(int index) throws SQLException {
3662:                NClob clob = EasyMock.createMock(NClob.class);
3663:
3664:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3665:
3666:                EasyMock.expect(this .resultSet1.getNClob(index))
3667:                        .andReturn(clob);
3668:
3669:                this .replay();
3670:
3671:                NClob result = this .resultSet.getNClob(index);
3672:
3673:                this .verify();
3674:
3675:                assert result == clob;
3676:
3677:                return result;
3678:            }
3679:
3680:            /**
3681:             * @see java.sql.ResultSet#getNClob(java.lang.String)
3682:             */
3683:            public NClob getNClob(String name) throws SQLException {
3684:                NClob clob = EasyMock.createMock(NClob.class);
3685:
3686:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3687:
3688:                EasyMock.expect(this .resultSet1.getNClob(name)).andReturn(clob);
3689:
3690:                this .replay();
3691:
3692:                NClob result = this .resultSet.getNClob(name);
3693:
3694:                this .verify();
3695:
3696:                assert result == clob;
3697:
3698:                return result;
3699:            }
3700:
3701:            /**
3702:             * @see java.sql.ResultSet#getNString(int)
3703:             */
3704:            @Test(dataProvider="int")
3705:            public String getNString(int index) throws SQLException {
3706:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3707:
3708:                EasyMock.expect(this .resultSet1.getNString(index))
3709:                        .andReturn("");
3710:
3711:                this .replay();
3712:
3713:                String result = this .resultSet.getNString(index);
3714:
3715:                this .verify();
3716:
3717:                assert result.equals("") : result;
3718:
3719:                return result;
3720:            }
3721:
3722:            /**
3723:             * @see java.sql.ResultSet#getNString(java.lang.String)
3724:             */
3725:            @Test(dataProvider="string")
3726:            public String getNString(String name) throws SQLException {
3727:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3728:
3729:                EasyMock.expect(this .resultSet1.getNString(name)).andReturn("");
3730:
3731:                this .replay();
3732:
3733:                String result = this .resultSet.getNString(name);
3734:
3735:                this .verify();
3736:
3737:                assert result.equals("") : result;
3738:
3739:                return result;
3740:            }
3741:
3742:            /**
3743:             * @see java.sql.ResultSet#getRowId(int)
3744:             */
3745:            @Test(dataProvider="int")
3746:            public RowId getRowId(int index) throws SQLException {
3747:                RowId rowId = EasyMock.createMock(RowId.class);
3748:
3749:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3750:
3751:                EasyMock.expect(this .resultSet1.getRowId(index)).andReturn(
3752:                        rowId);
3753:
3754:                this .replay();
3755:
3756:                RowId result = this .resultSet.getRowId(index);
3757:
3758:                this .verify();
3759:
3760:                assert result == rowId;
3761:
3762:                return result;
3763:            }
3764:
3765:            /**
3766:             * @see java.sql.ResultSet#getRowId(java.lang.String)
3767:             */
3768:            @Test(dataProvider="string")
3769:            public RowId getRowId(String name) throws SQLException {
3770:                RowId rowId = EasyMock.createMock(RowId.class);
3771:
3772:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3773:
3774:                EasyMock.expect(this .resultSet1.getRowId(name))
3775:                        .andReturn(rowId);
3776:
3777:                this .replay();
3778:
3779:                RowId result = this .resultSet.getRowId(name);
3780:
3781:                this .verify();
3782:
3783:                assert result == rowId;
3784:
3785:                return result;
3786:            }
3787:
3788:            /**
3789:             * @see java.sql.ResultSet#getSQLXML(int)
3790:             */
3791:            @Test(dataProvider="int")
3792:            public SQLXML getSQLXML(int index) throws SQLException {
3793:                SQLXML xml = EasyMock.createMock(SQLXML.class);
3794:
3795:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3796:
3797:                EasyMock.expect(this .resultSet1.getSQLXML(index))
3798:                        .andReturn(xml);
3799:
3800:                this .replay();
3801:
3802:                SQLXML result = this .resultSet.getSQLXML(index);
3803:
3804:                this .verify();
3805:
3806:                assert result == xml;
3807:
3808:                return result;
3809:            }
3810:
3811:            /**
3812:             * @see java.sql.ResultSet#getSQLXML(java.lang.String)
3813:             */
3814:            @Test(dataProvider="string")
3815:            public SQLXML getSQLXML(String name) throws SQLException {
3816:                SQLXML xml = EasyMock.createMock(SQLXML.class);
3817:
3818:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3819:
3820:                EasyMock.expect(this .resultSet1.getSQLXML(name)).andReturn(xml);
3821:
3822:                this .replay();
3823:
3824:                SQLXML result = this .resultSet.getSQLXML(name);
3825:
3826:                this .verify();
3827:
3828:                assert result == xml;
3829:
3830:                return result;
3831:            }
3832:
3833:            /**
3834:             * @see java.sql.ResultSet#isClosed()
3835:             */
3836:            @Test
3837:            public boolean isClosed() throws SQLException {
3838:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3839:
3840:                EasyMock.expect(this .resultSet1.isClosed()).andReturn(true);
3841:
3842:                this .replay();
3843:
3844:                boolean result = this .resultSet.isClosed();
3845:
3846:                this .verify();
3847:
3848:                assert result;
3849:
3850:                return result;
3851:            }
3852:
3853:            @DataProvider(name="int-inputStream")
3854:            Object[][] intInputStreamProvider() {
3855:                return new Object[][] { new Object[] { 1,
3856:                        new ByteArrayInputStream(new byte[0]) } };
3857:            }
3858:
3859:            /**
3860:             * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream)
3861:             */
3862:            @Test(dataProvider="int-inputStream")
3863:            public void updateAsciiStream(int index, InputStream value)
3864:                    throws SQLException {
3865:                File file = new File("");
3866:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
3867:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
3868:
3869:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3870:
3871:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
3872:                        file);
3873:
3874:                EasyMock.expect(this .fileSupport.getInputStream(file))
3875:                        .andReturn(input1);
3876:
3877:                this .resultSet1.updateAsciiStream(index, input1);
3878:
3879:                EasyMock.expect(this .fileSupport.getInputStream(file))
3880:                        .andReturn(input2);
3881:
3882:                this .resultSet2.updateAsciiStream(index, input2);
3883:
3884:                this .replay();
3885:
3886:                this .resultSet.updateAsciiStream(index, value);
3887:
3888:                this .verify();
3889:            }
3890:
3891:            @DataProvider(name="string-inputStream")
3892:            Object[][] stringInputStreamProvider() {
3893:                return new Object[][] { new Object[] { "",
3894:                        new ByteArrayInputStream(new byte[0]) } };
3895:            }
3896:
3897:            /**
3898:             * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream)
3899:             */
3900:            @Test(dataProvider="string-inputStream")
3901:            public void updateAsciiStream(String name, InputStream value)
3902:                    throws SQLException {
3903:                File file = new File("");
3904:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
3905:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
3906:
3907:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3908:
3909:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
3910:                        file);
3911:
3912:                EasyMock.expect(this .fileSupport.getInputStream(file))
3913:                        .andReturn(input1);
3914:
3915:                this .resultSet1.updateAsciiStream(name, input1);
3916:
3917:                EasyMock.expect(this .fileSupport.getInputStream(file))
3918:                        .andReturn(input2);
3919:
3920:                this .resultSet2.updateAsciiStream(name, input2);
3921:
3922:                this .replay();
3923:
3924:                this .resultSet.updateAsciiStream(name, value);
3925:
3926:                this .verify();
3927:            }
3928:
3929:            @DataProvider(name="int-inputStream-long")
3930:            Object[][] intInputStreamLongProvider() {
3931:                return new Object[][] { new Object[] { 1,
3932:                        new ByteArrayInputStream(new byte[0]), 1L } };
3933:            }
3934:
3935:            /**
3936:             * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, long)
3937:             */
3938:            @Test(dataProvider="int-inputStream-long")
3939:            public void updateAsciiStream(int index, InputStream value,
3940:                    long length) throws SQLException {
3941:                File file = new File("");
3942:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
3943:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
3944:
3945:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3946:
3947:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
3948:                        file);
3949:
3950:                EasyMock.expect(this .fileSupport.getInputStream(file))
3951:                        .andReturn(input1);
3952:
3953:                this .resultSet1.updateAsciiStream(index, input1, length);
3954:
3955:                EasyMock.expect(this .fileSupport.getInputStream(file))
3956:                        .andReturn(input2);
3957:
3958:                this .resultSet2.updateAsciiStream(index, input2, length);
3959:
3960:                this .replay();
3961:
3962:                this .resultSet.updateAsciiStream(index, value, length);
3963:
3964:                this .verify();
3965:            }
3966:
3967:            @DataProvider(name="string-inputStream-long")
3968:            Object[][] stringInputStreamLongProvider() {
3969:                return new Object[][] { new Object[] { "",
3970:                        new ByteArrayInputStream(new byte[0]), 1L } };
3971:            }
3972:
3973:            /**
3974:             * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, long)
3975:             */
3976:            @Test(dataProvider="string-inputStream-long")
3977:            public void updateAsciiStream(String name, InputStream value,
3978:                    long length) throws SQLException {
3979:                File file = new File("");
3980:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
3981:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
3982:
3983:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
3984:
3985:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
3986:                        file);
3987:
3988:                EasyMock.expect(this .fileSupport.getInputStream(file))
3989:                        .andReturn(input1);
3990:
3991:                this .resultSet1.updateAsciiStream(name, input1, length);
3992:
3993:                EasyMock.expect(this .fileSupport.getInputStream(file))
3994:                        .andReturn(input2);
3995:
3996:                this .resultSet2.updateAsciiStream(name, input2, length);
3997:
3998:                this .replay();
3999:
4000:                this .resultSet.updateAsciiStream(name, value, length);
4001:
4002:                this .verify();
4003:            }
4004:
4005:            /**
4006:             * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream)
4007:             */
4008:            @Test(dataProvider="int-inputStream")
4009:            public void updateBinaryStream(int index, InputStream value)
4010:                    throws SQLException {
4011:                File file = new File("");
4012:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
4013:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
4014:
4015:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4016:
4017:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4018:                        file);
4019:
4020:                EasyMock.expect(this .fileSupport.getInputStream(file))
4021:                        .andReturn(input1);
4022:
4023:                this .resultSet1.updateBinaryStream(index, input1);
4024:
4025:                EasyMock.expect(this .fileSupport.getInputStream(file))
4026:                        .andReturn(input2);
4027:
4028:                this .resultSet2.updateBinaryStream(index, input2);
4029:
4030:                this .replay();
4031:
4032:                this .resultSet.updateBinaryStream(index, value);
4033:
4034:                this .verify();
4035:            }
4036:
4037:            /**
4038:             * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream)
4039:             */
4040:            @Test(dataProvider="string-inputStream")
4041:            public void updateBinaryStream(String name, InputStream value)
4042:                    throws SQLException {
4043:                File file = new File("");
4044:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
4045:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
4046:
4047:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4048:
4049:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4050:                        file);
4051:
4052:                EasyMock.expect(this .fileSupport.getInputStream(file))
4053:                        .andReturn(input1);
4054:
4055:                this .resultSet1.updateBinaryStream(name, input1);
4056:
4057:                EasyMock.expect(this .fileSupport.getInputStream(file))
4058:                        .andReturn(input2);
4059:
4060:                this .resultSet2.updateBinaryStream(name, input2);
4061:
4062:                this .replay();
4063:
4064:                this .resultSet.updateBinaryStream(name, value);
4065:
4066:                this .verify();
4067:            }
4068:
4069:            /**
4070:             * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, long)
4071:             */
4072:            @Test(dataProvider="int-inputStream-long")
4073:            public void updateBinaryStream(int index, InputStream value,
4074:                    long length) throws SQLException {
4075:                File file = new File("");
4076:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
4077:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
4078:
4079:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4080:
4081:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4082:                        file);
4083:
4084:                EasyMock.expect(this .fileSupport.getInputStream(file))
4085:                        .andReturn(input1);
4086:
4087:                this .resultSet1.updateBinaryStream(index, input1, length);
4088:
4089:                EasyMock.expect(this .fileSupport.getInputStream(file))
4090:                        .andReturn(input2);
4091:
4092:                this .resultSet2.updateBinaryStream(index, input2, length);
4093:
4094:                this .replay();
4095:
4096:                this .resultSet.updateBinaryStream(index, value, length);
4097:
4098:                this .verify();
4099:            }
4100:
4101:            /**
4102:             * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, long)
4103:             */
4104:            @Test(dataProvider="string-inputStream-long")
4105:            public void updateBinaryStream(String name, InputStream value,
4106:                    long length) throws SQLException {
4107:                File file = new File("");
4108:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
4109:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
4110:
4111:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4112:
4113:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4114:                        file);
4115:
4116:                EasyMock.expect(this .fileSupport.getInputStream(file))
4117:                        .andReturn(input1);
4118:
4119:                this .resultSet1.updateBinaryStream(name, input1, length);
4120:
4121:                EasyMock.expect(this .fileSupport.getInputStream(file))
4122:                        .andReturn(input2);
4123:
4124:                this .resultSet2.updateBinaryStream(name, input2, length);
4125:
4126:                this .replay();
4127:
4128:                this .resultSet.updateBinaryStream(name, value, length);
4129:
4130:                this .verify();
4131:            }
4132:
4133:            /**
4134:             * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream)
4135:             */
4136:            @Test(dataProvider="int-inputStream")
4137:            public void updateBlob(int index, InputStream value)
4138:                    throws SQLException {
4139:                File file = new File("");
4140:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
4141:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
4142:
4143:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4144:
4145:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4146:                        file);
4147:
4148:                EasyMock.expect(this .fileSupport.getInputStream(file))
4149:                        .andReturn(input1);
4150:
4151:                this .resultSet1.updateBlob(index, input1);
4152:
4153:                EasyMock.expect(this .fileSupport.getInputStream(file))
4154:                        .andReturn(input2);
4155:
4156:                this .resultSet2.updateBlob(index, input2);
4157:
4158:                this .replay();
4159:
4160:                this .resultSet.updateBlob(index, value);
4161:
4162:                this .verify();
4163:            }
4164:
4165:            /**
4166:             * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream)
4167:             */
4168:            @Test(dataProvider="string-inputStream")
4169:            public void updateBlob(String name, InputStream value)
4170:                    throws SQLException {
4171:                File file = new File("");
4172:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
4173:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
4174:
4175:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4176:
4177:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4178:                        file);
4179:
4180:                EasyMock.expect(this .fileSupport.getInputStream(file))
4181:                        .andReturn(input1);
4182:
4183:                this .resultSet1.updateBlob(name, input1);
4184:
4185:                EasyMock.expect(this .fileSupport.getInputStream(file))
4186:                        .andReturn(input2);
4187:
4188:                this .resultSet2.updateBlob(name, input2);
4189:
4190:                this .replay();
4191:
4192:                this .resultSet.updateBlob(name, value);
4193:
4194:                this .verify();
4195:            }
4196:
4197:            /**
4198:             * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream, long)
4199:             */
4200:            @Test(dataProvider="int-inputStream-long")
4201:            public void updateBlob(int index, InputStream value, long length)
4202:                    throws SQLException {
4203:                File file = new File("");
4204:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
4205:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
4206:
4207:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4208:
4209:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4210:                        file);
4211:
4212:                EasyMock.expect(this .fileSupport.getInputStream(file))
4213:                        .andReturn(input1);
4214:
4215:                this .resultSet1.updateBlob(index, input1, length);
4216:
4217:                EasyMock.expect(this .fileSupport.getInputStream(file))
4218:                        .andReturn(input2);
4219:
4220:                this .resultSet2.updateBlob(index, input2, length);
4221:
4222:                this .replay();
4223:
4224:                this .resultSet.updateBlob(index, value, length);
4225:
4226:                this .verify();
4227:            }
4228:
4229:            /**
4230:             * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream, long)
4231:             */
4232:            @Test(dataProvider="string-inputStream-long")
4233:            public void updateBlob(String name, InputStream value, long length)
4234:                    throws SQLException {
4235:                File file = new File("");
4236:                InputStream input1 = new ByteArrayInputStream(new byte[0]);
4237:                InputStream input2 = new ByteArrayInputStream(new byte[0]);
4238:
4239:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4240:
4241:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4242:                        file);
4243:
4244:                EasyMock.expect(this .fileSupport.getInputStream(file))
4245:                        .andReturn(input1);
4246:
4247:                this .resultSet1.updateBlob(name, input1, length);
4248:
4249:                EasyMock.expect(this .fileSupport.getInputStream(file))
4250:                        .andReturn(input2);
4251:
4252:                this .resultSet2.updateBlob(name, input2, length);
4253:
4254:                this .replay();
4255:
4256:                this .resultSet.updateBlob(name, value, length);
4257:
4258:                this .verify();
4259:            }
4260:
4261:            @DataProvider(name="int-reader")
4262:            Object[][] intReaderProvider() {
4263:                return new Object[][] { new Object[] { 1, new StringReader("") } };
4264:            }
4265:
4266:            /**
4267:             * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader)
4268:             */
4269:            @Test(dataProvider="int-reader")
4270:            public void updateCharacterStream(int index, Reader value)
4271:                    throws SQLException {
4272:                File file = new File("");
4273:                Reader reader1 = new StringReader("");
4274:                Reader reader2 = new StringReader("");
4275:
4276:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4277:
4278:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4279:                        file);
4280:
4281:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4282:                        reader1);
4283:
4284:                this .resultSet1.updateCharacterStream(index, reader1);
4285:
4286:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4287:                        reader2);
4288:
4289:                this .resultSet2.updateCharacterStream(index, reader2);
4290:
4291:                this .replay();
4292:
4293:                this .resultSet.updateCharacterStream(index, value);
4294:
4295:                this .verify();
4296:            }
4297:
4298:            @DataProvider(name="string-reader")
4299:            Object[][] stringReaderProvider() {
4300:                return new Object[][] { new Object[] { "", new StringReader("") } };
4301:            }
4302:
4303:            /**
4304:             * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader)
4305:             */
4306:            @Test(dataProvider="string-reader")
4307:            public void updateCharacterStream(String name, Reader value)
4308:                    throws SQLException {
4309:                File file = new File("");
4310:                Reader reader1 = new StringReader("");
4311:                Reader reader2 = new StringReader("");
4312:
4313:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4314:
4315:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4316:                        file);
4317:
4318:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4319:                        reader1);
4320:
4321:                this .resultSet1.updateCharacterStream(name, reader1);
4322:
4323:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4324:                        reader2);
4325:
4326:                this .resultSet2.updateCharacterStream(name, reader2);
4327:
4328:                this .replay();
4329:
4330:                this .resultSet.updateCharacterStream(name, value);
4331:
4332:                this .verify();
4333:            }
4334:
4335:            @DataProvider(name="int-reader-long")
4336:            Object[][] intReaderLongProvider() {
4337:                return new Object[][] { new Object[] { 1, new StringReader(""),
4338:                        1L } };
4339:            }
4340:
4341:            /**
4342:             * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, long)
4343:             */
4344:            @Test(dataProvider="int-reader-long")
4345:            public void updateCharacterStream(int index, Reader value,
4346:                    long length) throws SQLException {
4347:                File file = new File("");
4348:                Reader reader1 = new StringReader("");
4349:                Reader reader2 = new StringReader("");
4350:
4351:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4352:
4353:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4354:                        file);
4355:
4356:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4357:                        reader1);
4358:
4359:                this .resultSet1.updateCharacterStream(index, reader1, length);
4360:
4361:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4362:                        reader2);
4363:
4364:                this .resultSet2.updateCharacterStream(index, reader2, length);
4365:
4366:                this .replay();
4367:
4368:                this .resultSet.updateCharacterStream(index, value, length);
4369:
4370:                this .verify();
4371:            }
4372:
4373:            @DataProvider(name="string-reader-long")
4374:            Object[][] stringReaderLongProvider() {
4375:                return new Object[][] { new Object[] { "",
4376:                        new StringReader(""), 1L } };
4377:            }
4378:
4379:            /**
4380:             * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, long)
4381:             */
4382:            @Test(dataProvider="string-reader-long")
4383:            public void updateCharacterStream(String name, Reader value,
4384:                    long length) throws SQLException {
4385:                File file = new File("");
4386:                Reader reader1 = new StringReader("");
4387:                Reader reader2 = new StringReader("");
4388:
4389:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4390:
4391:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4392:                        file);
4393:
4394:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4395:                        reader1);
4396:
4397:                this .resultSet1.updateCharacterStream(name, reader1, length);
4398:
4399:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4400:                        reader2);
4401:
4402:                this .resultSet2.updateCharacterStream(name, reader2, length);
4403:
4404:                this .replay();
4405:
4406:                this .resultSet.updateCharacterStream(name, value, length);
4407:
4408:                this .verify();
4409:            }
4410:
4411:            /**
4412:             * @see java.sql.ResultSet#updateClob(int, java.io.Reader)
4413:             */
4414:            @Test(dataProvider="int-reader")
4415:            public void updateClob(int index, Reader value) throws SQLException {
4416:                File file = new File("");
4417:                Reader reader1 = new StringReader("");
4418:                Reader reader2 = new StringReader("");
4419:
4420:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4421:
4422:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4423:                        file);
4424:
4425:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4426:                        reader1);
4427:
4428:                this .resultSet1.updateClob(index, reader1);
4429:
4430:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4431:                        reader2);
4432:
4433:                this .resultSet2.updateClob(index, reader2);
4434:
4435:                this .replay();
4436:
4437:                this .resultSet.updateClob(index, value);
4438:
4439:                this .verify();
4440:            }
4441:
4442:            /**
4443:             * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader)
4444:             */
4445:            @Test(dataProvider="string-reader")
4446:            public void updateClob(String name, Reader value)
4447:                    throws SQLException {
4448:                File file = new File("");
4449:                Reader reader1 = new StringReader("");
4450:                Reader reader2 = new StringReader("");
4451:
4452:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4453:
4454:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4455:                        file);
4456:
4457:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4458:                        reader1);
4459:
4460:                this .resultSet1.updateClob(name, reader1);
4461:
4462:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4463:                        reader2);
4464:
4465:                this .resultSet2.updateClob(name, reader2);
4466:
4467:                this .replay();
4468:
4469:                this .resultSet.updateClob(name, value);
4470:
4471:                this .verify();
4472:            }
4473:
4474:            /**
4475:             * @see java.sql.ResultSet#updateClob(int, java.io.Reader, long)
4476:             */
4477:            @Test(dataProvider="int-reader-long")
4478:            public void updateClob(int index, Reader value, long length)
4479:                    throws SQLException {
4480:                File file = new File("");
4481:                Reader reader1 = new StringReader("");
4482:                Reader reader2 = new StringReader("");
4483:
4484:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4485:
4486:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4487:                        file);
4488:
4489:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4490:                        reader1);
4491:
4492:                this .resultSet1.updateClob(index, reader1, length);
4493:
4494:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4495:                        reader2);
4496:
4497:                this .resultSet2.updateClob(index, reader2, length);
4498:
4499:                this .replay();
4500:
4501:                this .resultSet.updateClob(index, value, length);
4502:
4503:                this .verify();
4504:            }
4505:
4506:            /**
4507:             * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader, long)
4508:             */
4509:            @Test(dataProvider="string-reader-long")
4510:            public void updateClob(String name, Reader value, long length)
4511:                    throws SQLException {
4512:                File file = new File("");
4513:                Reader reader1 = new StringReader("");
4514:                Reader reader2 = new StringReader("");
4515:
4516:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4517:
4518:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4519:                        file);
4520:
4521:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4522:                        reader1);
4523:
4524:                this .resultSet1.updateClob(name, reader1, length);
4525:
4526:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4527:                        reader2);
4528:
4529:                this .resultSet2.updateClob(name, reader2, length);
4530:
4531:                this .replay();
4532:
4533:                this .resultSet.updateClob(name, value, length);
4534:
4535:                this .verify();
4536:            }
4537:
4538:            /**
4539:             * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader)
4540:             */
4541:            @Test(dataProvider="int-reader")
4542:            public void updateNCharacterStream(int index, Reader value)
4543:                    throws SQLException {
4544:                File file = new File("");
4545:                Reader reader1 = new StringReader("");
4546:                Reader reader2 = new StringReader("");
4547:
4548:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4549:
4550:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4551:                        file);
4552:
4553:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4554:                        reader1);
4555:
4556:                this .resultSet1.updateNCharacterStream(index, reader1);
4557:
4558:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4559:                        reader2);
4560:
4561:                this .resultSet2.updateNCharacterStream(index, reader2);
4562:
4563:                this .replay();
4564:
4565:                this .resultSet.updateNCharacterStream(index, value);
4566:
4567:                this .verify();
4568:            }
4569:
4570:            /**
4571:             * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader)
4572:             */
4573:            @Test(dataProvider="string-reader")
4574:            public void updateNCharacterStream(String name, Reader value)
4575:                    throws SQLException {
4576:                File file = new File("");
4577:                Reader reader1 = new StringReader("");
4578:                Reader reader2 = new StringReader("");
4579:
4580:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4581:
4582:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4583:                        file);
4584:
4585:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4586:                        reader1);
4587:
4588:                this .resultSet1.updateNCharacterStream(name, reader1);
4589:
4590:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4591:                        reader2);
4592:
4593:                this .resultSet2.updateNCharacterStream(name, reader2);
4594:
4595:                this .replay();
4596:
4597:                this .resultSet.updateNCharacterStream(name, value);
4598:
4599:                this .verify();
4600:            }
4601:
4602:            /**
4603:             * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader, long)
4604:             */
4605:            @Test(dataProvider="int-reader-long")
4606:            public void updateNCharacterStream(int index, Reader value,
4607:                    long length) throws SQLException {
4608:                File file = new File("");
4609:                Reader reader1 = new StringReader("");
4610:                Reader reader2 = new StringReader("");
4611:
4612:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4613:
4614:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4615:                        file);
4616:
4617:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4618:                        reader1);
4619:
4620:                this .resultSet1.updateNCharacterStream(index, reader1, length);
4621:
4622:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4623:                        reader2);
4624:
4625:                this .resultSet2.updateNCharacterStream(index, reader2, length);
4626:
4627:                this .replay();
4628:
4629:                this .resultSet.updateNCharacterStream(index, value, length);
4630:
4631:                this .verify();
4632:            }
4633:
4634:            /**
4635:             * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader, long)
4636:             */
4637:            @Test(dataProvider="string-reader-long")
4638:            public void updateNCharacterStream(String name, Reader value,
4639:                    long length) throws SQLException {
4640:                File file = new File("");
4641:                Reader reader1 = new StringReader("");
4642:                Reader reader2 = new StringReader("");
4643:
4644:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4645:
4646:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4647:                        file);
4648:
4649:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4650:                        reader1);
4651:
4652:                this .resultSet1.updateNCharacterStream(name, reader1, length);
4653:
4654:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4655:                        reader2);
4656:
4657:                this .resultSet2.updateNCharacterStream(name, reader2, length);
4658:
4659:                this .replay();
4660:
4661:                this .resultSet.updateNCharacterStream(name, value, length);
4662:
4663:                this .verify();
4664:            }
4665:
4666:            @DataProvider(name="int-nclob")
4667:            Object[][] intNClobProvider() throws Exception {
4668:                Map<Database, NClob> map = new TreeMap<Database, NClob>();
4669:
4670:                map.put(this .database1, this .nClob1);
4671:                map.put(this .database2, this .nClob2);
4672:
4673:                NClob clob = ProxyFactory
4674:                        .createProxy(NClob.class, new ClobInvocationHandler(
4675:                                null, this .handler, null, map));
4676:
4677:                return new Object[][] { new Object[] { 1, new MockClob() },
4678:                        new Object[] { 1, clob } };
4679:            }
4680:
4681:            /**
4682:             * @see java.sql.ResultSet#updateNClob(int, java.sql.NClob)
4683:             */
4684:            @Test(dataProvider="int-nclob")
4685:            public void updateNClob(int index, NClob value) throws SQLException {
4686:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4687:
4688:                if (Proxy.isProxyClass(value.getClass())) {
4689:                    this .resultSet1.updateNClob(index, this .nClob1);
4690:                    this .resultSet2.updateNClob(index, this .nClob2);
4691:                } else {
4692:                    this .resultSet1.updateNClob(EasyMock.eq(index), EasyMock
4693:                            .isA(NClob.class));
4694:                    this .resultSet2.updateNClob(EasyMock.eq(index), EasyMock
4695:                            .isA(NClob.class));
4696:                }
4697:
4698:                this .replay();
4699:
4700:                this .resultSet.updateNClob(index, value);
4701:
4702:                this .verify();
4703:            }
4704:
4705:            @DataProvider(name="string-nclob")
4706:            Object[][] stringNClobProvider() throws Exception {
4707:                Map<Database, NClob> map = new TreeMap<Database, NClob>();
4708:
4709:                map.put(this .database1, this .nClob1);
4710:                map.put(this .database2, this .nClob2);
4711:
4712:                this .replay();
4713:
4714:                NClob clob = ProxyFactory
4715:                        .createProxy(NClob.class, new ClobInvocationHandler(
4716:                                null, this .handler, null, map));
4717:
4718:                this .verify();
4719:                this .reset();
4720:
4721:                return new Object[][] { new Object[] { "", new MockClob() },
4722:                        new Object[] { "", clob } };
4723:            }
4724:
4725:            /**
4726:             * @see java.sql.ResultSet#updateNClob(java.lang.String, java.sql.NClob)
4727:             */
4728:            @Test(dataProvider="string-nclob")
4729:            public void updateNClob(String name, NClob value)
4730:                    throws SQLException {
4731:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4732:
4733:                if (Proxy.isProxyClass(value.getClass())) {
4734:                    this .resultSet1.updateNClob(name, this .nClob1);
4735:                    this .resultSet2.updateNClob(name, this .nClob2);
4736:                } else {
4737:                    this .resultSet1.updateNClob(EasyMock.eq(name), EasyMock
4738:                            .isA(NClob.class));
4739:                    this .resultSet2.updateNClob(EasyMock.eq(name), EasyMock
4740:                            .isA(NClob.class));
4741:                }
4742:
4743:                this .replay();
4744:
4745:                this .resultSet.updateNClob(name, value);
4746:
4747:                this .verify();
4748:            }
4749:
4750:            /**
4751:             * @see java.sql.ResultSet#updateNClob(int, java.io.Reader)
4752:             */
4753:            @Test(dataProvider="int-reader")
4754:            public void updateNClob(int index, Reader value)
4755:                    throws SQLException {
4756:                File file = new File("");
4757:                Reader reader1 = new StringReader("");
4758:                Reader reader2 = new StringReader("");
4759:
4760:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4761:
4762:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4763:                        file);
4764:
4765:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4766:                        reader1);
4767:
4768:                this .resultSet1.updateNClob(index, reader1);
4769:
4770:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4771:                        reader2);
4772:
4773:                this .resultSet2.updateNClob(index, reader2);
4774:
4775:                this .replay();
4776:
4777:                this .resultSet.updateNClob(index, value);
4778:
4779:                this .verify();
4780:            }
4781:
4782:            /**
4783:             * @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader)
4784:             */
4785:            @Test(dataProvider="string-reader")
4786:            public void updateNClob(String name, Reader value)
4787:                    throws SQLException {
4788:                File file = new File("");
4789:                Reader reader1 = new StringReader("");
4790:                Reader reader2 = new StringReader("");
4791:
4792:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4793:
4794:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4795:                        file);
4796:
4797:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4798:                        reader1);
4799:
4800:                this .resultSet1.updateNClob(name, reader1);
4801:
4802:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4803:                        reader2);
4804:
4805:                this .resultSet2.updateNClob(name, reader2);
4806:
4807:                this .replay();
4808:
4809:                this .resultSet.updateNClob(name, value);
4810:
4811:                this .verify();
4812:            }
4813:
4814:            /**
4815:             * @see java.sql.ResultSet#updateNClob(int, java.io.Reader, long)
4816:             */
4817:            @Test(dataProvider="int-reader-long")
4818:            public void updateNClob(int index, Reader value, long length)
4819:                    throws SQLException {
4820:                File file = new File("");
4821:                Reader reader1 = new StringReader("");
4822:                Reader reader2 = new StringReader("");
4823:
4824:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4825:
4826:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4827:                        file);
4828:
4829:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4830:                        reader1);
4831:
4832:                this .resultSet1.updateNClob(index, reader1, length);
4833:
4834:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4835:                        reader2);
4836:
4837:                this .resultSet2.updateNClob(index, reader2, length);
4838:
4839:                this .replay();
4840:
4841:                this .resultSet.updateNClob(index, value, length);
4842:
4843:                this .verify();
4844:            }
4845:
4846:            /**
4847:             * @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader, long)
4848:             */
4849:            @Test(dataProvider="string-reader-long")
4850:            public void updateNClob(String name, Reader value, long length)
4851:                    throws SQLException {
4852:                File file = new File("");
4853:                Reader reader1 = new StringReader("");
4854:                Reader reader2 = new StringReader("");
4855:
4856:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4857:
4858:                EasyMock.expect(this .fileSupport.createFile(value)).andReturn(
4859:                        file);
4860:
4861:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4862:                        reader1);
4863:
4864:                this .resultSet1.updateNClob(name, reader1, length);
4865:
4866:                EasyMock.expect(this .fileSupport.getReader(file)).andReturn(
4867:                        reader2);
4868:
4869:                this .resultSet2.updateNClob(name, reader2, length);
4870:
4871:                this .replay();
4872:
4873:                this .resultSet.updateNClob(name, value, length);
4874:
4875:                this .verify();
4876:            }
4877:
4878:            /**
4879:             * @see java.sql.ResultSet#updateNString(int, java.lang.String)
4880:             */
4881:            @Test(dataProvider="int-string")
4882:            public void updateNString(int index, String value)
4883:                    throws SQLException {
4884:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4885:
4886:                this .resultSet1.updateNString(index, value);
4887:                this .resultSet2.updateNString(index, value);
4888:
4889:                this .replay();
4890:
4891:                this .resultSet.updateNString(index, value);
4892:
4893:                this .verify();
4894:            }
4895:
4896:            /**
4897:             * @see java.sql.ResultSet#updateNString(java.lang.String, java.lang.String)
4898:             */
4899:            @Test(dataProvider="string-string")
4900:            public void updateNString(String name, String value)
4901:                    throws SQLException {
4902:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4903:
4904:                this .resultSet1.updateNString(name, value);
4905:                this .resultSet2.updateNString(name, value);
4906:
4907:                this .replay();
4908:
4909:                this .resultSet.updateNString(name, value);
4910:
4911:                this .verify();
4912:            }
4913:
4914:            @DataProvider(name="int-rowid")
4915:            Object[][] intRowIdProvider() {
4916:                return new Object[][] { new Object[] { 1,
4917:                        EasyMock.createMock(RowId.class) } };
4918:            }
4919:
4920:            /**
4921:             * @see java.sql.ResultSet#updateRowId(int, java.sql.RowId)
4922:             */
4923:            @Test(dataProvider="int-rowid")
4924:            public void updateRowId(int index, RowId value) throws SQLException {
4925:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4926:
4927:                this .resultSet1.updateRowId(index, value);
4928:                this .resultSet2.updateRowId(index, value);
4929:
4930:                this .replay();
4931:
4932:                this .resultSet.updateRowId(index, value);
4933:
4934:                this .verify();
4935:            }
4936:
4937:            @DataProvider(name="string-rowid")
4938:            Object[][] stringRowIdProvider() {
4939:                return new Object[][] { new Object[] { "",
4940:                        EasyMock.createMock(RowId.class) } };
4941:            }
4942:
4943:            /**
4944:             * @see java.sql.ResultSet#updateRowId(java.lang.String, java.sql.RowId)
4945:             */
4946:            @Test(dataProvider="string-rowid")
4947:            public void updateRowId(String name, RowId value)
4948:                    throws SQLException {
4949:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4950:
4951:                this .resultSet1.updateRowId(name, value);
4952:                this .resultSet2.updateRowId(name, value);
4953:
4954:                this .replay();
4955:
4956:                this .resultSet.updateRowId(name, value);
4957:
4958:                this .verify();
4959:            }
4960:
4961:            @DataProvider(name="int-xml")
4962:            Object[][] intSQLXMLProvider() {
4963:                return new Object[][] { new Object[] { 1,
4964:                        EasyMock.createMock(SQLXML.class) } };
4965:            }
4966:
4967:            /**
4968:             * @see java.sql.ResultSet#updateSQLXML(int, java.sql.SQLXML)
4969:             */
4970:            @Test(dataProvider="int-xml")
4971:            public void updateSQLXML(int index, SQLXML value)
4972:                    throws SQLException {
4973:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4974:
4975:                this .resultSet1.updateSQLXML(index, value);
4976:                this .resultSet2.updateSQLXML(index, value);
4977:
4978:                this .replay();
4979:
4980:                this .resultSet.updateSQLXML(index, value);
4981:
4982:                this .verify();
4983:            }
4984:
4985:            @DataProvider(name="string-xml")
4986:            Object[][] stringSQLXMLProvider() {
4987:                return new Object[][] { new Object[] { "",
4988:                        EasyMock.createMock(SQLXML.class) } };
4989:            }
4990:
4991:            /**
4992:             * @see java.sql.ResultSet#updateSQLXML(java.lang.String, java.sql.SQLXML)
4993:             */
4994:            @Test(dataProvider="string-xml")
4995:            public void updateSQLXML(String name, SQLXML value)
4996:                    throws SQLException {
4997:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
4998:
4999:                this .resultSet1.updateSQLXML(name, value);
5000:                this .resultSet2.updateSQLXML(name, value);
5001:
5002:                this .replay();
5003:
5004:                this .resultSet.updateSQLXML(name, value);
5005:
5006:                this .verify();
5007:            }
5008:
5009:            @DataProvider(name="class")
5010:            Object[][] classProvider() {
5011:                return new Object[][] { new Object[] { Object.class } };
5012:            }
5013:
5014:            /**
5015:             * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
5016:             */
5017:            @Test(dataProvider="class")
5018:            public boolean isWrapperFor(Class<?> targetClass)
5019:                    throws SQLException {
5020:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
5021:
5022:                EasyMock.expect(this .resultSet1.isWrapperFor(targetClass))
5023:                        .andReturn(true);
5024:
5025:                this .replay();
5026:
5027:                boolean result = this .resultSet.isWrapperFor(targetClass);
5028:
5029:                return result;
5030:            }
5031:
5032:            /**
5033:             * @see java.sql.Wrapper#unwrap(java.lang.Class)
5034:             */
5035:            @Test(dataProvider="class")
5036:            public <T> T unwrap(Class<T> targetClass) throws SQLException {
5037:                EasyMock.expect(this .cluster.isActive()).andReturn(true);
5038:
5039:                try {
5040:                    EasyMock.expect(this .resultSet1.unwrap(targetClass))
5041:                            .andReturn(targetClass.newInstance());
5042:
5043:                    this .replay();
5044:
5045:                    T result = this .resultSet.unwrap(targetClass);
5046:
5047:                    return result;
5048:                } catch (InstantiationException e) {
5049:                    assert false : e;
5050:                    return null;
5051:                } catch (IllegalAccessException e) {
5052:                    assert false : e;
5053:                    return null;
5054:                }
5055:            }
5056:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.