@Test public void testConnection() throws InterruptedException, IOException { Context context = new Context(); context.put(RedisConstants.CONF_HOST, DEFAULT_HOST); context.put(RedisConstants.CONF_CHANNELS, "channel1"); context.put("pool.testOnBorrow", "true"); context.put("pool.maxTotal", "100"); context.put("pool.maxIdle", "10"); context.put("pool.minIdle", "2"); context.put("pool.maxWaitInMillis", "100"); context.put("pool.testWhileIdle", "true"); context.put("pool.testOnReturn", "true"); context.put("pool.minEvictableIdleTimeInMillis", "10000"); context.put("pool.timeBetweenEvictionRunsMillis", "5000"); context.put("pool.numTestsPerEvictionRun", "10"); source.configure(context); Assert.assertNull(source.getName()); Assert.assertNotNull(source); }
@Override public void configure(Context context) { host = context.getString(RedisConstants.CONF_HOST, DEFAULT_HOST); port = context.getInteger(RedisConstants.CONF_PORT, DEFAULT_PORT); charset = context.getString(RedisConstants.CONF_CHARSET, DEFAULT_CHARSET); String rawChannels = context.getString(CONF_CHANNELS); String rawPatterns = context.getString(CONF_PCHANNELS); if(null != rawChannels){ channels = rawChannels.trim().split(","); pattern = false; } else if (null != rawPatterns){ patterns = rawPatterns.trim().split(","); pattern = true; } else { throw new RuntimeException("You must set " + CONF_CHANNELS + " or " + CONF_PCHANNELS + " property."); } poolProps = context.getSubProperties("pool."); log.info("Redis Source Configured"); }
RedisSource extends AbstractSource implements Configurable, EventDrivenSource { @Override public void configure(Context context) { host = context.getString(RedisConstants.CONF_HOST, DEFAULT_HOST); port = context.getInteger(RedisConstants.CONF_PORT, DEFAULT_PORT); charset = context.getString(RedisConstants.CONF_CHARSET, DEFAULT_CHARSET); String rawChannels = context.getString(CONF_CHANNELS); String rawPatterns = context.getString(CONF_PCHANNELS); if(null != rawChannels){ channels = rawChannels.trim().split(","); pattern = false; } else if (null != rawPatterns){ patterns = rawPatterns.trim().split(","); pattern = true; } else { throw new RuntimeException("You must set " + CONF_CHANNELS + " or " + CONF_PCHANNELS + " property."); } poolProps = context.getSubProperties("pool."); log.info("Redis Source Configured"); } }
RedisSource extends AbstractSource implements Configurable, EventDrivenSource { @Override public void configure(Context context) { host = context.getString(RedisConstants.CONF_HOST, DEFAULT_HOST); port = context.getInteger(RedisConstants.CONF_PORT, DEFAULT_PORT); charset = context.getString(RedisConstants.CONF_CHARSET, DEFAULT_CHARSET); String rawChannels = context.getString(CONF_CHANNELS); String rawPatterns = context.getString(CONF_PCHANNELS); if(null != rawChannels){ channels = rawChannels.trim().split(","); pattern = false; } else if (null != rawPatterns){ patterns = rawPatterns.trim().split(","); pattern = true; } else { throw new RuntimeException("You must set " + CONF_CHANNELS + " or " + CONF_PCHANNELS + " property."); } poolProps = context.getSubProperties("pool."); log.info("Redis Source Configured"); }  }
RedisSource extends AbstractSource implements Configurable, EventDrivenSource { @Override public void configure(Context context) { host = context.getString(RedisConstants.CONF_HOST, DEFAULT_HOST); port = context.getInteger(RedisConstants.CONF_PORT, DEFAULT_PORT); charset = context.getString(RedisConstants.CONF_CHARSET, DEFAULT_CHARSET); String rawChannels = context.getString(CONF_CHANNELS); String rawPatterns = context.getString(CONF_PCHANNELS); if(null != rawChannels){ channels = rawChannels.trim().split(","); pattern = false; } else if (null != rawPatterns){ patterns = rawPatterns.trim().split(","); pattern = true; } else { throw new RuntimeException("You must set " + CONF_CHANNELS + " or " + CONF_PCHANNELS + " property."); } poolProps = context.getSubProperties("pool."); log.info("Redis Source Configured"); }  @Override void configure(Context context); @Override synchronized void start(); @Override synchronized void stop(); }
RedisSource extends AbstractSource implements Configurable, EventDrivenSource { @Override public void configure(Context context) { host = context.getString(RedisConstants.CONF_HOST, DEFAULT_HOST); port = context.getInteger(RedisConstants.CONF_PORT, DEFAULT_PORT); charset = context.getString(RedisConstants.CONF_CHARSET, DEFAULT_CHARSET); String rawChannels = context.getString(CONF_CHANNELS); String rawPatterns = context.getString(CONF_PCHANNELS); if(null != rawChannels){ channels = rawChannels.trim().split(","); pattern = false; } else if (null != rawPatterns){ patterns = rawPatterns.trim().split(","); pattern = true; } else { throw new RuntimeException("You must set " + CONF_CHANNELS + " or " + CONF_PCHANNELS + " property."); } poolProps = context.getSubProperties("pool."); log.info("Redis Source Configured"); }  @Override void configure(Context context); @Override synchronized void start(); @Override synchronized void stop();  }