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"); } }
/** * @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']); } }
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); } }
public function getWriterTables($writerId) { return $this->storageApi->listTables($this->getSysBucketId($writerId)); }