@Produces @ServiceName("ZOOKEEPER") public String create(@New ZooKeeperServerConfig serverConfig) throws IOException, InterruptedException { String providedUrl = Systems.getEnvVarOrSystemProperty("ZOOKEEPER_URL", ""); if (Strings.isNullOrEmpty(providedUrl)) { ZooKeeperServerFactory factory = new ZooKeeperServerFactory(serverConfig); return factory.getZooKeeperUrl(); } else { return providedUrl; } } }
@ServiceName(HUBOT_SERVICE_NAME) private Instance<String> hubotUrlHolder;
@Produces @Singleton public CuratorFramework create(@ServiceName("ZOOKEEPER") String url, @New CuratorConfig config) throws IOException, InterruptedException { LOG.info("Connecting to ZooKeeper URL: {}", url); CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder() .connectString(url) .connectionTimeoutMs(config.getConnectionTimeOut()) .sessionTimeoutMs(config.getSessionTimeout()) .retryPolicy(new RetryNTimes(config.getRetryMax(), config.getRetryInterval())); if (!Strings.isNullOrBlank(config.getPassword())) { byte[] auth = (DEFAULT_AUTH_USER + ":" + PasswordEncoder.decode(config.getPassword())).getBytes(); builder = builder.authorization(DEFAULT_AUTH_SCHEME, auth); } CuratorFramework curatorFramework = builder.build(); curatorFramework.start(); return curatorFramework; }
Session session; @ServiceName("zipkin") @ArquillianResource Service service;
@Inject public KubernetesHubotNotifier(HubotNotifier notifier, @External @Protocol("http") @ServiceName("fabric8") String consoleLink, @ConfigProperty(name = "HUBOT_KUBERNETES_ROOM", defaultValue = DEFAULT_ROOM_EXPRESSION) String roomExpression) throws Exception { this.notifier = notifier;