From 1e0eaa25d071c87e273cc9e6fc3dc3eaf5c84fd3 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 22 Dec 2020 16:29:38 +0100 Subject: [PATCH] Drop all dead packages Apparently we have plenty of leftover of previous sub-dependencies. Composer automatically dumps those with any future dependency update, so I'm dropping them in an atomic step. Signed-off-by: Christoph Wurst --- 3rdparty | 2 +- .../lib/BackgroundJob/GetSharedSecret.php | 10 +---- .../lib/BackgroundJob/RequestSharedSecret.php | 6 +-- .../BackgroundJob/GetSharedSecretTest.php | 38 ------------------- .../BackgroundJob/RequestSharedSecretTest.php | 37 ------------------ 5 files changed, 3 insertions(+), 90 deletions(-) diff --git a/3rdparty b/3rdparty index 27a56c5bb9d0e..82d0c23acdce4 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 27a56c5bb9d0ec514a8fb22044fd5f03a51ea2a5 +Subproject commit 82d0c23acdce40f7b1ef3201aaff0a506b3d6129 diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php index 9390b047a9113..875f35899d7e7 100644 --- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php @@ -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; @@ -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']); } diff --git a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php index c9bee9fa6be99..1f801eec5697f 100644 --- a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php @@ -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; @@ -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']); } diff --git a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php index 7bd9208136b19..6da3ba6894073 100644 --- a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php @@ -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; @@ -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')); - } } diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php index cb912d1676bdb..f03c5aa2a2b89 100644 --- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php @@ -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; @@ -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')); - } }