summaryrefslogtreecommitdiff
path: root/server/Test/AppTestClass.php
diff options
context:
space:
mode:
authorroot <root@kabir-PC>2016-03-02 15:11:56 +0100
committerroot <root@kabir-PC>2016-03-02 15:11:56 +0100
commitdac5c28a6795984a32687fe21c41783de2e85d8b (patch)
treebb5b719f923b33e31d5a0880d1d50dbe49543e45 /server/Test/AppTestClass.php
parent70fcf3553abb4a25672ee198dafb89e430e2bd79 (diff)
parentb6d7d2c30efe5e9758072bb82ea3a947bda7fd1d (diff)
Merge branch 'develop' of https://github.com/manzerbredes/istic-openstack into othmane
Diffstat (limited to 'server/Test/AppTestClass.php')
-rwxr-xr-xserver/Test/AppTestClass.php36
1 files changed, 30 insertions, 6 deletions
diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php
index 311b9bf..4d7cab5 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;
@@ -16,7 +17,9 @@ class AppTest{
$this->tokenClass = new genTokenOptions($args);
$this->openstack = new OpenStack\OpenStack([]);
$this->pluginsApi = plugin_api::getInstance();
+ $this->errorClass = new errorManagement($this);
$this->output = array();
+ $this->postParams = $_POST;
}
@@ -40,6 +43,16 @@ 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);
+ return $this->openstack->networkingV2($opt);
+ break;
}
}
@@ -53,10 +66,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];
}
@@ -67,7 +91,7 @@ class AppTest{
}
public function show(){
- echo json_encode($this->output);
+ return json_encode($this->output);
}
-} \ No newline at end of file
+}