Skip to content

Commit f78cec4

Browse files
committed
Merge pull request #440 from UNC-Libraries/code4
CODE 4
2 parents 4c7cd64 + 886297f commit f78cec4

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Diff for: deposit/src/main/java/edu/unc/lib/deposit/normalize/Proquest2N3BagJob.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ private void setEmbargoUntil(Model model, Resource primaryResource, Element data
364364

365365
if ("2".equals(embargoCode))
366366
embargoEnd = embargoEnd.plusYears(1);
367-
else if ("3".equals(embargoCode))
367+
else if ("3".equals(embargoCode) || "4".equals(embargoCode))
368368
embargoEnd = embargoEnd.plusYears(2);
369369
else
370370
embargoEnd = null;

Diff for: deposit/src/test/java/edu/unc/lib/deposit/normalize/Proquest2N3BagJobTest.java

+22
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,28 @@ public void testEmbargoInactive() {
272272
DateTimeUtils.setCurrentMillisSystem();
273273
}
274274

275+
@Test
276+
public void testLongEmbargoed() {
277+
// Forever 2014, as far as this test is concerned
278+
DateTime newTime = new DateTime(2014, 5, 5, 0, 0, 0, 0);
279+
DateTimeUtils.setCurrentMillisFixed(newTime.getMillis());
280+
281+
copyTestPackage("src/test/resources/proquest-embargo-code4.zip", job);
282+
283+
job.run();
284+
285+
Model model = job.getWritableModel();
286+
Bag depositBag = model.getBag(job.getDepositPID().getURI());
287+
Resource primaryResource = (Resource) depositBag.iterator().next();
288+
289+
Property embargoUntilP = cdrprop(model, embargoUntil);
290+
String embargoValue = primaryResource.getProperty(embargoUntilP).getString();
291+
assertEquals("Embargo value did not match the expected valued", "2016-05-05T00:00:00", embargoValue);
292+
293+
// Restore the system clock
294+
DateTimeUtils.setCurrentMillisSystem();
295+
}
296+
275297
@Test
276298
public void testMultiplePackages() throws Exception {
277299
copyTestPackage("src/test/resources/proquest-noattach.zip", job);
2.14 KB
Binary file not shown.

0 commit comments

Comments
 (0)