use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class RepositoryObjectLoaderTest method invalidateTest.
@Test
public void invalidateTest() throws Exception {
PID pid = pidMinter.mintContentPid();
when(objectCacheLoader.load(eq(pid))).thenReturn(mock(FolderObject.class));
// Trigger population of cache
repoObjLoader.getRepositoryObject(pid);
LoadingCache<PID, RepositoryObject> repoObjCache = repoObjLoader.getRepositoryObjectCache();
assertNotNull(repoObjCache.getIfPresent(pid));
repoObjLoader.invalidate(pid);
assertNull(repoObjCache.getIfPresent(pid));
}
use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class OperationsMessageSender method sendSetAsPrimaryObjectOperation.
/**
* Sends set-as-primary-object operation message.
*
* @param userid id of user who triggered the operation
* @param pids objects whose primary object has changed
* @return id of operation message
*/
public String sendSetAsPrimaryObjectOperation(String userid, Collection<PID> pids) {
Element contentEl = createAtomEntry(userid, pids.iterator().next(), CDRActions.SET_AS_PRIMARY_OBJECT);
Element updateEl = new Element(CDRActions.SET_AS_PRIMARY_OBJECT.getName(), CDR_MESSAGE_NS);
contentEl.addContent(updateEl);
Element subjects = new Element("subjects", CDR_MESSAGE_NS);
updateEl.addContent(subjects);
for (PID sub : pids) {
subjects.addContent(new Element("pid", CDR_MESSAGE_NS).setText(sub.getRepositoryPath()));
}
Document msg = contentEl.getDocument();
sendMessage(msg);
LOG.debug("sent set-as-primary-object operation JMS message using JMS template: {}", this.getJmsTemplate());
return getMessageId(msg);
}
use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class PIDsTest method getRootFromIdTest.
@Test
public void getRootFromIdTest() {
PID pid = PIDs.get(REPOSITORY_ROOT_ID);
assertEquals(FEDORA_BASE, pid.getRepositoryPath());
assertEquals(REPOSITORY_ROOT_ID, pid.getId());
assertEquals(REPOSITORY_ROOT_ID, pid.getQualifier());
assertEquals(REPOSITORY_ROOT_ID + "/" + REPOSITORY_ROOT_ID, pid.getQualifiedId());
}
use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class PIDsTest method getContentBaseFromIdTest.
@Test
public void getContentBaseFromIdTest() {
PID pid = PIDs.get(CONTENT_BASE);
assertEquals(FEDORA_BASE + CONTENT_BASE, pid.getRepositoryPath());
assertEquals(CONTENT_BASE, pid.getId());
assertEquals(REPOSITORY_ROOT_ID, pid.getQualifier());
}
use of edu.unc.lib.boxc.model.api.ids.PID in project box-c by UNC-Libraries.
the class PIDsTest method getPidFromRepositoryPath.
@Test
public void getPidFromRepositoryPath() {
String path = fakeRepositoryPath(CONTENT_BASE, null);
PID pid = PIDs.get(path);
assertNotNull(pid);
assertEquals("Identifier did not match provided value", TEST_UUID, pid.getId());
assertEquals("Repository path was incorrect", path, pid.getRepositoryUri().toString());
assertEquals("Incorrect qualifier", CONTENT_BASE, pid.getQualifier());
assertNull("Component path should not be set", pid.getComponentPath());
}
Aggregations