From 82cae7df993533cd56291e37f569eac64a412892 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Wed, 24 Feb 2016 23:06:02 +0100 Subject: Add Network class Generation in App --- server/Test/AppTestClass.php | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'server/Test/AppTestClass.php') diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php index 311b9bf..2babed4 100755 --- a/server/Test/AppTestClass.php +++ b/server/Test/AppTestClass.php @@ -6,6 +6,7 @@ class AppTest{ protected $openstack; protected $pluginsApi; + protected $postParams; protected $tokenClass; protected $tokenPost; protected $output; @@ -15,8 +16,10 @@ class AppTest{ $this->tokenPost = NULL; $this->tokenClass = new genTokenOptions($args); $this->openstack = new OpenStack\OpenStack([]); - $this->pluginsApi = plugin_api::getInstance(); + $this->pluginsApi = plugin_api::getInstance(); + $this->errorClass = new errorManagement($this); $this->output = array(); + $this->postParams = $_POST; } @@ -40,6 +43,11 @@ class AppTest{ $opt = $this->tokenClass->getOptions($service); return $this->openstack->imagesV2($opt); break; + case "Network": + if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken(); + $opt = $this->tokenClass->getOptions($service); + return $this->openstack->networkingV2($opt); + break; } } @@ -53,10 +61,21 @@ class AppTest{ $this->tokenClass->genNetworkToken(); $this->setOutput("token", $this->tokenClass->getBackup()); - }catch(Exception $e){ - echo $e; - exit(); - } + }catch(BadResponseError $e){ + $this->errorClass->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->errorClass->UserInputHandler($e); + }catch(BaseError $e){ + $this->errorClass->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->errorClass->NotImplementedHandler($e); + } + + } + + public function getPostParam($name){ + + return $this->postParams[$name]; } -- cgit v1.2.3 From 59041ccb45d7cba18a66d0623d9b5875e6ac32b6 Mon Sep 17 00:00:00 2001 From: stupidon Date: Sun, 28 Feb 2016 10:23:17 +0100 Subject: added Compute case for libclass generation --- server/Test/AppTestClass.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'server/Test/AppTestClass.php') diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php index 2babed4..68d0cfc 100755 --- a/server/Test/AppTestClass.php +++ b/server/Test/AppTestClass.php @@ -43,6 +43,11 @@ class AppTest{ $opt = $this->tokenClass->getOptions($service); return $this->openstack->imagesV2($opt); break; + case "Compute": + if($this->tokenPost == NULL) $this->tokenClass->genComputeToken(); + $opt = $this->tokenClass->getOptions($service); + return $this->openstack->computeV2($opt); + break; case "Network": if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken(); $opt = $this->tokenClass->getOptions($service); @@ -89,4 +94,4 @@ class AppTest{ echo json_encode($this->output); } -} \ No newline at end of file +} -- cgit v1.2.3 From 9280eecbcf42253363a30f97d265069d0159de77 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Sun, 28 Feb 2016 19:26:53 +0100 Subject: Support gestion output --- server/Test/AppTestClass.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'server/Test/AppTestClass.php') diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php index 68d0cfc..4d7cab5 100755 --- a/server/Test/AppTestClass.php +++ b/server/Test/AppTestClass.php @@ -16,10 +16,10 @@ class AppTest{ $this->tokenPost = NULL; $this->tokenClass = new genTokenOptions($args); $this->openstack = new OpenStack\OpenStack([]); - $this->pluginsApi = plugin_api::getInstance(); + $this->pluginsApi = plugin_api::getInstance(); $this->errorClass = new errorManagement($this); $this->output = array(); - $this->postParams = $_POST; + $this->postParams = $_POST; } @@ -91,7 +91,7 @@ class AppTest{ } public function show(){ - echo json_encode($this->output); + return json_encode($this->output); } -} +} -- cgit v1.2.3