Skip to content

Commit

Permalink
Merge pull request #24816 from nextcloud/techdept/dead-packages
Browse files Browse the repository at this point in the history
Drop all dead packages
  • Loading branch information
juliusknorr authored Dec 23, 2020
2 parents 6846a83 + 1e0eaa2 commit 5b61120
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 90 deletions.
2 changes: 1 addition & 1 deletion 3rdparty
Submodule 3rdparty updated 187 files
10 changes: 1 addition & 9 deletions apps/federation/lib/BackgroundJob/GetSharedSecret.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Ring\Exception\RingException;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
Expand Down Expand Up @@ -191,14 +190,7 @@ protected function run($argument) {
'level' => ILogger::INFO,
'app' => 'federation',
]);
} catch (RingException $e) {
$status = -1; // There is no status code if we could not connect
$this->logger->logException($e, [
'message' => 'Could not connect to ' . $target,
'level' => ILogger::INFO,
'app' => 'federation',
]);
} catch (\Exception $e) {
} catch (\Throwable $e) {
$status = Http::STATUS_INTERNAL_SERVER_ERROR;
$this->logger->logException($e, ['app' => 'federation']);
}
Expand Down
6 changes: 1 addition & 5 deletions apps/federation/lib/BackgroundJob/RequestSharedSecret.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Ring\Exception\RingException;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
Expand Down Expand Up @@ -184,10 +183,7 @@ protected function run($argument) {
} catch (RequestException $e) {
$status = -1; // There is no status code if we could not connect
$this->logger->info('Could not connect to ' . $target, ['app' => 'federation']);
} catch (RingException $e) {
$status = -1; // There is no status code if we could not connect
$this->logger->info('Could not connect to ' . $target, ['app' => 'federation']);
} catch (\Exception $e) {
} catch (\Throwable $e) {
$status = Http::STATUS_INTERNAL_SERVER_ERROR;
$this->logger->logException($e, ['app' => 'federation']);
}
Expand Down
38 changes: 0 additions & 38 deletions apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
namespace OCA\Federation\Tests\BackgroundJob;

use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Ring\Exception\RingException;
use OCA\Federation\BackgroundJob\GetSharedSecret;
use OCA\Federation\TrustedServers;
use OCA\Files_Sharing\Tests\TestCase;
Expand Down Expand Up @@ -298,41 +297,4 @@ public function testRunConnectionError() {

$this->assertTrue($this->invokePrivate($this->getSharedSecret, 'retainJob'));
}

public function testRunRingException() {
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';

$argument = ['url' => $target, 'token' => $token];

$this->timeFactory->method('getTime')
->willReturn(42);

$this->urlGenerator
->expects($this->once())
->method('getAbsoluteURL')
->with('/')
->willReturn($source);
$this->httpClient->expects($this->once())->method('get')
->with(
$target . '/ocs/v2.php/apps/federation/api/v1/shared-secret',
[
'query' =>
[
'url' => $source,
'token' => $token,
'format' => 'json',
],
'timeout' => 3,
'connect_timeout' => 3,
]
)->willThrowException($this->createMock(RingException::class));

$this->trustedServers->expects($this->never())->method('addSharedSecret');

$this->invokePrivate($this->getSharedSecret, 'run', [$argument]);

$this->assertTrue($this->invokePrivate($this->getSharedSecret, 'retainJob'));
}
}
37 changes: 0 additions & 37 deletions apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
namespace OCA\Federation\Tests\BackgroundJob;

use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Ring\Exception\RingException;
use OCA\Federation\BackgroundJob\RequestSharedSecret;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
Expand Down Expand Up @@ -279,40 +278,4 @@ public function testRunConnectionError() {
$this->invokePrivate($this->requestSharedSecret, 'run', [$argument]);
$this->assertTrue($this->invokePrivate($this->requestSharedSecret, 'retainJob'));
}

public function testRunRingException() {
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';

$argument = ['url' => $target, 'token' => $token];

$this->timeFactory->method('getTime')->willReturn(42);

$this->urlGenerator
->expects($this->once())
->method('getAbsoluteURL')
->with('/')
->willReturn($source);

$this->httpClient
->expects($this->once())
->method('post')
->with(
$target . '/ocs/v2.php/apps/federation/api/v1/request-shared-secret',
[
'body' =>
[
'url' => $source,
'token' => $token,
'format' => 'json',
],
'timeout' => 3,
'connect_timeout' => 3,
]
)->willThrowException($this->createMock(RingException::class));

$this->invokePrivate($this->requestSharedSecret, 'run', [$argument]);
$this->assertTrue($this->invokePrivate($this->requestSharedSecret, 'retainJob'));
}
}

0 comments on commit 5b61120

Please sign in to comment.