Author: Stuart Herbert (stuart.herbert@datasift.com)
Ejemplo n.º 1
0
 public function __construct(Storyteller $st, $params = [])
 {
     // call our parent first
     parent::__construct($st, $params);
     // make sure that we have a ZMQ socket
     if (!isset($params[0]) || !$params[0] instanceof ZMQSocket) {
         throw new E5xx_ActionFailed(__METHOD__, "first param must be a ZMQ socket");
     }
 }
Ejemplo n.º 2
0
 public function __construct(StoryTeller $st, $params = array())
 {
     // call our parent
     parent::__construct($st, $params);
     // remember the name of this VM
     $this->amiId = $params[0];
     // get the data about the instance from EC2
     $this->image = fromEc2()->getImage($this->amiId);
 }
Ejemplo n.º 3
0
 public function __construct(StoryTeller $st, $args = array())
 {
     // call the parent constructor
     parent::__construct($st, $args);
     // arg[0] is the name of the box
     if (!isset($args[0])) {
         throw new E5xx_ActionFailed(__METHOD__, "Param #0 needs to be the name you've given to the machine");
     }
 }
Ejemplo n.º 4
0
 public function __construct(StoryTeller $st, $args)
 {
     // call our parent constructor
     parent::__construct($st, $args);
     // $args[0] will be our filename
     if (!isset($args[0])) {
         throw new E5xx_ActionFailed(__METHOD__, "Param #0 needs to be the name of the file to work with");
     }
 }
Ejemplo n.º 5
0
 public function __construct(StoryTeller $st, $args = array())
 {
     // call the parent constructor
     parent::__construct($st, $args);
     // $args[0] contains the hostname of our Zookeeper server
     $this->host = $args[0];
     // connect to zookeeper
     $this->zk = $this->connect($this->host);
 }
 public function __construct(StoryTeller $st, $args)
 {
     // call our parent
     parent::__construct($st, $args);
     // $args[0] should be our provisioning block
     if (!isset($args[0]) || !$args[0] instanceof ProvisioningDefinition) {
         throw new E5xx_ActionFailed(__METHOD__, "Param #0 must be a ProvisioningDefinition object");
     }
 }
Ejemplo n.º 7
0
 public function __construct(StoryTeller $st, $params = array())
 {
     // call our parent
     parent::__construct($st, $params);
     // get the SauceLabs auth details
     // they are part of the test device details available from $st
     $deviceDetails = $st->getDeviceDetails();
     // remember the auth details
     $this->sauceLabsUsername = $deviceDetails->saucelabs->username;
     $this->sauceLabsAccessKey = $deviceDetails->saucelabs->accesskey;
 }
 public function __construct(StoryTeller $st, $args)
 {
     // call our parent
     parent::__construct($st, $args);
     // $args[0] should contain the name of a valid provisioning helper
     if (!isset($args[0])) {
         throw new E5xx_ActionFailed(__METHOD__, "Param #0 must be the name of the provisioning engine you want to use");
     }
     // remember the provisioner for later
     $this->adapter = ProvisioningLib::getProvisioner($st, $args[0]);
 }
Ejemplo n.º 9
0
 public function __construct(Storyteller $st, $params = [])
 {
     // make sure we have a ZMQContext
     //
     // $params[0] is null when we need to create a ZMQContext
     if (!isset($params[0])) {
         $params[0] = new ZMQContext();
     }
     // now we're ready to call the parent constructor
     parent::__construct($st, $params);
 }
Ejemplo n.º 10
0
 public function __construct(StoryTeller $st, $args)
 {
     // call our parent first
     parent::__construct($st, $args);
     // make sure we have a Redis connection
     if (!isset($args[0])) {
         throw new E5xx_ActionFailed(__METHOD__, "param #1 needs to be a valid Redis connection");
     }
     if (!$args[0] instanceof PredisClient) {
         throw new E5xx_ActionFailed(__METHOD__, "param #1 needs to be an instance of Predis\\Client");
     }
 }
