use of com.ibm.lsid.server.LSIDServerException in project cdmlib by cybertaxonomy.
the class AuthorityControllerTest method testNotifyForeignAuthority.
@Test(expected = LSIDServerException.class)
public void testNotifyForeignAuthority() throws Exception {
LSIDServerException lse = new LSIDServerException(LSIDException.METHOD_NOT_IMPLEMENTED, "FAN service not available");
authorityService.notifyForeignAuthority(LSIDMatchers.eqLSID(lsid), LSIDMatchers.eqLSIDAuthority(lsidAuthority));
EasyMock.expectLastCall().andThrow(lse);
EasyMock.replay(authorityService);
authorityController.notifyForeignAuthority(lsid, lsidAuthority);
}
use of com.ibm.lsid.server.LSIDServerException in project cdmlib by cybertaxonomy.
the class AuthorityControllerTest method testGetServicesWithUnknownLSID.
@Test(expected = LSIDServerException.class)
public void testGetServicesWithUnknownLSID() throws Exception {
LSIDServerException lse = new LSIDServerException(LSIDException.UNKNOWN_LSID, "Unknown LSID");
EasyMock.expect(authorityService.getAvailableServices(LSIDMatchers.eqLSID(lsid))).andThrow(lse);
EasyMock.replay(authorityService);
authorityController.getAvailableServices(lsid);
}
use of com.ibm.lsid.server.LSIDServerException in project cdmlib by cybertaxonomy.
the class DataControllerTest method testGetDataWithUnknownLSID.
@Test(expected = LSIDServerException.class)
public void testGetDataWithUnknownLSID() throws Exception {
;
LSIDServerException lse = new LSIDServerException(LSIDException.UNKNOWN_LSID, "Unknown LSID");
EasyMock.expect(dataService.getData(LSIDMatchers.eqLSID(lsid))).andThrow(lse);
EasyMock.replay(dataService);
dataController.setLsidDataService(dataService);
dataController.getData(lsid, response);
}
use of com.ibm.lsid.server.LSIDServerException in project cdmlib by cybertaxonomy.
the class MetadataController method getMetadata.
/**
* Handle requests for the metadata representation of an object with a given lsid. Will return metadata in any format supported
* from a list of formats if specified.
*
* @param lsid the lsid to get metadata for
* @param formats a comma separated list of acceptable formats to the client
* @return ModelAndView containing the metadata response as an object with key 'metadataResponse', view name 'Metadata.rdf'
* @throws LSIDServerException
*/
@RequestMapping(value = "/authority/metadata.do", params = "lsid", method = RequestMethod.GET)
public ModelAndView getMetadata(@RequestParam("lsid") LSID lsid, @RequestParam(value = "acceptedFormats", required = false) String formats) throws LSIDServerException {
String[] acceptedFormats = null;
if (formats != null) {
StringTokenizer st = new StringTokenizer(formats, ",", false);
Vector<String> v = new Vector<String>();
while (st.hasMoreTokens()) {
v.add(st.nextToken());
}
acceptedFormats = new String[v.size()];
v.toArray(acceptedFormats);
}
if (acceptedFormats != null) {
boolean found = false;
for (int i = 0; i < acceptedFormats.length; i++) {
if (acceptedFormats[i].equals(MetadataResponse.RDF_FORMAT)) {
found = true;
}
break;
}
if (!found) {
throw new LSIDServerException(LSIDServerException.NO_METADATA_AVAILABLE_FOR_FORMATS, "No metadata found for given format");
}
}
IIdentifiableEntity identifiableEntity = lsidMetadataService.getMetadata(lsid);
ModelAndView modelAndView = new ModelAndView("Metadata.rdf");
modelAndView.addObject(identifiableEntity);
return modelAndView;
}
use of com.ibm.lsid.server.LSIDServerException in project cdmlib by cybertaxonomy.
the class AuthorityControllerTest method testRevokeForeignAuthority.
@Test(expected = LSIDServerException.class)
public void testRevokeForeignAuthority() throws Exception {
LSIDServerException lse = new LSIDServerException(LSIDException.METHOD_NOT_IMPLEMENTED, "FAN service not available");
authorityService.revokeNotificationForeignAuthority(LSIDMatchers.eqLSID(lsid), LSIDMatchers.eqLSIDAuthority(lsidAuthority));
EasyMock.expectLastCall().andThrow(lse);
EasyMock.replay(authorityService);
authorityController.revokeNotificationForeignAuthority(lsid, lsidAuthority);
}
Aggregations