public function __construct(array $params, $username, $password, array $driverOptions = array()) { $http = new \GuzzleHttp\Client(); $options = new Options(); $options->setHost($params["host"]); $options->setDatabase($params["dbname"]); $options->setUsername($username); $options->setPassword($password); $options->setPort($params["port"]); $adapter = new GuzzleAdapter($http, $options); $this->client = new Client($adapter); }
public function testWorksWithProxies() { $this->getClient()->createDatabase("proxy.test"); $options = new Options(); $options->setPort(9000); $options->setDatabase("proxy.test"); $options->setPrefix("/influxdb"); $http = new GuzzleHttpClient(); $adapter = new GuzzleAdapter($http, $options); $adapter->send(["points" => [["measurement" => "vm-serie", "fields" => ["cpu" => 18.12, "free" => 712423]]]]); $this->assertSerieExists("proxy.test", "vm-serie"); $this->assertSerieCount("proxy.test", "vm-serie", 1); $this->assertValueExistsInSerie("proxy.test", "vm-serie", "cpu", 18.12); $this->assertValueExistsInSerie("proxy.test", "vm-serie", "free", 712423); }
public function setUp() { $options = new Options(); $options->setHost("localhost"); $options->setPort(8086); $options->setUsername("root"); $options->setPassword("root"); $options->setDatabase("tcp.test"); $client = new Client(new GuzzleAdapter(new HttpClient(), $options)); $client->createDatabase("tcp.test"); $client->createDatabase("udp.test"); $this->httpClient = $client; $opts = new Options(); $opts->setPort(4444); $client = new Client(new UdpAdapter($opts)); $this->udpClient = $client; }
/** * Test that we handle socket problems correctly in the UDP * adapter, and that they don't inturrupt the user's application. * * @group udp */ public function testReplicateIssue27() { $options = new \InfluxDB\Options(); // Configure options $options->setHost('172.16.1.182'); $options->setPort(4444); $options->setDatabase('...'); $options->setUsername('root'); $options->setPassword('root'); $httpAdapter = new \InfluxDB\Adapter\UdpAdapter($options); $client = new \InfluxDB\Client($httpAdapter); $client->mark("udp.test", ["mark" => "element"]); }
/** * @group udp */ public function testWriteUDPPackagesToInvalidHostname() { $options = new Options(); $options->setHost("www.test-invalid.this-is-not-a-tld"); $options->setUsername("nothing"); $options->setPassword("nothing"); $options->setPort(15984); $adapter = new UdpAdapter($options); $object = new Client($adapter); $object->mark("udp.test", ["mark" => "element"]); }