public class AccountRoleServiceTest extends AbstractServiceTestImpl {
/** The Constant logger. */
- static private final Logger logger =
- LoggerFactory.getLogger(AccountRoleServiceTest.class);
+ private final static String CLASS_NAME = AccountRoleServiceTest.class.getName();
+ private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
/** The known resource id. */
private String knownResourceId = null;
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ testBanner(testName, CLASS_NAME);
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
AccountValue pv = accValues.get("acc-role-user1");
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ testBanner(testName, CLASS_NAME);
+ }
+
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
AccountRoleClient client = new AccountRoleClient();
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ testBanner(testName, CLASS_NAME);
+ }
+
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
AccountRoleClient client = new AccountRoleClient();
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"read"})
public void delete(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ testBanner(testName, CLASS_NAME);
+ }
+
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
AccountRoleClient client = new AccountRoleClient();
@AfterClass(alwaysRun = true)
@Override
public void cleanUp() {
- setupDelete("cleanUp");
+
+ setupDelete();
String noTest = System.getProperty("noTestCleanup");
if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
* @return the string
*/
private String createAccount(String userName, String email) {
- setupCreate("createAccount");
+
+ if (logger.isDebugEnabled()) {
+ testBanner("createAccount");
+ }
+
+ setupCreate();
+
AccountClient accClient = new AccountClient();
AccountsCommon account = AccountFactory.createAccountInstance(
userName, userName, userName, email,
* @param accId the acc id
*/
private void deleteAccount(String accId) {
- setupDelete("deleteAccount");
+
+ if (logger.isDebugEnabled()) {
+ testBanner("deleteAccount");
+ }
+
+ setupDelete();
+
AccountClient accClient = new AccountClient();
ClientResponse<Response> res = accClient.delete(accId);
int statusCode = res.getStatus();
* @return the string
*/
private String createRole(String roleName) {
- setupCreate("createRole");
+ if (logger.isDebugEnabled()) {
+ testBanner("createRole");
+ }
+ setupCreate();
RoleClient roleClient = new RoleClient();
Role role = RoleFactory.createRoleInstance(roleName,
* @param roleId the role id
*/
private void deleteRole(String roleId) {
- setupDelete("deleteRole");
+ if (logger.isDebugEnabled()) {
+ testBanner("deleteRole");
+ }
+ setupDelete();
RoleClient roleClient = new RoleClient();
ClientResponse<Response> res = roleClient.delete(roleId);
int statusCode = res.getStatus();
public class AccountServiceTest extends AbstractServiceTestImpl {
/** The Constant logger. */
- static private final Logger logger =
- LoggerFactory.getLogger(AccountServiceTest.class);
+ private final String CLASS_NAME = AccountServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
/** The known resource id. */
private String knownResourceId = null;
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
AccountsCommon account =
dependsOnMethods = {"create"})
public void createForUniqueUser(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
AccountsCommon account =
dependsOnMethods = {"create"})
public void createWithInvalidTenant(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
AccountsCommon account =
dependsOnMethods = {"create"})
public void createWithoutUser(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
AccountsCommon account =
dependsOnMethods = {"create"})
public void createWithInvalidEmail(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
AccountsCommon account =
dependsOnMethods = {"create"})
public void createWithoutScreenName(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
AccountsCommon account =
dependsOnMethods = {"create"})
public void createWithInvalidPassword(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
AccountsCommon account =
dependsOnMethods = {"create"})
public void createWithMostInvalid(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
AccountsCommon account =
dependsOnMethods = {"create"})
public void createList(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
AccountsCommon account1 =
createAccountInstance("curious", "curious", "hithere08", "curious@george.com",
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
dependsOnMethods = {"createList", "read"})
public void searchScreenName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
dependsOnMethods = {"createList", "read"})
public void searchUserId(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
dependsOnMethods = {"createList", "read"})
public void searchEmail(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
dependsOnMethods = {"createList", "read"})
public void searchScreenNameEmail(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
dependsOnMethods = {"read", "readList", "readNonExistent"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
dependsOnMethods = {"update"})
public void updatePassword(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
dependsOnMethods = {"update"})
public void updatePasswordWithoutUser(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
AccountsCommon accountToUpdate = new AccountsCommon();
accountToUpdate.setCsid(knownResourceId);
dependsOnMethods = {"update"})
public void updateInvalidPassword(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
if (logger.isDebugEnabled()) {
dependsOnMethods = {"updatePasswordWithoutUser"})
public void deactivate(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
dependsOnMethods = {"deactivate", "readNonExistent", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
//
dependsOnMethods = {"deactivate", "readNonExistent", "testSubmitRequest"})
public void updateWrongUser(String testName) throws Exception {
- setupUpdate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupUpdate();
// Submit the request to the service and store the response.
//
dependsOnMethods = {"testSubmitRequest", "updateWrongUser"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
@Test(dependsOnMethods = {"create", "read"})
public void testSubmitRequest() throws Exception {
- // Expected status code: 200 OK
- final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
+ setupRead();
// Submit the request to the service and store the response.
String method = ServiceRequestType.READ.httpMethodName();
logger.debug("testSubmitRequest: url=" + url
+ " status=" + statusCode);
}
- Assert.assertEquals(statusCode, EXPECTED_STATUS);
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
public class AcquisitionAuthRefsTest extends BaseServiceTest {
- private final Logger logger =
- LoggerFactory.getLogger(AcquisitionAuthRefsTest.class);
+ private final String CLASS_NAME = AcquisitionAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
final String SERVICE_PATH_COMPONENT = "acquisitions";
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void createWithAuthRefs(String testName) throws Exception {
- testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
+ // Perform setup.
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
dependsOnMethods = {"createWithAuthRefs"})
public void readAndCheckAuthRefs(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
// Perform setup.
- testSetup(OK_STATUS, ServiceRequestType.READ,testName);
-
+ testSetup(STATUS_OK, ServiceRequestType.READ);
+
// Submit the request to the service and store the response.
AcquisitionClient acquisitionClient = new AcquisitionClient();
ClientResponse<MultipartInput> res = acquisitionClient.read(knownResourceId);
public class AcquisitionServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(AcquisitionServiceTest.class);
+ private final String CLASS_NAME = AcquisitionServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
/** The known resource id. */
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
String identifier = createIdentifier();
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml();
-
- // Submit the request to the service and store the response.
- String method = REQUEST_TYPE.httpMethodName();
- String url = getServiceRootURL();
- final String entity = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
+ // Perform setup.
+ setupCreateWithMalformedXml();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getServiceRootURL();
+ final String entity = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ 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(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithWrongXmlSchema() throws Exception {
+ public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema();
-
- // Submit the request to the service and store the response.
- String method = REQUEST_TYPE.httpMethodName();
- String url = getServiceRootURL();
- final String entity = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getServiceRootURL();
+ final String entity = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
// Perform setup.
- setupRead(testName);
+ setupRead();
AcquisitionClient client = new AcquisitionClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
AcquisitionClient client = new AcquisitionClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
AcquisitionClient client = new AcquisitionClient();
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
AcquisitionClient client = new AcquisitionClient();
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- (testName + ": url=" + url + " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- }
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
+ // 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)?
+ if(logger.isDebugEnabled()){
+ (testName + ": url=" + url + " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
@Override
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
dependsOnMethods = {"create", "testSubmitRequest"})
- public void createWithEmptyEntityBody() throws Exception {
+ public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // Submit the request to the service and store the response.
- String method = REQUEST_TYPE.httpMethodName();
- String url = getResourceURL(knownResourceId);
- final String entity = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ final String entity = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ 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 updateWithWrongXmlSchema(String testName) {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // Submit the request to the service and store the response.
- String method = REQUEST_TYPE.httpMethodName();
- String url = getResourceURL(knownResourceId);
- final String entity = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ final String entity = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"create", "read", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
AcquisitionClient client = new AcquisitionClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
+
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
AcquisitionClient client = new AcquisitionClient();
/**
* Tests the code for manually submitting data that is used by several
* of the methods above.
+ *
* @throws Exception
*/
@Test(dependsOnMethods = {"create", "read"})
public void testSubmitRequest() throws Exception {
- // Expected status code: 200 OK
- final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
+ // Perform setup.
+ setupRead();
// Submit the request to the service and store the response.
String method = ServiceRequestType.READ.httpMethodName();
logger.debug("testSubmitRequest: url=" + url +
" status=" + statusCode);
}
- Assert.assertEquals(statusCode, EXPECTED_STATUS);
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
return multipart;
}
}
+
public class PermissionRoleServiceTest extends AbstractServiceTestImpl {
/** The Constant logger. */
- static private final Logger logger =
- LoggerFactory.getLogger(PermissionRoleServiceTest.class);
+ private final static String CLASS_NAME = PermissionRoleServiceTest.class.getName();
+ private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
/** The known resource id. */
private String knownResourceId = null;
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
PermissionValue pv = permValues.get(TEST_SERVICE_NAME + TEST_MARKER);
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
PermissionRoleClient client = new PermissionRoleClient();
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
PermissionRoleClient client = new PermissionRoleClient();
dependsOnMethods = {"read"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
PermissionRoleClient client = new PermissionRoleClient();
@AfterClass(alwaysRun = true)
@Override
public void cleanUp() {
- setupDelete("cleanUp");
+ setupDelete();
String noTest = System.getProperty("noTestCleanup");
if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
if (logger.isDebugEnabled()) {
* @return the string
*/
private String createPermission(String resName, EffectType effect) {
- setupCreate("createPermission");
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner("createPermission"));
+ }
+ setupCreate();
PermissionClient permClient = new PermissionClient();
List<PermissionAction> actions = PermissionFactory.createDefaultActions();
Permission permission = PermissionFactory.createPermissionInstance(resName,
* @param permId the perm id
*/
private void deletePermission(String permId) {
- setupDelete("deletePermission");
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner("deletePermission"));
+ }
+ setupDelete();
PermissionClient permClient = new PermissionClient();
ClientResponse<Response> res = null;
try {
* @return the string
*/
private String createRole(String roleName) {
- setupCreate("createRole");
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner("createRole"));
+ }
+ setupCreate();
RoleClient roleClient = new RoleClient();
Role role = RoleFactory.createRoleInstance(roleName,
* @param roleId the role id
*/
private void deleteRole(String roleId) {
- setupDelete("deleteRole");
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner("deleteRole"));
+ }
+ setupDelete();
RoleClient roleClient = new RoleClient();
ClientResponse<Response> res = null;
try {
public class PermissionServiceTest extends AbstractServiceTestImpl {
/** The Constant logger. */
- static private final Logger logger =
- LoggerFactory.getLogger(PermissionServiceTest.class);
+ private final static String CLASS_NAME = PermissionServiceTest.class.getName();
+ private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
/** The known resource id. */
private String knownResourceId = null;
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
List<PermissionAction> actions = PermissionFactory.createDefaultActions();
dependsOnMethods = {"create"})
public void createWithoutResourceName(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
List<PermissionAction> actions = PermissionFactory.createDefaultActions();
dependsOnMethods = {"create"})
public void createList(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
List<PermissionAction> actions = PermissionFactory.createDefaultActions();
Permission permission1 = createPermissionInstance("test-objects",
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
PermissionClient client = new PermissionClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
PermissionClient client = new PermissionClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
PermissionClient client = new PermissionClient();
dependsOnMethods = {"createList", "read"})
public void searchResourceName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
PermissionClient client = new PermissionClient();
dependsOnMethods = {"read", "readList", "readNonExistent"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
Permission permToUpdate = new Permission();
permToUpdate.setCsid(knownResourceId);
public void updateNotAllowed(String testName) throws Exception {
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
Permission permToUpdate = new Permission();
permToUpdate.setCsid(knownResourceId);
dependsOnMethods = {"updateNotAllowed"})
public void updateActions(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
Permission permToUpdate = new Permission();
permToUpdate.setCsid(knownResourceId);
dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
//
dependsOnMethods = {"updateActions", "testSubmitRequest"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
PermissionClient client = new PermissionClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
PermissionClient client = new PermissionClient();
public class RolePermissionServiceTest extends AbstractServiceTestImpl {
/** The Constant logger. */
- static private final Logger logger =
- LoggerFactory.getLogger(RolePermissionServiceTest.class);
+ private final static String CLASS_NAME = RolePermissionServiceTest.class.getName();
+ private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
/** The known resource id. */
private String knownResourceId = null;
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
RoleValue rv = roleValues.get(TEST_ROLE_NAME + TEST_MARKER);
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
RolePermissionClient client = new RolePermissionClient();
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
RolePermissionClient client = new RolePermissionClient();
dependsOnMethods = {"read"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ };
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
RolePermissionClient client = new RolePermissionClient();
@AfterClass(alwaysRun = true)
@Override
public void cleanUp() {
- setupDelete("cleanUp");
+ setupDelete();
String noTest = System.getProperty("noTestCleanup");
if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
if (logger.isDebugEnabled()) {
* @return the string
*/
private String createPermission(String resName, EffectType effect) {
- setupCreate("createPermission");
+ setupCreate();
PermissionClient permClient = new PermissionClient();
List<PermissionAction> actions = PermissionFactory.createDefaultActions();
Permission permission = PermissionFactory.createPermissionInstance(resName,
* @param permId the perm id
*/
private void deletePermission(String permId) {
- setupDelete("deletePermission");
+ setupDelete();
PermissionClient permClient = new PermissionClient();
ClientResponse<Response> res = null;
* @return the string
*/
private String createRole(String roleName) {
- setupCreate("createRole");
+ setupCreate();
RoleClient roleClient = new RoleClient();
Role role = RoleFactory.createRoleInstance(roleName,
* @param roleId the role id
*/
private void deleteRole(String roleId) {
- setupDelete("deleteRole");
+ setupDelete();
RoleClient roleClient = new RoleClient();
ClientResponse<Response> res = null;
try {
public class RoleServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(RoleServiceTest.class);
+ private final static String CLASS_NAME = RoleServiceTest.class.getName();
+ private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
/** The known resource id. */
private String knownResourceId = null;
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
dependsOnMethods = {"create"})
public void createForUniqueRole(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
dependsOnMethods = {"create"})
public void createWithoutRoleName(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
dependsOnMethods = {"create"})
public void createList(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
public void readToVerify(String testName) throws Exception {
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
dependsOnMethods = {"createList", "read"})
public void searchRoleName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
dependsOnMethods = {"read", "readList", "readNonExistent"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
Role roleToUpdate = new Role();
roleToUpdate.setCsid(knownResourceId);
public void updateNotAllowed(String testName) throws Exception {
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
Role roleToUpdate = new Role();
roleToUpdate.setCsid(knownResourceId);
dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
//
dependsOnMethods = {"updateNotAllowed", "testSubmitRequest"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
import java.util.ArrayList;
import java.util.List;
-import javax.ws.rs.core.Response;
-
import org.collectionspace.services.jaxb.AbstractCommonList;
import org.collectionspace.services.client.CollectionSpaceClient;
import org.jboss.resteasy.client.ClientResponse;
/**
* Sets up create tests.
- *
- * @param testName The name of the test being run.
- */
- protected void setupCreate(String testName) {
- setupCreate(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up create tests.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupCreate(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();
+ protected void setupCreate() {
+ EXPECTED_STATUS_CODE = STATUS_CREATED;
REQUEST_TYPE = ServiceRequestType.CREATE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
/* (non-Javadoc)
/**
* Sets up create tests with empty entity body.
- *
- * @param testName The name of the test being run.
- */
- protected void setupCreateWithEmptyEntityBody(String testName) {
- setupCreateWithEmptyEntityBody(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up create tests with empty entity body.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupCreateWithEmptyEntityBody(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
+ protected void setupCreateWithEmptyEntityBody() {
+ EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
REQUEST_TYPE = ServiceRequestType.CREATE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
/* (non-Javadoc)
/**
* Sets up create tests with malformed xml.
- *
- * @param testName The name of the test being run.
- */
- protected void setupCreateWithMalformedXml(String testName) {
- setupCreateWithMalformedXml(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up create tests with malformed xml.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupCreateWithMalformedXml(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
+ protected void setupCreateWithMalformedXml() {
+ EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
REQUEST_TYPE = ServiceRequestType.CREATE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
/* (non-Javadoc)
/**
* Sets up create tests with wrong xml schema.
- *
- * @param testName The name of the test being run.
- */
- protected void setupCreateWithWrongXmlSchema(String testName) {
- setupCreateWithWrongXmlSchema(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up create tests with wrong xml schema.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupCreateWithWrongXmlSchema(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
+ protected void setupCreateWithWrongXmlSchema() {
+ EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
REQUEST_TYPE = ServiceRequestType.CREATE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
// ---------------------------------------------------------------
/**
* Sets up read tests.
- *
- * @param testName The name of the test being run.
- */
- protected void setupRead(String testName) {
- setupRead(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up read tests.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupRead(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();
+ protected void setupRead() {
+ EXPECTED_STATUS_CODE = STATUS_OK;
REQUEST_TYPE = ServiceRequestType.READ;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
// Failure outcomes
/**
* Sets up read non existent tests.
- *
- * @param testName The name of the test being run.
- */
- protected void setupReadNonExistent(String testName) {
- setupReadNonExistent(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up read non existent tests.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupReadNonExistent(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.NOT_FOUND.getStatusCode();
+ protected void setupReadNonExistent() {
+ EXPECTED_STATUS_CODE = STATUS_NOT_FOUND;
REQUEST_TYPE = ServiceRequestType.READ;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
// ---------------------------------------------------------------
/**
* Sets up read list tests.
- *
- * @param testName The name of the test being run.
*/
- protected void setupReadList(String testName) {
- setupReadList(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up read list tests.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
- */
- protected void setupReadList(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();
+ protected void setupReadList() {
+ EXPECTED_STATUS_CODE = STATUS_OK;
REQUEST_TYPE = ServiceRequestType.READ_LIST;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
// Failure outcomes
/**
* Sets up update tests.
- *
- * @param testName The name of the test being run.
- */
- protected void setupUpdate(String testName) {
- setupUpdate(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up update tests.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupUpdate(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();
+ protected void setupUpdate() {
+ EXPECTED_STATUS_CODE = STATUS_OK;
REQUEST_TYPE = ServiceRequestType.UPDATE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
// Failure outcomes
/**
* Sets up update tests with an empty entity body.
- *
- * @param testName The name of the test being run.
- */
- protected void setupUpdateWithEmptyEntityBody(String testName) {
- setupUpdateWithEmptyEntityBody(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up update tests with an empty entity body.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupUpdateWithEmptyEntityBody(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
+ protected void setupUpdateWithEmptyEntityBody() {
+ EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
REQUEST_TYPE = ServiceRequestType.UPDATE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
/* (non-Javadoc)
/**
* Sets up update tests with malformed xml.
- *
- * @param testName The name of the test being run.
- */
- protected void setupUpdateWithMalformedXml(String testName) {
- setupUpdateWithMalformedXml(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up update tests with malformed xml.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupUpdateWithMalformedXml(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
+ protected void setupUpdateWithMalformedXml() {
+ EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
REQUEST_TYPE = ServiceRequestType.UPDATE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
/* (non-Javadoc)
/**
* Sets up update tests with wrong xml schema.
- *
- * @param testName The name of the test being run.
*/
- protected void setupUpdateWithWrongXmlSchema(String testName) {
- setupUpdateWithWrongXmlSchema(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up update tests with wrong xml schema.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
- */
- protected void setupUpdateWithWrongXmlSchema(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.BAD_REQUEST.getStatusCode();
+ protected void setupUpdateWithWrongXmlSchema() {
+ EXPECTED_STATUS_CODE = STATUS_BAD_REQUEST;
REQUEST_TYPE = ServiceRequestType.UPDATE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
/* (non-Javadoc)
@Override
public abstract void updateNonExistent(String testName) throws Exception;
- /**
- * Sets up update non existent tests.
- *
- * @param testName The name of the test being run.
- */
- protected void setupUpdateNonExistent(String testName) {
- setupUpdateNonExistent(testName, LOGGER_NULL);
- }
/**
* Sets up update non existent tests
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupUpdateNonExistent(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.NOT_FOUND.getStatusCode();
+ protected void setupUpdateNonExistent() {
+ EXPECTED_STATUS_CODE = STATUS_NOT_FOUND;
REQUEST_TYPE = ServiceRequestType.UPDATE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
// ---------------------------------------------------------------
/**
* Sets up delete tests.
- *
- * @param testName The name of the test being run.
*/
- protected void setupDelete(String testName) {
- setupDelete(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up delete tests.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
- */
- protected void setupDelete(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();
+ protected void setupDelete() {
+ EXPECTED_STATUS_CODE = STATUS_OK;
REQUEST_TYPE = ServiceRequestType.DELETE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
// Failure outcomes
/**
* Sets up delete non existent tests.
- *
- * @param testName The name of the test being run.
- */
- protected void setupDeleteNonExistent(String testName) {
- setupDeleteNonExistent(testName, LOGGER_NULL);
- }
-
- /**
- * Sets up delete non existent tests.
- *
- * @param testName The name of the test being run.
- *
- * @param testLogger The logger to use within the current base class,
- * when generating log statements related to that test.
*/
- protected void setupDeleteNonExistent(String testName, Logger testLogger) {
- EXPECTED_STATUS_CODE = Response.Status.NOT_FOUND.getStatusCode();
+ protected void setupDeleteNonExistent() {
+ EXPECTED_STATUS_CODE = STATUS_NOT_FOUND;
REQUEST_TYPE = ServiceRequestType.DELETE;
- testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE, testName, testLogger);
+ testSetup(EXPECTED_STATUS_CODE, REQUEST_TYPE);
}
// ---------------------------------------------------------------
dependsOnMethods = {"leafCreate"}) */
public void readPaginatedList(String testName) throws Exception {
// Perform setup.
- setupReadList(testName);
+ setupReadList();
CollectionSpaceClient client = this.getClientInstance();
// Get the current total number of items.
protected static final String MALFORMED_XML_DATA = XML_DECLARATION\r
+ "<malformed_xml>wrong schema contents</malformed_xml";\r
/** The wrong XML schema data. */\r
- protected final String WRONG_XML_SCHEMA_DATA = XML_DECLARATION\r
+ protected static final String WRONG_XML_SCHEMA_DATA = XML_DECLARATION\r
+ "<wrong_schema>wrong schema contents</wrong_schema>";\r
/** The null charset. */\r
- final String NULL_CHARSET = null;\r
+ private static final String NULL_CHARSET = null;\r
\r
- protected final static String BANNER_SEPARATOR_LINE =\r
+ private static final String BANNER_SEPARATOR_LINE =\r
"===================================================";\r
- protected final static String BANNER_PREFIX =\r
+ private static final String BANNER_PREFIX =\r
"\n" + BANNER_SEPARATOR_LINE + "\n";\r
- protected final static String BANNER_SUFFIX =\r
+ private static final String BANNER_SUFFIX =\r
"\n" + BANNER_SEPARATOR_LINE;\r
+ \r
+ protected static final int STATUS_BAD_REQUEST =\r
+ Response.Status.BAD_REQUEST.getStatusCode();\r
+ protected static final int STATUS_CREATED =\r
+ Response.Status.CREATED.getStatusCode();\r
+ protected static final int STATUS_NOT_FOUND =\r
+ Response.Status.NOT_FOUND.getStatusCode();\r
+ protected static final int STATUS_OK =\r
+ Response.Status.OK.getStatusCode();\r
\r
/**\r
* Instantiates a new base service test.\r
}\r
\r
/**\r
- * Initializes setup values for a given test, and prints a banner\r
+ * Initializes setup values for a given test. Returns a banner\r
* identifying the test being run, using the local logger for this class.\r
*\r
* @param expectedStatusCode A status code expected to be returned in the response.\r
*\r
* @param serviceRequestType A type of service request (e.g. CREATE, DELETE).\r
- *\r
- * @param testName The name of the test being run.\r
- */\r
- protected void testSetup(\r
- int expectedStatusCode,\r
- ServiceRequestType reqType,\r
- String testName) {\r
- testSetup(expectedStatusCode, reqType, testName, null);\r
- }\r
-\r
- /**\r
- * Initializes setup values for a given test, and prints a banner\r
- * identifying the test being run, using a specified logger.\r
- *\r
- * @param expectedStatusCode A status code expected to be returned in the response.\r
- *\r
- * @param serviceRequestType A type of service request (e.g. CREATE, DELETE).\r
- *\r
- * @param testName The name of the test being run.\r
- *\r
- * @param testLogger An optional logger to use within the current base\r
- * class, when generating log statements related to that test.\r
- * If null, the logger of the current base class will be used.\r
- */\r
- protected void testSetup(\r
- int expectedStatusCode,\r
- ServiceRequestType reqType,\r
- String testName,\r
- Logger testLogger) {\r
-\r
- testSetup(expectedStatusCode, reqType);\r
-\r
- // Print a banner identifying the test being run.\r
- //\r
- // If an optional logger has been provided, such as by a\r
- // calling class, use that logger to print the banner.\r
- if (testLogger != null) {\r
- if (testLogger.isDebugEnabled()) {\r
- testLogger.debug(testBanner(testName, testLogger));\r
- }\r
- // Otherwise, use this base class's logger to print the banner.\r
- } else {\r
- testLogger = logger;\r
- if (testLogger.isDebugEnabled()) {\r
- testLogger.debug(testBanner(testName));\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Initializes setup values for a given test.\r
- *\r
- * @param expectedStatusCode A status code expected to be returned in the response.\r
- *\r
- * @param serviceRequestType A type of service request (e.g. CREATE, DELETE).\r
*/\r
protected void testSetup(\r
int expectedStatusCode,\r
}\r
\r
/**\r
- * Returns label text inside a test-specific banner.\r
+ * Returns a test-specific banner.\r
*\r
* @param testName The name of a test method.\r
*\r
return banner(testName);\r
}\r
\r
- /**\r
- * Returns a test-specific banner.\r
- *\r
- * @param testName The name of a test method.\r
- *\r
- * @param testLogger An optional logger to use within the current base\r
- * class, when generating log statements related to that test.\r
- *\r
- * @return A test-specific banner.\r
- */\r
- protected static String testBanner(String testName, Logger testLogger) {\r
- String testClass = testLogger.getName();\r
- return testBanner(testName, testClass);\r
- }\r
-\r
/**\r
* Returns a test-specific banner.\r
*\r
public class CollectionObjectAuthRefsTest extends BaseServiceTest {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(CollectionObjectAuthRefsTest.class);
+ private final String CLASS_NAME = CollectionObjectAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
- /** The SERVIC e_ pat h_ component. */
+ /** The service path component. */
final String SERVICE_PATH_COMPONENT = "collectionobjects";
- /** The PERSO n_ authorit y_ name. */
+ /** The person authority name. */
final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
/** The known resource id. */
/** The person ids created. */
private List<String> personIdsCreated = new ArrayList<String>();
- /** The CREATE d_ status. */
- private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
-
- /** The O k_ status. */
- private int OK_STATUS = Response.Status.OK.getStatusCode();
-
/** The person auth csid. */
private String personAuthCSID = null;
/** The inscriber ref name. */
private String inscriberRefName = null;
- /** The NU m_ aut h_ ref s_ expected. */
+ /** The number of authority references expected. */
private final int NUM_AUTH_REFS_EXPECTED = 4;
/* (non-Javadoc)
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void createWithAuthRefs(String testName) throws Exception {
- testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
personAuthCSID = extractId(res);
contentOrganizationRefName = PersonAuthorityClientUtils.createPersonRefName(
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
return extractId(res);
}
dependsOnMethods = {"createWithAuthRefs"})
public void readAndCheckAuthRefs(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+ testSetup(STATUS_OK, ServiceRequestType.READ);
// Submit the request to the service and store the response.
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(CollectionObjectServiceTest.class);
+ private final String CLASS_NAME = CollectionObjectServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
/** The known resource id. */
private String knownResourceId = null;
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
CollectionObjectClient client = new CollectionObjectClient();
@Override
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void createWithMalformedXml(String testName) throws Exception {
- setupCreate(testName);
}
/* (non-Javadoc)
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throwsException {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
*/
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void createWithRequiredValuesNullOrEmpty(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Build a payload with invalid content, by omitting a
// field (objectNumber) which must be present, and in which
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
CollectionObjectClient client = new CollectionObjectClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
CollectionObjectClient client = new CollectionObjectClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
CollectionObjectClient client = new CollectionObjectClient();
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Read an existing resource that will be updated.
ClientResponse<MultipartInput> res = updateRetrieve(testName, knownResourceId);
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml() throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // Submit the request to the service and store the response.
- String method = REQUEST_TYPE.httpMethodName();
- String url = getResourceURL(knownResourceId);
- final String entity = MALFORMED_XML_DATA;
- String mediaType = MediaType.APPLICATION_XML;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ final String entity = MALFORMED_XML_DATA;
+ String mediaType = MediaType.APPLICATION_XML;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(String testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
//
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"read"})
public void updateWithRequiredValuesNullOrEmpty(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
if (logger.isDebugEnabled()) {
logger.debug(testName + " got object to update with ID: " + knownResourceId);
}
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
CollectionObjectClient client = new CollectionObjectClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
CollectionObjectClient client = new CollectionObjectClient();
* @throws Exception the exception
*/
private String createFromXmlFile(String testName, String fileName, boolean useJaxb) 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(testName);
+
+ // Perform setup.
+ setupCreate();
MultipartOutput multipart = null;
*/
public class ServiceLayerTest {
- final Logger logger = LoggerFactory.getLogger(ServiceTest.class);
+ private final String CLASS_NAME = ServiceLayerTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
private TestServiceClient serviceClient = new TestServiceClient();
private HttpClient httpClient = serviceClient.getHttpClient();
@Test
public void servicesExist() {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(BaseServiceTest.testBanner("servicesExist", CLASS_NAME));
+ }
//use ID service that should always be present in a working service layer
String url = serviceClient.getBaseURL() + "idgenerators";
OptionsMethod method = new OptionsMethod(url);
@Test
public void methodNotAllowed() {
+ if (logger.isDebugEnabled()) {
+ logger.debug(BaseServiceTest.testBanner("methodNotAllowed", CLASS_NAME));
+ }
// Delete is not allowed on the root URL of the id service
String url = serviceClient.getBaseURL() + "idgenerators";
DeleteMethod method = new DeleteMethod(url);
@Test
public void nonexistentService() {
+ if (logger.isDebugEnabled()) {
+ logger.debug(BaseServiceTest.testBanner("nonexistentService", CLASS_NAME));
+ }
String url = serviceClient.getBaseURL() + "nonexistent-service";
GetMethod method = new GetMethod(url);
try {
// @Test
public void serviceSecure() {
+ if (logger.isDebugEnabled()) {
+ logger.debug(BaseServiceTest.testBanner("serviceSecure", CLASS_NAME));
+ }
String url = serviceClient.getBaseURL() + "collectionobjects";
GetMethod method = new GetMethod(url);
// This vanilla HTTP client does not contain credentials or any other
@Test
public void traceSupported() {
+ if (logger.isDebugEnabled()) {
+ logger.debug(BaseServiceTest.testBanner("traceSupported", CLASS_NAME));
+ }
String url = serviceClient.getBaseURL() + "collectionobjects";
TraceMethod method = new TraceMethod(url);
try {
@Test
public void headSupported() {
+ if (logger.isDebugEnabled()) {
+ logger.debug(BaseServiceTest.testBanner("headSupported", CLASS_NAME));
+ }
String url = serviceClient.getBaseURL() + "intakes";
HeadMethod method = new HeadMethod(url);
try {
*/
public class ContactServiceTest extends AbstractServiceTestImpl {
- private final Logger logger =
- LoggerFactory.getLogger(ContactServiceTest.class);
+ private final String CLASS_NAME = ContactServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
final String SERVICE_PATH_COMPONENT = "contacts";
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithEmptyEntityBody(testName, logger);
- // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug("createWithEmptyEntityBody url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug("createWithEmptyEntityBody url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema(testName, logger);
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
dependsOnMethods = {"read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema(testName, logger);
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
public class DimensionServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(DimensionServiceTest.class);
+ private final String CLASS_NAME = DimensionServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
/** The SERVIC e_ pat h_ component. */
final String SERVICE_PATH_COMPONENT = "dimensions";
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug("createWithEmptyEntityBody url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithEmptyEntityBody(testName, logger);
+
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug("createWithEmptyEntityBody url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
// ---------------------------------------------------------------
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
dependsOnMethods = {"read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
DimensionClient client = new DimensionClient();
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml(testName, logger);
+
+ // 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 = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema(testName, logger);
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
*/
public class IntakeAuthRefsTest extends BaseServiceTest {
- private final Logger logger =
- LoggerFactory.getLogger(IntakeAuthRefsTest.class);
+ private final String CLASS_NAME = IntakeAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
final String SERVICE_PATH_COMPONENT = "intakes";
private String knownResourceId = null;
private List<String> intakeIdsCreated = new ArrayList<String>();
private List<String> personIdsCreated = new ArrayList<String>();
- private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
- private int OK_STATUS = Response.Status.OK.getStatusCode();
private String personAuthCSID = null;
private String currentOwnerRefName = null;
private String depositorRefName = null;
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void createWithAuthRefs(String testName) throws Exception {
- testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
personAuthCSID = extractId(res);
currentOwnerRefName = PersonAuthorityClientUtils.createPersonRefName(
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
return extractId(res);
}
dependsOnMethods = {"createWithAuthRefs"})
public void readAndCheckAuthRefs(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+ testSetup(STATUS_OK, ServiceRequestType.READ);
// Submit the request to the service and store the response.
IntakeClient intakeClient = new IntakeClient();
public class IntakeServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(IntakeServiceTest.class);
+ private final String CLASS_NAME = IntakeServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
- /** The SERVIC e_ pat h_ component. */
+ /** The service path component. */
final String SERVICE_PATH_COMPONENT = "intakes";
/** The known resource id. */
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
IntakeClient client = new IntakeClient();
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug("createWithEmptyEntityBody url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug("createWithEmptyEntityBody url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema(testName, logger);
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
IntakeClient client = new IntakeClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
IntakeClient client = new IntakeClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
IntakeClient client = new IntakeClient();
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
IntakeClient client = new IntakeClient();
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
IntakeClient client = new IntakeClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
IntakeClient client = new IntakeClient();
*/\r
public class OrganizationAuthRefDocsTest extends BaseServiceTest {\r
\r
- private final Logger logger =\r
- LoggerFactory.getLogger(OrganizationAuthRefDocsTest.class);\r
+ private final String CLASS_NAME = OrganizationAuthRefDocsTest.class.getName();\r
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);\r
\r
// Instance variables specific to this test.\r
final String SERVICE_PATH_COMPONENT = "intakes";\r
private String knownIntakeId = null;\r
private List<String> intakeIdsCreated = new ArrayList<String>();\r
private List<String> orgIdsCreated = new ArrayList<String>();\r
- private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();\r
- private int OK_STATUS = Response.Status.OK.getStatusCode();\r
private String orgAuthCSID = null; \r
private String currentOwnerOrgCSID = null; \r
private String currentOwnerRefName = null;\r
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)\r
public void createIntakeWithAuthRefs(String testName) throws Exception {\r
\r
- testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);\r
\r
// Submit the request to the service and store the response.\r
String identifier = createIdentifier();\r
\r
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
- Assert.assertEquals(statusCode, CREATED_STATUS);\r
+ Assert.assertEquals(statusCode, STATUS_CREATED);\r
orgAuthCSID = extractId(res);\r
\r
currentOwnerRefName = OrgAuthorityClientUtils.createOrganizationRefName(\r
\r
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
- Assert.assertEquals(statusCode, CREATED_STATUS);\r
+ Assert.assertEquals(statusCode, STATUS_CREATED);\r
return extractId(res);\r
}\r
\r
dependsOnMethods = {"createIntakeWithAuthRefs"})\r
public void readAndCheckAuthRefDocs(String testName) throws Exception {\r
\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
// Perform setup.\r
- testSetup(OK_STATUS, ServiceRequestType.READ,testName);\r
+ testSetup(STATUS_OK, ServiceRequestType.READ);\r
\r
// Get the auth ref docs and check them\r
OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();\r
*/
public class PersonAuthRefDocsTest extends BaseServiceTest {
- private final Logger logger =
- LoggerFactory.getLogger(PersonAuthRefDocsTest.class);
+ private final String CLASS_NAME = PersonAuthRefDocsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
final String SERVICE_PATH_COMPONENT = "intakes";
private String knownIntakeId = null;
private List<String> intakeIdsCreated = new ArrayList<String>();
private List<String> personIdsCreated = new ArrayList<String>();
- private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
- private int OK_STATUS = Response.Status.OK.getStatusCode();
private String personAuthCSID = null;
private String currentOwnerPersonCSID = null;
private String currentOwnerRefName = null;
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void createIntakeWithAuthRefs(String testName) throws Exception {
- testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
personAuthCSID = extractId(res);
currentOwnerRefName = PersonAuthorityClientUtils.createPersonRefName(
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
return extractId(res);
}
dependsOnMethods = {"createIntakeWithAuthRefs"})
public void readAndCheckAuthRefDocs(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+ testSetup(STATUS_OK, ServiceRequestType.READ);
// Get the auth ref docs and check them
PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
*/
public class LoaninAuthRefsTest extends BaseServiceTest {
- private final Logger logger =
- LoggerFactory.getLogger(LoaninAuthRefsTest.class);
-
+ private final String CLASS_NAME = LoaninAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
final String SERVICE_PATH_COMPONENT = "loansin";
final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
private String knownResourceId = null;
private List<String> loaninIdsCreated = new ArrayList<String>();
private List<String> personIdsCreated = new ArrayList<String>();
- private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
- private int OK_STATUS = Response.Status.OK.getStatusCode();
private String personAuthCSID = null;
private String lendersAuthorizerRefName = null;
private String lendersContactRefName = null;
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void createWithAuthRefs(String testName) throws Exception {
- testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
personAuthCSID = extractId(res);
// Create temporary Person resources, and their corresponding refNames
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
return extractId(res);
}
dependsOnMethods = {"createWithAuthRefs"})
public void readAndCheckAuthRefs(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+ testSetup(STATUS_OK, ServiceRequestType.READ);
// Submit the request to the service and store the response.
LoaninClient loaninClient = new LoaninClient();
public class LoaninServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(LoaninServiceTest.class);
+ private final String CLASS_NAME = LoaninServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
- /** The SERVIC e_ pat h_ component. */
+ /** The service path component. */
final String SERVICE_PATH_COMPONENT = "loansin";
/** The known resource id. */
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
LoaninClient client = new LoaninClient();
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug("createWithEmptyEntityBody url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug("createWithEmptyEntityBody url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml(testName, logger);
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema(testName, logger);
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
MultipartInput input = null;
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
LoaninClient client = new LoaninClient();
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
LoansinCommonList list = null;
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
MultipartInput input = null;
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
LoaninClient client = new LoaninClient();
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
LoaninClient client = new LoaninClient();
*/
public class LoanoutAuthRefsTest extends BaseServiceTest {
- private final Logger logger =
- LoggerFactory.getLogger(LoanoutAuthRefsTest.class);
+ private final String CLASS_NAME = LoanoutAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
final String SERVICE_PATH_COMPONENT = "loansout";
private String knownResourceId = null;
private List<String> loanoutIdsCreated = new ArrayList<String>();
private List<String> personIdsCreated = new ArrayList<String>();
- private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
- private int OK_STATUS = Response.Status.OK.getStatusCode();
private String personAuthCSID = null;
private String borrowersContactRefName = null;
private String lendersAuthorizerRefName = null;
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void createWithAuthRefs(String testName) throws Exception {
- testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
personAuthCSID = extractId(res);
// Create temporary Person resources, and their corresponding refNames
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
return extractId(res);
}
dependsOnMethods = {"createWithAuthRefs"})
public void readAndCheckAuthRefs(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+ testSetup(STATUS_OK, ServiceRequestType.READ);
// Submit the request to the service and store the response.
LoanoutClient loanoutClient = new LoanoutClient();
public class LoanoutServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(LoanoutServiceTest.class);
+ private final String CLASS_NAME = LoanoutServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
- /** The SERVIC e_ pat h_ component. */
+ /** The service path component. */
final String SERVICE_PATH_COMPONENT = "loansout";
/** The known resource id. */
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
LoanoutClient client = new LoanoutClient();
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug("createWithEmptyEntityBody url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug("createWithEmptyEntityBody url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
LoanoutClient client = new LoanoutClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
LoanoutClient client = new LoanoutClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
LoanoutClient client = new LoanoutClient();
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
LoanoutClient client = new LoanoutClient();
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
LoanoutClient client = new LoanoutClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
LoanoutClient client = new LoanoutClient();
public class LocationAuthorityServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(LocationAuthorityServiceTest.class);
+ private final String CLASS_NAME = LocationAuthorityServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
+
/** The SERVICE path component. */
final String SERVICE_PATH_COMPONENT = "locationauthorities";
- /** The ITEM servicE path component. */
+ /** The ITEM service path component. */
final String ITEM_SERVICE_PATH_COMPONENT = "items";
- /** The CONTACT servicE path component. */
+ /** The CONTACT service path component. */
final String CONTACT_SERVICE_PATH_COMPONENT = "contacts";
/** The TEST name. */
groups = {"create"})
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"create"}, dependsOnMethods = {"create"})
public void createItem(String testName) {
- setupCreate(testName);
+ if(logger.isDebugEnabled()){
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
String newID = createItemInAuthority(knownResourceId, knownResourceRefName);
}
final String testName = "createItemInAuthority";
if(logger.isDebugEnabled()){
- logger.debug(testName + ":...");
+ logger.debug(testBanner(testName, CLASS_NAME));
}
// Submit the request to the service and store the response.
groups = {"read"}, dependsOnGroups = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
groups = {"read"}, dependsOnGroups = {"create"})
public void readByName(String testName) throws Exception {
- // Perform setup.
- setupRead(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupRead();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
groups = {"read"}, dependsOnMethods = {"read"})
public void readItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
dependsOnMethods = {"readItem", "updateItem"})
public void verifyItemDisplayName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
dependsOnMethods = {"verifyItemDisplayName"})
public void verifyIllegalItemDisplayName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
+ // FIXME: create a setup configuration for this operation.
+ setupUpdateWithWrongXmlSchema();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
groups = {"read"}, dependsOnMethods = {"read"})
public void readNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
groups = {"read"}, dependsOnMethods = {"readItem"})
public void readItemNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
groups = {"readList"}, dependsOnGroups = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
*/
@Test(groups = {"readList"}, dependsOnMethods = {"readList"})
public void readItemList() {
+ String testName = "readItemList";
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
readItemList(knownResourceId, null);
}
*/
@Test(groups = {"readList"}, dependsOnMethods = {"readItemList"})
public void readItemListByAuthorityName() {
+ String testName = "readItemListByAuthorityName";
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
readItemList(null, knownResourceDisplayName);
}
*/
private void readItemList(String vcsid, String name) {
- final String testName = "readItemList";
+ String testName = "readItemList";
// Perform setup.
- setupReadList(testName);
+ setupReadList();
- // Submit the request to the service and store the response.
+ // Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
ClientResponse<LocationsCommonList> res = null;
if(vcsid!= null) {
groups = {"update"}, dependsOnGroups = {"read", "readList"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
LocationAuthorityClient client = new LocationAuthorityClient();
groups = {"update"}, dependsOnMethods = {"update"})
public void updateItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
LocationAuthorityClient client = new LocationAuthorityClient();
groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID(s) used when creating the request payload may be arbitrary.
groups = {"update"}, dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
public void updateNonExistentItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "update"})
public void deleteItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
if(logger.isDebugEnabled()){
logger.debug("parentcsid =" + knownResourceId +
groups = {"delete"}, dependsOnMethods = {"deleteItem"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
if(logger.isDebugEnabled()){
logger.debug("parentcsid =" + knownResourceId);
groups = {"delete"}, dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
groups = {"delete"}, dependsOnMethods = {"deleteItem"})
public void deleteNonExistentItem(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
*/
public class MovementAuthRefsTest extends BaseServiceTest {
- private final Logger logger =
- LoggerFactory.getLogger(MovementAuthRefsTest.class);
+ private final String CLASS_NAME = MovementAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
final String SERVICE_PATH_COMPONENT = "movements";
private String knownResourceId = null;
private List<String> movementIdsCreated = new ArrayList<String>();
private List<String> personIdsCreated = new ArrayList<String>();
- private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
- private int OK_STATUS = Response.Status.OK.getStatusCode();
private String personAuthCSID = null;
private String movementContactRefName = null;
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void createWithAuthRefs(String testName) throws Exception {
- testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
// Submit the request to the service and store the response.
String identifier = createIdentifier();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
personAuthCSID = extractId(res);
// Create temporary Person resources, and their corresponding refNames
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
return extractId(res);
}
dependsOnMethods = {"createWithAuthRefs"})
public void readAndCheckAuthRefs(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+ testSetup(STATUS_OK, ServiceRequestType.READ);
// Submit the request to the service and store the response.
MovementClient movementClient = new MovementClient();
public class MovementServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(MovementServiceTest.class);
+ private final String CLASS_NAME = MovementServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
/** The service path component. */
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
MovementClient client = new MovementClient();
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug("createWithEmptyEntityBody url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug("createWithEmptyEntityBody url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
MovementClient client = new MovementClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
MovementClient client = new MovementClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
MovementClient client = new MovementClient();
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
MovementClient client = new MovementClient();
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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);
+ // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
MovementClient client = new MovementClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
MovementClient client = new MovementClient();
private MultipartOutput createMovementInstance(String movementReferenceNumber,
String locationDate) {
MovementsCommon movement = new MovementsCommon();
- movement.setMovementReferenceNumber(movementReferenceNumber);
+ // FIXME: Values of currentLocation, normalLocation,
+ // and movementContact should be refNames.
+ movement.setCurrentLocation("currentLocation value");
+ movement.setCurrentLocationFitness("currentLocationFitness value");
+ movement.setCurrentLocationNote("currentLocationNote value");
movement.setLocationDate(locationDate);
+ movement.setNormalLocation("normalLocation value");
+ movement.setMovementContact("movementContact value");
MovementMethodsList movementMethodsList = new MovementMethodsList();
List<String> methods = movementMethodsList.getMovementMethod();
// @TODO Use properly formatted refNames for representative movement
methods.add("First Movement Method-" + identifier);
methods.add("Second Movement Method-" + identifier);
movement.setMovementMethods(movementMethodsList);
+ movement.setMovementNote("movementNote value");
+ movement.setMovementReferenceNumber(movementReferenceNumber);
+ movement.setPlannedRemovalDate("plannedRemovalDate value");
+ movement.setRemovalDate("removalDate value");
+ movement.setReasonForMove("reasonForMove value");
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
multipart.addPart(movement, MediaType.APPLICATION_XML_TYPE);
*/\r
public class NoteServiceTest extends AbstractServiceTestImpl {\r
\r
- private final Logger logger =\r
- LoggerFactory.getLogger(NoteServiceTest.class);\r
+ private final String CLASS_NAME = NoteServiceTest.class.getName();\r
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);\r
\r
// Instance variables specific to this test.\r
final String SERVICE_PATH_COMPONENT = "notes";\r
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)\r
public void create(String testName) throws Exception {\r
\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
// Perform setup, such as initializing the type of service request\r
// (e.g. CREATE, DELETE), its valid and expected status codes, and\r
// its associated HTTP method name (e.g. POST, DELETE).\r
- setupCreate(testName);\r
+ setupCreate();\r
\r
// Submit the request to the service and store the response.\r
NoteClient client = new NoteClient();\r
dependsOnMethods = {"create"})\r
public void read(String testName) throws Exception {\r
\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
// Perform setup.\r
- setupRead(testName);\r
+ setupRead();\r
\r
// Submit the request to the service and store the response.\r
NoteClient client = new NoteClient();\r
dependsOnMethods = {"read"})\r
public void readNonExistent(String testName) throws Exception {\r
\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
// Perform setup.\r
- setupReadNonExistent(testName);\r
+ setupReadNonExistent();\r
\r
// Submit the request to the service and store the response.\r
NoteClient client = new NoteClient();\r
dependsOnMethods = {"read"})\r
public void readList(String testName) throws Exception {\r
\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
// Perform setup.\r
- setupReadList(testName);\r
+ setupReadList();\r
\r
// Submit the request to the service and store the response.\r
NoteClient client = new NoteClient();\r
dependsOnMethods = {"read"})\r
public void update(String testName) throws Exception {\r
\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
// Perform setup.\r
- setupUpdate(testName);\r
+ setupUpdate();\r
\r
// Submit the request to the service and store the response.\r
NoteClient client = new NoteClient();\r
dependsOnMethods = {"update", "testSubmitRequest"})\r
public void updateNonExistent(String testName) throws Exception {\r
\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
// Perform setup.\r
- setupUpdateNonExistent(testName);\r
+ setupUpdateNonExistent();\r
\r
// Submit the request to the service and store the response.\r
// Note: The ID used in this 'create' call may be arbitrary.\r
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})\r
public void delete(String testName) throws Exception {\r
\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
// Perform setup.\r
- setupDelete(testName);\r
+ setupDelete();\r
\r
// Submit the request to the service and store the response.\r
NoteClient client = new NoteClient();\r
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,\r
dependsOnMethods = {"delete"})\r
public void deleteNonExistent(String testName) throws Exception {\r
-\r
+ \r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(testBanner(testName, CLASS_NAME));\r
+ }\r
// Perform setup.\r
- setupDeleteNonExistent(testName);\r
+ setupDeleteNonExistent();\r
\r
// Submit the request to the service and store the response.\r
NoteClient client = new NoteClient();\r
public class OrgAuthorityAuthRefsTest extends BaseServiceTest {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(OrgAuthorityAuthRefsTest.class);
+ private final String CLASS_NAME = OrgAuthorityAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
/** The SERVIC e_ pat h_ component. */
/** The person ids created. */
private List<String> personIdsCreated = new ArrayList<String>();
- /** The CREATE d_ status. */
- private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
-
- /** The O k_ status. */
- private int OK_STATUS = Response.Status.OK.getStatusCode();
-
/** The person auth csid. */
private String personAuthCSID = null;
/** The organization contact person ref name. */
private String organizationContactPersonRefName = null;
- /** The NU m_ aut h_ ref s_ expected. */
+ /** The number of authorityreferences expected. */
private final int NUM_AUTH_REFS_EXPECTED = 1;
/* (non-Javadoc)
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void createWithAuthRefs(String testName) throws Exception {
- testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
// Create a new Organization Authority resource.
OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
int statusCode = res.getStatus();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
personAuthCSID = extractId(res);
} finally {
res.releaseConnection();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, CREATED_STATUS);
+ Assert.assertEquals(statusCode, STATUS_CREATED);
result = extractId(res);
} finally {
res.releaseConnection();
dependsOnMethods = {"createWithAuthRefs"})
public void readAndCheckAuthRefs(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+ testSetup(STATUS_OK, ServiceRequestType.READ);
// Submit the request to the service and store the response.
OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(OrgAuthorityServiceTest.class);
+ private final String CLASS_NAME = OrgAuthorityServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
- /** The SERVIC e_ pat h_ component. */
+ /** The service path component. */
final String SERVICE_PATH_COMPONENT = "orgauthorities";
- /** The ITE m_ servic e_ pat h_ component. */
+ /** The item service path component. */
final String ITEM_SERVICE_PATH_COMPONENT = "items";
- /** The CONTAC t_ servic e_ pat h_ component. */
+ /** The contact service path component. */
final String CONTACT_SERVICE_PATH_COMPONENT = "contacts";
- /** The TES t_ or g_ shortname. */
+ /** The test organization shortname. */
private final String TEST_ORG_SHORTNAME = "Test Org";
- /** The TES t_ or g_ foundin g_ place. */
+ /** The test organization founding place. */
private final String TEST_ORG_FOUNDING_PLACE = "Anytown, USA";
/** The known resource id. */
groups = {"create"})
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"create"}, dependsOnMethods = {"create"})
public void createItem(String testName) {
- setupCreate(testName);
+ setupCreate();
String newID = createItemInAuthority(knownResourceId, knownResourceRefName);
}
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"create"}, dependsOnMethods = {"createItem"})
public void createContact(String testName) {
- setupCreate(testName);
+ setupCreate();
String newID = createContactInItem(knownResourceId, knownItemResourceId);
}
private String createContactInItem(String parentcsid, String itemcsid) {
final String testName = "createContactInItem";
- setupCreate(testName);
- if(logger.isDebugEnabled()){
- logger.debug(testName + ":...");
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
}
+ setupCreate();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()) {
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- }
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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)?
+ if(logger.isDebugEnabled()) {
+ 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(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
groups = {"read"}, dependsOnGroups = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"read"}, dependsOnGroups = {"create"})
public void readByName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"read"}, dependsOnMethods = {"read"})
public void readByName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(knownResourceId);
groups = {"read"}, dependsOnMethods = {"read"})
public void readItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
dependsOnMethods = {"readItem", "updateItem"})
public void verifyItemDisplayName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
dependsOnMethods = {"verifyItemDisplayName"})
public void verifyIllegalItemDisplayName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
+ testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
+ // setupUpdateWithWrongXmlSchema(testName, logger);
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"read"}, dependsOnMethods = {"readItem"})
public void readContact(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"read"}, dependsOnMethods = {"read"})
public void readNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"read"}, dependsOnMethods = {"readItem"})
public void readItemNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"read"}, dependsOnMethods = {"readContact"})
public void readContactNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"readList"}, dependsOnGroups = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
final String testName = "readItemList";
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
private void readContactList(String parentcsid, String itemcsid) {
final String testName = "readContactList";
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"update"}, dependsOnGroups = {"read", "readList"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"update"}, dependsOnMethods = {"update"})
public void updateItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"update"}, dependsOnMethods = {"updateItem"})
public void updateContact(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- }
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
- @Override
- @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
- groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
- public void updateWithWrongXmlSchema(String testName) throws Exception {
+ // 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 = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug("updateWithWrongXmlSchema: url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
+ groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
+
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema(testName, logger);
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug("updateWithWrongXmlSchema: url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
groups = {"update"}, dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
public void updateNonExistentItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID(s) used when creating the request payload may be arbitrary.
groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "update"})
public void deleteContact(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
if(logger.isDebugEnabled()){
logger.debug("parentcsid =" + knownResourceId +
groups = {"delete"}, dependsOnMethods = {"deleteContact"})
public void deleteItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
if(logger.isDebugEnabled()){
logger.debug("parentcsid =" + knownResourceId +
groups = {"delete"}, dependsOnMethods = {"deleteItem"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
if(logger.isDebugEnabled()){
logger.debug("parentcsid =" + knownResourceId);
groups = {"delete"}, dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"delete"}, dependsOnMethods = {"deleteItem"})
public void deleteNonExistentItem(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
groups = {"delete"}, dependsOnMethods = {"deleteContact"})
public void deleteNonExistentContact(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
*/
public class PersonAuthoritySearchTest extends BaseServiceTest {
- static final Logger logger = LoggerFactory.getLogger(PersonAuthoritySearchTest.class);
-
+ private final String CLASS_NAME = PersonAuthoritySearchTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
/** The service path component. */
final String SERVICE_PATH_COMPONENT = "personauthorities";
groups = {"readListByPartialTerm"})
public void partialTermMatch(String testName) {
if (logger.isDebugEnabled()) {
- logger.debug(testBanner(testName, logger));
+ logger.debug(testBanner(testName, CLASS_NAME));
}
int numMatchesFound = 0;
String partialTerm = getPartialTerm();
groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
public void partialTermMatchCaseInsensitiveLowerCase(String testName) {
if (logger.isDebugEnabled()) {
- logger.debug(testBanner(testName, logger));
+ logger.debug(testBanner(testName, CLASS_NAME));
}
int numMatchesFound = 0;
groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
public void partialTermMatchCaseInsensitiveUpperCase(String testName) {
if (logger.isDebugEnabled()) {
- logger.debug(testBanner(testName, logger));
+ logger.debug(testBanner(testName, CLASS_NAME));
}
int numMatchesFound = 0;
groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
public void partialTermMatchMinimumLength(String testName) {
if (logger.isDebugEnabled()) {
- logger.debug(testBanner(testName, logger));
+ logger.debug(testBanner(testName, CLASS_NAME));
}
int numMatchesFound = 0;
String partialTerm = getPartialTermMinimumLength();
groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
public void partialTermMatchUTF8(String testName) {
if (logger.isDebugEnabled()) {
- logger.debug(testBanner(testName, logger));
+ logger.debug(testBanner(testName, CLASS_NAME));
}
int numMatchesFound = 0;
String partialTerm = getPartialTermUtf8();
groups = {"readListByPartialTerm"}, dependsOnMethods = {"partialTermMatch"})
public void partialTermMatchOnNonexistentTerm(String testName) {
if (logger.isDebugEnabled()) {
- logger.debug(testBanner(testName, logger));
+ logger.debug(testBanner(testName, CLASS_NAME));
}
int numMatchesFound = 0;
int ZERO_MATCHES_EXPECTED = 0;
*/
private int readItemListByPartialTerm(String authorityCsid, String partialTerm) {
+ String testName = "readItemListByPartialTerm";
+
// Perform setup.
int expectedStatusCode = Response.Status.OK.getStatusCode();
ServiceRequestType requestType = ServiceRequestType.READ_LIST;
- String testName = "readItemListByPartialTerm";
- testSetup(expectedStatusCode, requestType, testName, logger);
+ testSetup(expectedStatusCode, requestType);
- // Submit the request to the service and store the response.
+ // Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<PersonsCommonList> res = null;
if (authorityCsid != null) {
public void createAuthority() throws Exception {
+ String testName = "createAuthority";
+
// Perform setup.
int expectedStatusCode = Response.Status.CREATED.getStatusCode();
ServiceRequestType requestType = ServiceRequestType.CREATE;
- String testName = "createPersonAuthority";
- testSetup(expectedStatusCode, requestType, testName, logger);
+ testSetup(expectedStatusCode, requestType);
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<Response> res = client.create(multipart);
try {
int statusCode = res.getStatus();
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
*/
private void createItemInAuthorityForPartialTermMatch(String authorityCsid, String authRefName)
throws Exception {
+
+ String testName = "createItemInAuthorityForPartialTermMatch";
int expectedStatusCode = Response.Status.CREATED.getStatusCode();
ServiceRequestType requestType = ServiceRequestType.CREATE;
- String testName = "createItemInAuthorityForPartialTermMatch";
- testSetup(expectedStatusCode, requestType, testName);
+ testSetup(expectedStatusCode, requestType);
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(PersonAuthorityServiceTest.class);
+ private final String CLASS_NAME = PersonAuthorityServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
/** The service path component. */
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"create"})
public void create(String testName) throws Exception {
-
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"create"}, dependsOnMethods = {"create"})
public void createItem(String testName) {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
String newID = createItemInAuthority(knownResourceId, knownResourceRefName);
}
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"create"}, dependsOnMethods = {"createItem"})
public void createContact(String testName) {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
String newID = createContactInItem(knownResourceId, knownItemResourceId);
}
private String createContactInItem(String parentcsid, String itemcsid) {
final String testName = "createContactInItem";
- setupCreate(testName);
if(logger.isDebugEnabled()){
logger.debug(testName + ":...");
}
+
+ setupCreate();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()) {
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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)?
+ if(logger.isDebugEnabled()) {
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
groups = {"create"}, dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"createList"}, dependsOnGroups = {"create"})
public void createList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
for (int i = 0; i < nItemsToCreateInList; i++) {
create(testName);
}
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"createList"}, dependsOnMethods = {"createList"})
public void createItemList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Add items to the initially-created, known parent record.
for (int j = 0; j < nItemsToCreateInList; j++) {
createItem(testName);
groups = {"read"}, dependsOnGroups = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"read"}, dependsOnGroups = {"create"})
public void readByName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"read"}, dependsOnMethods = {"read"})
public void readByName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
setupRead();
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"read"}, dependsOnMethods = {"read"})
public void readItem(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"readItem", "updateItem"})
public void verifyItemDisplayName(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
dependsOnMethods = {"verifyItemDisplayName"})
public void verifyIllegalItemDisplayName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
+ testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
+ // setupUpdateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"read"}, dependsOnMethods = {"readItem"})
public void readContact(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"read"}, dependsOnMethods = {"read"})
public void readNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"read"}, dependsOnMethods = {"readItem"})
public void readItemNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"read"}, dependsOnMethods = {"readContact"})
public void readContactNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"readList"}, dependsOnGroups = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
final String testName = "readItemList";
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
final String testName = "readContactList";
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"update"}, dependsOnGroups = {"read", "readList", "readListByPartialTerm"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"update"}, dependsOnMethods = {"update"})
public void updateItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
PersonAuthorityClient client = new PersonAuthorityClient();
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
groups = {"update"}, dependsOnMethods = {"updateItem"})
public void updateContact(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithEmptyEntityBody(testName, logger);
+
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug("updateWithWrongXmlSchema: url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug("updateWithWrongXmlSchema: url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
groups = {"update"}, dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID(s) used when creating the request payload may be arbitrary.
// The only relevant ID may be the one used in update(), below.
PersonAuthorityClient client = new PersonAuthorityClient();
- String displayName = "displayName-NON_EXISTENT_ID";
+ String displayName = "displayName-NON_EXISTENT_ID";
String fullRefName = PersonAuthorityClientUtils.createPersonAuthRefName(displayName, true);
MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
displayName, fullRefName, client.getCommonPartName());
groups = {"update"}, dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
public void updateNonExistentItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
groups = {"delete"}, dependsOnGroups = {"create", "read", "readList", "readListByPartialTerm", "update"})
public void deleteContact(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
if(logger.isDebugEnabled()){
logger.debug("parentcsid =" + knownResourceId +
groups = {"delete"}, dependsOnMethods = {"deleteContact"})
public void deleteItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
if(logger.isDebugEnabled()){
logger.debug("parentcsid =" + knownResourceId +
groups = {"delete"}, dependsOnMethods = {"deleteItem"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
if(logger.isDebugEnabled()){
logger.debug("parentcsid =" + knownResourceId);
groups = {"delete"}, dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"delete"}, dependsOnMethods = {"deleteItem"})
public void deleteNonExistentItem(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
groups = {"delete"}, dependsOnMethods = {"deleteContact"})
public void deleteNonExistentContact(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
public class RelationServiceTest extends AbstractServiceTestImpl {
/** The logger. */
- private final Logger logger =
- LoggerFactory.getLogger(RelationServiceTest.class);
+ private final String CLASS_NAME = RelationServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
- /** The SERVIC e_ pat h_ component. */
+ /** The SERVICE path component. */
final String SERVICE_PATH_COMPONENT = "relations";
/** The known resource id. */
@Override
public void create(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
RelationClient client = new RelationClient();
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
RelationClient client = new RelationClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
RelationClient client = new RelationClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
RelationClient client = new RelationClient();
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve an existing resource that we can update.
RelationClient client = new RelationClient();
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA; // Constant from abstract base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA; // Constant from abstract base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA; // Constant from abstract base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA; // Constant from abstract base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
RelationClient client = new RelationClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
RelationClient client = new RelationClient();
@Test(dependsOnMethods = {"create", "read"})
public void testSubmitRequest() {
- // Expected status code: 200 OK
- final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
+ setupRead();
// Submit the request to the service and store the response.
String method = ServiceRequestType.READ.httpMethodName();
logger.debug("testSubmitRequest: url=" + url +
" status=" + statusCode);
}
- Assert.assertEquals(statusCode, EXPECTED_STATUS);
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
// ---------------------------------------------------------------
private String knownResourceId = null;
private String barneyAccountId = null; //active
private String georgeAccountId = null; //inactive
+
/** The logger. */
- final Logger logger = LoggerFactory.getLogger(AuthenticationServiceTest.class);
-
+ private final String CLASS_NAME = AuthenticationServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTest#getServicePathComponent()
*/
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void createActiveAccount(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
+
AccountClient accountClient = new AccountClient();
accountClient.setAuth(true, "test", true, "test", true);
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void createInactiveAccount(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(testName);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreate();
+
AccountClient accountClient = new AccountClient();
accountClient.setAuth(true, "test", true, "test", true);
}
res.releaseConnection();
//deactivate
- setupUpdate(testName);
+ setupUpdate();
account.setStatus(Status.INACTIVE);
if (logger.isDebugEnabled()) {
logger.debug(testName + ":updated object");
dependsOnMethods = {"createActiveAccount"})
@Override
public void create(String testName) {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
collectionObjectClient.setAuth(true, "barney", true, "barney08", true);
String identifier = BaseServiceTest.createIdentifier();
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"createActiveAccount"})
public void createWithoutAuthn(String testName) {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
collectionObjectClient.setAuth(false, "test", true, "test", true);
String identifier = BaseServiceTest.createIdentifier();
@Test(dataProvider = "testName", dependsOnMethods = {"createInactiveAccount"})
public void createWithInactiveAccount(String testName) {
- banner(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName));
+ }
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
collectionObjectClient.setAuth(true, "george", true, "george08", true);
String identifier = BaseServiceTest.createIdentifier();
*/
@Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
public void createWithoutPassword(String testName) {
- banner(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName));
+ }
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
collectionObjectClient.setAuth(true, "test", true, "", false);
String identifier = BaseServiceTest.createIdentifier();
*/
@Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
public void createWithUnknownUser(String testName) {
- banner(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName));
+ }
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
collectionObjectClient.setAuth(true, "foo", true, "bar", true);
String identifier = BaseServiceTest.createIdentifier();
*/
@Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
public void createWithIncorrectPassword(String testName) {
- banner(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName));
+ }
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
collectionObjectClient.setAuth(true, "test", true, "bar", true);
String identifier = BaseServiceTest.createIdentifier();
*/
@Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
public void createWithIncorrectUserPassword(String testName) {
- banner(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName));
+ }
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
collectionObjectClient.setAuth(true, "foo", true, "bar", true);
String identifier = BaseServiceTest.createIdentifier();
*/
@Test(dataProvider = "testName", dependsOnMethods = {"createActiveAccount"})
public void createWithoutTenant(String testName) {
- banner(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName));
+ }
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
collectionObjectClient.setAuth(true, "babybop", true, "babybop09", true);
String identifier = BaseServiceTest.createIdentifier();
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"create"})
public void delete(String testName) {
- setupDelete(testName);
+ setupDelete();
}
dependsOnMethods = {"create", "createWithInactiveAccount"})
public void deleteAccounts(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
AccountClient accountClient = new AccountClient();
accountClient.setAuth(true, "test", true, "test", true);
// Submit the request to the service and store the response.
*/
public class AuthorizationServiceTest extends AbstractServiceTestImpl {
- static private final Logger logger =
- LoggerFactory.getLogger(AuthorizationServiceTest.class);
+ private final String CLASS_NAME = AuthorizationServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
// Instance variables specific to this test.
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
@Override
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
- setupCreate(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupCreate();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
public void readNonExistent(String testName) throws Exception {
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
}
// ---------------------------------------------------------------
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
- setupReadList(testName);
+ setupReadList();
}
// Failure outcomes
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"read", "readList", "readNonExistent"})
public void update(String testName) throws Exception {
- setupUpdate(testName);
+ setupUpdate();
}
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"read", "readList", "readNonExistent"})
public void updateNotAllowed(String testName) throws Exception {
- setupUpdate(testName);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ setupUpdate();
DimensionClient client = new DimensionClient();
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"updateNotAllowed"})
public void deleteNotAllowed(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"deleteNotAllowed"})
public void delete(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
// ---------------------------------------------------------------
@AfterClass(alwaysRun = true)
public void cleanUp() {
- setupDelete("cleanup");
+ setupDelete();
String noTest = System.getProperty("noTestCleanup");
if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
if (logger.isDebugEnabled()) {
private String createPermission(String resName,
List<PermissionAction> actions, EffectType effect) {
- setupCreate("createPermission");
+ setupCreate();
PermissionClient permClient = new PermissionClient();
Permission permission = PermissionFactory.createPermissionInstance(resName,
"default permissions for " + resName,
}
private void deletePermission(String permId) {
- setupDelete("deletePermission");
+ setupDelete();
PermissionClient permClient = new PermissionClient();
ClientResponse<Response> res = permClient.delete(permId);
int statusCode = res.getStatus();
}
private String createRole(String roleName) {
- setupCreate("createRole");
+ setupCreate();
RoleClient roleClient = new RoleClient();
Role role = RoleFactory.createRoleInstance(roleName,
}
private void deleteRole(String roleId) {
- setupDelete("deleteRole");
+ setupDelete();
RoleClient roleClient = new RoleClient();
ClientResponse<Response> res = roleClient.delete(roleId);
int statusCode = res.getStatus();
}
private String createAccount(String userName, String email) {
- setupCreate("createAccount");
+ setupCreate();
AccountClient accClient = new AccountClient();
AccountsCommon account = AccountFactory.createAccountInstance(
userName, userName, userName, email,
}
private void deleteAccount(String accId) {
- setupDelete("deleteAccount");
+ setupDelete();
AccountClient accClient = new AccountClient();
ClientResponse<Response> res = accClient.delete(accId);
int statusCode = res.getStatus();
private String createAccountRole(AccountValue av,
Collection<RoleValue> rvs) {
- setupCreate("createAccountRole");
+ setupCreate();
// Submit the request to the service and store the response.
AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
private void deleteAccountRole(String screenName) {
// Perform setup.
- setupDelete("deleteAccountRole");
+ setupDelete();
// Submit the request to the service and store the response.
AccountRoleClient client = new AccountRoleClient();
private String createPermissionRole(PermissionValue pv,
Collection<RoleValue> rvs) {
- setupCreate("createPermissionRole");
+ setupCreate();
List<RoleValue> rvls = new ArrayList<RoleValue>();
rvls.addAll(rvs);
PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
private void deletePermissionRole(String permId) {
// Perform setup.
- setupDelete("deletePermissionRole");
+ setupDelete();
// Submit the request to the service and store the response.
PermissionRoleClient client = new PermissionRoleClient();
*/
public class VocabularyServiceTest extends AbstractServiceTestImpl {
- private final Logger logger =
- LoggerFactory.getLogger(VocabularyServiceTest.class);
+ private final String CLASS_NAME = VocabularyServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
// Instance variables specific to this test.
final String SERVICE_PATH_COMPONENT = "vocabularies";
@Override
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
public void create(String testName) throws Exception {
-
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// 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(testName);
+ setupCreate();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"create"})
public void createItem(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupCreate(testName);
+ setupCreate();
VocabularyClient client = new VocabularyClient();
HashMap<String, String> itemInfo = new HashMap<String, String>();
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupCreateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()) {
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithEmptyEntityBody(testName, CLASS_NAME);
+
+ // 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)?
+ if(logger.isDebugEnabled()) {
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupCreateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA; // Constant from base class.
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "testSubmitRequest"})
public void createWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupCreateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"create"})
public void read(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"read"})
public void readByName(String testName) throws Exception {
- // Perform setup.
- setupRead(testName);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupRead();
- // Submit the request to the service and store the response.
- ClientResponse<MultipartInput> res = client.read(knownResourceId);
- int statusCode = res.getStatus();
+ // Submit the request to the service and store the response.
+ ClientResponse<MultipartInput> res = client.read(knownResourceId);
+ int statusCode = res.getStatus();
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- //FIXME: remove the following try catch once Aron fixes signatures
- try {
- MultipartInput input = (MultipartInput) res.getEntity();
- VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input,
- client.getCommonPartName(), VocabulariesCommon.class);
- Assert.assertNotNull(vocabulary);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
}
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ //FIXME: remove the following try catch once Aron fixes signatures
+ try {
+ MultipartInput input = (MultipartInput) res.getEntity();
+ VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input,
+ client.getCommonPartName(), VocabulariesCommon.class);
+ Assert.assertNotNull(vocabulary);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
*/
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"createItem", "read"})
public void readItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupRead(testName);
+ setupRead();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"updateItem"})
public void verifyIllegalItemDisplayName(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
+ testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
+ // setupUpdateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"read"})
public void readNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"readItem", "readNonExistent"})
public void readItemNonExistent(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadNonExistent(testName);
+ setupReadNonExistent();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"createList", "read"})
public void readList(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
final String testName = "readItemList";
// Perform setup.
- setupReadList(testName);
+ setupReadList();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"read"})
public void update(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"readItem", "update"})
public void updateItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdate(testName);
+ setupUpdate();
// Retrieve the contents of a resource to update.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithEmptyEntityBody(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithEmptyEntityBody(testName);
-
- // 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)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // 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)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithMalformedXml(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithMalformedXml(testName);
-
- // 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 = MALFORMED_XML_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // 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 = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
@Override
dependsOnMethods = {"create", "update", "testSubmitRequest"})
public void updateWithWrongXmlSchema(String testName) throws Exception {
- // Perform setup.
- setupUpdateWithWrongXmlSchema(testName);
-
- // 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 = WRONG_XML_SCHEMA_DATA;
- int statusCode = submitRequest(method, url, mediaType, entity);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug("updateWithWrongXmlSchema: url=" + url +
- " status=" + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // 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 = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, mediaType, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug("updateWithWrongXmlSchema: url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
*/
dependsOnMethods = {"update", "testSubmitRequest"})
public void updateNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"updateItem", "testItemSubmitRequest"})
public void updateNonExistentItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupUpdateNonExistent(testName);
+ setupUpdateNonExistent();
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
public void delete(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
"updateItem", "verifyIllegalItemDisplayName"})
public void deleteItem(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDelete(testName);
+ setupDelete();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"delete"})
public void deleteNonExistent(String testName) throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
dependsOnMethods = {"deleteItem"})
public void deleteNonExistentItem(String testName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
// Perform setup.
- setupDeleteNonExistent(testName);
+ setupDeleteNonExistent();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
public void testSubmitRequest() {
// Expected status code: 200 OK
- final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
-
+ setupRead();
+
// Submit the request to the service and store the response.
String method = ServiceRequestType.READ.httpMethodName();
String url = getResourceURL(knownResourceId);
logger.debug("testSubmitRequest: url=" + url +
" status=" + statusCode);
}
- Assert.assertEquals(statusCode, EXPECTED_STATUS);
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}