AccountRoleClient client = new AccountRoleClient();
ClientResponse<AccountRole> res = client.read(
accValues.get("acc-role-user1").getAccountId());
- int statusCode = res.getStatus();
+ assertStatusCode(res, testName);
try {
- // 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);
-
AccountRole output = res.getEntity();
Assert.assertNotNull(output);
} finally {
AccountRoleClient client = new AccountRoleClient();
ClientResponse<AccountRole> res = client.read(
accValues.get("acc-role-user2").getAccountId());
- int statusCode = res.getStatus();
+ assertStatusCode(res, testName);
try {
- // 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, Response.Status.OK.getStatusCode());
AccountRole output = res.getEntity();
if(logger.isDebugEnabled()) {
// Submit the request to the service and store the response.
ClientResponse<AccountRole> res = roleClient.readRoleAccounts(
roleValues.get("ROLE_CO1").getRoleId());
- int statusCode = res.getStatus();
+ assertStatusCode(res, testName);
try {
- // 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);
AccountRole output = res.getEntity();
// Now verify that the role has 2 accounts associate to it.
AccountClient client = new AccountClient();
ClientResponse<AccountsCommonList> res =
client.readSearchList(null, this.prebuiltAdminUserId, null);
+ assertStatusCode(res, "findPrebuiltAdminAccount");
AccountsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
List<AccountListItem> items = list.getAccountListItem();
Assert.assertEquals(1, items.size(), "Found more than one Admin account!");
AccountListItem item = items.get(0);
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> 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);
+ assertStatusCode(res, testName);
AccountsCommon output = (AccountsCommon) res.getEntity();
Assert.assertNotNull(output);
// Submit the request to the service and store the response.
AccountClient client = new AccountClient();
ClientResponse<AccountsCommonList> res = client.readList();
+ assertStatusCode(res, testName);
AccountsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
AccountClient client = new AccountClient();
ClientResponse<AccountsCommonList> res =
client.readSearchList("tom", null, null);
+ assertStatusCode(res, testName);
+
AccountsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
Assert.assertEquals(1, list.getAccountListItem().size());
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
AccountClient client = new AccountClient();
ClientResponse<AccountsCommonList> res =
client.readSearchList(null, "tom", null);
+ assertStatusCode(res, testName);
+
AccountsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
Assert.assertEquals(1, list.getAccountListItem().size());
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
AccountClient client = new AccountClient();
ClientResponse<AccountsCommonList> res =
client.readSearchList(null, null, "dinoland");
+ assertStatusCode(res, testName);
+
AccountsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
Assert.assertEquals(2, list.getAccountListItem().size());
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
AccountClient client = new AccountClient();
ClientResponse<AccountsCommonList> res =
client.readSearchList("tom", null, "jerry");
+ assertStatusCode(res, testName);
+
AccountsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
Assert.assertEquals(1, list.getAccountListItem().size());
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got object to update with ID: " + knownResourceId);
// Submit the request to the service and store the response.
res = client.update(knownResourceId, accountToUpdate);
- 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);
+ assertStatusCode(res, testName);
AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
Assert.assertNotNull(accountUpdated);
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug(testName + ": got object to update password with ID: " + knownResourceId);
// Submit the request to the service and store the response.
res = client.update(knownResourceId, accountToUpdate);
- 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);
-
+ assertStatusCode(res, testName);
AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
Assert.assertNotNull(accountUpdated);
setupUpdate();
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug(testName + ": got object to update password with ID: " + knownResourceId);
AccountClient client = new AccountClient();
ClientResponse<AccountsCommonList> res =
client.readSearchList(null, this.prebuiltAdminUserId, null);
+ assertStatusCode(res, "findPrebuiltAdminAccount");
AccountsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
List<AccountListItem> items = list.getAccountListItem();
Assert.assertEquals(1, items.size(), "Found more than one Admin account!");
AccountListItem item = items.get(0);
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(prebuiltAdminCSID);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
- if (logger.isDebugEnabled()) {
- logger.debug("Did get on Admin Account to update with ID: " + prebuiltAdminCSID);
- }
+ assertStatusCode(res, testName);
AccountsCommon accountFound = (AccountsCommon) res.getEntity();
Assert.assertNotNull(accountFound);
// Submit the request to the service and store the response.
res = client.update(prebuiltAdminCSID, accountToUpdate);
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));
- // Note that the error is not returned, it is just ignored
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // Comment below was not understood - but preserved in case it is
+ // important - during work on CSPACE-4572, which replaced several
+ // lines of status code checking with the call below.
+ //
+ // Note that the error is not returned, it is just ignored
+ assertStatusCode(res, testName);
+
AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
Assert.assertNotNull(accountUpdated);
// Submit the request to the service and store the response.
ClientResponse<AccountsCommon> accountRes = client.read(testResourceId);
- statusCode = accountRes.getStatus();
-
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(accountRes, testName);
AccountsCommon accountRead = (AccountsCommon) accountRes.getEntity();
Assert.assertNotNull(accountRead);
// Submit the request to the service and store the response.
accountRes = client.update(testResourceId, accountToUpdate);
- statusCode = accountRes.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);
-
+ assertStatusCode(accountRes, testName);
AccountsCommon accountUpdated = (AccountsCommon) accountRes.getEntity();
Assert.assertNotNull(accountUpdated);
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got object to update with ID: " + knownResourceId);
// Submit the request to the service and store the response.
res = client.update(knownResourceId, accountToUpdate);
- 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);
+ assertStatusCode(res, testName);
AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
Assert.assertNotNull(accountUpdated);
// The only relevant ID may be the one used in updateAccount(), below.
AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got object to update with ID: " + knownResourceId);
// Submit the request to the service and store the response.
AcquisitionClient acquisitionClient = new AcquisitionClient();
ClientResponse<String> res = acquisitionClient.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 + ".read: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
AcquisitionsCommon acquisition = (AcquisitionsCommon) extractPart(input,
// Get the auth refs and check them
ClientResponse<AuthorityRefList> res2 =
acquisitionClient.getAuthorityRefs(knownResourceId);
- statusCode = res2.getStatus();
-
- if(logger.isDebugEnabled()){
- logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res2, testName);
+
AuthorityRefList list = res2.getEntity();
List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
// Submit the request to the service and store the response.
AcquisitionClient client = new AcquisitionClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
if(logger.isTraceEnabled()){
// Retrieve the contents of a resource to update.
AcquisitionClient client = new AcquisitionClient();
ClientResponse<String> res = client.read(knownResourceId);
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
- if(logger.isDebugEnabled()){
- logger.debug("got object to update with ID: " + knownResourceId);
- }
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
AcquisitionsCommon acquisition = (AcquisitionsCommon) extractPart(input,
res = client.update(knownResourceId, output);
int statusCode = res.getStatus();
- // Check the status code of the response: does it match the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
input = new PoxPayloadIn(res.getEntity());
AcquisitionsCommon updatedAcquisition =
// Submit the request to the service and store the response.
AcquisitionClient client = new AcquisitionClient();
ClientResponse<String> res = client.read(csid);
- 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);
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
try {
res = client.read(
permValues.get(TEST_SERVICE_NAME + TEST_MARKER).getPermissionId());
- 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);
-
+ assertStatusCode(res, testName);
PermissionRole output = (PermissionRole) res.getEntity();
Assert.assertNotNull(output);
} finally {
try {
res = client.read(
permValues.get(TEST_SERVICE_NAME + TEST_MARKER + NO_REL_SUFFIX).getPermissionId());
- 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, Response.Status.OK.getStatusCode());
-
+ assertStatusCode(res, testName);
+
PermissionRole output = (PermissionRole) res.getEntity();
String sOutput = objectAsXmlString(output, PermissionRole.class);
// Submit the request to the service and store the response.
PermissionClient client = new PermissionClient();
ClientResponse<Permission> 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);
-
+ assertStatusCode(res, testName);
Permission output = (Permission) res.getEntity();
Assert.assertNotNull(output);
}
// Submit the request to the service and store the response.
PermissionClient client = new PermissionClient();
ClientResponse<PermissionsList> res = client.readList();
+ assertStatusCode(res, testName);
PermissionsList list = res.getEntity(PermissionsList.class);
- 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);
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
// Submit the request to the service and store the response.
PermissionClient client = new PermissionClient();
ClientResponse<PermissionsList> res = client.readSearchList("acquisition");
+ assertStatusCode(res, testName);
PermissionsList list = res.getEntity(PermissionsList.class);
- 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);
int EXPECTED_ITEMS = 5; //seeded permissions
int actual = list.getPermission().size();
if (logger.isDebugEnabled()) {
PermissionClient client = new PermissionClient();
// Submit the request to the service and store the response.
ClientResponse<Permission> res = client.update(knownResourceId, permToUpdate);
- 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);
-
-
+ assertStatusCode(res, testName);
Permission permUpdated = (Permission) res.getEntity();
Assert.assertNotNull(permUpdated);
PermissionClient client = new PermissionClient();
// Submit the request to the service and store the response.
ClientResponse<Permission> res = client.update(knownResourceId, permToUpdate);
- 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);
-
+ assertStatusCode(res, testName);
Permission permUpdated = (Permission) res.getEntity();
Assert.assertNotNull(permUpdated);
int updated_actions = permToUpdate.getAction().size();
ClientResponse<PermissionRole> res = null;
try {
res = client.read(roleValues.get(getRoleName()).getRoleId());
- 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);
-
+ assertStatusCode(res, testName);
PermissionRole output = (PermissionRole) res.getEntity();
Assert.assertNotNull(output);
} finally {
try {
res = client.read(roleValues.get(getRoleName() + NO_REL_SUFFIX).getRoleId());
- 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, Response.Status.OK.getStatusCode());
+ assertStatusCode(res, testName);
PermissionRole output = (PermissionRole) res.getEntity();
String sOutput = objectAsXmlString(output, PermissionRole.class);
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
ClientResponse<Role> 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);
-
+ assertStatusCode(res, testName);
Role output = (Role) res.getEntity();
Assert.assertNotNull(output);
}
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
ClientResponse<Role> res = client.read(verifyResourceId);
- 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);
-
+ assertStatusCode(res, testName);
Role output = (Role) res.getEntity();
Assert.assertNotNull(output);
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
ClientResponse<RolesList> res = client.readList();
+ assertStatusCode(res, testName);
RolesList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
// Submit the request to the service and store the response.
RoleClient client = new RoleClient();
ClientResponse<RolesList> res = client.readSearchList("movingImage");
+ assertStatusCode(res, testName);
RolesList list = res.getEntity();
- int statusCode = res.getStatus();
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
int EXPECTED_ITEMS = 1;
if (logger.isDebugEnabled()) {
logger.debug(testName + ": received = " + list.getRole().size()
RoleClient client = new RoleClient();
// Submit the request to the service and store the response.
ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
- 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);
-
-
+ assertStatusCode(res, testName);
Role roleUpdated = (Role) res.getEntity();
Assert.assertNotNull(roleUpdated);
// Submit the request to the service and store the response.
ClientResponse<Role> roleRes = client.read(testResourceId);
- statusCode = roleRes.getStatus();
-
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+ assertStatusCode(roleRes, testName);
Role roleRead = (Role) roleRes.getEntity();
Assert.assertNotNull(roleRead);
String mdProtection = roleRead.getMetadataProtection();
// Submit the request to the service and store the response.
roleRes = client.update(testResourceId, roleToUpdate);
- statusCode = roleRes.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);
-
-
+ assertStatusCode(roleRes, testName);
Role roleUpdated = (Role) roleRes.getEntity();
Assert.assertNotNull(roleUpdated);
if (logger.isDebugEnabled()) {
setupReadList();
BatchClient client = new BatchClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
String bar = "\r\n\r\n=================================\r\n\r\n";
System.out.println(bar+" res: "+res);
AbstractCommonList list = res.getEntity();
-
System.out.println(bar+" list: "+list);
- assertStatusCode(res, testName);
if(logger.isTraceEnabled()){
AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
setupReadList();
BlobClient client = new BlobClient();
ClientResponse<AbstractCommonList> res = client.readList();
- AbstractCommonList list = res.getEntity();
assertStatusCode(res, testName);
+ AbstractCommonList list = res.getEntity();
if (logger.isDebugEnabled()) {
List<AbstractCommonList.ListItem> items =
list.getListItem();
//
CollectionSpacePoxClient client = assertPoxClient();
ClientResponse<AbstractCommonList> res = client.readIncludeDeleted(includeDeleted);
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
- //
- // Check the status code of the response: does it match
- // the expected response(s)?
- //
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
//
// Now check that list size is correct
//
null, /* partial terms */
null, /* keywords */
includeDeleted);
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
- //
- // Check the status code of the response: does it match
- // the expected response(s)?
- //
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
result = list.getTotalItems();
// Send the search request and receive a response
ClientResponse<AbstractCommonList> res = client.keywordSearchIncludeDeleted(KEYWORD, Boolean.FALSE);
int result = res.getStatus();
- Assert.assertEquals(result, STATUS_OK);
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
long itemsMatchedBySearch = list.getTotalItems();
// Send the search request and receive a response
res = client.keywordSearchIncludeDeleted(KEYWORD, Boolean.TRUE);
result = res.getStatus();
- Assert.assertEquals(result, STATUS_OK);
+ assertStatusCode(res, testName);
list = res.getEntity();
itemsMatchedBySearch = list.getTotalItems();
//
AuthorityClient client = (AuthorityClient) this.getClientInstance();
ClientResponse<String> res = client.readItemWorkflow(parentCsid, itemCsid);
- assertStatusCode(
- res, testName);
+ assertStatusCode(res, testName);
logger.debug("Got object to update life cycle state with ID: " + itemCsid);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
WorkflowCommon workflowCommons = (WorkflowCommon) extractPart(input, WorkflowClient.SERVICE_COMMONPART_NAME, WorkflowCommon.class);
// Submit the request to the service and store the response.
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
ClientResponse<String> res = collectionObjectClient.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 + ".read: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
CollectionobjectsCommon collectionObject = (CollectionobjectsCommon) extractPart(input,
// Get all of the auth refs and check that the expected number is returned
ClientResponse<AuthorityRefList> res2 = collectionObjectClient.getAuthorityRefs(knownResourceId);
- statusCode = res2.getStatus();
-
- if(logger.isDebugEnabled()){
- logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res2, testName);
+
AuthorityRefList list = res2.getEntity();
List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
// Submit the request to the service and store the response.
CollectionObjectClient client = new CollectionObjectClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
// the expected response(s)?
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
ClientResponse<String> 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);
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
ContactsCommon contact = (ContactsCommon) extractPart(input,
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = false;
// Submit the request to the service and store the response.
ContactClient client = new ContactClient();
ClientResponse<String> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got object to update with ID: " + knownResourceId);
commonPart.setLabel(client.getCommonPartName());
res = client.update(knownResourceId, output);
- int statusCode = res.getStatus();
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
input = new PoxPayloadIn(res.getEntity());
ContactsCommon updatedContact =
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
ClientResponse<String> 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);
-
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
DimensionsCommon dimensionsCommon = null;
// Submit the request to the service and store the response.
DimensionClient client = new DimensionClient();
ClientResponse<DimensionsCommonList> res = client.readList();
+ assertStatusCode(res, testName);
DimensionsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = false;
DimensionClient client = new DimensionClient();
ClientResponse<String> res =
client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got object to update with ID: " + knownResourceId);
}
res = client.update(knownResourceId, output);
int statusCode = res.getStatus();
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
input = new PoxPayloadIn(res.getEntity());
DimensionsCommon updatedDimensionsCommon =
(DimensionsCommon) extractPart(input,
setupReadList();
GroupClient client = new GroupClient();
ClientResponse<AbstractCommonList> res = client.readList();
- AbstractCommonList list = res.getEntity();
assertStatusCode(res, testName);
+ AbstractCommonList list = res.getEntity();
if(logger.isTraceEnabled()){
AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
}
// Submit the request to the service and store the response.
IdClient client = new IdClient();
ClientResponse<String> res = client.createId(knownResourceId);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- //
- // Specifically:
- // Does it fall within the set of valid status codes?
- // Does it exactly match the expected status code?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
String generatedId = res.getEntity();
Assert.assertNotNull(generatedId);
// Assumes that the last part in the ID pattern generates values
// that will always differ at each generation.
res = client.createId(knownResourceId);
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
String secondGeneratedId = res.getEntity();
Assert.assertNotNull(secondGeneratedId);
// Submit the request to the service and store the response.
IdClient client = new IdClient();
ClientResponse<String> 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);
-
+ assertStatusCode(res, testName);
String entity = res.getEntity();
Assert.assertNotNull(entity);
if (logger.isDebugEnabled()) {
// Submit the request to the service and store the response.
IdClient client = new IdClient();
ClientResponse<String> res = client.readList();
- 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);
-
- // 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);
-
+ assertStatusCode(res, testName);
String entity = res.getEntity();
Assert.assertNotNull(entity);
if (logger.isDebugEnabled()) {
// Submit the request to the service and store the response.
IntakeClient intakeClient = new IntakeClient();
ClientResponse<String> res = intakeClient.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 + ".read: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
IntakesCommon intake = (IntakesCommon) extractPart(input,
// Get the auth refs and check them
ClientResponse<AuthorityRefList> res2 = intakeClient.getAuthorityRefs(knownResourceId);
- statusCode = res2.getStatus();
+ assertStatusCode(res2, testName);
- if(logger.isDebugEnabled()){
- logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
AuthorityRefList list = res2.getEntity();
List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
// Submit the request to the service and store the response.
IntakeClient client = new IntakeClient();
ClientResponse<String> 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);
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
// Submit the request to the service and store the response.
IntakeClient client = new IntakeClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
// Retrieve the contents of a resource to update.
IntakeClient client = new IntakeClient();
ClientResponse<String> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got object to update with ID: " + knownResourceId);
// Submit the request to the service and store the response.
res = client.update(knownResourceId, output);
- int statusCode = res.getStatus();
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
+
input = new PoxPayloadIn(res.getEntity());
IntakesCommon updatedIntake =
(IntakesCommon) extractPart(input,
// Retrieve the contents of a resource to update.
IntakeClient client = new IntakeClient();
ClientResponse<String> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
- if (logger.isDebugEnabled()) {
- logger.debug("got object to update with ID: " + knownResourceId);
- }
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
PayloadInputPart payloadInputPart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
Element coreAsElement = null;
// Submit the request to the service and store the response.
res = client.update(knownResourceId, output);
- int statusCode = res.getStatus();
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
input = new PoxPayloadIn(res.getEntity());
PayloadInputPart updatedCorePart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();\r
ClientResponse<AuthorityRefDocList> refDocListResp =\r
orgAuthClient.getReferencingObjects(orgAuthCSID, currentOwnerOrgCSID);\r
+ assertStatusCode(refDocListResp, testName);\r
\r
- int statusCode = refDocListResp.getStatus();\r
-\r
- if(logger.isDebugEnabled()){\r
- logger.debug(testName + ".getReferencingObjects: status = " + statusCode);\r
- }\r
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
AuthorityRefDocList list = refDocListResp.getEntity();\r
\r
// Optionally output additional data about list members for debugging.\r
PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
ClientResponse<AuthorityRefDocList> refDocListResp =
personAuthClient.getReferencingObjects(personAuthCSID, currentOwnerPersonCSID);
-
- int statusCode = refDocListResp.getStatus();
-
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ".getReferencingObjects: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(refDocListResp, testName);
AuthorityRefDocList list = refDocListResp.getEntity();
List<AuthorityRefDocList.AuthorityRefDocItem> items =
personAuthClient = new PersonAuthorityClient();
refDocListResp =
personAuthClient.getReferencingObjects(personAuthCSID, depositorPersonCSID);
-
- statusCode = refDocListResp.getStatus();
-
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ".getReferencingObjects: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(refDocListResp, testName);
list = refDocListResp.getEntity();
items = list.getAuthorityRefDocItem();
PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
ClientResponse<AuthorityRefDocList> refDocListResp =
personAuthClient.getReferencingObjects(personAuthCSID, insurerPersonCSID);
-
- int statusCode = refDocListResp.getStatus();
-
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ".getReferencingObjects: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(refDocListResp, testName);
AuthorityRefDocList list = refDocListResp.getEntity();
List<AuthorityRefDocList.AuthorityRefDocItem> items =
// Submit the request to the service and store the response.
LoaninClient loaninClient = new LoaninClient();
ClientResponse<String> res = loaninClient.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 + ".read: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Extract the common part from the response.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
// Get the auth refs and check them
ClientResponse<AuthorityRefList> res2 =
loaninClient.getAuthorityRefs(knownResourceId);
- statusCode = res2.getStatus();
-
- if(logger.isDebugEnabled()){
- logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res2, testName);
AuthorityRefList list = res2.getEntity();
List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
// Submit the request to the service and store the response.
LoaninClient client = new LoaninClient();
ClientResponse<String> res = client.read(knownResourceId);
+ assertStatusCode(res, testName);
PoxPayloadIn input = null;
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, EXPECTED_STATUS_CODE);
input = new PoxPayloadIn(res.getEntity());
} finally {
res.releaseConnection();
AbstractCommonList list = null;
LoaninClient client = new LoaninClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
list = res.getEntity();
} finally {
res.releaseConnection();
// Retrieve the contents of a resource to update.
LoaninClient client = new LoaninClient();
ClientResponse<String> res = client.read(knownResourceId);
+ assertStatusCode(res, testName);
PoxPayloadIn input = null;
try {
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
if (logger.isDebugEnabled()) {
logger.debug("got object to update with ID: " + knownResourceId);
}
PayloadOutputPart commonPart = output.addPart(loaninCommon, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartName());
res = client.update(knownResourceId, output);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
input = new PoxPayloadIn(res.getEntity());
} finally {
res.releaseConnection();
// Submit the request to the service and store the response.
LoanoutClient loanoutClient = new LoanoutClient();
ClientResponse<String> res = loanoutClient.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 + ".read: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Extract the common part from the response.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
// Get the auth refs and check them
ClientResponse<AuthorityRefList> res2 =
loanoutClient.getAuthorityRefs(knownResourceId);
- statusCode = res2.getStatus();
+ assertStatusCode(res2, testName);
- if(logger.isDebugEnabled()){
- logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
AuthorityRefList list = res2.getEntity();
List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
// Submit the request to the service and store the response.
LoanoutClient client = new LoanoutClient();
ClientResponse<String> 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);
+ assertStatusCode(res, testName);
// Get the common part of the response and verify that it is not null.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
// Submit the request to the service and store the response.
LoanoutClient client = new LoanoutClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
// Retrieve the contents of a resource to update.
LoanoutClient client = new LoanoutClient();
ClientResponse<String> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
- if (logger.isDebugEnabled()) {
- logger.debug("got object to update with ID: " + knownResourceId);
- }
+ assertStatusCode(res, testName);
// Extract the common part from the response.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
PayloadOutputPart commonPart = output.addPart(loanoutCommon, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartName());
res = client.update(knownResourceId, output);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Extract the updated common part from the response.
input = new PoxPayloadIn(res.getEntity());
LocationAuthorityClient client = new LocationAuthorityClient();
String newID = null;
ClientResponse<String> res = client.read(knownResourceId);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
//FIXME: remove the following try catch once Aron fixes signatures
try {
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
ClientResponse<String> res = client.readByName(knownResourceShortIdentifer);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
//FIXME: remove the following try catch once Aron fixes signatures
try {
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
// Check whether we've received a location.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
LocationsCommon location = (LocationsCommon) extractPart(input,
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
// Check whether location has expected displayName.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
LocationsCommon location = (LocationsCommon) extractPart(input,
commonPart.setLabel(client.getItemCommonPartName());
res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
commonPart.setLabel(client.getItemCommonPartName());
res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
if (logger.isDebugEnabled()) {
logger.debug(testBanner(testName, CLASS_NAME));
}
- // Perform setup.
- // FIXME: create a setup configuration for this operation.
- setupUpdateWithWrongXmlSchema();
+
+ // Perform setup for read.
+ setupRead();
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+ assertStatusCode(res, testName);
+
+ // Perform setup for update.
+ testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
+
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, Response.Status.OK.getStatusCode());
// Check whether Location has expected displayName.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
commonPart.setLabel(client.getItemCommonPartName());
res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
} finally {
res.releaseConnection();
}
// Submit the request to the service and store the response.
LocationAuthorityClient client = new LocationAuthorityClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
try {
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
if(logger.isTraceEnabled()){
} else {
Assert.fail("readItemList passed null csid and name!");
}
+ assertStatusCode(res, testName);
try {
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
List<AbstractCommonList.ListItem> items =
list.getListItem();
// Retrieve the contents of a resource to update.
LocationAuthorityClient client = new LocationAuthorityClient();
ClientResponse<String> res = client.read(knownResourceId);
+ assertStatusCode(res, testName);
try {
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
if(logger.isDebugEnabled()){
logger.debug("got LocationAuthority to update with ID: " + knownResourceId);
commonPart.setLabel(client.getCommonPartName());
res.releaseConnection();
res = client.update(knownResourceId, output);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
+
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
LocationauthoritiesCommon updatedLocationAuthority =
LocationAuthorityClient client = new LocationAuthorityClient();
ClientResponse<String> res =
client.readItem(knownResourceId, knownItemResourceId);
+ assertStatusCode(res, testName);
try {
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
if(logger.isDebugEnabled()){
logger.debug("got Location to update with ID: " +
knownItemResourceId +
commonPart.setLabel(client.getItemCommonPartName());
res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- 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);
-
+ assertStatusCode(res, testName);
+
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
LocationsCommon updatedLocation =
setupReadList();
MediaClient client = new MediaClient();
ClientResponse<AbstractCommonList> res = client.readList();
- AbstractCommonList list = res.getEntity();
assertStatusCode(res, testName);
+ AbstractCommonList list = res.getEntity();
// Optionally output additional data about list members for debugging.
if(logger.isTraceEnabled()){
AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
// Submit the request to the service and store the response.
MovementClient movementClient = new MovementClient();
ClientResponse<String> res = movementClient.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 + ".read: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Extract and return the common part of the record.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
// Get the auth refs and check them
ClientResponse<AuthorityRefList> res2 =
movementClient.getAuthorityRefs(knownResourceId);
- statusCode = res2.getStatus();
+ assertStatusCode(res2, testName);
- if(logger.isDebugEnabled()){
- logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
AuthorityRefList list = res2.getEntity();
List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
// Submit the request to the service and store the response.
MovementClient client = new MovementClient();
ClientResponse<String> 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);
+ assertStatusCode(res, testName);
// Get the common part of the response and verify that it is not null.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
// Submit the request to the service and store the response.
MovementClient client = new MovementClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
if(logger.isTraceEnabled()){
// Retrieve the contents of a resource to update.
MovementClient client = new MovementClient();
ClientResponse<String> res = client.read(knownResourceId);
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
- if(logger.isDebugEnabled()){
- logger.debug("got object to update with ID: " + knownResourceId);
- }
+ assertStatusCode(res, testName);
+ assertStatusCode(res, testName);
// Extract the common part from the response.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
PayloadOutputPart commonPart = output.addPart(movementCommon, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartName());
res = client.update(knownResourceId, output);
+ assertStatusCode(res, testName);
- // Check the status code of the response: does it match the expected response(s)?
- int statusCode = res.getStatus();
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
- // Extract the updated common part from the response.
+ // Extract the updated common part from the response.
input = new PoxPayloadIn(res.getEntity());
payloadInputPart = input.getPart(client.getCommonPartName());
MovementsCommon updatedMovementCommon = null;
// Submit the request to the service and store the response.
MovementClient client = new MovementClient();
ClientResponse<String> res = client.read(csid);
- 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);
+ assertStatusCode(res, testName);
// Extract and return the common part of the record.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
ClientResponse<AbstractCommonList> res =
client.readListSortedBy(sortFieldName);
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
return list;
ClientResponse<AbstractCommonList> res =
client.keywordSearchSortedBy(keywords, sortFieldName);
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
return list;
// Submit the request to the service and store the response.\r
NoteClient client = new NoteClient();\r
ClientResponse<String> res = client.read(knownResourceId);\r
- int statusCode = res.getStatus();\r
-\r
- // Check the status code of the response: does it match\r
- // the expected response(s)?\r
- if(logger.isDebugEnabled()){\r
- logger.debug(testName + ": status = " + statusCode);\r
- }\r
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
+ assertStatusCode(res, testName);\r
\r
// Get the common part of the response and verify that it is not null.\r
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());\r
NoteClient client = new NoteClient();\r
ClientResponse<NotesCommonList> res = client.readList();\r
NotesCommonList list = res.getEntity();\r
- int statusCode = res.getStatus();\r
-\r
- // Check the status code of the response: does it match\r
- // the expected response(s)?\r
- if(logger.isDebugEnabled()){\r
- logger.debug(testName + ": status = " + statusCode);\r
- }\r
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),\r
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);\r
+ assertStatusCode(res, testName);\r
\r
// Optionally output additional data about list members for debugging.\r
boolean iterateThroughList = false;\r
// Submit the request to the service and store the response.\r
NoteClient client = new NoteClient();\r
ClientResponse<String> res = client.read(knownResourceId);\r
- if(logger.isDebugEnabled()){\r
- logger.debug(testName + ": read status = " + res.getStatus());\r
- }\r
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);\r
- if(logger.isDebugEnabled()){\r
- logger.debug("got object to update with ID: " + knownResourceId);\r
- }\r
+ assertStatusCode(res, testName);\r
\r
// Get the common part of the response and verify that it is not null.\r
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());\r
setupReadList();
ObjectExitClient client = new ObjectExitClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
String bar = "\r\n\r\n=================================\r\n\r\n";
System.out.println(bar+" res: "+res);
AbstractCommonList list = res.getEntity();
-
System.out.println(bar+" list: "+list);
- assertStatusCode(res, testName);
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = true;
OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
ClientResponse<String> res =
orgAuthClient.readItem(knownResourceId, knownItemResourceId);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ".read: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
// and get the ID for the organization item
ClientResponse<AuthorityRefList> res2 =
orgAuthClient.getItemAuthorityRefs(knownResourceId, knownItemResourceId);
- statusCode = res2.getStatus();
-
- if(logger.isDebugEnabled()){
- logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res2, testName);
+
AuthorityRefList list = res2.getEntity();
List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
} else {
Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
}
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
//FIXME: remove the following try catch once Aron fixes signatures
try {
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
} else {
Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
}
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
// Check whether we've received a organization.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
OrgAuthorityClient client = new OrgAuthorityClient();
PoxPayloadIn input = null;
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
- // Check whether organization has expected displayName.
input = new PoxPayloadIn(res.getEntity());
} finally {
res.releaseConnection();
}
+ // Check whether organization has expected displayName.
OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
client.getItemCommonPartName(), OrganizationsCommon.class);
Assert.assertNotNull(organization);
PayloadOutputPart commonPart = output.addPart(organization, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getItemCommonPartName());
res = client.updateItem(knownResourceId, knownItemResourceId, output);
+ assertStatusCode(res, testName);
try {
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
} finally {
commonPart = output.addPart(organization, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getItemCommonPartName());
res = client.updateItem(knownResourceId, knownItemResourceId, output);
+ assertStatusCode(res, testName);
try {
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
} finally {
if (logger.isDebugEnabled()) {
logger.debug(testBanner(testName, CLASS_NAME));
}
- // Perform setup.
- testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
- // setupUpdateWithWrongXmlSchema(testName, logger);
-
+
+ // Perform setup for read.
+ setupRead();
+
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
- 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, Response.Status.OK.getStatusCode());
+ assertStatusCode(res, testName);
+
+ // Perform setup for update.
+ testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
+ try {
// Check whether organization has expected displayName.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
PoxPayloadOut output = new PoxPayloadOut(OrgAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
PayloadOutputPart commonPart = output.addPart(organization, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getItemCommonPartName());
- res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- } finally {
+ assertStatusCode(res, testName);
+ } finally {
res.releaseConnection();
}
}
ClientResponse<String> res =
client.readContact(knownResourceId, knownItemResourceId,
knownContactResourceId);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
// Check whether we've received a contact.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
ContactsCommon contact = (ContactsCommon) extractPart(input,
// Submit the request to the service and store the response.
OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
try {
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
// Optionally output additional data about list members for debugging.
if (logger.isTraceEnabled()) {
AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
} else {
Assert.fail("readItemList passed null csid and name!");
}
+ assertStatusCode(res, testName);
try {
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
List<AbstractCommonList.ListItem> items =
list.getListItem();
int nItemsReturned = items.size();
AbstractCommonList list = null;
ClientResponse<AbstractCommonList> res =
client.readContactList(parentcsid, itemcsid);
+ assertStatusCode(res, testName);
try {
list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
List<AbstractCommonList.ListItem> listitems =
list.getListItem();
OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<String> res =
client.read(knownResourceId);
+ assertStatusCode(res, testName);
try {
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
if (logger.isDebugEnabled()) {
logger.debug("got OrgAuthority to update with ID: " + knownResourceId);
}
commonPart.setLabel(client.getCommonPartName());
res.releaseConnection();
res = client.update(knownResourceId, output);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<String> res =
client.readItem(knownResourceId, knownItemResourceId);
+ assertStatusCode(res, testName);
try {
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
if (logger.isDebugEnabled()) {
logger.debug("got Organization to update with ID: "
+ knownItemResourceId
commonPart.setLabel(client.getItemCommonPartName());
res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- 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);
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<String> res =
client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
+ assertStatusCode(res, testName);
try {
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
if (logger.isDebugEnabled()) {
logger.debug("got Contact to update with ID: "
+ knownContactResourceId
commonPart.setLabel(new ContactClient().getCommonPartName());
res.releaseConnection();
res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
- 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);
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
} else {
Assert.fail("readItemListByPartialTerm passed null csid!");
}
+ assertStatusCode(res, testName);
AbstractCommonList list = null;
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, EXPECTED_STATUS_CODE);
-
list = res.getEntity();
} finally {
res.releaseConnection();
Assert.fail(testName+" passed null csid!");
}
AbstractCommonList list = null;
+ assertStatusCode(res, testName);
try {
- int statusCode = res.getStatus();
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
list = res.getEntity();
} finally {
res.releaseConnection();
} else {
Assert.fail("readInternal: Internal error. One of CSID or shortId must be non-null");
}
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
//FIXME: remove the following try catch once Aron fixes signatures
try {
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
} else {
Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
}
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
// Check whether we've received a person.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
PersonsCommon person = (PersonsCommon) extractPart(input,
PersonAuthorityClient client = new PersonAuthorityClient();
PoxPayloadIn input = null;
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
- // Check whether person has expected displayName.
input = new PoxPayloadIn(res.getEntity());
} finally {
res.releaseConnection();
PersonsCommon person = (PersonsCommon) extractPart(input,
client.getItemCommonPartName(), PersonsCommon.class);
Assert.assertNotNull(person);
- String displayName = person.getDisplayName();
+ // Check whether person has expected displayName.
// Make sure displayName matches computed form
+ String displayName = person.getDisplayName();
String expectedDisplayName =
PersonAuthorityClientUtils.prepareDefaultDisplayName(
TEST_FORE_NAME, null, TEST_SUR_NAME,
TEST_BIRTH_DATE, TEST_DEATH_DATE);
Assert.assertFalse(displayName.equals(expectedDisplayName));
+ // Make sure short displayName matches computed form
String shortDisplayName = person.getShortDisplayName();
- // Make sure displayName matches computed form
String expectedShortDisplayName =
PersonAuthorityClientUtils.prepareDefaultDisplayName(
TEST_FORE_NAME, null, TEST_SUR_NAME, null, null);
PayloadOutputPart commonPart = output.addPart(person, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getItemCommonPartName());
res = client.updateItem(knownResourceId, knownItemResourceId, output);
+ assertStatusCode(res, testName);
try {
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
} finally {
commonPart = output.addPart(person, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getItemCommonPartName());
res = client.updateItem(knownResourceId, knownItemResourceId, output);
+ assertStatusCode(res, testName);
try {
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
} finally {
if (logger.isDebugEnabled()) {
logger.debug(testBanner(testName, CLASS_NAME));
}
- // Perform setup.
- testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
- // setupUpdateWithWrongXmlSchema(testName);
+
+ // Perform setup for read.
+ setupRead();
// Submit the request to the service and store the response.
PersonAuthorityClient client = new PersonAuthorityClient();
- PoxPayloadIn input = null;
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
- 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, Response.Status.OK.getStatusCode());
+ assertStatusCode(res, testName);
+
+ // Perform setup for update.
+ testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
- // Check whether Person has expected displayName.
+ PoxPayloadIn input = null;
+ try {
input = new PoxPayloadIn(res.getEntity());
} finally {
res.releaseConnection();
PayloadOutputPart commonPart = output.addPart(person, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getItemCommonPartName());
res = client.updateItem(knownResourceId, knownItemResourceId, output);
+ assertStatusCode(res, testName);
try {
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ // intentionally empty try block
} finally {
res.releaseConnection();
}
ClientResponse<String> res =
client.readContact(knownResourceId, knownItemResourceId,
knownContactResourceId);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
// Check whether we've received a contact.
input = new PoxPayloadIn(res.getEntity());
} finally {
PersonAuthorityClient client = new PersonAuthorityClient();
AbstractCommonList list = null;
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
list = res.getEntity();
} finally {
res.releaseConnection();
}
- // Optionally output additional data about list members for debugging.
// Optionally output additional data about list members for debugging.
if (logger.isTraceEnabled()) {
AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
} else {
Assert.fail("readItemList passed null csid and name!");
}
+ assertStatusCode(res, testName);
AbstractCommonList list = null;
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, EXPECTED_STATUS_CODE);
-
list = res.getEntity();
} finally {
res.releaseConnection();
AbstractCommonList list = null;
ClientResponse<AbstractCommonList> res =
client.readContactList(parentcsid, itemcsid);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
list = res.getEntity();
} finally {
res.releaseConnection();
PersonAuthorityClient client = new PersonAuthorityClient();
PoxPayloadIn input = null;
ClientResponse<String> res = client.read(knownResourceId);
+ assertStatusCode(res, testName);
try {
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
- if (logger.isDebugEnabled()) {
- logger.debug("got PersonAuthority to update with ID: " + knownResourceId);
- }
input = new PoxPayloadIn(res.getEntity());
} finally {
res.releaseConnection();
PayloadOutputPart commonPart = output.addPart(personAuthority, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartName());
res = client.update(knownResourceId, output);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
} finally {
PoxPayloadIn input = null;
ClientResponse<String> res =
client.readItem(knownResourceId, knownItemResourceId);
+ assertStatusCode(res, testName);
try {
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
- if (logger.isDebugEnabled()) {
- logger.debug("got Person to update with ID: "
- + knownItemResourceId
- + " in PersonAuthority: " + knownResourceId);
- }
input = new PoxPayloadIn(res.getEntity());
} finally {
res.releaseConnection();
PayloadOutputPart commonPart = output.addPart(person, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getItemCommonPartName());
res = client.updateItem(knownResourceId, knownItemResourceId, output);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
} finally {
PoxPayloadIn input = null;
ClientResponse<String> res =
client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
+ assertStatusCode(res, testName);
try {
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
- if (logger.isDebugEnabled()) {
- logger.debug("got Contact to update with ID: "
- + knownContactResourceId
- + " in item: " + knownItemResourceId
- + " in parent: " + knownResourceId);
- }
input = new PoxPayloadIn(res.getEntity());
} finally {
res.releaseConnection();
PayloadOutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE); //FIXME: REM - Replace with output.addPart(contact, client.getCommonPartName())
commonPart.setLabel(client.getCommonPartName());
res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
+ assertStatusCode(res, testName);
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, EXPECTED_STATUS_CODE);
-
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());;
} finally {
// Submit the request to the service and store the response.
RelationClient client = new RelationClient();
ClientResponse<String> 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);
+ assertStatusCode(res, testName);
// Get the common part from the response and check that it is not null.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
// Submit the request to the service and store the response.
RelationClient client = new RelationClient();
ClientResponse<RelationsCommonList> res = client.readList();
+ assertStatusCode(res, testName);
RelationsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = false;
if(iterateThroughList && logger.isDebugEnabled()){
pageSize,
pageNumber);
RelationsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Optionally output additional data about list members for debugging.
boolean iterateThroughList = false;
// Retrieve an existing resource that we can update.
RelationClient client = new RelationClient();
ClientResponse<String> res = client.read(knownResourceId);
- logger.debug(testName + ": read status = " + res.getStatus());
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
logger.debug("Got object to update with ID: " + knownResourceId);
// Extract the common part and verify that it is not null.
PayloadOutputPart commonPart = output.addPart(relationCommon, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartName());
res = client.update(knownResourceId, output);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- logger.debug(testName + ": status = " + statusCode);
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Extract the common part of the updated resource and verify that it is not null.
input = new PoxPayloadIn(res.getEntity());
// Submit the request to the service and store the response.
ReportClient client = new ReportClient();
ClientResponse<String> res = client.read(knownResourceId);
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- int statusCode = res.getStatus();
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Get the common part of the response and verify that it is not null.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
// Submit the request to the service and store the response.
ReportClient client = new ReportClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
if(logger.isTraceEnabled()){
ReportClient client = new ReportClient();
ClientResponse<AbstractCommonList> res = client.readListFiltered(
testDocType, "single");
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
List<AbstractCommonList.ListItem> items =
list.getListItem();
// Now filter for something else, and ensure it is NOT returned
res = client.readListFiltered("Intake", "single");
+ assertStatusCode(res, testName);
list = res.getEntity();
- 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);
items = list.getListItem();
// We must NOT find the basic one we created
// Now filter for something else, and ensure it is NOT returned
res = client.readListFiltered(testDocType, "group");
+ assertStatusCode(res, testName);
list = res.getEntity();
- 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);
items = list.getListItem();
// We must NOT find the basic one we created
// Retrieve the contents of a resource to update.
ReportClient client = new ReportClient();
ClientResponse<String> res = client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got object to update with ID: " + knownResourceId);
}
PayloadOutputPart commonPart = output.addPart(reportCommon, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartName());
res = client.update(knownResourceId, output);
-
- // Check the status code of the response: does it match the expected response(s)?
- int statusCode = res.getStatus();
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Extract the updated common part from the response.
input = new PoxPayloadIn(res.getEntity());
//elmo allowed to read
client.setAuth(true, "elmo2010", true, "elmo2010", true);
ClientResponse<String> 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);
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
DimensionsCommon dimension = (DimensionsCommon) extractPart(input,
DimensionClient client = new DimensionClient();
client.setAuth(true, userName, true, userName, true);
ClientResponse<String> res = client.read(id);
- 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);
-
+ assertStatusCode(res, testName);
+
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
return (DimensionsCommon) extractPart(input,
client.getCommonPartName(), DimensionsCommon.class);
String newID = null;
ClientResponse<String> res = client.read(knownResourceId);
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, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
//FIXME: remove the following try catch once Aron fixes signatures
try {
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
ClientResponse<String> res = client.readByName(knownResourceShortIdentifer);
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, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
//FIXME: remove the following try catch once Aron fixes signatures
try {
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
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, EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
// Check whether we've received an authority item record.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
TaxonCommon taxon = (TaxonCommon) extractPart(input,
TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
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, EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
// Check whether taxon has expected displayName.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
TaxonCommon taxon = (TaxonCommon) extractPart(input,
commonPart.setLabel(client.getItemCommonPartName());
res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
TaxonCommon updatedTaxon =
commonPart.setLabel(client.getItemCommonPartName());
res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
updatedTaxon =
if (logger.isDebugEnabled()) {
logger.debug(testBanner(testName, CLASS_NAME));
}
- // Perform setup.
- // FIXME: create a setup configuration for this operation.
- setupUpdateWithWrongXmlSchema();
+
+ // Perform setup for read.
+ setupRead();
// Submit the request to the service and store the response.
TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+ assertStatusCode(res, testName);
+
+ // Perform setup for update.
+ testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
+
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, Response.Status.OK.getStatusCode());
-
// Check whether Taxonomy has expected displayName.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
TaxonCommon taxon = (TaxonCommon) extractPart(input,
commonPart.setLabel(client.getItemCommonPartName());
res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
} finally {
res.releaseConnection();
}
TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
ClientResponse<AbstractCommonList> res = client.readList();
try {
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
// Optionally output additional data about list members for debugging.
if(logger.isTraceEnabled()){
AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
Assert.fail("readItemList passed null csid and name!");
}
try {
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
List<AbstractCommonList.ListItem> items =
list.getListItem();
int nItemsReturned = items.size();
ClientResponse<String> res =
client.readItem(knownResourceId, knownItemResourceId);
try {
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
-
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got Taxonomy to update with ID: "
+ knownItemResourceId
commonPart.setLabel(client.getItemCommonPartName());
res.releaseConnection();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- 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);
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
ClientResponse<String> res = client.readByName(knownResourceShortIdentifer);
- int statusCode = res.getStatus();
+ assertStatusCode(res, testName);
- // 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);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input,
client.getCommonPartName(), VocabulariesCommon.class);
// Submit the request to the service and store the response.
ClientResponse<PoxPayloadIn> res = client.read(knownResourceId);
int statusCode = res.getStatus();
+ assertStatusCode(res, testName);
- // 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 {
PoxPayloadIn input = (PoxPayloadIn) res.getEntity();
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
- 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);
+ assertStatusCode(res, testName);
// Check whether we've received a vocabulary item.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
if (logger.isDebugEnabled()) {
logger.debug(testBanner(testName, CLASS_NAME));
}
- // Perform setup.
- testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
- // setupUpdateWithWrongXmlSchema(testName);
+ // Perform setup for read.
+ setupRead();
+
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
- 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, Response.Status.OK.getStatusCode());
+ assertStatusCode(res, testName);
+
+ // Perform setup for update.
+ testSetup(STATUS_BAD_REQUEST, ServiceRequestType.UPDATE);
// Check whether Person has expected displayName.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
PayloadOutputPart commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartItemName());
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- statusCode = res.getStatus();
+ int statusCode = res.getStatus();
// Check the status code of the response: does it match the expected response(s)?
if (logger.isDebugEnabled()) {
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
ClientResponse<AbstractCommonList> res = client.readList();
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
// Optionally output additional data about list members for debugging.
if(logger.isTraceEnabled()){
} else {
Assert.fail("Internal Error: readItemList both vcsid and shortId are null!");
}
+ assertStatusCode(res, testName);
AbstractCommonList list = res.getEntity();
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(" " + testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
List<AbstractCommonList.ListItem> items = list.getListItem();
int nItemsReturned = items.size();
VocabularyClient client = new VocabularyClient();
ClientResponse<String> res =
client.read(knownResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got Vocabulary to update with ID: " + knownResourceId);
PayloadOutputPart commonPart = output.addPart(vocabulary, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartName());
res = client.update(knownResourceId, output);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("update: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
VocabularyClient client = new VocabularyClient();
ClientResponse<String> res =
client.readItem(knownResourceId, knownItemResourceId);
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": read status = " + res.getStatus());
- }
- Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
if (logger.isDebugEnabled()) {
logger.debug("got VocabularyItem to update with ID: "
PayloadOutputPart commonPart = output.addPart(vocabularyItem, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartItemName());
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug("updateItem: status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that its contents exist.
input = new PoxPayloadIn(res.getEntity());
// Submit the request to the service and store the response.
VocabularyClient client = new VocabularyClient();
ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if (logger.isDebugEnabled()) {
- logger.debug(testName + " read Vocab:" + knownResourceId + "/Item:"
- + knownItemResourceId + " status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, Response.Status.OK.getStatusCode());
+ assertStatusCode(res, testName);
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
VocabularyitemsCommon vitem = (VocabularyitemsCommon) extractPart(input,
PayloadOutputPart commonPart = output.addPart(vitem, MediaType.APPLICATION_XML_TYPE);
commonPart.setLabel(client.getCommonPartItemName());
res = client.updateItem(knownResourceId, knownItemResourceId, output);
- 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);
+ assertStatusCode(res, testName);
// Retrieve the updated resource and verify that the parent did not change
res = client.readItem(knownResourceId, knownItemResourceId);
// setupReadList();
// WorkflowClient client = new WorkflowClient();
// ClientResponse<AbstractCommonList> res = client.readList();
-// AbstractCommonList list = res.getEntity();
// assertStatusCode(res, testName);
+// AbstractCommonList list = res.getEntity();
// if (logger.isDebugEnabled()) {
// List<AbstractCommonList.ListItem> items =
// list.getListItem();