org.fcrepo.test.api
Class TestRESTAPI
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.custommonkey.xmlunit.XMLTestCase
org.fcrepo.test.FedoraTestCase
org.fcrepo.test.FedoraServerTestCase
org.fcrepo.test.api.TestRESTAPI
- All Implemented Interfaces:
- junit.framework.Test, org.custommonkey.xmlunit.XMLConstants, org.custommonkey.xmlunit.XSLTConstants, Constants, FedoraTestConstants
public class TestRESTAPI
- extends FedoraServerTestCase
Tests of the REST API. Tests assume a running instance of Fedora with the
REST API enabled. //TODO: actually validate the ResponseBody instead of just
HTTP status codes
- Since:
- 3.0
- Version:
- $Id$
- Author:
- Edwin Shin, Bill Branan
| Fields inherited from interface org.fcrepo.common.Constants |
ACCESS, ACTION, API, ATOM_APIM1_0, ATOM_ZIP1_1, ATOM1_1, AUDIT, AUDIT1_0, BATCH_MODIFY, BATCH_MODIFY1_1, BE_SECURITY, BE_SECURITY1_0, BINDING_SPEC, DATASTREAM, DC, DISSEMINATOR, DS_COMPOSITE_MODEL, DS_COMPOSITE_MODEL1_0, DS_INPUT_SPEC1_0, DS_INPUT_SPEC1_1, ENVIRONMENT, FCFG, FEDORA, FEDORA_APP_CONTEXT_NAME, FEDORA_DEFAULT_APP_CONTEXT, FEDORA_HOME, FEDORA_REPOSITORY_PID, FOXML, FOXML1_0, FOXML1_0_LEGACY, FOXML1_1, HTTP_REQUEST, MANAGEMENT, METHOD_MAP, METS, METS_EXT, METS_EXT1_0, METS_EXT1_0_LEGACY, METS_EXT1_1, MODEL, MULGARA, OAI_DC, OAI_DC2_0, OAI_FRIENDS, OAI_FRIENDS2_0, OAI_IDENTIFIER, OAI_IDENTIFIER2_0, OAI_PMH, OAI_PMH2_0, OAI_PROV, OAI_PROV2_0, OBJ_DATASTREAMS1_0, OBJ_HISTORY1_0, OBJ_ITEMS1_0, OBJ_METHODS1_0, OBJ_PROFILE1_0, OBJ_VALIDATION1_0, OBJECT, OLD_XLINK, PID_LIST1_0, RDF, RDF_XSD, RECOVERY, RELS_EXT, RELS_EXT1_0, RELS_INT1_0, REPO_DESC1_0, RESOURCE, SDEF, SDEF_METHOD_MAP1_0, SDEP, SDEP_METHOD_MAP1_0, SDEP_METHOD_MAP1_1, SERVICE_PROFILE, SOAP, SOAP_ENC, SUBJECT, TYPES, VIEW, WSDL, WSDL_HTTP, WSDL_MIME, XACML_POLICY, XACML_POLICY1_0, XACML1, XACML1_ACTION, XACML1_POLICY, XACML1_RESOURCE, XACML1_SUBJECT, XACML2_POLICY_SCHEMA, XLINK, XML_XSD, XMLNS, XSI |
| Fields inherited from interface org.fcrepo.common.FedoraTestConstants |
BESECURITY, DEMO_DIR_PREFIX, FCFG, FEDORA_HOME_CLIENT, FEDORA_HOME_CLIENT_BIN, FEDORA_HOME_SERVER, FEDORA_HOME_SERVER_CONFIG, FEDORA_PASSWORD, FEDORA_USERNAME, NS_FCFG, NS_FEDORA_TYPES, NS_FEDORA_TYPES_PREFIX |
| Fields inherited from interface org.custommonkey.xmlunit.XSLTConstants |
JAVA5_XSLTC_FACTORY_NAME, XSLT_END, XSLT_IDENTITY_TEMPLATE, XSLT_START, XSLT_START_NO_VERSION, XSLT_STRIP_COMMENTS_TEMPLATE, XSLT_STRIP_WHITESPACE, XSLT_XML_OUTPUT_NOINDENT |
| Fields inherited from interface org.custommonkey.xmlunit.XMLConstants |
CLOSE_NODE, END_CDATA, END_COMMENT, END_PROCESSING_INSTRUCTION, OPEN_END_NODE, OPEN_START_NODE, START_CDATA, START_COMMENT, START_DOCTYPE, START_PROCESSING_INSTRUCTION, W3C_XML_SCHEMA_INSTANCE_NO_NAMESPACE_SCHEMA_LOCATION_ATTR, W3C_XML_SCHEMA_INSTANCE_NS_URI, W3C_XML_SCHEMA_INSTANCE_SCHEMA_LOCATION_ATTR, W3C_XML_SCHEMA_NS_URI, XML_DECLARATION, XMLNS_PREFIX, XPATH_ATTRIBUTE_IDENTIFIER, XPATH_CHARACTER_NODE_IDENTIFIER, XPATH_COMMENT_IDENTIFIER, XPATH_NODE_INDEX_END, XPATH_NODE_INDEX_START, XPATH_PROCESSING_INSTRUCTION_IDENTIFIER, XPATH_SEPARATOR |
|
Method Summary |
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse |
delete(boolean authenticate)
|
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse |
get(boolean authenticate)
Issues an HTTP GET for the specified URL, schema-validate the response
(if it is XML) If the response is intentionally XML with no schema, then
use get(authenticate, false) then the response won't be validated. |
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse |
get(boolean authenticate,
boolean validate)
Issues an HTTP GET for the specified URL. |
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse |
post(File requestContent,
boolean authenticate)
|
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse |
post(String requestContent,
boolean authenticate)
|
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse |
post(String requestContent,
boolean authenticate,
boolean validate)
|
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse |
put(boolean authenticate)
Issues an HTTP PUT to url. |
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse |
put(File requestContent,
boolean authenticate)
|
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse |
put(String requestContent,
boolean authenticate)
|
void |
setUp()
|
static junit.framework.Test |
suite()
|
void |
tearDown()
|
void |
testAddDatastream()
|
void |
testAddRelationship()
|
void |
testChunked()
|
void |
testDatastreamDisseminationContentDispositionFromId()
|
void |
testDatastreamDisseminationContentDispositionFromLabel()
|
void |
testDatastreamDisseminationContentDispositionFromRels()
|
void |
testDeletedObject()
|
void |
testDisseminationContentLengthWhenKnown()
|
void |
testExportObject()
|
void |
testFindObjects()
|
void |
testFindObjectsBadSyntax()
|
void |
testFindObjectWithSingleQuote()
test case for FCREPO-867. |
void |
testGetDatastreamDissemination()
|
void |
testGetDatastreamHistory()
|
void |
testGetDatastreamProfile()
|
void |
testGETMethodBuiltInBadMethod()
|
void |
testGETMethodBuiltInBadUserArg()
|
void |
testGETMethodBuiltInNoArg()
|
void |
testGETMethodCustomBadDate()
|
void |
testGETMethodCustomBadMethod()
|
void |
testGETMethodCustomBadUserArg()
|
void |
testGETMethodCustomEarlyDate()
|
void |
testGETMethodCustomGoodDate()
|
void |
testGETMethodCustomGoodUserArg()
|
void |
testGETMethodCustomGoodUserArgGoodDate()
|
void |
testGETMethodCustomNoArg()
|
void |
testGETMethodCustomUserArgBadDate()
|
void |
testGETMethodCustomUserArgEarlyDate()
|
void |
testGetNextPID()
|
void |
testGetObjectHistory()
|
void |
testGetObjectProfile()
|
void |
testGetObjectXML()
|
void |
testGetRelationships()
|
void |
testGetWADL()
|
void |
testIngest()
|
void |
testIngestWithParameterPid()
|
void |
testLifecycle()
|
void |
testListDatastreams()
|
void |
testListMethods()
|
void |
testListMethodsForSDep()
|
void |
testModifyDatastreamByReference()
|
void |
testModifyDatastreamByValue()
|
void |
testModifyDatastreamNoContent()
|
void |
testModifyObject()
|
void |
testPurgeDatastream()
|
void |
testPurgeObject()
|
void |
testPurgeRelationship()
|
void |
testResponseOverride()
|
void |
testResumeFindObjects()
Disabled until FCREPO-798 is public public void testFindObjectsQuery()
throws Exception { String templateUrl = "/search?$value$";
TemplatedResourceIterator tri = new
TemplatedResourceIterator(templateUrl,
"src/test/resources/APIM2/restsearchvalues"); while (tri.hasNext()) { url
= tri.next(); HttpResponse resp = get(getAuthAccess());
//assertEquals(SC_OK, resp.getStatusCode()); url =
String.format("/objects/new"); HttpResponse response = post("", true);
assertEquals(SC_CREATED, response.getStatusCode()); } } |
void |
testSetDatastreamState()
|
void |
testSetDatastreamVersionable()
|
void |
testUpload()
|
void |
testValidate()
|
protected void |
validateResponse(org.fcrepo.test.api.TestRESTAPI.HttpResponse res)
|
| Methods inherited from class org.fcrepo.test.FedoraServerTestCase |
getDemoObjects, getXMLQueryResult, getXMLQueryResult, ingestDemoObjects, ingestDemoObjects, ingestDemoObjects, ingestDemoObjects, main, purgeDemoObjects, purgeDemoObjects, testingAtom, testingAtomZip, testingMETS |
| Methods inherited from class org.fcrepo.test.FedoraTestCase |
getBaseURL, getDemoAppServerContext, getDemoBaseURL, getFedoraAppServerContext, getFedoraClient, getFedoraClient, getHost, getPassword, getPort, getProtocol, getServerConfiguration, getUsername |
| Methods inherited from class org.custommonkey.xmlunit.XMLTestCase |
assertNodeTestPasses, assertNodeTestPasses, assertNodeTestPasses, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLIdentical, assertXMLIdentical, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLValid, assertXMLValid, assertXMLValid, assertXMLValid, assertXMLValid, assertXMLValid, assertXMLValid, assertXpathEvaluatesTo, assertXpathEvaluatesTo, assertXpathEvaluatesTo, assertXpathExists, assertXpathExists, assertXpathExists, assertXpathNotExists, assertXpathNotExists, assertXpathNotExists, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, compareXML, compareXML, compareXML, compareXML, compareXML, compareXML |
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
| Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
authorizeAccess
protected Boolean authorizeAccess
url
protected String url
TestRESTAPI
public TestRESTAPI()
setUp
public void setUp()
throws Exception
- Overrides:
setUp in class junit.framework.TestCase
- Throws:
Exception
tearDown
public void tearDown()
throws Exception
- Overrides:
tearDown in class junit.framework.TestCase
- Throws:
Exception
testGetWADL
public void testGetWADL()
throws Exception
- Throws:
Exception
testGetObjectProfile
public void testGetObjectProfile()
throws Exception
- Throws:
Exception
testListMethods
public void testListMethods()
throws Exception
- Throws:
Exception
testListMethodsForSDep
public void testListMethodsForSDep()
throws Exception
- Throws:
Exception
testGETMethodBuiltInBadMethod
public void testGETMethodBuiltInBadMethod()
throws Exception
- Throws:
Exception
testGETMethodBuiltInBadUserArg
public void testGETMethodBuiltInBadUserArg()
throws Exception
- Throws:
Exception
testGETMethodBuiltInNoArg
public void testGETMethodBuiltInNoArg()
throws Exception
- Throws:
Exception
testGETMethodCustomBadMethod
public void testGETMethodCustomBadMethod()
throws Exception
- Throws:
Exception
testGETMethodCustomBadUserArg
public void testGETMethodCustomBadUserArg()
throws Exception
- Throws:
Exception
testGETMethodCustomNoArg
public void testGETMethodCustomNoArg()
throws Exception
- Throws:
Exception
testGETMethodCustomGoodUserArg
public void testGETMethodCustomGoodUserArg()
throws Exception
- Throws:
Exception
testGETMethodCustomGoodUserArgGoodDate
public void testGETMethodCustomGoodUserArgGoodDate()
throws Exception
- Throws:
Exception
testGETMethodCustomUserArgBadDate
public void testGETMethodCustomUserArgBadDate()
throws Exception
- Throws:
Exception
testGETMethodCustomUserArgEarlyDate
public void testGETMethodCustomUserArgEarlyDate()
throws Exception
- Throws:
Exception
testGETMethodCustomGoodDate
public void testGETMethodCustomGoodDate()
throws Exception
- Throws:
Exception
testGETMethodCustomBadDate
public void testGETMethodCustomBadDate()
throws Exception
- Throws:
Exception
testGETMethodCustomEarlyDate
public void testGETMethodCustomEarlyDate()
throws Exception
- Throws:
Exception
testListDatastreams
public void testListDatastreams()
throws Exception
- Throws:
Exception
testDeletedObject
public void testDeletedObject()
throws Exception
- Throws:
Exception
testGetDatastreamProfile
public void testGetDatastreamProfile()
throws Exception
- Throws:
Exception
testGetDatastreamHistory
public void testGetDatastreamHistory()
throws Exception
- Throws:
Exception
testGetDatastreamDissemination
public void testGetDatastreamDissemination()
throws Exception
- Throws:
Exception
testFindObjects
public void testFindObjects()
throws Exception
- Throws:
Exception
testFindObjectWithSingleQuote
public void testFindObjectWithSingleQuote()
throws Exception
- test case for FCREPO-867. Since all SQL statements have been switched to
PreparedStatement it's safe to use a singlequote in a search query.
- Throws:
Exception
testResumeFindObjects
public void testResumeFindObjects()
throws Exception
- Disabled until FCREPO-798 is public public void testFindObjectsQuery()
throws Exception { String templateUrl = "/search?$value$";
TemplatedResourceIterator tri = new
TemplatedResourceIterator(templateUrl,
"src/test/resources/APIM2/restsearchvalues"); while (tri.hasNext()) { url
= tri.next(); HttpResponse resp = get(getAuthAccess());
//assertEquals(SC_OK, resp.getStatusCode()); url =
String.format("/objects/new"); HttpResponse response = post("", true);
assertEquals(SC_CREATED, response.getStatusCode()); } }
- Throws:
Exception
testFindObjectsBadSyntax
public void testFindObjectsBadSyntax()
throws Exception
- Throws:
Exception
testGetObjectHistory
public void testGetObjectHistory()
throws Exception
- Throws:
Exception
testIngest
public void testIngest()
throws Exception
- Throws:
Exception
testIngestWithParameterPid
public void testIngestWithParameterPid()
throws Exception
- Throws:
Exception
testModifyObject
public void testModifyObject()
throws Exception
- Throws:
Exception
testGetObjectXML
public void testGetObjectXML()
throws Exception
- Throws:
Exception
testValidate
public void testValidate()
throws Exception
- Throws:
Exception
testExportObject
public void testExportObject()
throws Exception
- Throws:
Exception
testPurgeObject
public void testPurgeObject()
throws Exception
- Throws:
Exception
testAddDatastream
public void testAddDatastream()
throws Exception
- Throws:
Exception
testModifyDatastreamByReference
public void testModifyDatastreamByReference()
throws Exception
- Throws:
Exception
testModifyDatastreamByValue
public void testModifyDatastreamByValue()
throws Exception
- Throws:
Exception
testModifyDatastreamNoContent
public void testModifyDatastreamNoContent()
throws Exception
- Throws:
Exception
testSetDatastreamState
public void testSetDatastreamState()
throws Exception
- Throws:
Exception
testSetDatastreamVersionable
public void testSetDatastreamVersionable()
throws Exception
- Throws:
Exception
testPurgeDatastream
public void testPurgeDatastream()
throws Exception
- Throws:
Exception
testGetNextPID
public void testGetNextPID()
throws Exception
- Throws:
Exception
testLifecycle
public void testLifecycle()
throws Exception
- Throws:
Exception
testChunked
public void testChunked()
throws Exception
- Throws:
Exception
testResponseOverride
public void testResponseOverride()
throws Exception
- Throws:
Exception
testDatastreamDisseminationContentDispositionFromRels
public void testDatastreamDisseminationContentDispositionFromRels()
throws Exception
- Throws:
Exception
testDatastreamDisseminationContentDispositionFromLabel
public void testDatastreamDisseminationContentDispositionFromLabel()
throws Exception
- Throws:
Exception
testDatastreamDisseminationContentDispositionFromId
public void testDatastreamDisseminationContentDispositionFromId()
throws Exception
- Throws:
Exception
testUpload
public void testUpload()
throws Exception
- Throws:
Exception
testGetRelationships
public void testGetRelationships()
throws Exception
- Throws:
Exception
testAddRelationship
public void testAddRelationship()
throws Exception
- Throws:
Exception
testPurgeRelationship
public void testPurgeRelationship()
throws Exception
- Throws:
Exception
testDisseminationContentLengthWhenKnown
public void testDisseminationContentLengthWhenKnown()
throws Exception
- Throws:
Exception
get
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse get(boolean authenticate)
throws Exception
- Issues an HTTP GET for the specified URL, schema-validate the response
(if it is XML) If the response is intentionally XML with no schema, then
use get(authenticate, false) then the response won't be validated.
- Parameters:
authenticate -
- Returns:
-
- Throws:
Exception
get
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse get(boolean authenticate,
boolean validate)
throws Exception
- Issues an HTTP GET for the specified URL. Optionally validate the
response (if the response is XML)
- Parameters:
authenticate - validate - - validate the response against its schema
- Returns:
- HttpResponse
- Throws:
Exception
validateResponse
protected void validateResponse(org.fcrepo.test.api.TestRESTAPI.HttpResponse res)
throws Exception
- Throws:
Exception
delete
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse delete(boolean authenticate)
throws Exception
- Throws:
Exception
put
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse put(boolean authenticate)
throws Exception
- Issues an HTTP PUT to
url. Callers are responsible for
calling releaseConnection() on the returned HttpMethod.
- Parameters:
authenticate -
- Returns:
-
- Throws:
Exception
put
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse put(String requestContent,
boolean authenticate)
throws Exception
- Throws:
Exception
post
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse post(String requestContent,
boolean authenticate)
throws Exception
- Throws:
Exception
post
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse post(String requestContent,
boolean authenticate,
boolean validate)
throws Exception
- Throws:
Exception
put
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse put(File requestContent,
boolean authenticate)
throws Exception
- Throws:
Exception
post
protected org.fcrepo.test.api.TestRESTAPI.HttpResponse post(File requestContent,
boolean authenticate)
throws Exception
- Throws:
Exception
suite
public static junit.framework.Test suite()
Copyright © 2012 DuraSpace. All Rights Reserved.