[teiid-commits] teiid SVN: r2763 - in branches/7.1.x/engine/src: test/java/org/teiid/dqp/internal/process and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Dec 8 11:35:00 EST 2010


Author: shawkins
Date: 2010-12-08 11:34:59 -0500 (Wed, 08 Dec 2010)
New Revision: 2763

Modified:
   branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
   branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
   branches/7.1.x/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
Log:
TEIID-1383 a fix for partial results mode

Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java	2010-12-07 02:15:42 UTC (rev 2762)
+++ branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java	2010-12-08 16:34:59 UTC (rev 2763)
@@ -211,7 +211,7 @@
 	    				results = getResults();
 	    			}
     			} catch (TranslatorException e) {
-    				exceptionOccurred(e, true);
+    				results = exceptionOccurred(e, true);
     			} catch (DataNotAvailableException e) {
     				dtm.scheduleWork(new Runnable() {
     					@Override
@@ -352,7 +352,7 @@
     	}
     }
 
-    void exceptionOccurred(TranslatorException exception, boolean removeState) throws TeiidComponentException, TeiidProcessingException {
+    AtomicResultsMessage exceptionOccurred(TranslatorException exception, boolean removeState) throws TeiidComponentException, TeiidProcessingException {
     	if (removeState) {
 			fullyCloseSource();
 		}
@@ -360,16 +360,15 @@
 			AtomicResultsMessage emptyResults = new AtomicResultsMessage(new List[0], null);
 			emptyResults.setWarnings(Arrays.asList((Exception)exception));
 			emptyResults.setFinalRow(this.rowsProcessed);
-			receiveResults(emptyResults);
-		} else {
-    		if (exception.getCause() instanceof TeiidComponentException) {
-    			throw (TeiidComponentException)exception.getCause();
-    		}
-    		if (exception.getCause() instanceof TeiidProcessingException) {
-    			throw (TeiidProcessingException)exception.getCause();
-    		}
-    		throw new TeiidProcessingException(exception);
-		}	
+			return emptyResults;
+		} 
+		if (exception.getCause() instanceof TeiidComponentException) {
+			throw (TeiidComponentException)exception.getCause();
+		}
+		if (exception.getCause() instanceof TeiidProcessingException) {
+			throw (TeiidProcessingException)exception.getCause();
+		}
+		throw new TeiidProcessingException(exception);
 	}
 
 	void receiveResults(AtomicResultsMessage response) {

Modified: branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2010-12-07 02:15:42 UTC (rev 2762)
+++ branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2010-12-08 16:34:59 UTC (rev 2763)
@@ -43,7 +43,6 @@
 import org.teiid.query.sql.lang.Command;
 import org.teiid.query.unittest.FakeMetadataFactory;
 import org.teiid.query.util.CommandContext;
-import org.teiid.translator.TranslatorException;
 
 public class TestDataTierManager {
     
@@ -125,8 +124,16 @@
     
     @Test public void testPartialResults() throws Exception {
     	helpSetup(1);
-    	info.exceptionOccurred(new TranslatorException(), true);
-    	assertNull(info.nextTuple());
+    	connectorManager.throwExceptionOnExecute = true;
+    	for (int i = 0; i < 10; i++) {
+	    	try {
+	    		assertNull(info.nextTuple());
+	    		return;
+	    	} catch (BlockedException e) {
+	    		Thread.sleep(50);
+	    	}
+    	}
+    	fail();
     }
     
     @Test public void testNoRowsException() throws Exception {

Modified: branches/7.1.x/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java	2010-12-07 02:15:42 UTC (rev 2762)
+++ branches/7.1.x/engine/src/test/java/org/teiid/dqp/service/AutoGenDataService.java	2010-12-08 16:34:59 UTC (rev 2763)
@@ -70,9 +70,6 @@
     @Override
     public ConnectorWork registerRequest(AtomicRequestMessage message)
     		throws TeiidComponentException {
-    	if (throwExceptionOnExecute) {
-    		throw new TeiidComponentException("Connector Exception"); //$NON-NLS-1$
-    	}
         List projectedSymbols = (message.getCommand()).getProjectedSymbols();               
         List[] results = createResults(projectedSymbols);
                 
@@ -87,6 +84,9 @@
 			
 			@Override
 			public AtomicResultsMessage execute() throws TranslatorException {
+				if (throwExceptionOnExecute) {
+		    		throw new TranslatorException("Connector Exception"); //$NON-NLS-1$
+		    	}
 				if (dataNotAvailable > -1) {
 					int delay = dataNotAvailable;
 					dataNotAvailable = -1;



More information about the teiid-commits mailing list