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);
 }
示例#2
0
 /**
  * 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"]);
 }
 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;
 }
示例#4
0
 /**
  * @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"]);
 }