예제 #1
0
 /**
  * Tests provision request
  */
 public function testProvision()
 {
     $_instanceId = 'bender';
     /** @var Instance $_instance */
     if (null !== ($_instance = Instance::byNameOrId($_instanceId)->first())) {
         $_instance->delete();
     }
     $_payload = ['instance-id' => $_instanceId, 'owner-id' => '*****@*****.**', 'guest-location' => GuestLocations::DFE_CLUSTER];
     \Artisan::call('dfe:provision', $_payload);
 }
 /**
  * Tests provision request
  */
 public function testProvision()
 {
     $_instanceId = 'dfe-test-case';
     $_payload = ['instance-id' => $_instanceId, 'owner-id' => 1, 'guest-location' => GuestLocations::DFE_CLUSTER];
     /** @var Instance $_instance */
     if (null !== ($_instance = Instance::byNameOrId($_instanceId)->first())) {
         $_instance->delete();
     }
     $_job = new ProvisionJob($_instanceId, $_payload);
     $_result = \Queue::push($_job);
 }
예제 #3
0
 /**
  * Tests provision request
  */
 public function testImport()
 {
     $_instanceId = 'jablan';
     $_snapshotId = '20150824141112.jablan';
     try {
         Instance::byNameOrId($_instanceId)->firstOrFail();
         throw new \RuntimeException('The instance "' . $_instanceId . '" already exists.');
     } catch (ModelNotFoundException $_ex) {
         //  Good
     }
     $_payload = ['instance-id' => $_instanceId, 'snapshot' => $_snapshotId, 'owner-id' => 1, '--owner-type' => OwnerTypes::USER, '--snapshot-id' => true];
     $_result = \Artisan::call('dfe:import', $_payload);
 }
예제 #4
0
 /**
  * @param string|Instance $instanceId
  *
  * @return \DreamFactory\Enterprise\Database\Models\Instance
  * @throws \DreamFactory\Enterprise\Database\Exceptions\InstanceNotFoundException
  */
 protected function _validateInstance($instanceId)
 {
     if ($instanceId instanceof Instance) {
         return $instanceId;
     }
     if ($instanceId instanceof InstanceAware) {
         return $instanceId->getInstance();
     }
     if (!is_string($instanceId)) {
         throw new InstanceNotFoundException($instanceId);
     }
     try {
         $instanceId = Instance::sanitizeName($instanceId);
         return Instance::byNameOrId($instanceId)->firstOrFail();
     } catch (\Exception $_ex) {
         throw new InstanceNotFoundException($instanceId);
     }
 }
 /**
  * @param int|string $instanceId
  *
  * @return Instance
  */
 protected static function _lookupInstance($instanceId)
 {
     return Instance::byNameOrId($instanceId)->firstOrFail();
 }