Skip to content

Commit

Permalink
Merge pull request #440 from UNC-Libraries/code4
Browse files Browse the repository at this point in the history
CODE 4
  • Loading branch information
daines committed Jan 6, 2016
2 parents 4c7cd64 + 886297f commit f78cec4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ private void setEmbargoUntil(Model model, Resource primaryResource, Element data

if ("2".equals(embargoCode))
embargoEnd = embargoEnd.plusYears(1);
else if ("3".equals(embargoCode))
else if ("3".equals(embargoCode) || "4".equals(embargoCode))
embargoEnd = embargoEnd.plusYears(2);
else
embargoEnd = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,28 @@ public void testEmbargoInactive() {
DateTimeUtils.setCurrentMillisSystem();
}

@Test
public void testLongEmbargoed() {
// Forever 2014, as far as this test is concerned
DateTime newTime = new DateTime(2014, 5, 5, 0, 0, 0, 0);
DateTimeUtils.setCurrentMillisFixed(newTime.getMillis());

copyTestPackage("src/test/resources/proquest-embargo-code4.zip", job);

job.run();

Model model = job.getWritableModel();
Bag depositBag = model.getBag(job.getDepositPID().getURI());
Resource primaryResource = (Resource) depositBag.iterator().next();

Property embargoUntilP = cdrprop(model, embargoUntil);
String embargoValue = primaryResource.getProperty(embargoUntilP).getString();
assertEquals("Embargo value did not match the expected valued", "2016-05-05T00:00:00", embargoValue);

// Restore the system clock
DateTimeUtils.setCurrentMillisSystem();
}

@Test
public void testMultiplePackages() throws Exception {
copyTestPackage("src/test/resources/proquest-noattach.zip", job);
Expand Down
Binary file not shown.

0 comments on commit f78cec4

Please sign in to comment.