-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media versioning #96
Media versioning #96
Conversation
… a helper method for getting the file from the media, flesh out the method for creating a media version
…andora#92) Bumps [symfony/http-foundation](https://github.com/symfony/http-foundation) from 3.4.30 to 3.4.36. - [Release notes](https://github.com/symfony/http-foundation/releases) - [Changelog](https://github.com/symfony/http-foundation/blob/master/CHANGELOG.md) - [Commits](symfony/http-foundation@v3.4.30...v3.4.36) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ndora#94) Bumps [symfony/http-foundation](https://github.com/symfony/http-foundation) from 3.4.30 to 3.4.36. - [Release notes](https://github.com/symfony/http-foundation/releases) - [Changelog](https://github.com/symfony/http-foundation/blob/master/CHANGELOG.md) - [Commits](symfony/http-foundation@v3.4.30...v3.4.36) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ora#91) Bumps [symfony/http-foundation](https://github.com/symfony/http-foundation) from 3.4.30 to 3.4.36. - [Release notes](https://github.com/symfony/http-foundation/releases) - [Changelog](https://github.com/symfony/http-foundation/blob/master/CHANGELOG.md) - [Commits](symfony/http-foundation@v3.4.30...v3.4.36) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ora#101) Bumps [symfony/http-foundation](https://github.com/symfony/http-foundation) from 3.4.30 to 3.4.38. - [Release notes](https://github.com/symfony/http-foundation/releases) - [Changelog](https://github.com/symfony/http-foundation/blob/master/CHANGELOG.md) - [Commits](symfony/http-foundation@v3.4.30...v3.4.38) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…dora#98) Bumps [symfony/http-foundation](https://github.com/symfony/http-foundation) from 3.4.30 to 3.4.38. - [Release notes](https://github.com/symfony/http-foundation/releases) - [Changelog](https://github.com/symfony/http-foundation/blob/master/CHANGELOG.md) - [Commits](symfony/http-foundation@v3.4.30...v3.4.38) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than some small things, this looks like a good little refactor. We'll have to sort out what's up with tests, too, but I'm 👍 to this.
{ | ||
$token = $request->headers->get("Authorization", null); | ||
try { | ||
$this->log->info("in create Node version with " . $uuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would delete this or set the level to debug.
{ | ||
$token = $request->headers->get("Authorization", null); | ||
try { | ||
$this->log->info("in create Node version with " . $uuid); | ||
$urls = $this->milliner->getGeminiUrls($uuid, $token); | ||
$this->log->info($urls); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would delete these two lines or set the levels to debug.
$json_url = $request->headers->get("Content-Location"); | ||
|
||
if (empty($json_url)) { | ||
$this->log->info("json url is EMPTY"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use error instead of info here
$this->log->info("json url is EMPTY"); | ||
return new Response("Expected JSON url in Content-Location header", 400); | ||
} else { | ||
$this->log->info("json url is" . $json_url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make this debug or delete it
$timestamp, | ||
null, | ||
$headers | ||
$this->log->error("the fedora url in service is " . $fedora_url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make this debug or delete it.
404 | ||
); | ||
} | ||
return array('fedora'=>$urls['fedora'], 'jsonld' =>$jsonld_url, 'drupal'=>$urls['drupal']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate myself for nitpicking on this, but you should use []
instead of array
here
Hrm... Chullo is out of date at 30f13e7 according to the composer install output from Travis, but it is recent enough to contain versioning. It's not a bad idea to run |
… a helper method for getting the file from the media, flesh out the method for creating a media version
…method in the service instead
…ayfish into media_versioning
I might need some help with the tests here: https://travis-ci.com/github/Islandora/Crayfish/jobs/382853022 |
Because you refactored and added the diff --git a/Milliner/tests/Islandora/Milliner/Tests/MillinerControllerTest.php b/Milliner/tests/Islandora/Milliner/Tests/MillinerControllerTest.php
index 09b9e74..e28e5f9 100644
--- a/Milliner/tests/Islandora/Milliner/Tests/MillinerControllerTest.php
+++ b/Milliner/tests/Islandora/Milliner/Tests/MillinerControllerTest.php
@@ -48,12 +48,16 @@ class MillinerControllerTest extends TestCase
$milliner = $this->prophesize(MillinerServiceInterface::class);
$milliner->saveNode(Argument::any(), Argument::any(), Argument::any(), Argument::any())
->willThrow(new \Exception("Forbidden", 403));
+ $milliner->getFileFromMedia(Argument::any(), Argument::any(), Argument::any())
+ ->willThrow(new \Exception("Forbidden", 403));
$milliner->saveMedia(Argument::any(), Argument::any(), Argument::any())
->willThrow(new \Exception("Forbidden", 403));
$milliner->deleteNode(Argument::any(), Argument::any())
->willThrow(new \Exception("Forbidden", 403));
$milliner->saveExternal(Argument::any(), Argument::any(), Argument::any(), Argument::any())
->willThrow(new \Exception("Forbidden", 403));
+ $milliner->getGeminiUrls(Argument::any(), Argument::any())
+ ->willThrow(new \Exception("Forbidden", 403));
$milliner->createVersion(Argument::any(), Argument::any())
->willThrow(new \Exception("Forbidden", 403));
$milliner = $milliner->reveal();
@@ -473,7 +477,9 @@ class MillinerControllerTest extends TestCase
public function testCreateNodeVersionReturnsSuccessOnSuccess()
{
$milliner = $this->prophesize(MillinerServiceInterface::class);
- $milliner->createVersion(Argument::any(), Argument::any(), Argument::any(), Argument::any())
+ $milliner->getGeminiUrls(Argument::any(), Argument::any())
+ ->willReturn(['fedora' => "http://example.org/fcrepo/abc123", "drupal" => "http://example.org/node/1"]);
+ $milliner->createVersion(Argument::any(), Argument::any())
->willReturn(new Response(201));
$milliner = $milliner->reveal();
$controller = new MillinerController($milliner, $this->logger);
@@ -499,7 +505,9 @@ class MillinerControllerTest extends TestCase
);
$milliner = $this->prophesize(MillinerServiceInterface::class);
- $milliner->createVersion(Argument::any(), Argument::any(), Argument::any(), Argument::any())
+ $milliner->getGeminiUrls(Argument::any(), Argument::any())
+ ->willReturn(['fedora' => "http://example.org/fcrepo/abc123", "drupal" => "http://example.org/node/1"]);
+ $milliner->createVersion(Argument::any(), Argument::any())
->willReturn(new Response(204));
$milliner = $milliner->reveal();
$controller = new MillinerController($milliner, $this->logger); |
my hero!!! |
Codecov Report
@@ Coverage Diff @@
## dev #96 +/- ##
============================================
- Coverage 94.85% 91.87% -2.99%
- Complexity 168 175 +7
============================================
Files 9 9
Lines 700 726 +26
============================================
+ Hits 664 667 +3
- Misses 36 59 +23
Continue to review full report at Codecov.
|
GitHub Issue: (Islandora/documentation#740)
add a call to a milliner versioning endpoint for media Alpaca#70
What does this Pull Request do?
Allows Milliner to fire requests to Fedora to create versions of Media objects
What's new?
How should this be tested?
/var/www/html/Crayfish/Milliner
)Additional Notes:
This PR depends on an Alpaca PR or it will break versioning for nodes (media versioning didn't work before this point). Islandora/Alpaca#70
Interested parties
@Islandora/8-x-committers