-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fedora Docker setup updates, plus Fedora object read test
- Loading branch information
Showing
7 changed files
with
137 additions
and
24 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
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,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Policy xmlns="urn:oasis:names:tc:xacml:1.0:policy" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
PolicyId="deny-file-resolve-if-not-allowed-dir" | ||
RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable"> | ||
<Description>deny any file datastream resolution if not in FEDORA_HOME/demo/succeed</Description> | ||
<Target> | ||
<Subjects> | ||
<AnySubject/> | ||
</Subjects> | ||
<Resources> | ||
<Resource> | ||
<ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match"> | ||
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">^file:/.*$</AttributeValue> | ||
<ResourceAttributeDesignator AttributeId="urn:fedora:names:fedora:2.1:resource:datastream:fileUri" | ||
DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false" /> | ||
</ResourceMatch> | ||
</Resource> | ||
</Resources> | ||
<Actions> | ||
<Action> | ||
<ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> | ||
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">urn:fedora:names:fedora:2.1:action:id-retrieveFile</AttributeValue> | ||
<ActionAttributeDesignator DataType="http://www.w3.org/2001/XMLSchema#string" AttributeId="urn:fedora:names:fedora:2.1:action:id"/> | ||
</ActionMatch> | ||
</Action> | ||
</Actions> | ||
</Target> | ||
<Rule RuleId="1" Effect="Permit"> | ||
<Condition FunctionId="urn:oasis:names:tc:xacml:1.0:function:or"> | ||
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:regexp-string-match"> | ||
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">^file:/opt/fixtures/.*$</AttributeValue> | ||
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">s | ||
<ResourceAttributeDesignator AttributeId="urn:fedora:names:fedora:2.1:resource:datastream:fileUri" | ||
DataType="http://www.w3.org/2001/XMLSchema#string"/> | ||
</Apply> | ||
</Apply> | ||
</Condition> | ||
</Rule> | ||
<Rule RuleId="2" Effect="Deny"> | ||
</Rule> | ||
</Policy> |
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
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
require 'rails_helper' | ||
|
||
describe "Digital Object Editor UI" do | ||
|
||
before(:each) do | ||
feature_spec_sign_in_admin_user | ||
wait_for_ajax | ||
end | ||
|
||
it "can create a new Digital Object", :js => true do | ||
expect(page).to have_content 'New Digital Object' | ||
|
||
end | ||
end |
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,40 @@ | ||
require 'rails_helper' | ||
|
||
describe "Fedora content ds read tests" do | ||
describe "creating an Asset and attempting to download the bytes directly from Fedora" do | ||
let(:pid) { 'sample:123' } | ||
let(:docker_mounted_fixture_file_location) { '/opt/fixtures/files/lincoln.jpg' } | ||
|
||
it "works" do | ||
generic_resource = GenericResource.new(pid: pid) | ||
content_ds = generic_resource.create_datastream( | ||
ActiveFedora::Datastream, | ||
'content', | ||
controlGroup: 'E', | ||
mimeType: BestType.mime_type.for_file_name(docker_mounted_fixture_file_location), | ||
dsLabel: File.basename(docker_mounted_fixture_file_location), | ||
versionable: true | ||
) | ||
content_ds.dsLocation = "file://#{docker_mounted_fixture_file_location}" | ||
generic_resource.add_datastream(content_ds) | ||
|
||
generic_resource.save | ||
|
||
expect(generic_resource.datastreams['content'].dsLocation).to eq("file://#{docker_mounted_fixture_file_location}") | ||
expect(generic_resource.datastreams['content'].content.length).to be_positive | ||
end | ||
|
||
# Uncomment this "test" when debugging Fedora errors: | ||
# it "reads the fedora log to find out what went wrong", focus: true do | ||
# puts 'reading fedora log now...' | ||
# sleep 20 | ||
# puts `docker container list` | ||
# fedora_container_id = `docker container list | grep fedora | awk '{print $1}'`.strip | ||
# puts "fedora_container_id: #{fedora_container_id}" | ||
# puts `docker exec #{fedora_container_id} ls -la /opt/fedora/server/logs/fedora.log` | ||
# fedora_log_content = `docker exec #{fedora_container_id} cat /opt/fedora/server/logs/fedora.log` | ||
# puts "fedora_log_content: #{fedora_log_content}" | ||
# expect(fedora_log_content).to eq('') | ||
# end | ||
end | ||
end |