Restore HTTP adapter for InfluxDB 0.9

This commit is contained in:
Walter Dal Mut
2015-06-10 15:53:27 +02:00
parent 27811cbd14
commit 37da8604f1
13 changed files with 111 additions and 868 deletions
-1
View File
@@ -10,7 +10,6 @@
"zendframework/zend-servicemanager": "~2"
},
"require-dev": {
"phpspec/phpspec": "2.*",
"phpunit/phpunit": "4.*",
"athletic/athletic": "~0.1",
"ext-sockets": "*"
Generated
+76 -403
View File
@@ -4,30 +4,30 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "f2dbbf00b528de2e350ff4550629e1b4",
"hash": "96faa156d58fde5c5c3cf3df60d74ae1",
"packages": [
{
"name": "guzzlehttp/guzzle",
"version": "5.2.0",
"version": "5.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "475b29ccd411f2fa8a408e64576418728c032cfa"
"reference": "f3c8c22471cb55475105c14769644a49c3262b93"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/475b29ccd411f2fa8a408e64576418728c032cfa",
"reference": "475b29ccd411f2fa8a408e64576418728c032cfa",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/f3c8c22471cb55475105c14769644a49c3262b93",
"reference": "f3c8c22471cb55475105c14769644a49c3262b93",
"shasum": ""
},
"require": {
"guzzlehttp/ringphp": "~1.0",
"guzzlehttp/ringphp": "^1.1",
"php": ">=5.4.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
"phpunit/phpunit": "^4.0",
"psr/log": "^1.0"
},
"type": "library",
"extra": {
@@ -62,20 +62,20 @@
"rest",
"web service"
],
"time": "2015-01-28 01:03:29"
"time": "2015-05-20 03:47:55"
},
{
"name": "guzzlehttp/ringphp",
"version": "1.0.7",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/RingPHP.git",
"reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2"
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/52d868f13570a9a56e5fce6614e0ec75d0f13ac2",
"reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2",
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
"shasum": ""
},
"require": {
@@ -93,7 +93,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "1.1-dev"
}
},
"autoload": {
@@ -113,7 +113,7 @@
}
],
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
"time": "2015-03-30 01:43:20"
"time": "2015-05-20 03:37:09"
},
{
"name": "guzzlehttp/streams",
@@ -211,29 +211,31 @@
},
{
"name": "zendframework/zend-filter",
"version": "2.4.2",
"version": "2.5.1",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-filter.git",
"reference": "a3711101850078b2aa69586c71897acaada2e9cb"
"reference": "93e6990a198e6cdd811064083acac4693f4b29ae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-filter/zipball/a3711101850078b2aa69586c71897acaada2e9cb",
"reference": "a3711101850078b2aa69586c71897acaada2e9cb",
"url": "https://api.github.com/repos/zendframework/zend-filter/zipball/93e6990a198e6cdd811064083acac4693f4b29ae",
"reference": "93e6990a198e6cdd811064083acac4693f4b29ae",
"shasum": ""
},
"require": {
"php": ">=5.3.23",
"zendframework/zend-stdlib": "self.version"
"zendframework/zend-stdlib": "~2.5"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master",
"zendframework/zend-crypt": "self.version",
"zendframework/zend-servicemanager": "self.version",
"zendframework/zend-uri": "self.version"
"zendframework/zend-config": "~2.5",
"zendframework/zend-crypt": "~2.5",
"zendframework/zend-i18n": "~2.5",
"zendframework/zend-loader": "~2.5",
"zendframework/zend-servicemanager": "~2.5",
"zendframework/zend-uri": "~2.5"
},
"suggest": {
"zendframework/zend-crypt": "Zend\\Crypt component",
@@ -244,8 +246,8 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"autoload": {
@@ -263,20 +265,20 @@
"filter",
"zf2"
],
"time": "2015-05-07 14:55:31"
"time": "2015-06-03 15:32:01"
},
{
"name": "zendframework/zend-servicemanager",
"version": "2.4.2",
"version": "2.5.1",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-servicemanager.git",
"reference": "855294e12771b4295c26446b6ed2df2f1785f234"
"reference": "3b22c403e351d92526c642cba0bd810bc22e1c56"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/855294e12771b4295c26446b6ed2df2f1785f234",
"reference": "855294e12771b4295c26446b6ed2df2f1785f234",
"url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/3b22c403e351d92526c642cba0bd810bc22e1c56",
"reference": "3b22c403e351d92526c642cba0bd810bc22e1c56",
"shasum": ""
},
"require": {
@@ -285,8 +287,8 @@
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master",
"zendframework/zend-di": "self.version"
"zendframework/zend-di": "~2.5",
"zendframework/zend-mvc": "~2.5"
},
"suggest": {
"ocramius/proxy-manager": "ProxyManager 0.5.* to handle lazy initialization of services",
@@ -295,8 +297,8 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"autoload": {
@@ -308,25 +310,25 @@
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zend-service-manager",
"homepage": "https://github.com/zendframework/zend-servicemanager",
"keywords": [
"servicemanager",
"zf2"
],
"time": "2015-05-07 14:55:31"
"time": "2015-06-03 15:32:02"
},
{
"name": "zendframework/zend-stdlib",
"version": "2.4.2",
"version": "2.5.1",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-stdlib.git",
"reference": "a5dd7fd2ba6e8f6c6ea5a12db0605d3aa48af1e7"
"reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/a5dd7fd2ba6e8f6c6ea5a12db0605d3aa48af1e7",
"reference": "a5dd7fd2ba6e8f6c6ea5a12db0605d3aa48af1e7",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cc8e90a60dd5d44b9730b77d07b97550091da1ae",
"reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae",
"shasum": ""
},
"require": {
@@ -335,11 +337,12 @@
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master",
"zendframework/zend-eventmanager": "self.version",
"zendframework/zend-filter": "self.version",
"zendframework/zend-serializer": "self.version",
"zendframework/zend-servicemanager": "self.version"
"zendframework/zend-config": "~2.5",
"zendframework/zend-eventmanager": "~2.5",
"zendframework/zend-filter": "~2.5",
"zendframework/zend-inputfilter": "~2.5",
"zendframework/zend-serializer": "~2.5",
"zendframework/zend-servicemanager": "~2.5"
},
"suggest": {
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
@@ -350,8 +353,8 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"autoload": {
@@ -368,7 +371,7 @@
"stdlib",
"zf2"
],
"time": "2015-05-07 14:55:31"
"time": "2015-06-03 15:32:03"
}
],
"packages-dev": [
@@ -620,118 +623,6 @@
],
"time": "2015-02-03 12:10:50"
},
{
"name": "phpspec/php-diff",
"version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/phpspec/php-diff.git",
"reference": "30e103d19519fe678ae64a60d77884ef3d71b28a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/php-diff/zipball/30e103d19519fe678ae64a60d77884ef3d71b28a",
"reference": "30e103d19519fe678ae64a60d77884ef3d71b28a",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-0": {
"Diff": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Chris Boulton",
"homepage": "http://github.com/chrisboulton",
"role": "Original developer"
}
],
"description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).",
"time": "2013-11-01 13:02:21"
},
{
"name": "phpspec/phpspec",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/phpspec.git",
"reference": "9727d75919a00455433e867565bc022f0b985a39"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/phpspec/zipball/9727d75919a00455433e867565bc022f0b985a39",
"reference": "9727d75919a00455433e867565bc022f0b985a39",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.1",
"php": ">=5.3.3",
"phpspec/php-diff": "~1.0.0",
"phpspec/prophecy": "~1.4",
"sebastian/exporter": "~1.0",
"symfony/console": "~2.3",
"symfony/event-dispatcher": "~2.1",
"symfony/finder": "~2.1",
"symfony/process": "~2.1",
"symfony/yaml": "~2.1"
},
"require-dev": {
"behat/behat": "^3.0.11",
"bossa/phpspec2-expect": "~1.0",
"phpunit/phpunit": "~4.4",
"symfony/filesystem": "~2.1",
"symfony/process": "~2.1"
},
"suggest": {
"phpspec/nyan-formatters": "~1.0 Adds Nyan formatters"
},
"bin": [
"bin/phpspec"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
}
},
"autoload": {
"psr-0": {
"PhpSpec": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"homepage": "http://marcelloduarte.net/"
}
],
"description": "Specification-oriented BDD framework for PHP 5.3+",
"homepage": "http://phpspec.net/",
"keywords": [
"BDD",
"SpecBDD",
"TDD",
"spec",
"specification",
"testing",
"tests"
],
"time": "2015-04-18 16:22:51"
},
{
"name": "phpspec/prophecy",
"version": "v1.4.1",
@@ -794,16 +685,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "2.0.16",
"version": "2.1.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c"
"reference": "28a6b34e91d789b2608072ab3c82eaae7cdb973c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/934fd03eb6840508231a7f73eb8940cf32c3b66c",
"reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/28a6b34e91d789b2608072ab3c82eaae7cdb973c",
"reference": "28a6b34e91d789b2608072ab3c82eaae7cdb973c",
"shasum": ""
},
"require": {
@@ -826,7 +717,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "2.1.x-dev"
}
},
"autoload": {
@@ -852,7 +743,7 @@
"testing",
"xunit"
],
"time": "2015-04-11 04:35:00"
"time": "2015-06-03 07:01:01"
},
{
"name": "phpunit/php-file-iterator",
@@ -1040,16 +931,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.6.6",
"version": "4.6.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "3afe303d873a4d64c62ef84de491b97b006fbdac"
"reference": "7b5fe98b28302a8b25693b2298bca74463336975"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3afe303d873a4d64c62ef84de491b97b006fbdac",
"reference": "3afe303d873a4d64c62ef84de491b97b006fbdac",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b5fe98b28302a8b25693b2298bca74463336975",
"reference": "7b5fe98b28302a8b25693b2298bca74463336975",
"shasum": ""
},
"require": {
@@ -1108,20 +999,20 @@
"testing",
"xunit"
],
"time": "2015-04-29 15:18:52"
"time": "2015-06-03 05:03:30"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "2.3.1",
"version": "2.3.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "74ffb87f527f24616f72460e54b595f508dccb5c"
"reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/74ffb87f527f24616f72460e54b595f508dccb5c",
"reference": "74ffb87f527f24616f72460e54b595f508dccb5c",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/253c005852591fd547fc18cd5b7b43a1ec82d8f7",
"reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7",
"shasum": ""
},
"require": {
@@ -1163,7 +1054,7 @@
"mock",
"xunit"
],
"time": "2015-04-02 05:36:41"
"time": "2015-05-29 05:19:18"
},
{
"name": "pimple/pimple",
@@ -1582,240 +1473,22 @@
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-02-24 06:35:25"
},
{
"name": "symfony/console",
"version": "v2.6.7",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "ebc5679854aa24ed7d65062e9e3ab0b18a917272"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/ebc5679854aa24ed7d65062e9e3ab0b18a917272",
"reference": "ebc5679854aa24ed7d65062e9e3ab0b18a917272",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1",
"symfony/phpunit-bridge": "~2.7",
"symfony/process": "~2.1"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Console\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
},
{
"name": "symfony/event-dispatcher",
"version": "v2.6.7",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
"reference": "672593bc4b0043a0acf91903bb75a1c82d8f2e02"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/672593bc4b0043a0acf91903bb75a1c82d8f2e02",
"reference": "672593bc4b0043a0acf91903bb75a1c82d8f2e02",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.0,>=2.0.5",
"symfony/dependency-injection": "~2.6",
"symfony/expression-language": "~2.6",
"symfony/phpunit-bridge": "~2.7",
"symfony/stopwatch": "~2.3"
},
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\EventDispatcher\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
},
{
"name": "symfony/finder",
"version": "v2.6.7",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
"url": "https://github.com/symfony/Finder.git",
"reference": "704c64c8b12c8882640d5c0330a8414b1e06dc99"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Finder/zipball/704c64c8b12c8882640d5c0330a8414b1e06dc99",
"reference": "704c64c8b12c8882640d5c0330a8414b1e06dc99",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Finder\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
},
{
"name": "symfony/process",
"version": "v2.6.7",
"target-dir": "Symfony/Component/Process",
"source": {
"type": "git",
"url": "https://github.com/symfony/Process.git",
"reference": "9f3c4baaf840ed849e1b1f7bfd5ae246e8509562"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Process/zipball/9f3c4baaf840ed849e1b1f7bfd5ae246e8509562",
"reference": "9f3c4baaf840ed849e1b1f7bfd5ae246e8509562",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Process\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
},
{
"name": "symfony/yaml",
"version": "v2.6.7",
"target-dir": "Symfony/Component/Yaml",
"version": "v2.7.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "f157ab074e453ecd4c0fa775f721f6e67a99d9e2"
"reference": "4a29a5248aed4fb45f626a7bbbd330291492f5c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/f157ab074e453ecd4c0fa775f721f6e67a99d9e2",
"reference": "f157ab074e453ecd4c0fa775f721f6e67a99d9e2",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/4a29a5248aed4fb45f626a7bbbd330291492f5c3",
"reference": "4a29a5248aed4fb45f626a7bbbd330291492f5c3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
@@ -1823,11 +1496,11 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
"dev-master": "2.7-dev"
}
},
"autoload": {
"psr-0": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
}
},
@@ -1847,7 +1520,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
"time": "2015-05-02 15:21:08"
},
{
"name": "zeptech/annotations",
+1 -1
View File
@@ -13,7 +13,7 @@
</testsuite>
</testsuites>
<php>
<env name="UDP_PORT" value="5551"/>
<env name="UDP_PORT" value="4444"/>
<env name="UDP_DB" value="udp.test"/>
<env name="TCP_PORT" value="8086"/>
@@ -1,90 +0,0 @@
<?php
namespace spec\InfluxDB\Adapter;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use GuzzleHttp\Client;
use InfluxDB\Options;
use GuzzleHttp\Message\Response;
class GuzzleAdapterSpec extends ObjectBehavior
{
function let(Client $client, Options $options)
{
$options->getHttpSeriesEndpoint()->willReturn("localhost");
$options->getHttpDatabaseEndpoint()->willReturn("localhost");
$options->getUsername()->willReturn("one");
$options->getPassword()->willReturn("two");
$this->beConstructedWith($client, $options);
}
function it_is_initializable()
{
$this->shouldHaveType('InfluxDB\Adapter\GuzzleAdapter');
}
function it_should_send_data_via_post(Client $client, Options $options)
{
$client->post("localhost", [
'auth' => ["one", "two"],
'body' => json_encode(['pippo'])
])->shouldBeCalledTimes(1);
$this->send(["pippo"]);
}
function it_should_query_data(Client $client, Options $options)
{
$client->get(
"localhost",
[
"auth" => ["one", "two"],
"query" => [
"q" => "select * from tcp.test",
]
]
)->willReturn(new Response(200,[],null));
$this->query("select * from tcp.test")->shouldReturn(null);
}
function it_should_query_data_with_time_precision(Client $client, Options $options)
{
$client->get(
"localhost",
[
"auth" => ["one", "two"],
"query" => [
"time_precision" => "s",
"q" => "select * from tcp.test",
]
]
)->willReturn(new Response(200, [], null));
$this->query("select * from tcp.test", "s")->shouldReturn(null);
}
function it_should_list_all_databases(Client $client, Options $options)
{
$client->get(
"localhost",
[
"auth" => ["one", "two"]
]
)->shouldBeCalledTimes(1)->willReturn(new Response(200, [], null));
$this->getDatabases()->shouldReturn(null);
}
function it_should_create_a_new_database(Client $client, Options $options)
{
$client->post(
"localhost",
[
"auth" => ["one", "two"],
"body" => json_encode(["name" => "db_name"])
]
)->shouldBeCalledTimes(1)->willReturn(new Response(200, [], null));
$this->createDatabase("db_name")->shouldReturn(null);
}
}
-194
View File
@@ -1,194 +0,0 @@
<?php
namespace spec\InfluxDB\Adapter;
use GuzzleHttp\Client;
use GuzzleHttp\Message\Response;
use GuzzleHttp\Stream\Stream;
use InfluxDB\Adapter\HttpAdapter;
use InfluxDB\Exception\InfluxAuthorizationException;
use InfluxDB\Exception\InfluxBadResponseException;
use InfluxDB\Exception\InfluxGeneralException;
use InfluxDB\Exception\InfluxNoSeriesException;
use InfluxDB\Exception\InfluxUnexpectedResponseException;
use InfluxDB\Options;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class HttpAdapterSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('InfluxDB\Adapter\HttpAdapter');
}
function let(Options $options, Client $client)
{
$options->getHttpSeriesEndpoint()->willReturn("localhost");
$options->getHttpDatabaseEndpoint()->willReturn("localhost");
$options->getUsername()->willReturn("one");
$options->getPassword()->willReturn("two");
$this->beConstructedWith($options, $client);
}
function it_should_send_data_via_post(Client $client)
{
$responseBody = ['key'=>'value'];
$response = new Response(200,[], Stream::factory(json_encode($responseBody)));
$client->post("localhost", [
'auth' => ["one", "two"],
'exceptions' => false,
'body' => json_encode(['pippo'])
])->willReturn($response)
->shouldBeCalledTimes(1);
$this->send(["pippo"])->shouldReturn($responseBody);
}
function it_should_query_data(Client $client, Options $options)
{
$client->get(
"localhost",
[
"auth" => ["one", "two"],
"exceptions" => false,
"query" => [
"q" => "select * from tcp.test",
]
]
)->willReturn(new Response(200,[],null));
$this->query("select * from tcp.test")->shouldReturn(null);
}
function it_should_query_data_with_time_precision(Client $client, Options $options)
{
$client->get(
"localhost",
[
"auth" => ["one", "two"],
"exceptions" => false,
"query" => [
"time_precision" => "s",
"q" => "select * from tcp.test",
]
]
)->willReturn(new Response(200, [], null));
$this->query("select * from tcp.test", "s")->shouldReturn(null);
}
function it_should_list_all_databases(Client $client, Options $options)
{
$client->get(
"localhost",
[
"auth" => ["one", "two"],
"exceptions" => false,
]
)->shouldBeCalledTimes(1)->willReturn(new Response(200, [], null));
$this->getDatabases()->shouldReturn(null);
}
function it_should_create_a_new_database(Client $client, Options $options)
{
$client->post(
"localhost",
[
"auth" => ["one", "two"],
"exceptions" => false,
"body" => json_encode(["name" => "db_name"])
]
)->shouldBeCalledTimes(1)->willReturn(new Response(201, [], null));
$this->createDatabase("db_name")->shouldReturn(true);
}
function it_should_return_true_with_success(Client $client) {
foreach ([201,204,299] as $code) {
$client->post(Argument::any(), Argument::any(), Argument::any())->willReturn(new Response($code, [], null));
$this->createDatabase("db_name")->shouldReturn(true);
}
}
function it_should_throw_no_series_exception (Client $client)
{
$client->get(
"localhost",
[
"auth" => ["one", "two"],
"exceptions" => false,
"query" => [
"q" => "select * from tcp.test",
]
]
)->willReturn(new Response(HttpAdapter::STATUS_CODE_BAD_REQUEST,[], Stream::factory("Couldn't find series: tcp.test")));
$this->shouldThrow(new InfluxNoSeriesException("Couldn't find series: tcp.test", HttpAdapter::STATUS_CODE_BAD_REQUEST))
->during("query", ["select * from tcp.test"]);
}
function it_should_throw_authorization_exception (Client $client)
{
$codes = [HttpAdapter::STATUS_CODE_UNAUTHORIZED, HttpAdapter::STATUS_CODE_FORBIDDEN];
foreach ($codes as $code) {
$client->get(
"localhost",
[
"auth" => ["one", "two"],
"exceptions" => false,
"query" => [
"q" => "select * from tcp.test",
]
]
)->willReturn(new Response($code,[], Stream::factory("Message")));
$this->shouldThrow(new InfluxAuthorizationException("Message", $code))
->during("query", ["select * from tcp.test"]);
}
}
function it_should_throw_general_exception (Client $client)
{
$client->get(
"localhost",
[
"auth" => ["one", "two"],
"exceptions" => false,
"query" => [
"q" => "select * from tcp.test",
]
]
)->willReturn(new Response(409,[], Stream::factory("Message")));
$this->shouldThrow(new InfluxGeneralException("Message", 409))
->during("query", ["select * from tcp.test"]);
}
function it_should_throw_general_exception_with_default_message (Client $client)
{
$client->get(Argument::any(), Argument::any())->willReturn(new Response(409));
$this->shouldThrow(new InfluxGeneralException("Conflict", 409))
->during("query", ["select * from tcp.test"]);
}
function it_should_throw_bad_response_exception(Client $client)
{
$response = new Response(200,[], Stream::factory('bad response'));
$client->post("localhost", [
'auth' => ["one", "two"],
'exceptions' => false,
'body' => json_encode(['pippo'])
])->willReturn($response)
->shouldBeCalledTimes(1);
$this->shouldThrow(new InfluxBadResponseException("Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON; Response is 'bad response'", 0))
->during("send", [["pippo"]]);
}
function it_should_throw_unexpected_response_exception (Client $client)
{
foreach ([0, 300, 500] as $code) {
$client->get(Argument::any(), Argument::any())->willReturn(new Response($code, [], Stream::factory("Message")));
$this->shouldThrow(new InfluxUnexpectedResponseException("Message", $code))
->during("query", ["select * from tcp.test"]);
}
}
}
-25
View File
@@ -1,25 +0,0 @@
<?php
namespace spec\InfluxDB\Adapter;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use InfluxDB\Options;
class UdpAdapterSpec extends ObjectBehavior
{
function let(Options $options)
{
$this->beConstructedWith($options);
}
function it_is_initializable()
{
$this->shouldHaveType('InfluxDB\Adapter\UdpAdapter');
}
function it_should_implement_adapter_interface()
{
$this->shouldImplement("InfluxDB\Adapter\AdapterInterface");
}
}
-86
View File
@@ -1,86 +0,0 @@
<?php
namespace spec\InfluxDB;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use InfluxDB\Adapter\GuzzleAdapter;
use InfluxDB\Adapter\UdpAdapter;
use InfluxDB\Adapter\AdapterInterface;
use InfluxDb\Adapter\QueryableInterface;
class ClientSpec extends ObjectBehavior
{
function let(\InfluxDB\Adapter\AdapterInterface $adapter)
{
$this->setAdapter($adapter);
}
function it_is_initializable()
{
$this->shouldHaveType('InfluxDB\Client');
}
function it_should_send_data(AdapterInterface $adapter)
{
$adapter->send([[
"name" => "video.search",
"columns" => ["author", "title"],
"points" => [
["Guccini", "Autogrill"]
]
]], false)->shouldBeCalledTimes(1);
$this->mark("video.search", [
"author" => "Guccini",
"title" => "Autogrill"
]);
}
function it_should_send_data_with_time_precision(AdapterInterface $adapter)
{
$adapter->send([[
"name" => "video.search",
"columns" => ["time", "author", "title"],
"points" => [
["1410591552", "Guccini", "Autogrill"]
]
]], "s")->shouldBeCalledTimes(1);
$this->mark("video.search", [
"time" => "1410591552",
"author" => "Guccini",
"title" => "Autogrill"
], "s");
}
function it_should_query_on_querable_adapter(GuzzleAdapter $adapter)
{
$this->setAdapter($adapter);
$adapter->query("select * from tcp.test", false)->willReturn([]);
$this->query("select * from tcp.test")->shouldReturn([]);
}
function it_should_query_with_time_precision(GuzzleAdapter $adapter)
{
$this->setAdapter($adapter);
$adapter->query("select * from tcp.test", "s")->willReturn([]);
$this->query("select * from tcp.test", "s")->shouldReturn([]);
}
function it_should_query_but_skip_invalid_time_precision(GuzzleAdapter $adapter)
{
$this->setAdapter($adapter);
$adapter->query("select * from tcp.test", false)->willReturn([]);
$this->query("select * from tcp.test", "r")->shouldReturn([]);
}
function it_should_thrown_an_exception_on_unquerable_adapter(UdpAdapter $adapter)
{
$this->setAdapter($adapter);
$this->shouldThrow("\\BadMethodCallException")->duringQuery("select * from tcp.test");
}
}
-40
View File
@@ -1,40 +0,0 @@
<?php
namespace spec\InfluxDB;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class OptionsSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('InfluxDB\Options');
}
function it_should_create_a_valid_tcp_endpoint()
{
$this->setDatabase("mine");
$this->getHttpSeriesEndpoint()
->shouldReturn("http://localhost:8086/db/mine/series");
}
function it_should_allows_option_override_for_tcp_endpoint()
{
$this->setHost("influx.1.prod.tld");
$this->setPort(19385);
$this->setUsername("walter");
$this->setPassword("walter");
$this->setDatabase("me");
$this->getHttpSeriesEndpoint()
->shouldReturn("http://influx.1.prod.tld:19385/db/me/series");
}
function it_should_allows_https_for_tcp_endpoint()
{
$this->setProtocol("https");
$this->setDatabase("me");
$this->getHttpSeriesEndpoint()
->shouldReturn("https://localhost:8086/db/me/series");
}
}
+12 -8
View File
@@ -67,6 +67,7 @@ class GuzzleAdapter implements AdapterInterface, QueryableInterface
"auth" => [$this->options->getUsername(), $this->options->getPassword()],
'query' => [
"q" => $query,
"db" => $this->getOptions()->getDatabase(),
]
];
@@ -74,7 +75,7 @@ class GuzzleAdapter implements AdapterInterface, QueryableInterface
$options["query"]["time_precision"] = $timePrecision;
}
$endpoint = $this->options->getHttpSeriesEndpoint();
$endpoint = $this->options->getHttpQueryEndpoint();
return $this->httpClient->get($endpoint, $options)->json();
}
@@ -86,10 +87,12 @@ class GuzzleAdapter implements AdapterInterface, QueryableInterface
{
$options = [
"auth" => [$this->options->getUsername(), $this->options->getPassword()],
"query" => [
"q" => "show databases",
],
];
$endpoint = $this->options->getHttpDatabaseEndpoint();
$endpoint = $this->options->getHttpQueryEndpoint();
return $this->httpClient->get($endpoint, $options)->json();
}
@@ -100,11 +103,11 @@ class GuzzleAdapter implements AdapterInterface, QueryableInterface
{
$httpMessage = [
"auth" => [$this->options->getUsername(), $this->options->getPassword()],
"body" => json_encode(["name" => $name])
"query" => ["q" => "CREATE DATABASE \"{$name}\""],
];
$endpoint = $this->options->getHttpDatabaseEndpoint();
return $this->httpClient->post($endpoint, $httpMessage)->json();
$endpoint = $this->options->getHttpQueryEndpoint();
return $this->httpClient->get($endpoint, $httpMessage)->json();
}
/**
@@ -114,9 +117,10 @@ class GuzzleAdapter implements AdapterInterface, QueryableInterface
{
$httpMessage = [
"auth" => [$this->options->getUsername(), $this->options->getPassword()],
"query" => ["q" => "drop database \"{$name}\""],
];
$endpoint = $this->options->getHttpDatabaseEndpoint($name);
return $this->httpClient->delete($endpoint, $httpMessage)->json();
$endpoint = $this->options->getHttpQueryEndpoint();
return $this->httpClient->get($endpoint, $httpMessage)->json();
}
}
+5 -5
View File
@@ -42,17 +42,17 @@ class Client
* @param bool|string $timePrecision
* @return mixed
*/
public function mark($name, array $values, $timePrecision = false)
public function mark($name, array $values = [], $timePrecision = false)
{
$data =[];
$timePrecision = $this->clearTimePrecision($timePrecision);
$data['name'] = $name;
$data['columns'] = array_keys($values);
$data['points'][] = array_values($values);
$data["database"] = $this->getAdapter()->getOptions()->getDatabase();
$data['points'][0]['name'] = $name;
$data['points'][0]['fields'] = $values;
return $this->getAdapter()->send([$data], $timePrecision);
return $this->getAdapter()->send($data, $timePrecision);
}
/**
+4 -9
View File
@@ -160,11 +160,10 @@ class Options
public function getHttpSeriesEndpoint()
{
return sprintf(
"%s://%s:%d/db/%s/series",
"%s://%s:%d/write",
$this->getProtocol(),
$this->getHost(),
$this->getPort(),
$this->getDatabase()
$this->getPort()
);
}
@@ -173,19 +172,15 @@ class Options
* @param string $name
* @return string
*/
public function getHttpDatabaseEndpoint($name = false)
public function getHttpQueryEndpoint($name = false)
{
$url = sprintf(
"%s://%s:%d/db",
"%s://%s:%d/query",
$this->getProtocol(),
$this->getHost(),
$this->getPort()
);
if ($name !== false) {
$url .= "/{$name}";
}
return $url;
}
}
+11 -6
View File
@@ -38,8 +38,10 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$this->object = $influx;
$databases = $this->object->getDatabases();
foreach ($databases as $database) {
$this->object->deleteDatabase($database["name"]);
if (array_key_exists("values", $databases["results"][0]["series"][0])) {
foreach ($databases["results"][0]["series"][0]["values"] as $database) {
$this->object->deleteDatabase($database[0]);
}
}
$this->object->createDatabase($this->rawOptions["udp"]["database"]);
@@ -51,11 +53,14 @@ class ClientTest extends \PHPUnit_Framework_TestCase
*/
public function testGuzzleHttpApiWorksCorrectly()
{
$this->object->mark("tcp.test", ["mark" => "element"]);
$t = $this->object->mark("tcp.test", ["mark" => "element"]);
$body = $this->object->query("select * from tcp.test");
$this->assertCount(1, $body[0]["points"]);
$this->assertEquals("element", $body[0]["points"][0][2]);
sleep(1);
$body = $this->object->query("select * from \"tcp.test\"");
$this->assertCount(1, $body["results"][0]["series"][0]["values"]);
$this->assertEquals("mark", $body["results"][0]["series"][0]["columns"][1]);
$this->assertEquals("element", $body["results"][0]["series"][0]["values"][0][1]);
}
/**
+2
View File
@@ -13,6 +13,8 @@ class HttpAdapterTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->markTestSkipped();
$options = include __DIR__ . '/../bootstrap.php';
$this->rawOptions = $options;