Exemplo n.º 1
0
 /**
  * Constructs a new context with the specified parameters.
  *
  * @param array $args {<br/>
  *      **username**: (optional) The username to login with. Defaults to 
  *                    "admin".<br/>
  *      **password**: (optional) The password to login with. Defaults to 
  *                    "changeme".<br/>
  *      **token**: (optional) The authentication token to use. If provided,
  *                 the username and password are ignored and there is no
  *                 need to call login(). In the format "Splunk SESSION_KEY".
  *                 <br/>
  *      **host**: (optional) The hostname of the Splunk server. Defaults to 
  *                "localhost".<br/>
  *      **port**: (optional) The port of the Splunk server. Defaults to 
  *                8089.<br/>
  *      **scheme**: (optional) The scheme to use: either "http" or "https". 
  *                  Defaults to "https".<br/>
  *      **namespace**: (optional) Namespace that all object lookups will 
  *                     occur in by default. Defaults to 
  *                     `Splunk_Namespace::createDefault()`.<br/>
  *      **http**: (optional) An Http object that will be used for 
  *                performing HTTP requests. This is intended for testing 
  *                only.<br/>
  * }
  */
 public function __construct($args = array())
 {
     $args = array_merge(array('username' => 'admin', 'password' => 'changeme', 'token' => NULL, 'host' => 'localhost', 'port' => 8089, 'scheme' => 'https', 'namespace' => Splunk_Namespace::createDefault(), 'http' => new Splunk_Http()), $args);
     $this->username = $args['username'];
     $this->password = $args['password'];
     $this->token = $args['token'];
     $this->host = $args['host'];
     $this->port = $args['port'];
     $this->scheme = $args['scheme'];
     $this->namespace = $args['namespace'];
     $this->http = $args['http'];
 }
Exemplo n.º 2
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testCreateDefaultWithTooManyArguments()
 {
     Splunk_Namespace::createDefault('theowner');
 }