Ejemplo n.º 11
0
 public function __construct($st, $args)
 {
     // call our parent first
     parent::__construct($st, $args);
     // make sure we have a PDO connection to use
     if (!isset($this->args[0])) {
         throw new E5xx_ActionFailed(__METHOD__, "param #1 must be a valid PDO connection");
     }
     if (!$this->args[0] instanceof PDO) {
         throw new E5xx_ActionFailed(__METHOD__, "param #1 must be an instance of PDO");
     }
 }
Ejemplo n.º 12
0
 /**
  * __construct
  *
  * @param StoryTeller $st The StoryTeller object
  * @param array $args Any arguments to be used in this Prose module
  *
  * @return parent::__construct
  */
 public function __construct(StoryTeller $st, $args = array())
 {
     if (!isset($args[0])) {
         throw new E4xx_MissingArgument(__METHOD__, "You must provide a table name to " . get_class($this) . "::__construct");
     }
     // normalise
     //
     // in Storyplayer v1.x, we used ucfirst(), but on reflection,
     // I strongly prefer lcfirst() now that we've introduced support
     // for retrieving data via the template engine
     $args[0] = lcfirst($args[0]);
     return parent::__construct($st, $args);
 }
Ejemplo n.º 13
0
 public function __construct($st, $args)
 {
     parent::__construct($st, $args);
     if (!isset($args[0])) {
         throw new E5xx_ActionFailed(__METHOD__, "param 1 must be the host of the MySQL server");
     }
     if (!isset($args[1])) {
         throw new E5xx_ActionFailed(__METHOD__, "param 2 must be the MySQL user to use");
     }
     if (!isset($args[2])) {
         throw new E5xx_ActionFailed(__METHOD__, "param 2 must be the password for the MySQL user");
     }
 }
Ejemplo n.º 14
0
 public function __construct(StoryTeller $st, $params = array())
 {
     // call our parent
     parent::__construct($st, $params);
     // get the VM details from the hosts table
     $this->vmDetails = fromHostsTable()->getDetailsForHost($params[0]);
     if ($this->vmDetails) {
         // remember the name of this VM
         $this->instanceName = $this->vmDetails->ec2Name;
         // get the data about the instance from EC2
         $this->instance = fromEc2()->getInstance($this->instanceName);
         // add the instance data to the vmDetails too, to keep that
         // up to date
         $this->vmDetails->ec2Instance = $this->instance;
     }
 }
Ejemplo n.º 15
0
 public function __construct(StoryTeller $st, $args = array())
 {
     // call the parent constructor
     parent::__construct($st, $args);
 }
Ejemplo n.º 16
0
 /**
  * __construct
  *
  * @param StoryTeller $st The StoryTeller object
  * @param array $args Any arguments to be used in this Prose module
  *
  * @return parent::__construct
  */
 public function __construct(StoryTeller $st, $args = array())
 {
     // The key of the entry we're working with
     $this->key = $args[0];
     return parent::__construct($st, $args);
 }
Ejemplo n.º 17
0
 /**
  * DO NOT TYPEHINT $response!!
  *
  * Although it is extra work for us, if we use typehinting here, then
  * we get a failure in the PHP engine (which is harder to handle).
  * It's currently considered to be better if we detect the error
  * ourselves.
  *
  * @param StoryTeller $st       [description]
  */
 public function __construct(StoryTeller $st, $params)
 {
     // do we HAVE a valid response?
     if (!isset($params[0])) {
         throw new E5xx_ExpectFailed(__METHOD__, "HttpClientResponse object", "missing object");
     }
     $response = $params[0];
     if (!is_object($response)) {
         throw new E5xx_ExpectFailed(__METHOD__, "HttpClientResponse object", gettype($response));
     }
     if (!$response instanceof HttpClientResponse) {
         throw new E5xx_ExpectFailed(__METHOD__, "HttpClientResponse object", get_class($response));
     }
     // call our parent constructor
     parent::__construct($st, array($response));
 }