// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test
- public void create() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class)
+ public void create(String testName) throws Exception {
// Perform setup, such as initializing the type of service request
// (e.g. CREATE, DELETE), its valid and expected status codes, and
// its associated HTTP method name (e.g. POST, DELETE).
- setupCreate();
+ setupCreate(testName);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
// Does it fall within the set of valid status codes?
// Does it exactly match the expected status code?
if(logger.isDebugEnabled()){
- logger.debug("create: status = " + statusCode);
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
}
@Override
- @Test(dependsOnMethods = {"create"})
- public void createList() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create"})
+ public void createList(String testName) throws Exception {
for(int i = 0; i < 3; i++){
- create();
+ create(testName);
}
}
// Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
@Override
- public void createWithEmptyEntityBody() throws Exception {
+ public void createWithEmptyEntityBody(String testName) throws Exception {
}
@Override
- public void createWithMalformedXml() throws Exception {
+ public void createWithMalformedXml(String testName) throws Exception {
}
@Override
- public void createWithWrongXmlSchema() throws Exception {
+ public void createWithWrongXmlSchema(String testName) throws Exception {
}
/*
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithMalformedXml() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithMalformedXml(String testName) throws Exception {
// Perform setup.
setupCreateWithMalformedXml();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithMalformedXml url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema() throws Exception {
// Perform setup.
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithWrongXmlSchema url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"create"})
- public void read() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create"})
+ public void read(String testName) throws Exception {
// Perform setup.
- setupRead();
+ setupRead(testName);
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(knownResourceId);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("read: status = " + statusCode);
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
MultipartInput input = (MultipartInput) res.getEntity();
- AcquisitionsCommon acquistionObject = (AcquisitionsCommon) extractPart(input,
+ AcquisitionsCommon acquisitionObject = (AcquisitionsCommon) extractPart(input,
client.getCommonPartName(), AcquisitionsCommon.class);
- Assert.assertNotNull(acquistionObject);
+ Assert.assertNotNull(acquisitionObject);
}
// Failure outcomes
@Override
- @Test(dependsOnMethods = {"read"})
- public void readNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"read"})
+ public void readNonExistent(String testName) throws Exception {
// Perform setup.
- setupReadNonExistent();
+ setupReadNonExistent(testName);
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("readNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"createList", "read"})
- public void readList() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"createList", "read"})
+ public void readList(String testName) throws Exception {
// Perform setup.
- setupReadList();
+ setupReadList(testName);
// Submit the request to the service and store the response.
ClientResponse<AcquisitionsCommonList> res = client.readList();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("readList: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
list.getAcquisitionListItem();
int i = 0;
for(AcquisitionsCommonList.AcquisitionListItem item : items){
- logger.debug("readList: list-item[" + i + "] csid=" +
+ logger.debug(testName + ": list-item[" + i + "] csid=" +
item.getCsid());
- logger.debug("readList: list-item[" + i + "] objectNumber=" +
+ logger.debug(testName + ": list-item[" + i + "] objectNumber=" +
item.getAccessionDate());
- logger.debug("readList: list-item[" + i + "] URI=" +
+ logger.debug(testName + ": list-item[" + i + "] URI=" +
item.getUri());
i++;
}
// Success outcomes
@Override
- @Test(dependsOnMethods = {"read"})
- public void update() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"read"})
+ public void update(String testName) throws Exception {
// Perform setup.
- setupUpdate();
+ setupUpdate(testName);
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
- logger.debug("update: read status = " + res.getStatus());
+ logger.debug(testName + ": read status = " + res.getStatus());
}
Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
int statusCode = res.getStatus();
// Check the status code of the response: does it match the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("update: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Failure outcomes
// Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
- public void updateWithEmptyEntityBody() throws Exception {
+ @Override
+ public void updateWithEmptyEntityBody(String testName) throws Exception {
}
- public void updateWithMalformedXml() throws Exception {
+ @Override
+ public void updateWithMalformedXml(String testName) throws Exception {
}
- public void updateWithWrongXmlSchema() throws Exception {
+ @Override
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
}
/*
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithEmptyEntityBody() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithEmptyEntityBody(String testName) throws Exception {
// Perform setup.
- setupUpdateWithEmptyEntityBody();
+ setupUpdateWithEmptyEntityBody(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- ("updateWithEmptyEntityBody url=" + url + " status=" + statusCode);
- }
+ (testName + ": url=" + url + " status=" + statusCode);
+ }
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody() throws Exception {
// Perform setup.
- setupCreateWithEmptyEntityBody();
+ setupCreateWithEmptyEntityBody(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithEmptyEntityBody url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
- }
+ }
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithMalformedXml() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithMalformedXml(String testName) throws Exception {
// Perform setup.
- setupUpdateWithMalformedXml();
+ setupUpdateWithMalformedXml(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithMalformedXml: url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
@Override
@Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithWrongXmlSchema() {
+ public void updateWithWrongXmlSchema(String testName) {
// Perform setup.
- setupUpdateWithWrongXmlSchema();
+ setupUpdateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithWrongXmlSchema: url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
*/
@Override
- @Test(dependsOnMethods = {"update", "testSubmitRequest"})
- public void updateNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"update", "testSubmitRequest"})
+ public void updateNonExistent(String testName) throws Exception {
// Perform setup.
- setupUpdateNonExistent();
+ setupUpdateNonExistent(testName);
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"create", "read", "update"})
- public void delete() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "read", "update"})
+ public void delete(String testName) throws Exception {
// Perform setup.
- setupDelete();
+ setupDelete(testName);
// Submit the request to the service and store the response.
ClientResponse<Response> res = client.delete(knownResourceId);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("delete: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Failure outcomes
@Override
- @Test(dependsOnMethods = {"delete"})
- public void deleteNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"delete"})
+ public void deleteNonExistent(String testName) throws Exception {
// Perform setup.
- setupDeleteNonExistent();
+ setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("deleteNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#create()
*/
- @Test
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class)
@Override
- public void create() {
+ public void create(String testName) {
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
String identifier = this.createIdentifier();
MultipartOutput multipart = createCollectionObjectInstance(
* @see org.collectionspace.services.client.test.AbstractServiceTest#delete()
*/
@Override
- @Test(dependsOnMethods = { "createWithIncorrectUserPassword" })
- public void delete() {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = { "createWithIncorrectUserPassword" })
+ public void delete(String testName) {
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
collectionObjectClient = new CollectionObjectClient();
if (!collectionObjectClient.isServerSecure()) {
* @see org.collectionspace.services.client.test.AbstractServiceTest#createList()
*/
@Override
- public void createList() throws Exception {
+ public void createList(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#createWithEmptyEntityBody()
*/
@Override
- public void createWithEmptyEntityBody() throws Exception {
+ public void createWithEmptyEntityBody(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#createWithMalformedXml()
*/
@Override
- public void createWithMalformedXml() throws Exception {
+ public void createWithMalformedXml(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#createWithWrongXmlSchema()
*/
@Override
- public void createWithWrongXmlSchema() throws Exception {
+ public void createWithWrongXmlSchema(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#read()
*/
@Override
- public void read() throws Exception {
+ public void read(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#readNonExistent()
*/
@Override
- public void readNonExistent() throws Exception {
+ public void readNonExistent(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#readList()
*/
@Override
- public void readList() throws Exception {
+ public void readList(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#update()
*/
@Override
- public void update() throws Exception {
+ public void update(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#updateWithEmptyEntityBody()
*/
@Override
- public void updateWithEmptyEntityBody() throws Exception {
+ public void updateWithEmptyEntityBody(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#updateWithMalformedXml()
*/
@Override
- public void updateWithMalformedXml() throws Exception {
+ public void updateWithMalformedXml(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#updateWithWrongXmlSchema()
*/
@Override
- public void updateWithWrongXmlSchema() throws Exception {
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#updateNonExistent()
*/
@Override
- public void updateNonExistent() throws Exception {
+ public void updateNonExistent(String testName) throws Exception {
}
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#deleteNonExistent()
*/
@Override
- public void deleteNonExistent() throws Exception {
+ public void deleteNonExistent(String testName) throws Exception {
}
}
<artifactId>resteasy-multipart-provider</artifactId>\r
<version>1.0.2.GA</version>\r
</dependency>\r
+ <!-- Set TestNG scope to default (compile), rather than test -->\r
+ <!-- to allow import(s) in AbstractServiceTest class -->\r
<dependency>\r
<groupId>org.testng</groupId>\r
<artifactId>testng</artifactId>\r
<version>5.6</version>\r
- <scope>test</scope>\r
</dependency>\r
\r
<!-- javax -->\r
package org.collectionspace.services.client.test;
import java.io.ByteArrayInputStream;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+
+import org.testng.annotations.DataProvider;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
XML_DECLARATION +
"<wrong_schema>wrong schema contents</wrong_schema>";
+
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
// Success outcomes
@Override
- public void create() throws Exception {
+ public void create(String testName) throws Exception {
}
protected void setupCreate() {
REQUEST_TYPE = ServiceRequestType.CREATE;
// Print a banner identifying the test that will be run.
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
@Override
- public abstract void createList() throws Exception;
+ public abstract void createList(String testName) throws Exception;
// No setup required for createList()
// Failure outcomes
@Override
- public abstract void createWithEmptyEntityBody()
+ public abstract void createWithEmptyEntityBody(String testName)
throws Exception;
protected void setupCreateWithEmptyEntityBody() {
EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
REQUEST_TYPE = ServiceRequestType.CREATE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
@Override
- public abstract void createWithMalformedXml() throws Exception;
+ public abstract void createWithMalformedXml(String testName) throws Exception;
protected void setupCreateWithMalformedXml() {
setupCreateWithMalformedXml("CreateWithMalformedXml");
EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
REQUEST_TYPE = ServiceRequestType.CREATE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
@Override
- public abstract void createWithWrongXmlSchema() throws Exception;
+ public abstract void createWithWrongXmlSchema(String testName) throws Exception;
protected void setupCreateWithWrongXmlSchema() {
setupCreateWithWrongXmlSchema("CreateWithWrongXmlSchema");
EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
REQUEST_TYPE = ServiceRequestType.CREATE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
// Success outcomes
@Override
- public abstract void read() throws Exception;
+ public abstract void read(String testName) throws Exception;
protected void setupRead() {
setupRead("Read");
EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();
REQUEST_TYPE = ServiceRequestType.READ;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
// Failure outcomes
@Override
- public abstract void readNonExistent() throws Exception;
+ public abstract void readNonExistent(String testName) throws Exception;
protected void setupReadNonExistent() {
setupReadNonExistent("ReadNonExistent");
EXPECTED_STATUS_CODE = Response.Status.NOT_FOUND.getStatusCode();
REQUEST_TYPE = ServiceRequestType.READ;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
// Success outcomes
@Override
- public abstract void readList() throws Exception;
+ public abstract void readList(String testName) throws Exception;
protected void setupReadList() {
setupReadList("ReadList");
EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();
REQUEST_TYPE = ServiceRequestType.READ_LIST;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
// Success outcomes
@Override
- public abstract void update() throws Exception;
+ public abstract void update(String testName) throws Exception;
protected void setupUpdate() {
setupUpdate("Update");
EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();
REQUEST_TYPE = ServiceRequestType.UPDATE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
// Failure outcomes
@Override
- public abstract void updateWithEmptyEntityBody() throws Exception;
+ public abstract void updateWithEmptyEntityBody(String testName) throws Exception;
protected void setupUpdateWithEmptyEntityBody() {
setupUpdateWithEmptyEntityBody("UpdateWithEmptyEntityBody");
EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
REQUEST_TYPE = ServiceRequestType.UPDATE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
@Override
- public abstract void updateWithMalformedXml() throws Exception;
+ public abstract void updateWithMalformedXml(String testName) throws Exception;
protected void setupUpdateWithMalformedXml() {
setupUpdateWithMalformedXml("UpdateWithMalformedXml");
EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
REQUEST_TYPE = ServiceRequestType.UPDATE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
@Override
- public abstract void updateWithWrongXmlSchema() throws Exception;
+ public abstract void updateWithWrongXmlSchema(String testName) throws Exception;
protected void setupUpdateWithWrongXmlSchema() {
setupUpdateWithWrongXmlSchema("UpdateWithWrongXmlSchema");
EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
REQUEST_TYPE = ServiceRequestType.UPDATE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
@Override
- public abstract void updateNonExistent() throws Exception;
+ public abstract void updateNonExistent(String testName) throws Exception;
protected void setupUpdateNonExistent() {
setupUpdateNonExistent("UpdateNonExistent");
EXPECTED_STATUS_CODE = Response.Status.NOT_FOUND.getStatusCode();
REQUEST_TYPE = ServiceRequestType.UPDATE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
// Success outcomes
@Override
- public abstract void delete() throws Exception;
+ public abstract void delete(String testName) throws Exception;
protected void setupDelete() {
setupDelete("Delete");
EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();
REQUEST_TYPE = ServiceRequestType.DELETE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
// Failure outcomes
@Override
- public abstract void deleteNonExistent() throws Exception;
+ public abstract void deleteNonExistent(String testName) throws Exception;
protected void setupDeleteNonExistent() {
setupDeleteNonExistent("DeleteNonExistent");
EXPECTED_STATUS_CODE = Response.Status.NOT_FOUND.getStatusCode();
REQUEST_TYPE = ServiceRequestType.DELETE;
if (logger.isDebugEnabled()) {
- printBanner(label);
+ banner(label);
}
}
*
* This component will follow directly after the
* base path, if any.
+ *
+ * @return The URL path component of the service.
*/
protected abstract String getServicePathComponent();
+ /**
+ * Returns the common part name for the service request.
+ *
+ * @return The common part name for the service request.
+ */
+/*
+ public String getCommonPartName();
+*/
+
// ---------------------------------------------------------------
// Utility methods
// ---------------------------------------------------------------
REQUEST_TYPE = ServiceRequestType.NON_EXISTENT;
}
+ /**
+ * Returns the name of the currently running test.
+ *
+ * Note: although the return type is listed as Object[][],
+ * this method instead returns a String.
+ *
+ * @param m The currently running test method.
+ *
+ * @return The name of the currently running test method.
+ */
+ @DataProvider(name="testName")
+ public static Object[][] testName(Method m){
+ return new Object[][]{
+ new Object[] { m.getName() }
+ };
+ }
+
/**
* Returns an error message indicating that the status code returned by a
* specific call to a service does not fall within a set of valid status
protected String extractId(ClientResponse<Response> res) {
MultivaluedMap mvm = res.getMetadata();
String uri = (String) ((ArrayList) mvm.get("Location")).get(0);
- verbose("extractId:uri=" + uri);
+ if(logger.isDebugEnabled()){
+ logger.debug("extractId:uri=" + uri);
+ }
String[] segments = uri.split("/");
String id = segments[segments.length - 1];
- verbose("id=" + id);
+ if(logger.isDebugEnabled()){
+ logger.debug("id=" + id);
+ }
return id;
}
String partLabel = part.getHeaders().getFirst("label");
if(label.equalsIgnoreCase(partLabel)){
String partStr = part.getBodyAsString();
- verbose("extracted part str=\n" + partStr);
+ if(logger.isDebugEnabled()){
+ logger.debug("extracted part str=\n" + partStr);
+ }
obj = part.getBody(clazz, null);
- verbose("extracted part obj=\n", obj, clazz);
+ if(logger.isDebugEnabled()){
+ logger.debug("extracted part obj=\n", obj, clazz);
+ }
break;
}
}
protected void verbose(String msg, Object o, Class clazz) {
try{
- verbose(msg);
+ if(logger.isDebugEnabled()){
+ logger.debug(msg);
+ }
JAXBContext jc = JAXBContext.newInstance(clazz);
Marshaller m = jc.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
protected void verboseMap(MultivaluedMap map) {
for(Object entry : map.entrySet()){
MultivaluedMap.Entry mentry = (MultivaluedMap.Entry) entry;
- verbose(" name=" + mentry.getKey() + " value=" + mentry.getValue());
+ if(logger.isDebugEnabled()){
+ logger.debug(" name=" + mentry.getKey() +
+ " value=" + mentry.getValue());
+ }
}
}
- private void printBanner(String label) {
+ private void banner(String label) {
if(logger.isDebugEnabled()){
logger.debug("===================================================");
logger.debug(" Test = " + label);
/**
* ServiceTest, interface specifying the client tests to be performed
* to test an entity or relation service.
+ *
+ * The 'testName' parameter will receive the name of the currently
+ * running test by means of reflection, from a TestNG DataProvider.
+ *
+ * @see org.collectionspace.services.client.test.AbstractServiceTest#testName
*/
public interface ServiceTest {
- /**
- * Returns the URL path component of the service.
- *
- * This component will follow directly after the
- * base path, if any.
- */
-// public String getServicePathComponent();
-//
-// /**
-// * getCommonPartName get common part name for the service request
-// * @return
-// */
-// public String getCommonPartName();
-
// ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
*
* Relied upon by 'read', 'update' and 'delete' tests, below.
*/
- public void create() throws Exception;
+ public void create(String testName) throws Exception;
/**
* Tests creation of a list of two or more new resources by repeatedly
*
* Relied upon by 'read list' tests, below.
*/
- public void createList() throws Exception;
+ public void createList(String testName) throws Exception;
// Failure outcomes
* Tests creation of a resource by submitting
* an empty entity body (aka empty payload).
*/
- public void createWithEmptyEntityBody() throws Exception;
+ public void createWithEmptyEntityBody(String testName) throws Exception;
/**
* Tests creation of a resource by submitting
* a representation with malformed XML data.
*/
- public void createWithMalformedXml() throws Exception;
+ public void createWithMalformedXml(String testName) throws Exception;
/**
* Tests creation of a resource by submitting
* a representation in the wrong XML schema
* (e.g. not matching the object's schema).
*/
- public void createWithWrongXmlSchema() throws Exception;
+ public void createWithWrongXmlSchema(String testName) throws Exception;
// @TODO If feasible, implement a negative (failure)
// test for creation of duplicate resources.
/**
* Tests reading (i.e. retrieval) of a resource.
*/
- public void read() throws Exception;
+ public void read(String testName) throws Exception;
// Failure outcomes
* resource, whose resource identifier does not exist
* at the specified URL.
*/
- public void readNonExistent() throws Exception;
+ public void readNonExistent(String testName) throws Exception;
// ---------------------------------------------------------------
* Tests reading (i.e. retrieval) of a list of
* multiple resources.
*/
- public void readList() throws Exception;
+ public void readList(String testName) throws Exception;
// If feasible, implement a test for reading
// an empty list returned by the service.
/**
* Tests updating the content of a resource.
*/
- public void update() throws Exception;
+ public void update(String testName) throws Exception;
// Failure outcomes
* Tests updating the content of a resource
* by submitting an empty entity body (aka empty payload).
*/
- public void updateWithEmptyEntityBody() throws Exception;
+ public void updateWithEmptyEntityBody(String testName) throws Exception;
/**
* Tests updating the content of a resource
* by submitting a representation with malformed
* XML data.
*/
- public void updateWithMalformedXml() throws Exception;
+ public void updateWithMalformedXml(String testName) throws Exception;
/**
* Tests updating the content of a resource
* by submitting a representation in the wrong
* XML schema (e.g. not matching the object's schema).
*/
- public void updateWithWrongXmlSchema() throws Exception;
+ public void updateWithWrongXmlSchema(String testName) throws Exception;
/**
* Tests updating the content of a non-existent
* resource, whose resource identifier does not exist.
*/
- public void updateNonExistent() throws Exception;
+ public void updateNonExistent(String testName) throws Exception;
// ---------------------------------------------------------------
/**
* Tests deleting a resource.
*/
- public void delete() throws Exception;
+ public void delete(String testName) throws Exception;
// Failure outcomes
* Tests deleting a non-existent resource, whose resource
* identifier does not exist at the specified URL.
*/
- public void deleteNonExistent() throws Exception;
+ public void deleteNonExistent(String testName) throws Exception;
}
// Instance variables specific to this test.
private CollectionObjectClient client = new CollectionObjectClient();
- private String knownResourceId = null;
+ private String knownResourceId = null;
/*
* This method is called only by the parent class, AbstractServiceTest
*/
@Override
- public String getServicePathComponent() {
+ protected String getServicePathComponent() {
return client.getServicePathComponent();
}
- // ---------------------------------------------------------------
+ // ---------------------------------------------------------------
// CRUD tests : CREATE tests
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test
- public void create() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class)
+ public void create(String testName) throws Exception {
// Perform setup, such as initializing the type of service request
// (e.g. CREATE, DELETE), its valid and expected status codes, and
// its associated HTTP method name (e.g. POST, DELETE).
- setupCreate();
+ setupCreate(testName);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
-
- MultipartOutput multipart = createCollectionObjectInstance(client.getCommonPartName(), identifier);
+ MultipartOutput multipart =
+ createCollectionObjectInstance(client.getCommonPartName(), identifier);
ClientResponse<Response> res = client.create(multipart);
-
int statusCode = res.getStatus();
// Check the status code of the response: does it match
// Does it fall within the set of valid status codes?
// Does it exactly match the expected status code?
if(logger.isDebugEnabled()){
- logger.debug("create: status = " + statusCode);
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// for additional tests below.
knownResourceId = extractId(res);
if(logger.isDebugEnabled()){
- logger.debug("create: knownResourceId=" + knownResourceId);
+ logger.debug(testName + ": knownResourceId=" + knownResourceId);
}
}
/* (non-Javadoc)
- * @see org.collectionspace.services.client.test.AbstractServiceTest#createList()
+ * @see org.collectionspace.services.client.test.ServiceTest#createList()
*/
@Override
- @Test(dependsOnMethods = {"create"})
- public void createList() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create"})
+ public void createList(String testName) throws Exception {
for(int i = 0; i < 3; i++){
- create();
+ create(testName);
}
}
// Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
@Override
- public void createWithEmptyEntityBody() throws Exception {}
+ public void createWithEmptyEntityBody(String testName) throws Exception {}
@Override
- public void createWithMalformedXml() throws Exception {}
+ public void createWithMalformedXml(String testName) throws Exception {}
@Override
- public void createWithWrongXmlSchema() throws Exception {}
+ public void createWithWrongXmlSchema(String testName) throws Exception {}
/*
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithEmptyEntityBody() throwsException {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithEmptyEntityBody(String testName) throwsException {
// Perform setup.
- setupCreateWithEmptyEntityBody();
+ setupCreateWithEmptyEntityBody(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithEmptyEntityBody url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithMalformedXml() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithMalformedXml(String testName) throws Exception {
// Perform setup.
- setupCreateWithMalformedXml();
+ setupCreateWithMalformedXml(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithMalformedXml url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithWrongXmlSchema() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithWrongXmlSchema(String testName) throws Exception {
// Perform setup.
- setupCreateWithWrongXmlSchema();
+ setupCreateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithWrongXmlSchema url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
// Success outcomes
@Override
- @Test(dependsOnMethods = {"create"})
- public void read() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create"})
+ public void read(String testName) throws Exception {
// Perform setup.
- setupRead();
+ setupRead(testName);
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(knownResourceId);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("read: status = " + statusCode);
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Failure outcomes
@Override
- @Test(dependsOnMethods = {"read"})
- public void readNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"read"})
+ public void readNonExistent(String testName) throws Exception {
// Perform setup.
- setupReadNonExistent();
+ setupReadNonExistent(testName);
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("readNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"createList", "read"})
- public void readList() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"createList", "read"})
+ public void readList(String testName) throws Exception {
+
// Perform setup.
- setupReadList();
+ setupReadList(testName);
// Submit the request to the service and store the response.
ClientResponse<CollectionobjectsCommonList> res = client.readList();
CollectionobjectsCommonList list = res.getEntity();
-
int statusCode = res.getStatus();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("readList: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
int i = 0;
for(CollectionobjectsCommonList.CollectionObjectListItem item : items){
- logger.debug("readList: list-item[" + i + "] csid=" +
+ logger.debug(testName + ": list-item[" + i + "] csid=" +
item.getCsid());
- logger.debug("readList: list-item[" + i + "] objectNumber=" +
+ logger.debug(testName + ": list-item[" + i + "] objectNumber=" +
item.getObjectNumber());
- logger.debug("readList: list-item[" + i + "] URI=" +
+ logger.debug(testName + ": list-item[" + i + "] URI=" +
item.getUri());
i++;
// Failure outcomes
// None at present.
+
// ---------------------------------------------------------------
// CRUD tests : UPDATE tests
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"read"})
- public void update() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"read"})
+ public void update(String testName) throws Exception {
// Perform setup.
- setupUpdate();
+ setupUpdate(testName);
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
- logger.debug("update: read status = " + res.getStatus());
+ logger.debug(testName + ": read status = " + res.getStatus());
}
Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
int statusCode = res.getStatus();
// Check the status code of the response: does it match the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("update: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
@Override
- public void updateWithEmptyEntityBody() throws Exception {}
+ public void updateWithEmptyEntityBody(String testName) throws Exception {}
@Override
- public void updateWithMalformedXml() throws Exception {}
+ public void updateWithMalformedXml(String testName) throws Exception {}
@Override
- public void updateWithWrongXmlSchema() throws Exception {}
+ public void updateWithWrongXmlSchema(String testName) throws Exception {}
/*
@Override
-
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithEmptyEntityBody() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithEmptyEntityBody(String testName) throws Exception {
// Perform setup.
- setupUpdateWithEmptyEntityBody();
+ setupUpdateWithEmptyEntityBody(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithEmptyEntityBody url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml() throws Exception {
// Perform setup.
- setupUpdateWithMalformedXml();
+ setupUpdateWithMalformedXml(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithMalformedXml: url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithWrongXmlSchema() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
// Perform setup.
- setupUpdateWithWrongXmlSchema();
+ setupUpdateWithWrongXmlSchema(String testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithWrongXmlSchema: url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
*/
@Override
- @Test(dependsOnMethods = {"update", "testSubmitRequest"})
- public void updateNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"update", "testSubmitRequest"})
+ public void updateNonExistent(String testName) throws Exception {
// Perform setup.
- setupUpdateNonExistent();
+ setupUpdateNonExistent(testName);
// Submit the request to the service and store the response.
+ //
// Note: The ID used in this 'create' call may be arbitrary.
-
// The only relevant ID may be the one used in updateCollectionObject(), below.
MultipartOutput multipart =
createCollectionObjectInstance(client.getCommonPartName(),
NON_EXISTENT_ID);
ClientResponse<MultipartInput> res =
client.update(NON_EXISTENT_ID, multipart);
-
int statusCode = res.getStatus();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
- public void delete() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+ public void delete(String testName) throws Exception {
// Perform setup.
- setupDelete();
+ setupDelete(testName);
// Submit the request to the service and store the response.
ClientResponse<Response> res = client.delete(knownResourceId);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("delete: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Failure outcomes
@Override
- @Test(dependsOnMethods = {"delete"})
- public void deleteNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"delete"})
+ public void deleteNonExistent(String testName) throws Exception {
// Perform setup.
- setupDeleteNonExistent();
+ setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("deleteNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test
- public void create() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class)
+ public void create(String testName) throws Exception {
// Perform setup, such as initializing the type of service request
// (e.g. CREATE, DELETE), its valid and expected status codes, and
// its associated HTTP method name (e.g. POST, DELETE).
- setupCreate();
+ setupCreate(testName);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
// Does it fall within the set of valid status codes?
// Does it exactly match the expected status code?
if(logger.isDebugEnabled()){
- logger.debug("create: status = " + statusCode);
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// for additional tests below.
knownResourceId = extractId(res);
if(logger.isDebugEnabled()){
- logger.debug("create: knownResourceId=" + knownResourceId);
+ logger.debug(testName + ": knownResourceId=" + knownResourceId);
}
}
@Override
- @Test(dependsOnMethods = {"create"})
- public void createList() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create"})
+ public void createList(String testName) throws Exception {
for(int i = 0; i < 3; i++){
- create();
+ create(testName);
}
}
// Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
@Override
- public void createWithEmptyEntityBody() throws Exception {
+ public void createWithEmptyEntityBody(String testName) throws Exception {
}
@Override
- public void createWithMalformedXml() throws Exception {
+ public void createWithMalformedXml(String testName) throws Exception {
}
@Override
- public void createWithWrongXmlSchema() throws Exception {
+ public void createWithWrongXmlSchema(String testName) throws Exception {
}
/*
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithEmptyEntityBody() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithEmptyEntityBody(String testName) throws Exception {
// Perform setup.
- setupCreateWithEmptyEntityBody();
+ setupCreateWithEmptyEntityBody(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
}
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithMalformedXml() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithMalformedXml(String testName) throws Exception {
// Perform setup.
- setupCreateWithMalformedXml();
+ setupCreateWithMalformedXml(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithMalformedXml url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithWrongXmlSchema() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithWrongXmlSchema(String testName) throws Exception {
// Perform setup.
- setupCreateWithWrongXmlSchema();
+ setupCreateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithWrongSchema url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"create"})
- public void read() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create"})
+ public void read(String testName) throws Exception {
// Perform setup.
- setupRead();
+ setupRead(testName);
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(knownResourceId);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("read: status = " + statusCode);
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Failure outcomes
@Override
- @Test(dependsOnMethods = {"read"})
- public void readNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"read"})
+ public void readNonExistent(String testName) throws Exception {
// Perform setup.
- setupReadNonExistent();
+ setupReadNonExistent(testName);
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("readNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"read"})
- public void readList() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"read"})
+ public void readList(String testName) throws Exception {
// Perform setup.
- setupReadList();
+ setupReadList(testName);
// Submit the request to the service and store the response.
ClientResponse<IntakesCommonList> res = client.readList();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("readList: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
list.getIntakeListItem();
int i = 0;
for(IntakesCommonList.IntakeListItem item : items){
- logger.debug("readList: list-item[" + i + "] csid=" +
+ logger.debug(testName + ": list-item[" + i + "] csid=" +
item.getCsid());
- logger.debug("readList: list-item[" + i + "] objectNumber=" +
+ logger.debug(testName + ": list-item[" + i + "] objectNumber=" +
item.getEntryNumber());
- logger.debug("readList: list-item[" + i + "] URI=" +
+ logger.debug(testName + ": list-item[" + i + "] URI=" +
item.getUri());
i++;
}
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"read"})
- public void update() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"read"})
+ public void update(String testName) throws Exception {
// Perform setup.
- setupUpdate();
+ setupUpdate(testName);
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
- logger.debug("update: read status = " + res.getStatus());
+ logger.debug(testName + ": read status = " + res.getStatus());
}
Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
int statusCode = res.getStatus();
// Check the status code of the response: does it match the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("update: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
@Override
- public void updateWithEmptyEntityBody() throws Exception{
+ public void updateWithEmptyEntityBody(String testName) throws Exception{
}
@Override
- public void updateWithMalformedXml() throws Exception {
+ public void updateWithMalformedXml(String testName) throws Exception {
}
@Override
- public void updateWithWrongXmlSchema() throws Exception {
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
}
/*
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithEmptyEntityBody() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithEmptyEntityBody(String testName) throws Exception {
// Perform setup.
- setupUpdateWithEmptyEntityBody();
+ setupUpdateWithEmptyEntityBody(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithEmptyEntityBody url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithMalformedXml() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithMalformedXml(String testName) throws Exception {
// Perform setup.
- setupUpdateWithMalformedXml();
+ setupUpdateWithMalformedXml(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithMalformedXml: url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithWrongXmlSchema() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
// Perform setup.
- setupUpdateWithWrongXmlSchema();
+ setupUpdateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithWrongXmlSchema: url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
*/
@Override
- @Test(dependsOnMethods = {"update", "testSubmitRequest"})
- public void updateNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"update", "testSubmitRequest"})
+ public void updateNonExistent(String testName) throws Exception {
// Perform setup.
- setupUpdateNonExistent();
+ setupUpdateNonExistent(testName);
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
- public void delete() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+ public void delete(String testName) throws Exception {
// Perform setup.
- setupDelete();
+ setupDelete(testName);
// Submit the request to the service and store the response.
ClientResponse<Response> res = client.delete(knownResourceId);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("delete: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Failure outcomes
@Override
- @Test(dependsOnMethods = {"delete"})
- public void deleteNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"delete"})
+ public void deleteNonExistent(String testName) throws Exception {
// Perform setup.
- setupDeleteNonExistent();
+ setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("deleteNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test
- public void create() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class)
+ public void create(String testName) throws Exception {
// Perform setup, such as initializing the type of service request
// (e.g. CREATE, DELETE), its valid and expected status codes, and
// its associated HTTP method name (e.g. POST, DELETE).
- setupCreate();
+ setupCreate(testName);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
// Does it fall within the set of valid status codes?
// Does it exactly match the expected status code?
if(logger.isDebugEnabled()){
- logger.debug("create: status = " + statusCode);
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
}
@Override
- @Test(dependsOnMethods = {"create"})
- public void createList() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create"})
+ public void createList(String testName) throws Exception {
for(int i = 0; i < 3; i++){
- create();
+ create(testName);
}
}
// Failure outcomes
// Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
- public void createWithEmptyEntityBody() throws Exception {
+ public void createWithEmptyEntityBody(String testName) throws Exception {
}
- public void createWithMalformedXml() throws Exception {
+ public void createWithMalformedXml(String testName) throws Exception {
}
- public void createWithWrongXmlSchema() throws Exception {
+ public void createWithWrongXmlSchema(String testName) throws Exception {
}
/*
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithEmptyEntityBody() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithEmptyEntityBody(String testName) throws Exception {
// Perform setup.
- setupCreateWithEmptyEntityBody();
+ setupCreateWithEmptyEntityBody(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithEmptyEntityBody url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithMalformedXml() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithMalformedXml(String testName) throws Exception {
// Perform setup.
- setupCreateWithMalformedXml();
+ setupCreateWithMalformedXml(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithMalformedXml url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithWrongXmlSchema()n throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithWrongXmlSchema(String testName) throws Exception {
// Perform setup.
- setupCreateWithWrongXmlSchema();
+ setupCreateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("createWithWrongSchema url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"create"})
- public void read() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create"})
+ public void read(String testName) throws Exception {
// Perform setup.
- setupRead();
+ setupRead(testName);
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(knownResourceId);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("read: status = " + statusCode);
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Failure outcomes
@Override
- @Test(dependsOnMethods = {"read"})
- public void readNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"read"})
+ public void readNonExistent(String testName) throws Exception {
// Perform setup.
- setupReadNonExistent();
+ setupReadNonExistent(testName);
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("readNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"createList", "read"})
- public void readList() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"createList", "read"})
+ public void readList(String testName) throws Exception {
// Perform setup.
- setupReadList();
+ setupReadList(testName);
// Submit the request to the service and store the response.
ClientResponse<RelationsCommonList> res = client.readList();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("readList: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
list.getRelationListItem();
int i = 0;
for(RelationsCommonList.RelationListItem item : items){
- logger.debug("readList: list-item[" + i + "] csid=" +
+ logger.debug(testName + ": list-item[" + i + "] csid=" +
item.getCsid());
- logger.debug("readList: list-item[" + i + "] URI=" +
+ logger.debug(testName + ": list-item[" + i + "] URI=" +
item.getUri());
i++;
}
// Success outcomes
@Override
- @Test(dependsOnMethods = {"read"})
- public void update() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"read"})
+ public void update(String testName) throws Exception {
// Perform setup.
- setupUpdate();
+ setupUpdate(testName);
// Retrieve an existing resource that we can update.
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
- logger.debug("update: read status = " + res.getStatus());
+ logger.debug(testName + ": read status = " + res.getStatus());
}
Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
if(logger.isDebugEnabled()){
commonPart.getHeaders().add("label", client.getCommonPartName());
res = client.update(knownResourceId, output);
int statusCode = res.getStatus();
+
// Check the status code of the response: does it match the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("update: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Failure outcomes
// Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
- public void updateWithEmptyEntityBody() throws Exception {
+ public void updateWithEmptyEntityBody(String testName) throws Exception {
}
- public void updateWithMalformedXml() throws Exception {
+ public void updateWithMalformedXml(String testName) throws Exception {
}
- public void updateWithWrongXmlSchema() throws Exception {
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
}
/*
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithEmptyEntityBody() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithEmptyEntityBody(String testName) throws Exception {
// Perform setup.
- setupUpdateWithEmptyEntityBody();
+ setupUpdateWithEmptyEntityBody(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithEmptyEntityBody url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithMalformedXml() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithMalformedXml(String testName) throws Exception {
// Perform setup.
- setupUpdateWithMalformedXml();
+ setupUpdateWithMalformedXml(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithMalformedXml: url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
}
@Override
- @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
- public void updateWithWrongXmlSchema() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
// Perform setup.
- setupUpdateWithWrongXmlSchema();
+ setupUpdateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
String method = REQUEST_TYPE.httpMethodName();
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateWithWrongXmlSchema: url=" + url +
+ logger.debug(testName + ": url=" + url +
" status=" + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
*/
@Override
- @Test(dependsOnMethods = {"update", "testSubmitRequest"})
- public void updateNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"update", "testSubmitRequest"})
+ public void updateNonExistent(String testName) throws Exception {
// Perform setup.
- setupUpdateNonExistent();
+ setupUpdateNonExistent(testName);
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("updateNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// ---------------------------------------------------------------
// Success outcomes
@Override
- @Test(dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
- public void delete() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+ public void delete(String testName) throws Exception {
// Perform setup.
- setupDelete();
+ setupDelete(testName);
// Submit the request to the service and store the response.
ClientResponse<Response> res = client.delete(knownResourceId);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("delete: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
// Failure outcomes
@Override
- @Test(dependsOnMethods = {"delete"})
- public void deleteNonExistent() throws Exception {
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ dependsOnMethods = {"delete"})
+ public void deleteNonExistent(String testName) throws Exception {
// Perform setup.
- setupDeleteNonExistent();
+ setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
// Check the status code of the response: does it match
// the expected response(s)?
if(logger.isDebugEnabled()){
- logger.debug("deleteNonExistent: status = " + res.getStatus());
+ logger.debug(testName + ": status = " + statusCode);
}
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));