// Failure outcomes
+ @Override
+ public abstract void createWithEmptyEntityBody();
+
+ protected void setupCreateWithEmptyEntityBody() {
+ clearSetup();
+ EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
+ REQUEST_TYPE = ServiceRequestType.CREATE;
+ }
+
@Override
public abstract void createWithMalformedXml();
// Failure outcomes
+ @Override
+ public abstract void updateWithEmptyEntityBody();
+
+ protected void setupUpdateWithEmptyEntityBody() {
+ clearSetup();
+ EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
+ REQUEST_TYPE = ServiceRequestType.UPDATE;
+ }
+
@Override
public abstract void updateWithMalformedXml();
// Failure outcomes
+ /**
+ * Tests creation of a resource by submitting
+ * an empty entity body (aka empty payload).
+ */
+ public void createWithEmptyEntityBody();
+
/**
* Tests creation of a resource by submitting
* a representation with malformed XML data.
// Failure outcomes
+ /**
+ * Tests updating the content of a resource
+ * by submitting an empty entity body (aka empty payload).
+ */
+ public void updateWithEmptyEntityBody();
+
/**
* Tests updating the content of a resource
* by submitting a representation with malformed
// Failure outcomes
- // Placeholders until the two tests below can be uncommented.
+ // Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
+ public void createWithEmptyEntityBody() {}
public void createWithMalformedXml() {}
public void createWithWrongXmlSchema() {}
/*
+ @Override
+ @Test(dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithEmptyEntityBody() {
+
+ // Perform setup.
+ setupCreateWithEmptyEntityBody();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getServiceRootURL();
+ String mediaType = MediaType.APPLICATION_XML;
+ final String entity = "";
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("createWithEmptyEntityBody 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"})
public void createWithMalformedXml() {
// Failure outcomes
- // Placeholders until the two tests below can be uncommented.
+ // Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
+ public void updateWithEmptyEntityBody() {}
public void updateWithMalformedXml() {}
public void updateWithWrongXmlSchema() {}
/*
+ @Override
+ @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithEmptyEntityBody() {
+
+ // Perform setup.
+ setupUpdateWithEmptyEntityBody();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ String mediaType = MediaType.APPLICATION_XML;
+ final String entity = "";
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("updateWithEmptyEntityBody 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() {
// Failure outcomes
- // Placeholders until the two tests below can be uncommented.
+ // Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
+ public void createWithEmptyEntityBody() {}
public void createWithMalformedXml() {}
public void createWithWrongXmlSchema() {}
/*
+ @Override
+ @Test(dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithEmptyEntityBody() {
+
+ // Perform setup.
+ setupCreateWithEmptyEntityBody();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getServiceRootURL();
+ String mediaType = MediaType.APPLICATION_XML;
+ final String entity = "";
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("createWithEmptyEntityBody 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"})
public void createWithMalformedXml() {
// Failure outcomes
- // Placeholders until the two tests below can be uncommented.
+ // Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
+ public void updateWithEmptyEntityBody() {}
public void updateWithMalformedXml() {}
public void updateWithWrongXmlSchema() {}
/*
+ @Override
+ @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithEmptyEntityBody() {
+
+ // Perform setup.
+ setupUpdateWithEmptyEntityBody();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ String mediaType = MediaType.APPLICATION_XML;
+ final String entity = "";
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("updateWithEmptyEntityBody 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() {
// Failure outcomes
- // Placeholders until the two tests below can be uncommented.
+ // Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
+ public void createWithEmptyEntityBody() {}
public void createWithMalformedXml() {}
public void createWithWrongXmlSchema() {}
/*
+ @Override
+ @Test(dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithEmptyEntityBody() {
+
+ // Perform setup.
+ setupCreateWithEmptyEntityBody();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getServiceRootURL();
+ String mediaType = MediaType.APPLICATION_XML;
+ final String entity = "";
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("createWithEmptyEntityBody 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"})
public void createWithMalformedXml() {
// Failure outcomes
- // Placeholders until the two tests below can be uncommented.
+ // Placeholders until the three tests below can be uncommented.
// See Issue CSPACE-401.
+ public void updateWithEmptyEntityBody() {}
public void updateWithMalformedXml() {}
public void updateWithWrongXmlSchema() {}
/*
+ @Override
+ @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithEmptyEntityBody() {
+
+ // Perform setup.
+ setupUpdateWithEmptyEntityBody();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ String mediaType = MediaType.APPLICATION_XML;
+ final String entity = "";
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("updateWithEmptyEntityBody 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() {