@Test public void testNodeId() throws Exception { TupleSourceCache tsc = new TupleSourceCache(); HardcodedDataManager pdm = new HardcodedDataManager() { @Override public TupleSource registerRequest(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject) throws TeiidComponentException { assertEquals(1, parameterObject.nodeID); return Mockito.mock(TupleSource.class); } }; CommandContext context = TestProcessor.createCommandContext(); BufferManagerImpl bufferMgr = BufferManagerFactory.createBufferManager(); Command command = new Insert(); RegisterRequestParameter parameterObject = new RegisterRequestParameter("z", 1, 1); parameterObject.info = new RegisterRequestParameter.SharedAccessInfo(); tsc.getSharedTupleSource(context, command, "x", parameterObject, bufferMgr, pdm); }
public TupleSource getSharedTupleSource(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject, BufferManager bufferMgr, ProcessorDataManager pdm) throws TeiidComponentException, TeiidProcessingException { if (sharedStates == null) { sharedStates = new HashMap<Integer, SharedState>(); } SharedState state = sharedStates.get(parameterObject.info.id); if (state == null) { state = new SharedState(); state.expectedReaders = parameterObject.info.sharingCount; RegisterRequestParameter param = new RegisterRequestParameter(parameterObject.connectorBindingId, parameterObject.nodeID, -1); param.fetchSize = parameterObject.fetchSize; param.copyStreamingLobs = true; state.ts = pdm.registerRequest(context, command, modelName, param); if (param.doNotCache) { return state.ts; } state.tb = bufferMgr.createTupleBuffer(command.getProjectedSymbols(), context.getConnectionId(), TupleSourceType.PROCESSOR); state.id = parameterObject.info.id; sharedStates.put(parameterObject.info.id, state); } return new SharedTupleSource(state); }
TupleSourceCache { public TupleSource getSharedTupleSource(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject, BufferManager bufferMgr, ProcessorDataManager pdm) throws TeiidComponentException, TeiidProcessingException { if (sharedStates == null) { sharedStates = new HashMap<Integer, SharedState>(); } SharedState state = sharedStates.get(parameterObject.info.id); if (state == null) { state = new SharedState(); state.expectedReaders = parameterObject.info.sharingCount; RegisterRequestParameter param = new RegisterRequestParameter(parameterObject.connectorBindingId, parameterObject.nodeID, -1); param.fetchSize = parameterObject.fetchSize; param.copyStreamingLobs = true; state.ts = pdm.registerRequest(context, command, modelName, param); if (param.doNotCache) { return state.ts; } state.tb = bufferMgr.createTupleBuffer(command.getProjectedSymbols(), context.getConnectionId(), TupleSourceType.PROCESSOR); state.id = parameterObject.info.id; sharedStates.put(parameterObject.info.id, state); } return new SharedTupleSource(state); } }
TupleSourceCache { public TupleSource getSharedTupleSource(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject, BufferManager bufferMgr, ProcessorDataManager pdm) throws TeiidComponentException, TeiidProcessingException { if (sharedStates == null) { sharedStates = new HashMap<Integer, SharedState>(); } SharedState state = sharedStates.get(parameterObject.info.id); if (state == null) { state = new SharedState(); state.expectedReaders = parameterObject.info.sharingCount; RegisterRequestParameter param = new RegisterRequestParameter(parameterObject.connectorBindingId, parameterObject.nodeID, -1); param.fetchSize = parameterObject.fetchSize; param.copyStreamingLobs = true; state.ts = pdm.registerRequest(context, command, modelName, param); if (param.doNotCache) { return state.ts; } state.tb = bufferMgr.createTupleBuffer(command.getProjectedSymbols(), context.getConnectionId(), TupleSourceType.PROCESSOR); state.id = parameterObject.info.id; sharedStates.put(parameterObject.info.id, state); } return new SharedTupleSource(state); }  }
TupleSourceCache { public TupleSource getSharedTupleSource(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject, BufferManager bufferMgr, ProcessorDataManager pdm) throws TeiidComponentException, TeiidProcessingException { if (sharedStates == null) { sharedStates = new HashMap<Integer, SharedState>(); } SharedState state = sharedStates.get(parameterObject.info.id); if (state == null) { state = new SharedState(); state.expectedReaders = parameterObject.info.sharingCount; RegisterRequestParameter param = new RegisterRequestParameter(parameterObject.connectorBindingId, parameterObject.nodeID, -1); param.fetchSize = parameterObject.fetchSize; param.copyStreamingLobs = true; state.ts = pdm.registerRequest(context, command, modelName, param); if (param.doNotCache) { return state.ts; } state.tb = bufferMgr.createTupleBuffer(command.getProjectedSymbols(), context.getConnectionId(), TupleSourceType.PROCESSOR); state.id = parameterObject.info.id; sharedStates.put(parameterObject.info.id, state); } return new SharedTupleSource(state); }  void close(); TupleSource getSharedTupleSource(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject, BufferManager bufferMgr, ProcessorDataManager pdm); }
TupleSourceCache { public TupleSource getSharedTupleSource(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject, BufferManager bufferMgr, ProcessorDataManager pdm) throws TeiidComponentException, TeiidProcessingException { if (sharedStates == null) { sharedStates = new HashMap<Integer, SharedState>(); } SharedState state = sharedStates.get(parameterObject.info.id); if (state == null) { state = new SharedState(); state.expectedReaders = parameterObject.info.sharingCount; RegisterRequestParameter param = new RegisterRequestParameter(parameterObject.connectorBindingId, parameterObject.nodeID, -1); param.fetchSize = parameterObject.fetchSize; param.copyStreamingLobs = true; state.ts = pdm.registerRequest(context, command, modelName, param); if (param.doNotCache) { return state.ts; } state.tb = bufferMgr.createTupleBuffer(command.getProjectedSymbols(), context.getConnectionId(), TupleSourceType.PROCESSOR); state.id = parameterObject.info.id; sharedStates.put(parameterObject.info.id, state); } return new SharedTupleSource(state); }  void close(); TupleSource getSharedTupleSource(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject, BufferManager bufferMgr, ProcessorDataManager pdm);  }