@Test public void canCreateTcpTransport() throws AgentConfigurationException { AbstractSplunkInternalHandler internalHandler = new DummySplunkInternalHandler(); internalHandler.setHost("127.0.0.1"); internalHandler.setPort(8088); internalHandler.setScheme("tcp"); Transport transport = new DefaultTransportFactory(internalHandler).create(); Assert.isInstanceOf(TCPTransport.class, transport); }
@Override public Transport<T> create() throws AgentConfigurationException { if (StringUtils.isNotBlank(this.internalHandler.getToken())) { HECTransportConfig config = new HECTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a HECTransport with the settings: " + config); return new HECTransport<T>(config, this.internalHandler.getObjectMapper()); } if (this.internalHandler.getScheme().equals("tcp")) { TCPTransportConfig config = new TCPTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a TCPTransport with the settings: " + config); return new TCPTransport<T>(config, this.internalHandler.getObjectMapper()); } RestTransportConfig config = new RestTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a RestTransport with the settings: " + config); return new RestTransport<T>(config, this.internalHandler.getObjectMapper()); }
DefaultTransportFactory implements TransportFactory<T> { @Override public Transport<T> create() throws AgentConfigurationException { if (StringUtils.isNotBlank(this.internalHandler.getToken())) { HECTransportConfig config = new HECTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a HECTransport with the settings: " + config); return new HECTransport<T>(config, this.internalHandler.getObjectMapper()); } if (this.internalHandler.getScheme().equals("tcp")) { TCPTransportConfig config = new TCPTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a TCPTransport with the settings: " + config); return new TCPTransport<T>(config, this.internalHandler.getObjectMapper()); } RestTransportConfig config = new RestTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a RestTransport with the settings: " + config); return new RestTransport<T>(config, this.internalHandler.getObjectMapper()); } }
DefaultTransportFactory implements TransportFactory<T> { @Override public Transport<T> create() throws AgentConfigurationException { if (StringUtils.isNotBlank(this.internalHandler.getToken())) { HECTransportConfig config = new HECTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a HECTransport with the settings: " + config); return new HECTransport<T>(config, this.internalHandler.getObjectMapper()); } if (this.internalHandler.getScheme().equals("tcp")) { TCPTransportConfig config = new TCPTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a TCPTransport with the settings: " + config); return new TCPTransport<T>(config, this.internalHandler.getObjectMapper()); } RestTransportConfig config = new RestTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a RestTransport with the settings: " + config); return new RestTransport<T>(config, this.internalHandler.getObjectMapper()); } DefaultTransportFactory(AbstractSplunkInternalHandler<T> internalHandler); }
DefaultTransportFactory implements TransportFactory<T> { @Override public Transport<T> create() throws AgentConfigurationException { if (StringUtils.isNotBlank(this.internalHandler.getToken())) { HECTransportConfig config = new HECTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a HECTransport with the settings: " + config); return new HECTransport<T>(config, this.internalHandler.getObjectMapper()); } if (this.internalHandler.getScheme().equals("tcp")) { TCPTransportConfig config = new TCPTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a TCPTransport with the settings: " + config); return new TCPTransport<T>(config, this.internalHandler.getObjectMapper()); } RestTransportConfig config = new RestTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a RestTransport with the settings: " + config); return new RestTransport<T>(config, this.internalHandler.getObjectMapper()); } DefaultTransportFactory(AbstractSplunkInternalHandler<T> internalHandler); @Override Transport<T> create(); }
DefaultTransportFactory implements TransportFactory<T> { @Override public Transport<T> create() throws AgentConfigurationException { if (StringUtils.isNotBlank(this.internalHandler.getToken())) { HECTransportConfig config = new HECTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a HECTransport with the settings: " + config); return new HECTransport<T>(config, this.internalHandler.getObjectMapper()); } if (this.internalHandler.getScheme().equals("tcp")) { TCPTransportConfig config = new TCPTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a TCPTransport with the settings: " + config); return new TCPTransport<T>(config, this.internalHandler.getObjectMapper()); } RestTransportConfig config = new RestTransportConfig.Builder(this.internalHandler).build(); LOGGER.debug("Creating the a RestTransport with the settings: " + config); return new RestTransport<T>(config, this.internalHandler.getObjectMapper()); } DefaultTransportFactory(AbstractSplunkInternalHandler<T> internalHandler); @Override Transport<T> create();  }