-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #107 - added support for repeatable to bag profile conformance c…
…hecker
- Loading branch information
1 parent
304d666
commit 39654ff
Showing
15 changed files
with
131 additions
and
39 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
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
14 changes: 14 additions & 0 deletions
14
...v/loc/repository/bagit/exceptions/conformance/MetatdataValueIsNotRepeatableException.java
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,14 @@ | ||
package gov.loc.repository.bagit.exceptions.conformance; | ||
|
||
import org.slf4j.helpers.MessageFormatter; | ||
|
||
/** | ||
* Class to represent when a metadata's value is not to be repeated | ||
*/ | ||
public class MetatdataValueIsNotRepeatableException extends Exception { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public MetatdataValueIsNotRepeatableException(final String message, final String metadataKey) { | ||
super(MessageFormatter.format(message, metadataKey).getMessage()); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -11,23 +11,36 @@ public class BagitProfileTest extends AbstractBagitProfileTest{ | |
@Test | ||
public void testToString() throws Exception{ | ||
String expectedOutput = "BagitProfile [bagitProfileIdentifier=http://canadiana.org/standards/bagit/tdr_ingest.json, " | ||
+ "sourceOrganization=Candiana.org, externalDescription=BagIt profile for ingesting content into the C.O. TDR " | ||
+ "loading dock., contactName=William Wueppelmann, [email protected], version=1.2, " | ||
+ "bagInfoRequirements={Payload-Oxum=[required=true, acceptableValues=[]], Bag-Size=[required=true, " | ||
+ "acceptableValues=[]], Bagging-Date=[required=true, acceptableValues=[]], Source-Organization=[required=true, " | ||
+ "acceptableValues=[Simon Fraser University, York University]], Bag-Count=[required=true, acceptableValues=[]], " | ||
+ "Organization-Address=[required=true, acceptableValues=[8888 University Drive Burnaby, B.C. V5A 1S6 Canada, " | ||
+ "4700 Keele Street Toronto, Ontario M3J 1P3 Canada]], Bag-Group-Identifier=[required=false, " | ||
+ "acceptableValues=[]], External-Identifier=[required=false, acceptableValues=[]], " | ||
+ "Internal-Sender-Identifier=[required=false, acceptableValues=[]], Contact-Email=[required=true, " | ||
+ "acceptableValues=[]], Contact-Phone=[required=false, acceptableValues=[]], " | ||
+ "Internal-Sender-Description=[required=false, acceptableValues=[]], External-Description=[required=true, " | ||
+ "acceptableValues=[]], Contact-Name=[required=true, acceptableValues=[Mark Jordan, Nick Ruest]]}, " | ||
+ "manifestTypesRequired=[md5], fetchFileAllowed=false, serialization=forbidden, " | ||
+ "acceptableMIMESerializationTypes=[application/zip], acceptableBagitVersions=[0.96], " | ||
+ "tagManifestTypesRequired=[md5], tagFilesRequired=[DPN/dpnFirstNode.txt, DPN/dpnRegistry]]"; | ||
+ "sourceOrganization=Candiana.org, " | ||
+ "externalDescription=BagIt profile for ingesting content into the C.O. TDR loading dock., " | ||
+ "contactName=William Wueppelmann, " | ||
+ "[email protected], " | ||
+ "version=1.2, " | ||
+ "bagInfoRequirements={" | ||
+ "Payload-Oxum=[required=true, acceptableValues=[], repeatable=false], " | ||
+ "Bag-Size=[required=true, acceptableValues=[], repeatable=false], " | ||
+ "Bagging-Date=[required=true, acceptableValues=[], repeatable=false], " | ||
+ "Source-Organization=[required=true, acceptableValues=[Simon Fraser University, York University], repeatable=false], " | ||
+ "Bag-Count=[required=true, acceptableValues=[], repeatable=false], " | ||
+ "Organization-Address=[required=true, acceptableValues=[8888 University Drive Burnaby, B.C. V5A 1S6 Canada, 4700 Keele Street Toronto, Ontario M3J 1P3 Canada], repeatable=false], " | ||
+ "Bag-Group-Identifier=[required=false, acceptableValues=[], repeatable=false], " | ||
+ "External-Identifier=[required=false, acceptableValues=[], repeatable=false], " | ||
+ "Internal-Sender-Identifier=[required=false, acceptableValues=[], repeatable=false], " | ||
+ "Contact-Email=[required=true, acceptableValues=[], repeatable=false], " | ||
+ "Contact-Phone=[required=false, acceptableValues=[], repeatable=false], " | ||
+ "Internal-Sender-Description=[required=false, acceptableValues=[], repeatable=false], " | ||
+ "External-Description=[required=true, acceptableValues=[], repeatable=false], " | ||
+ "Contact-Name=[required=true, acceptableValues=[Mark Jordan, Nick Ruest], repeatable=false]}, " | ||
+ "manifestTypesRequired=[md5], " | ||
+ "fetchFileAllowed=false, " | ||
+ "serialization=forbidden, " | ||
+ "acceptableMIMESerializationTypes=[application/zip], " | ||
+ "acceptableBagitVersions=[0.96], " | ||
+ "tagManifestTypesRequired=[md5], " | ||
+ "tagFilesRequired=[DPN/dpnFirstNode.txt, DPN/dpnRegistry]]"; | ||
|
||
BagitProfile profile = mapper.readValue(new File("src/test/resources/bagitProfiles/exampleProfile.json"), BagitProfile.class); | ||
System.err.println(profile.toString()); | ||
assertEquals(expectedOutput, profile.toString()); | ||
} | ||
|
||
|
1 change: 1 addition & 0 deletions
1
src/test/resources/bagitProfileTestBags/repeatedMetadataBag/DPN/dpnFirstNode.txt
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 @@ | ||
foo |
1 change: 1 addition & 0 deletions
1
src/test/resources/bagitProfileTestBags/repeatedMetadataBag/DPN/dpnRegistry
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 @@ | ||
bar |
11 changes: 11 additions & 0 deletions
11
src/test/resources/bagitProfileTestBags/repeatedMetadataBag/bag-info.txt
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,11 @@ | ||
Bag-Software-Agent: bagit.py v1.5.4 <http://github.com/libraryofcongress/bagit-python> | ||
Bagging-Date: 2017-01-30 | ||
Bagging-Date: 2017-01-30 | ||
Payload-Oxum: 6.1 | ||
Source-Organization: York University | ||
Organization-Address: 4700 Keele Street Toronto, Ontario M3J 1P3 Canada | ||
Contact-Name: Nick Ruest | ||
Contact-Email: [email protected] | ||
External-Description: description here | ||
Bag-Size: 6kb | ||
Bag-Count: 1 of 1 |
2 changes: 2 additions & 0 deletions
2
src/test/resources/bagitProfileTestBags/repeatedMetadataBag/bagit.txt
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,2 @@ | ||
BagIt-Version: 0.96 | ||
Tag-File-Character-Encoding: UTF-8 |
1 change: 1 addition & 0 deletions
1
src/test/resources/bagitProfileTestBags/repeatedMetadataBag/data/hello.txt
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 @@ | ||
hello |
1 change: 1 addition & 0 deletions
1
src/test/resources/bagitProfileTestBags/repeatedMetadataBag/manifest-md5.txt
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 @@ | ||
b1946ac92492d2347c6235b4d2611184 data/hello.txt |
3 changes: 3 additions & 0 deletions
3
src/test/resources/bagitProfileTestBags/repeatedMetadataBag/tagmanifest-md5.txt
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,3 @@ | ||
55760904ab1799e2c61d438a6c44a013 bag-info.txt | ||
ace0ef9419c8edbe164a888d4e4ab7ee bagit.txt | ||
4cf73cc2586a3e8c3c118e1de8970675 manifest-md5.txt |
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