Author: shawkins
Date: 2010-01-22 12:27:53 -0500 (Fri, 22 Jan 2010)
New Revision: 1775
Modified:
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestAllResultsImpl.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java
Log:
TEIID-916 fix for timeout during nextBatch.
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestAllResultsImpl.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestAllResultsImpl.java 2010-01-22
17:24:27 UTC (rev 1774)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestAllResultsImpl.java 2010-01-22
17:27:53 UTC (rev 1775)
@@ -35,7 +35,11 @@
import java.util.List;
import java.util.TimeZone;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.mockito.Matchers;
+
import junit.framework.TestCase;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -772,20 +776,20 @@
static MMResultSet helpTestBatching(MMStatement statement, int fetchSize, int
batchLength,
int totalLength) throws InterruptedException, ExecutionException,
- MetaMatrixProcessingException, SQLException {
+ MetaMatrixProcessingException, SQLException, TimeoutException {
ClientSideDQP dqp = mock(ClientSideDQP.class);
stub(statement.getDQP()).toReturn(dqp);
stub(statement.getFetchSize()).toReturn(fetchSize);
for (int i = batchLength; i < totalLength; i += batchLength) {
//forward requests
ResultsFuture<ResultsMessage> nextBatch = mock(ResultsFuture.class);
- stub(nextBatch.get()).toReturn(exampleResultsMsg4(i + 1, Math.min(batchLength,
totalLength - i), fetchSize, i + batchLength >= totalLength));
+ stub(nextBatch.get(Matchers.anyLong(),
(TimeUnit)Matchers.anyObject())).toReturn(exampleResultsMsg4(i + 1, Math.min(batchLength,
totalLength - i), fetchSize, i + batchLength >= totalLength));
stub(dqp.processCursorRequest(REQUEST_ID, i + 1, fetchSize)).toReturn(nextBatch);
if (i + batchLength < totalLength) {
//backward requests
ResultsFuture<ResultsMessage> previousBatch = mock(ResultsFuture.class);
- stub(previousBatch.get()).toReturn(exampleResultsMsg4(i - batchLength + 1, i,
fetchSize, false));
+ stub(previousBatch.get(Matchers.anyLong(),
(TimeUnit)Matchers.anyObject())).toReturn(exampleResultsMsg4(i - batchLength + 1, i,
fetchSize, false));
stub(dqp.processCursorRequest(REQUEST_ID, i, fetchSize)).toReturn(previousBatch);
}
}
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java 2010-01-22
17:24:27 UTC (rev 1774)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java 2010-01-22
17:27:53 UTC (rev 1775)
@@ -33,6 +33,7 @@
import java.util.List;
import java.util.TimeZone;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
import junit.framework.TestCase;
@@ -693,6 +694,8 @@
throw new SQLException(e.getMessage());
} catch (ExecutionException e) {
throw new SQLException(e.getMessage());
+ } catch (TimeoutException e) {
+ throw new SQLException(e.getMessage());
}
}
Show replies by date