-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ff8f72
commit 3c17bfa
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Utopia\Storage\Device; | ||
|
||
use Exception; | ||
use Utopia\Storage\Device; | ||
use Utopia\Storage\Storage; | ||
|
||
class OracleObject extends Device | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected string $root = 'oracle-object'; | ||
|
||
/** | ||
* OracleObject constructor. | ||
* | ||
* @param string $root | ||
*/ | ||
public function __construct(string $root = '') | ||
{ | ||
$this->root = $root; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return 'Oracle Object Storage'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getType(): string | ||
{ | ||
return Storage::DEVICE_ORACLE_OBJECT; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDescription(): string | ||
{ | ||
return 'Adapter for Oracle Object Storage.'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getRoot(): string | ||
{ | ||
return $this->root; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Utopia\Storage\Device\OracleObject; | ||
|
||
class OracleObjectTest extends TestCase | ||
{ | ||
/** | ||
* @var OracleObject | ||
*/ | ||
private $oracleObject; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->oracleObject = new OracleObject('oracle-object-root'); | ||
} | ||
|
||
public function testUploadFileToOracleObjectStorage() | ||
{ | ||
// Implement your test for the upload method here | ||
$localFilePath = 'local_file.txt'; | ||
$remoteFilePath = 'remote_file.txt'; | ||
|
||
// Call the method you want to test | ||
$result = $this->oracleObject->uploadFileToOracleObjectStorage($localFilePath, $remoteFilePath); | ||
|
||
// Assert that the upload was successful (you can customize this assertion) | ||
$this->assertTrue($result); | ||
} | ||
|
||
public function testDownloadFileFromOracleObjectStorage() | ||
{ | ||
// Implement your test for the download method here | ||
$remoteFilePath = 'remote_file.txt'; | ||
$localFilePath = 'downloaded_file.txt'; | ||
|
||
// Call the method you want to test | ||
$result = $this->oracleObject->downloadFileFromOracleObjectStorage($remoteFilePath, $localFilePath); | ||
|
||
// Assert that the download was successful (you can customize this assertion) | ||
$this->assertTrue($result); | ||
} | ||
|
||
public function testDeleteFileFromOracleObjectStorage() | ||
{ | ||
// Implement your test for the delete method here | ||
$remoteFilePath = 'remote_file.txt'; | ||
|
||
// Call the method you want to test | ||
$result = $this->oracleObject->deleteFileFromOracleObjectStorage($remoteFilePath); | ||
|
||
// Assert that the delete was successful (you can customize this assertion) | ||
$this->assertTrue($result); | ||
} | ||
} |