@Test public void testOpen() throws Exception { FakeProcessorPlan[] plans = new FakeProcessorPlan[4]; for (int i = 0; i < plans.length; i++) { plans[i] = new FakeProcessorPlan(1); } BatchedUpdatePlan plan = new BatchedUpdatePlan(Arrays.asList(plans), plans.length, null, false); plan.initialize(new CommandContext(), null, null); plan.open(); for (int i = 1; i < plans.length; i++) { assertFalse(plans[i].isOpened()); } }
public void open() throws TeiidComponentException, TeiidProcessingException { try { openPlan(); } catch (BlockedException e){ throw e; } catch (TeiidComponentException | TeiidProcessingException e) { if (singleResult) { throw e; } Throwable cause = e; if (e.getCause() instanceof TranslatorBatchException) { TranslatorBatchException tbe = (TranslatorBatchException)e.getCause(); for (int i = 0; i < tbe.getUpdateCounts().length; i++) { updateCounts[commandIndex++] = Arrays.asList(updateCounts[i]); } } updateCounts = Arrays.copyOf(updateCounts, commandIndex); getContext().setBatchUpdateException(cause); } }
BatchedUpdatePlan extends ProcessorPlan { public void open() throws TeiidComponentException, TeiidProcessingException { try { openPlan(); } catch (BlockedException e){ throw e; } catch (TeiidComponentException | TeiidProcessingException e) { if (singleResult) { throw e; } Throwable cause = e; if (e.getCause() instanceof TranslatorBatchException) { TranslatorBatchException tbe = (TranslatorBatchException)e.getCause(); for (int i = 0; i < tbe.getUpdateCounts().length; i++) { updateCounts[commandIndex++] = Arrays.asList(updateCounts[i]); } } updateCounts = Arrays.copyOf(updateCounts, commandIndex); getContext().setBatchUpdateException(cause); } } }
BatchedUpdatePlan extends ProcessorPlan { public void open() throws TeiidComponentException, TeiidProcessingException { try { openPlan(); } catch (BlockedException e){ throw e; } catch (TeiidComponentException | TeiidProcessingException e) { if (singleResult) { throw e; } Throwable cause = e; if (e.getCause() instanceof TranslatorBatchException) { TranslatorBatchException tbe = (TranslatorBatchException)e.getCause(); for (int i = 0; i < tbe.getUpdateCounts().length; i++) { updateCounts[commandIndex++] = Arrays.asList(updateCounts[i]); } } updateCounts = Arrays.copyOf(updateCounts, commandIndex); getContext().setBatchUpdateException(cause); } } BatchedUpdatePlan(List<? extends ProcessorPlan> childPlans, int commandsInBatch, List<VariableContext> contexts, boolean singleResult); }
BatchedUpdatePlan extends ProcessorPlan { public void open() throws TeiidComponentException, TeiidProcessingException { try { openPlan(); } catch (BlockedException e){ throw e; } catch (TeiidComponentException | TeiidProcessingException e) { if (singleResult) { throw e; } Throwable cause = e; if (e.getCause() instanceof TranslatorBatchException) { TranslatorBatchException tbe = (TranslatorBatchException)e.getCause(); for (int i = 0; i < tbe.getUpdateCounts().length; i++) { updateCounts[commandIndex++] = Arrays.asList(updateCounts[i]); } } updateCounts = Arrays.copyOf(updateCounts, commandIndex); getContext().setBatchUpdateException(cause); } } BatchedUpdatePlan(List<? extends ProcessorPlan> childPlans, int commandsInBatch, List<VariableContext> contexts, boolean singleResult); BatchedUpdatePlan clone(); void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr); List getOutputElements(); void open(); TupleBatch nextBatch(); void close(); void reset(); PlanNode getDescriptionProperties(); String toString(); List getUpdatePlans(); @Override Boolean requiresTransaction(boolean transactionalReads); void setSingleResult(boolean singleResult); }
BatchedUpdatePlan extends ProcessorPlan { public void open() throws TeiidComponentException, TeiidProcessingException { try { openPlan(); } catch (BlockedException e){ throw e; } catch (TeiidComponentException | TeiidProcessingException e) { if (singleResult) { throw e; } Throwable cause = e; if (e.getCause() instanceof TranslatorBatchException) { TranslatorBatchException tbe = (TranslatorBatchException)e.getCause(); for (int i = 0; i < tbe.getUpdateCounts().length; i++) { updateCounts[commandIndex++] = Arrays.asList(updateCounts[i]); } } updateCounts = Arrays.copyOf(updateCounts, commandIndex); getContext().setBatchUpdateException(cause); } } BatchedUpdatePlan(List<? extends ProcessorPlan> childPlans, int commandsInBatch, List<VariableContext> contexts, boolean singleResult); BatchedUpdatePlan clone(); void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr); List getOutputElements(); void open(); TupleBatch nextBatch(); void close(); void reset(); PlanNode getDescriptionProperties(); String toString(); List getUpdatePlans(); @Override Boolean requiresTransaction(boolean transactionalReads); void setSingleResult(boolean singleResult);  }