public function tearDown() { // Delete local files $finder = new Finder(); $fs = new Filesystem(); $fs->remove($finder->files()->in($this->tmpDir . "/download")); $fs->remove($finder->files()->in($this->tmpDir)); $fs->remove($this->tmpDir . "/download"); $fs->remove($this->tmpDir); // Delete file uploads $options = new ListFilesOptions(); $options->setTags(["docker-bundle-test"]); $files = $this->client->listFiles($options); foreach ($files as $file) { $this->client->deleteFile($file["id"]); } if ($this->client->bucketExists("in.c-docker-test")) { // Delete tables foreach ($this->client->listTables("in.c-docker-test") as $table) { $this->client->dropTable($table["id"]); } // Delete bucket $this->client->dropBucket("in.c-docker-test"); } if ($this->client->bucketExists("in.c-docker-test-redshift")) { // Delete tables foreach ($this->client->listTables("in.c-docker-test-redshift") as $table) { $this->client->dropTable($table["id"]); } // Delete bucket $this->client->dropBucket("in.c-docker-test-redshift"); } }
/** * Remove account * * @param $accountId */ public function removeAccount($accountId) { $tableId = $this->getSysBucketId() . '.' . $accountId; if ($this->storageApi->tableExists($tableId)) { $this->storageApi->dropTable($tableId); } unset($this->accounts[$accountId]); }
/** * @throws \Exception * @throws \Keboola\StorageApi\ClientException */ protected function clearBucket() { // Delete tables and bucket if ($this->client->bucketExists("out.c-tde-test")) { foreach ($this->client->listTables("out.c-tde-test") as $table) { $this->client->dropTable($table["id"]); } // Delete bucket $this->client->dropBucket("out.c-tde-test"); } }
protected function setUp() { self::$client = static::createClient(); $this->container = self::$client->getContainer(); $sapiToken = $this->container->getParameter('storage_api.test.token'); $sapiUrl = $this->container->getParameter('storage_api.test.url'); self::$client->setServerParameters(array('HTTP_X-StorageApi-Token' => $sapiToken)); $this->storageApi = new SapiClient(['token' => $sapiToken, 'url' => $sapiUrl, 'userAgent' => 'ex-db']); $this->manager = new Manager($this->storageApi, $this->componentName); // Cleanup $sysBucketId = $this->manager->getSysBucketId(); $accTables = $this->storageApi->listTables($sysBucketId); foreach ($accTables as $table) { $this->storageApi->dropTable($table['id']); } }
public function deleteTable($writerId, $id) { $table = $this->tableFactory->get($writerId, $id); try { $this->storageApi->dropTable($table->getId()); } catch (ClientException $e) { // table already deleted } }
public function deleteAccount($accountId) { $tableId = $this->getSysBucketId() . '.' . $accountId; try { $this->storageApi->dropTable($tableId); } catch (ClientException $e) { // table probably dont exists anymore throw new UserException($e->getMessage()); } }
protected function setUp() { self::$client = static::createClient(); $container = self::$client->getContainer(); $sapiToken = $container->getParameter('storage_api.test.token'); $sapiUrl = $container->getParameter('storage_api.test.url'); self::$client->setServerParameters(array('HTTP_X-StorageApi-Token' => $sapiToken)); $this->storageApi = new SapiClient(['token' => $sapiToken, 'url' => $sapiUrl, 'userAgent' => $this->componentName]); $this->encryptor = $container->get('syrup.encryptor'); $this->configuration = $container->get('ex_google_drive.configuration'); $this->configuration->setStorageApi($this->storageApi); try { $this->configuration->create(); } catch (\Exception $e) { // bucket exists } // Cleanup $sysBucketId = $this->configuration->getSysBucketId(); $tableId = $sysBucketId . '.' . $this->accountId; if ($this->storageApi->tableExists($tableId)) { $this->storageApi->dropTable($tableId); } }
protected function setUp($driver = null) { self::$client = static::createClient(); $this->container = self::$client->getContainer(); $sapiToken = $this->container->getParameter('storage_api.test.token'); $sapiUrl = $this->container->getParameter('storage_api.test.url'); self::$client->setServerParameters(['HTTP_X-StorageApi-Token' => $sapiToken]); $this->storageApi = new SapiClient(['token' => $sapiToken, 'url' => $sapiUrl, 'userAgent' => $this->componentName]); if ($driver != null) { $this->configuration = new Configuration($this->componentName . '-' . $driver, $this->storageApi, $driver); } else { $this->configuration = new Configuration($this->componentName, $this->storageApi); } // Cleanup $sysBucketId = $this->configuration->getSysBucketId($this->writerId); if ($this->storageApi->bucketExists($sysBucketId)) { $accTables = $this->storageApi->listTables($sysBucketId); foreach ($accTables as $table) { $this->storageApi->dropTable($table['id']); } $this->storageApi->dropBucket($sysBucketId); } }