Skip to content

Commit

Permalink
Added OracleObject Storage adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
SaketKaswa20 committed Oct 5, 2023
1 parent 1ff8f72 commit 3c17bfa
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/Storage/Device/OracleObject.php
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;
}
}
2 changes: 2 additions & 0 deletions src/Storage/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Storage

const DEVICE_LINODE = 'linode';

const DEVICE_ORACLEOBJECT = 'oracleobject';

/**
* Devices.
*
Expand Down
55 changes: 55 additions & 0 deletions tests/Storage/Device/OracleObjectTest.php
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);
}
}

0 comments on commit 3c17bfa

Please sign in to comment.