private final Logger logger =
LoggerFactory.getLogger(AccountServiceTest.class);
// Instance variables specific to this test.
- private AccountClient client = new AccountClient();
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
boolean addTenant = true;
@Override
protected String getServicePathComponent() {
- return client.getServicePathComponent();
+ return new AccountClient().getServicePathComponent();
}
// ---------------------------------------------------------------
AccountsCommon account =
createAccountInstance("barney", "barney", "hithere08", "barney@dinoland.com",
true, false, true, true);
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.create(account);
int statusCode = res.getStatus();
AccountsCommon account =
createAccountInstance("barney1", "barney", "hithere08", "barney@dinoland.com",
true, false, true, true);
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.create(account);
int statusCode = res.getStatus();
AccountsCommon account =
createAccountInstance("barney", "otherUser", "hithere08", "barney@dinoland.com",
true, false, true, true);
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.create(account);
int statusCode = res.getStatus();
AccountsCommon account =
createAccountInstance("babybop", "babybop", "hithere08", "babybop@dinoland.com",
true, true, true, true);
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.create(account);
int statusCode = res.getStatus();
// Does it exactly match the expected status code?
AccountsCommon account =
createAccountInstance("babybop", "babybop", "hithere08", "babybop@dinoland.com",
true, false, false, true);
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.create(account);
int statusCode = res.getStatus();
// Does it exactly match the expected status code?
AccountsCommon account =
createAccountInstance("babybop", "babybop", "hithere08", "babybop.dinoland.com",
true, false, true, true);
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.create(account);
int statusCode = res.getStatus();
// Does it exactly match the expected status code?
AccountsCommon account =
createAccountInstance("babybop", "babybop", "hithere08", "babybop@dinoland.com",
false, false, true, true);
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.create(account);
int statusCode = res.getStatus();
// Does it exactly match the expected status code?
AccountsCommon account =
createAccountInstance("babybop", "babybop", "hithere08", "babybop/dinoland.com",
false, true, false, false);
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.create(account);
int statusCode = res.getStatus();
// Does it exactly match the expected status code?
AccountsCommon account1 =
createAccountInstance("curious", "curious", "hithere08", "curious@george.com",
true, false, true, true);
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.create(account1);
int statusCode = res.getStatus();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
setupRead(testName);
// Submit the request to the service and store the response.
+ AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ AccountClient client = new AccountClient();
ClientResponse<AccountsCommon> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ AccountClient client = new AccountClient();
ClientResponse<AccountsCommonList> res = client.readList();
AccountsCommonList list = res.getEntity();
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
- ClientResponse<AccountsCommonList> res = client.readSearchList("tom", null, null);
+ AccountClient client = new AccountClient();
+ ClientResponse<AccountsCommonList> res =
+ client.readSearchList("tom", null, null);
AccountsCommonList list = res.getEntity();
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
- ClientResponse<AccountsCommonList> res = client.readSearchList(null, "tom", null);
+ AccountClient client = new AccountClient();
+ ClientResponse<AccountsCommonList> res =
+ client.readSearchList(null, "tom", null);
AccountsCommonList list = res.getEntity();
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
- ClientResponse<AccountsCommonList> res = client.readSearchList(null, null, "dinoland");
+ AccountClient client = new AccountClient();
+ ClientResponse<AccountsCommonList> res =
+ client.readSearchList(null, null, "dinoland");
AccountsCommonList list = res.getEntity();
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
- ClientResponse<AccountsCommonList> res = client.readSearchList("tom", null, "jerry");
+ AccountClient client = new AccountClient();
+ ClientResponse<AccountsCommonList> res =
+ client.readSearchList("tom", null, "jerry");
AccountsCommonList list = res.getEntity();
int statusCode = res.getStatus();
// Perform setup.
setupUpdate(testName);
-
- ClientResponse<AccountsCommon> res =
- client.read(knownResourceId);
+ AccountClient client = new AccountClient();
+ ClientResponse<AccountsCommon> res = client.read(knownResourceId);
if (logger.isDebugEnabled()) {
logger.debug(testName + ": read status = " + res.getStatus());
}
// Perform setup.
setupUpdate(testName);
- ClientResponse<AccountsCommon> res =
- client.read(knownResourceId);
+ AccountClient client = new AccountClient();
+ ClientResponse<AccountsCommon> res = client.read(knownResourceId);
if (logger.isDebugEnabled()) {
logger.debug(testName + ": read status = " + res.getStatus());
}
// Perform setup.
setupUpdate(testName);
- ClientResponse<AccountsCommon> res =
- client.read(knownResourceId);
+ AccountClient client = new AccountClient();
+ ClientResponse<AccountsCommon> res = client.read(knownResourceId);
if (logger.isDebugEnabled()) {
logger.debug(testName + ": read status = " + res.getStatus());
}
// Perform setup.
setupUpdate(testName);
- ClientResponse<AccountsCommon> res =
- client.read(knownResourceId);
+ AccountClient client = new AccountClient();
+ ClientResponse<AccountsCommon> res = client.read(knownResourceId);
if (logger.isDebugEnabled()) {
logger.debug(testName + ": read status = " + res.getStatus());
}
//
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in updateAccount(), below.
+ AccountClient client = new AccountClient();
AccountsCommon account =
createAccountInstance("simba", "simba", "tiger", "simba@lionking.com",
true, false, true, true);
ClientResponse<AccountsCommon> res =
- client.update(NON_EXISTENT_ID, account);
+ client.update(NON_EXISTENT_ID, account);
int statusCode = res.getStatus();
// Check the status code of the response: does it match
public void updateWrongUser(String testName) throws Exception {
setupUpdate();
+
// Submit the request to the service and store the response.
//
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in updateAccount(), below.
- ClientResponse<AccountsCommon> res =
- client.read(knownResourceId);
+ AccountClient client = new AccountClient();
+ ClientResponse<AccountsCommon> res = client.read(knownResourceId);
if (logger.isDebugEnabled()) {
logger.debug(testName + ": read status = " + res.getStatus());
}
setupDelete(testName);
// Submit the request to the service and store the response.
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ AccountClient client = new AccountClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ AccountClient client = new AccountClient();
for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
LoggerFactory.getLogger(AcquisitionAuthRefsTest.class);
// Instance variables specific to this test.
- private AcquisitionClient acquisitionClient = new AcquisitionClient();
- private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
final String SERVICE_PATH_COMPONENT = "acquisitions";
final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
private String knownResourceId = null;
acquisitionFundingSourceRefName,
fieldCollectorRefName );
+ AcquisitionClient acquisitionClient = new AcquisitionClient();
ClientResponse<Response> res = acquisitionClient.create(multipart);
int statusCode = res.getStatus();
protected void createPersonRefs(){
String authRefName =
PersonAuthorityClientUtils.createPersonAuthRefName(PERSON_AUTHORITY_NAME, false);
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
PERSON_AUTHORITY_NAME, authRefName, personAuthClient.getCommonPartName());
ClientResponse<Response> res = personAuthClient.create(multipart);
Map<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
MultipartOutput multipart =
PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
refName, personInfo, personAuthClient.getItemCommonPartName());
testSetup(OK_STATUS, ServiceRequestType.READ,testName);
// Submit the request to the service and store the response.
+ AcquisitionClient acquisitionClient = new AcquisitionClient();
ClientResponse<MultipartInput> res = acquisitionClient.read(knownResourceId);
int statusCode = res.getStatus();
Assert.assertEquals(acquisition.getFieldCollector(), fieldCollectorRefName);
// Get the auth refs and check them
- ClientResponse<AuthorityRefList> res2 = acquisitionClient.getAuthorityRefs(knownResourceId);
+ ClientResponse<AuthorityRefList> res2 =
+ acquisitionClient.getAuthorityRefs(knownResourceId);
statusCode = res2.getStatus();
if(logger.isDebugEnabled()){
*/
// @AfterClass(alwaysRun=true)
public void cleanUp() {
+
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+
+ AcquisitionClient acquisitionClient = new AcquisitionClient();
// Note: Any non-success responses are ignored and not reported.
for (String resourceId : acquisitionIdsCreated) {
ClientResponse<Response> res = acquisitionClient.delete(resourceId);
}
+
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
// Delete persons before PersonAuth
for (String resourceId : personIdsCreated) {
ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
multipart.addPart(acquisition, MediaType.APPLICATION_XML_TYPE);
+ AcquisitionClient acquisitionClient = new AcquisitionClient();
commonPart.getHeaders().add("label", acquisitionClient.getCommonPartName());
if(logger.isDebugEnabled()){
LoggerFactory.getLogger(AcquisitionServiceTest.class);
// Instance variables specific to this test.
- private AcquisitionClient client = new AcquisitionClient();
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
// Submit the request to the service and store the response.
String identifier = createIdentifier();
+ AcquisitionClient client = new AcquisitionClient();
MultipartOutput multipart = createAcquisitionInstance(identifier);
ClientResponse<Response> res = client.create(multipart);
// Perform setup.
setupRead(testName);
+ AcquisitionClient client = new AcquisitionClient();
+
// Submit the request to the service and store the response.
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ AcquisitionClient client = new AcquisitionClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ AcquisitionClient client = new AcquisitionClient();
ClientResponse<AcquisitionsCommonList> res = client.readList();
AcquisitionsCommonList list = res.getEntity();
int statusCode = res.getStatus();
// Perform setup.
setupUpdate(testName);
- ClientResponse<MultipartInput> res =
- client.read(knownResourceId);
+ // Retrieve the contents of a resource to update.
+ AcquisitionClient client = new AcquisitionClient();
+ ClientResponse<MultipartInput> res = client.read(knownResourceId);
if(logger.isDebugEnabled()){
logger.debug(testName + ": read status = " + res.getStatus());
}
logger.debug("got object to update with ID: " + knownResourceId);
}
MultipartInput input = (MultipartInput) res.getEntity();
+
AcquisitionsCommon acquisition = (AcquisitionsCommon) extractPart(input,
client.getCommonPartName(), AcquisitionsCommon.class);
Assert.assertNotNull(acquisition);
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
+ AcquisitionClient client = new AcquisitionClient();
MultipartOutput multipart = createAcquisitionInstance(NON_EXISTENT_ID);
ClientResponse<MultipartInput> res =
- client.update(NON_EXISTENT_ID, multipart);
+ client.update(NON_EXISTENT_ID, multipart);
int statusCode = res.getStatus();
// Check the status code of the response: does it match
setupDelete(testName);
// Submit the request to the service and store the response.
+ AcquisitionClient client = new AcquisitionClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ AcquisitionClient client = new AcquisitionClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ AcquisitionClient client = new AcquisitionClient();
for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
// ---------------------------------------------------------------
@Override
public String getServicePathComponent() {
- return client.getServicePathComponent();
+ return new AcquisitionClient().getServicePathComponent();
}
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart = multipart.addPart(acquisition,
MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", client.getCommonPartName());
+ commonPart.getHeaders().add("label", new AcquisitionClient().getCommonPartName());
if(logger.isDebugEnabled()){
logger.debug("to be created, acquisition common");
private final Logger logger =
LoggerFactory.getLogger(PermissionRoleServiceTest.class);
// Instance variables specific to this test.
- private PermissionRoleClient client = new PermissionRoleClient();
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
private Hashtable<String, String> permIds = new Hashtable<String, String>();
@Override
protected String getServicePathComponent() {
- return client.getServicePathComponent();
+ return new PermissionRoleClient().getServicePathComponent();
}
@BeforeClass(alwaysRun = true)
// Submit the request to the service and store the response.
PermissionRole permRole = createPermissionRoleInstance(permIds.get("accounts"),
roleIds.values().toArray(new String[0]), true, true);
+ PermissionRoleClient client = new PermissionRoleClient();
ClientResponse<Response> res = client.create(permIds.get("accounts"), permRole);
int statusCode = res.getStatus();
setupCreate(testName);
// Submit the request to the service and store the response.
+ PermissionRoleClient client = new PermissionRoleClient();
PermissionRole permRole = createPermissionRoleInstance(permIds.get("collectionobjects"),
roleIds.values().toArray(new String[0]), true, true);
ClientResponse<Response> res = client.create(permIds.get("collectionobjects"), permRole);
setupRead(testName);
// Submit the request to the service and store the response.
+ PermissionRoleClient client = new PermissionRoleClient();
ClientResponse<PermissionRole> res = client.read(permIds.get("accounts"), "123");
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ PermissionRoleClient client = new PermissionRoleClient();
ClientResponse<PermissionRole> res = client.read(NON_EXISTENT_ID, "123");
int statusCode = res.getStatus();
setupDelete(testName);
// Submit the request to the service and store the response.
+ PermissionRoleClient client = new PermissionRoleClient();
ClientResponse<Response> res = client.delete(permIds.get("accounts"), "123");
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ PermissionRoleClient client = new PermissionRoleClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID, "123");
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ PermissionRoleClient client = new PermissionRoleClient();
for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId, "123");
static private final Logger logger =
LoggerFactory.getLogger(PermissionServiceTest.class);
// Instance variables specific to this test.
- private PermissionClient client = new PermissionClient();
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
boolean addTenant = true;
@Override
protected String getServicePathComponent() {
- return client.getServicePathComponent();
+ return new PermissionClient().getServicePathComponent();
}
// ---------------------------------------------------------------
true,
true,
true);
+ PermissionClient client = new PermissionClient();
ClientResponse<Response> res = client.create(permission);
int statusCode = res.getStatus();
false,
true,
true);
+ PermissionClient client = new PermissionClient();
ClientResponse<Response> res = client.create(permission);
int statusCode = res.getStatus();
// Does it exactly match the expected status code?
true,
true,
true);
+ PermissionClient client = new PermissionClient();
ClientResponse<Response> res = client.create(permission1);
int statusCode = res.getStatus();
Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
setupRead(testName);
// Submit the request to the service and store the response.
+ PermissionClient client = new PermissionClient();
ClientResponse<Permission> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ PermissionClient client = new PermissionClient();
ClientResponse<Permission> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ PermissionClient client = new PermissionClient();
ClientResponse<PermissionsList> res = client.readList();
PermissionsList list = res.getEntity();
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ PermissionClient client = new PermissionClient();
ClientResponse<PermissionsList> res = client.readSearchList("acquisition");
PermissionsList list = res.getEntity();
int statusCode = res.getStatus();
// Perform setup.
setupUpdate(testName);
-
+ // Retrieve the contents of a resource to update.
+ PermissionClient client = new PermissionClient();
ClientResponse<Permission> res =
client.read(knownResourceId);
if (logger.isDebugEnabled()) {
//
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in updatePermission(), below.
+ PermissionClient client = new PermissionClient();
List<PermissionAction> actions = getDefaultActions();
Permission permission = createPermissionInstance("acquisitions",
"default permissions for acquisitions",
setupDelete(testName);
// Submit the request to the service and store the response.
+ PermissionClient client = new PermissionClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ PermissionClient client = new PermissionClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("to be created, permission common");
- logger.debug(objectAsXmlString(permission, Permission.class));
+ logger.debug(objectAsXmlString(permission, Permission.class));
}
return permission;
}
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ PermissionClient client = new PermissionClient();
for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
static private final Logger logger =
LoggerFactory.getLogger(RoleServiceTest.class);
// Instance variables specific to this test.
- private RoleClient client = new RoleClient();
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
boolean addTenant = true;
@Override
protected String getServicePathComponent() {
- return client.getServicePathComponent();
+ return new RoleClient().getServicePathComponent();
}
// ---------------------------------------------------------------
setupCreate(testName);
// Submit the request to the service and store the response.
+ RoleClient client = new RoleClient();
Role role = createRoleInstance("ROLE_USERS_TEST",
"all users are required to be in this role",
true);
setupCreate(testName);
// Submit the request to the service and store the response.
+ RoleClient client = new RoleClient();
Role role = createRoleInstance("ROLE_USERS",
"role users",
true);
setupCreate(testName);
// Submit the request to the service and store the response.
+ RoleClient client = new RoleClient();
Role role = createRoleInstance("ROLE_USERS",
"role for users",
false);
public void createList(String testName) throws Exception {
setupCreate(testName);
+
// Submit the request to the service and store the response.
- Role role1 = createRoleInstance("ROLE_COLLECTIONS_MANGER_TEST",
+ RoleClient client = new RoleClient();
+ Role role1 = createRoleInstance("ROLE_COLLECTIONS_MANGER_TEST",
"collection manager",
true);
ClientResponse<Response> res = client.create(role1);
setupRead(testName);
// Submit the request to the service and store the response.
+ RoleClient client = new RoleClient();
ClientResponse<Role> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ RoleClient client = new RoleClient();
ClientResponse<Role> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ RoleClient client = new RoleClient();
ClientResponse<RolesList> res = client.readList();
RolesList list = res.getEntity();
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ RoleClient client = new RoleClient();
ClientResponse<RolesList> res = client.readSearchList("movingImage");
RolesList list = res.getEntity();
int statusCode = res.getStatus();
// Perform setup.
setupUpdate(testName);
-
+ RoleClient client = new RoleClient();
ClientResponse<Role> res =
client.read(knownResourceId);
if (logger.isDebugEnabled()) {
//
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in updateRole(), below.
+ RoleClient client = new RoleClient();
Role role = createRoleInstance("ROLE_XXX",
"xxx",
true);
setupDelete(testName);
// Submit the request to the service and store the response.
+ RoleClient client = new RoleClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ RoleClient client = new RoleClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ RoleClient client = new RoleClient();
for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
LoggerFactory.getLogger(CollectionObjectAuthRefsTest.class);
// Instance variables specific to this test.
- private CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
- private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
final String SERVICE_PATH_COMPONENT = "collectionobjects";
final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
private String knownResourceId = null;
// Create all the person refs and entities
createPersonRefs();
+ CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
MultipartOutput multipart = createCollectionObjectInstance(
"Obj Title",
"ObjNum-1234",
protected void createPersonRefs(){
String authRefName =
PersonAuthorityClientUtils.createPersonAuthRefName(PERSON_AUTHORITY_NAME, false);
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
PERSON_AUTHORITY_NAME, authRefName, personAuthClient.getCommonPartName());
ClientResponse<Response> res = personAuthClient.create(multipart);
Map<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
MultipartOutput multipart =
PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
refName, personInfo, personAuthClient.getItemCommonPartName());
testSetup(OK_STATUS, ServiceRequestType.READ,testName);
// Submit the request to the service and store the response.
+ CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
ClientResponse<MultipartInput> res = collectionObjectClient.read(knownResourceId);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
- // Note: Any non-success responses are ignored and not reported.
+ CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
+ // Note: Any non-success responses are ignored and not reported.
for (String resourceId : collectionObjectIdsCreated) {
ClientResponse<Response> res = collectionObjectClient.delete(resourceId);
}
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
// Delete persons before PersonAuth
for (String resourceId : personIdsCreated) {
ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", collectionObjectClient.getCommonPartName());
+ commonPart.getHeaders().add("label", new CollectionObjectClient().getCommonPartName());
if(logger.isDebugEnabled()){
logger.debug("to be created, collectionObject common");
private final Logger logger =
LoggerFactory.getLogger(CollectionObjectServiceTest.class);
// Instance variables specific to this test.
- private CollectionObjectClient client = new CollectionObjectClient();
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
private boolean multivalue; //toggle
*/
@Override
protected String getServicePathComponent() {
- return client.getServicePathComponent();
+ return new CollectionObjectClient().getServicePathComponent();
}
// ---------------------------------------------------------------
setupCreate(testName);
// Submit the request to the service and store the response.
+ CollectionObjectClient client = new CollectionObjectClient();
String identifier = createIdentifier();
MultipartOutput multipart =
createCollectionObjectInstance(client.getCommonPartName(), identifier);
collectionObject.setObjectName("some name");
// Submit the request to the service and store the response.
+ CollectionObjectClient client = new CollectionObjectClient();
MultipartOutput multipart =
createCollectionObjectInstance(client.getCommonPartName(), collectionObject, null);
ClientResponse<Response> res = client.create(multipart);
setupRead(testName);
// Submit the request to the service and store the response.
+ CollectionObjectClient client = new CollectionObjectClient();
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ CollectionObjectClient client = new CollectionObjectClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ CollectionObjectClient client = new CollectionObjectClient();
ClientResponse<CollectionobjectsCommonList> res = client.readList();
CollectionobjectsCommonList list = res.getEntity();
int statusCode = res.getStatus();
ClientResponse<MultipartInput> res = updateRetrieve(testName, knownResourceId);
// Extract its common part.
+ CollectionObjectClient client = new CollectionObjectClient();
MultipartInput input = (MultipartInput) res.getEntity();
CollectionobjectsCommon collectionObject =
(CollectionobjectsCommon) extractPart(input,
private ClientResponse<MultipartInput> updateRetrieve(String testName, String id) {
final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
+ CollectionObjectClient client = new CollectionObjectClient();
ClientResponse<MultipartInput> res = client.read(id);
if (logger.isDebugEnabled()) {
logger.debug("read in updateRetrieve for " + testName + " status = " + res.getStatus());
CollectionobjectsCommon collectionObject) {
MultipartOutput output = new MultipartOutput();
OutputPart commonPart = output.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
+ CollectionObjectClient client = new CollectionObjectClient();
commonPart.getHeaders().add("label", client.getCommonPartName());
ClientResponse<MultipartInput> res = client.update(knownResourceId, output);
return res;
//
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in updateCollectionObject(), below.
+ CollectionObjectClient client = new CollectionObjectClient();
MultipartOutput multipart =
createCollectionObjectInstance(client.getCommonPartName(),
NON_EXISTENT_ID);
// Read an existing record for updating.
ClientResponse<MultipartInput> res = updateRetrieve(testName, knownResourceId);
+ CollectionObjectClient client = new CollectionObjectClient();
MultipartInput input = (MultipartInput) res.getEntity();
CollectionobjectsCommon collectionObject =
(CollectionobjectsCommon) extractPart(input,
setupDelete(testName);
// Submit the request to the service and store the response.
+ CollectionObjectClient client = new CollectionObjectClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ CollectionObjectClient client = new CollectionObjectClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
- for (String resourceId : allResourceIdsCreated) {
+ CollectionObjectClient client = new CollectionObjectClient();
+ for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
}
MultipartOutput multipart = null;
+ CollectionObjectClient client = new CollectionObjectClient();
if (useJaxb) {
multipart = createCollectionObjectInstanceFromXml(testName,
client.getCommonPartName(), fileName);
LoggerFactory.getLogger(ContactServiceTest.class);
// Instance variables specific to this test.
- private ContactClient client = new ContactClient();
final String SERVICE_PATH_COMPONENT = "contacts";
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
setupCreate(testName);
// Submit the request to the service and store the response.
+ ContactClient client = new ContactClient();
String identifier = createIdentifier();
-
MultipartOutput multipart =
ContactClientUtils.createContactInstance(identifier, client.getCommonPartName());
ClientResponse<Response> res = client.create(multipart);
setupRead(testName);
// Submit the request to the service and store the response.
+ ContactClient client = new ContactClient();
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ ContactClient client = new ContactClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ ContactClient client = new ContactClient();
ClientResponse<ContactsCommonList> res = client.readList();
ContactsCommonList list = res.getEntity();
int statusCode = res.getStatus();
// Perform setup.
setupUpdate(testName);
+ // Submit the request to the service and store the response.
+ ContactClient client = new ContactClient();
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
-
- // The only relevant ID may be the one used in update(), below.
+ ContactClient client = new ContactClient();
MultipartOutput multipart =
ContactClientUtils.createContactInstance(NON_EXISTENT_ID, client.getCommonPartName());
ClientResponse<MultipartInput> res =
setupDelete(testName);
// Submit the request to the service and store the response.
+ ContactClient client = new ContactClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ ContactClient client = new ContactClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ ContactClient client = new ContactClient();
for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
LoggerFactory.getLogger(DimensionServiceTest.class);
// Instance variables specific to this test.
- private DimensionClient client = new DimensionClient();
final String SERVICE_PATH_COMPONENT = "dimensions";
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
setupCreate(testName);
// Submit the request to the service and store the response.
+ DimensionClient client = new DimensionClient();
String identifier = createIdentifier();
-
MultipartOutput multipart = createDimensionInstance(identifier);
ClientResponse<Response> res = client.create(multipart);
setupRead(testName);
// Submit the request to the service and store the response.
+ DimensionClient client = new DimensionClient();
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ DimensionClient client = new DimensionClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ DimensionClient client = new DimensionClient();
ClientResponse<DimensionsCommonList> res = client.readList();
DimensionsCommonList list = res.getEntity();
int statusCode = res.getStatus();
// Perform setup.
setupUpdate(testName);
+ // Retrieve the contents of a resource to update.
+ DimensionClient client = new DimensionClient();
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
client.getCommonPartName(), DimensionsCommon.class);
Assert.assertNotNull(dimension);
- // Update the content of this resource.
// Update the content of this resource.
dimension.setValue("updated-" + dimension.getValue());
dimension.setValueDate("updated-" + dimension.getValueDate());
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
-
- // The only relevant ID may be the one used in update(), below.
+ DimensionClient client = new DimensionClient();
MultipartOutput multipart = createDimensionInstance(NON_EXISTENT_ID);
ClientResponse<MultipartInput> res =
client.update(NON_EXISTENT_ID, multipart);
setupDelete(testName);
// Submit the request to the service and store the response.
+ DimensionClient client = new DimensionClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ DimensionClient client = new DimensionClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ DimensionClient client = new DimensionClient();
for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
multipart.addPart(dimension, MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", client.getCommonPartName());
+ commonPart.getHeaders().add("label", new DimensionClient().getCommonPartName());
if(logger.isDebugEnabled()){
logger.debug("to be created, dimension common");
LoggerFactory.getLogger(IntakeAuthRefsTest.class);
// Instance variables specific to this test.
- private IntakeClient intakeClient = new IntakeClient();
- private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
final String SERVICE_PATH_COMPONENT = "intakes";
final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
private String knownResourceId = null;
// Create all the person refs and entities
createPersonRefs();
+ // Submit the request to the service and store the response.
+ IntakeClient intakeClient = new IntakeClient();
MultipartOutput multipart = createIntakeInstance(
"entryNumber-" + identifier,
"entryDate-" + identifier,
- currentOwnerRefName,
- depositorRefName,
- conditionCheckAssesorRefName,
- insurerRefName,
- fieldCollectorRefName,
- valuerRefName );
-
+ currentOwnerRefName,
+ depositorRefName,
+ conditionCheckAssesorRefName,
+ insurerRefName,
+ fieldCollectorRefName,
+ valuerRefName );
ClientResponse<Response> res = intakeClient.create(multipart);
int statusCode = res.getStatus();
}
protected void createPersonRefs(){
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
String authRefName =
PersonAuthorityClientUtils.createPersonAuthRefName(PERSON_AUTHORITY_NAME, false);
MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
}
protected String createPerson(String firstName, String surName, String refName ) {
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
Map<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
testSetup(OK_STATUS, ServiceRequestType.READ,testName);
// Submit the request to the service and store the response.
+ IntakeClient intakeClient = new IntakeClient();
ClientResponse<MultipartInput> res = intakeClient.read(knownResourceId);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ IntakeClient intakeClient = new IntakeClient();
// Note: Any non-success responses are ignored and not reported.
for (String resourceId : intakeIdsCreated) {
ClientResponse<Response> res = intakeClient.delete(resourceId);
}
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
// Delete persons before PersonAuth
for (String resourceId : personIdsCreated) {
ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", intakeClient.getCommonPartName());
+ commonPart.getHeaders().add("label", new IntakeClient().getCommonPartName());
if(logger.isDebugEnabled()){
logger.debug("to be created, intake common");
LoggerFactory.getLogger(IntakeServiceTest.class);
// Instance variables specific to this test.
- private IntakeClient client = new IntakeClient();
final String SERVICE_PATH_COMPONENT = "intakes";
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
setupCreate(testName);
// Submit the request to the service and store the response.
+ IntakeClient client = new IntakeClient();
String identifier = createIdentifier();
-
MultipartOutput multipart = createIntakeInstance(identifier);
ClientResponse<Response> res = client.create(multipart);
setupRead(testName);
// Submit the request to the service and store the response.
+ IntakeClient client = new IntakeClient();
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ IntakeClient client = new IntakeClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ IntakeClient client = new IntakeClient();
ClientResponse<IntakesCommonList> res = client.readList();
IntakesCommonList list = res.getEntity();
int statusCode = res.getStatus();
// Perform setup.
setupUpdate(testName);
+ // Retrieve the contents of a resource to update.
+ IntakeClient client = new IntakeClient();
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
-
- // The only relevant ID may be the one used in update(), below.
+ IntakeClient client = new IntakeClient();
MultipartOutput multipart = createIntakeInstance(NON_EXISTENT_ID);
ClientResponse<MultipartInput> res =
client.update(NON_EXISTENT_ID, multipart);
setupDelete(testName);
// Submit the request to the service and store the response.
+ IntakeClient client = new IntakeClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ IntakeClient client = new IntakeClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ IntakeClient client = new IntakeClient();
for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", client.getCommonPartName());
+ commonPart.getHeaders().add("label", new IntakeClient().getCommonPartName());
if(logger.isDebugEnabled()){
logger.debug("to be created, intake common");
LoggerFactory.getLogger(LoaninAuthRefsTest.class);
// Instance variables specific to this test.
- private LoaninClient loaninClient = new LoaninClient();
- private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
final String SERVICE_PATH_COMPONENT = "loansin";
final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
private String knownResourceId = null;
//
// One or more fields in this resource will be PersonAuthority
// references, and will refer to Person resources by their refNames.
+ LoaninClient loaninClient = new LoaninClient();
MultipartOutput multipart = createLoaninInstance(
"loanInNumber-" + identifier,
"returnDate-" + identifier,
lendersAuthorizerRefName,
lendersContactRefName,
loanInContactRefName);
-
ClientResponse<Response> res = loaninClient.create(multipart);
-
int statusCode = res.getStatus();
// Check the status code of the response: does it match
protected void createPersonRefs(){
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
// Create a temporary PersonAuthority resource, and its corresponding
// refName by which it can be identified.
String authRefName =
}
protected String createPerson(String firstName, String surName, String refName ) {
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
Map<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
testSetup(OK_STATUS, ServiceRequestType.READ,testName);
// Submit the request to the service and store the response.
+ LoaninClient loaninClient = new LoaninClient();
ClientResponse<MultipartInput> res = loaninClient.read(knownResourceId);
int statusCode = res.getStatus();
}
// Note: Any non-success responses are ignored and not reported.
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
// Delete Person resource(s) (before PersonAuthority resources).
ClientResponse<Response> res;
for (String resourceId : personIdsCreated) {
// Delete PersonAuthority resource(s).
res = personAuthClient.delete(personAuthCSID);
// Delete Loans In resource(s).
+ LoaninClient loaninClient = new LoaninClient();
for (String resourceId : loaninIdsCreated) {
res = loaninClient.delete(resourceId);
}
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
multipart.addPart(loanin, MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", loaninClient.getCommonPartName());
+ commonPart.getHeaders().add("label", new LoaninClient().getCommonPartName());
if(logger.isDebugEnabled()){
logger.debug("to be created, loanin common");
LoggerFactory.getLogger(LoaninServiceTest.class);
// Instance variables specific to this test.
- private LoaninClient client = new LoaninClient();
final String SERVICE_PATH_COMPONENT = "loansin";
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
setupCreate(testName);
// Submit the request to the service and store the response.
+ LoaninClient client = new LoaninClient();
String identifier = createIdentifier();
-
MultipartOutput multipart = createLoaninInstance(identifier);
ClientResponse<Response> res = client.create(multipart);
setupRead(testName);
// Submit the request to the service and store the response.
+ LoaninClient client = new LoaninClient();
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ LoaninClient client = new LoaninClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ LoaninClient client = new LoaninClient();
ClientResponse<LoansinCommonList> res = client.readList();
LoansinCommonList list = res.getEntity();
int statusCode = res.getStatus();
// Perform setup.
setupUpdate(testName);
+ // Retrieve the contents of a resource to update.
+ LoaninClient client = new LoaninClient();
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
-
- // The only relevant ID may be the one used in update(), below.
+ LoaninClient client = new LoaninClient();
MultipartOutput multipart = createLoaninInstance(NON_EXISTENT_ID);
ClientResponse<MultipartInput> res =
client.update(NON_EXISTENT_ID, multipart);
setupDelete(testName);
// Submit the request to the service and store the response.
+ LoaninClient client = new LoaninClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ LoaninClient client = new LoaninClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
- for (String resourceId : allResourceIdsCreated) {
+ LoaninClient client = new LoaninClient();
+ for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
}
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
multipart.addPart(loanin, MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", client.getCommonPartName());
+ commonPart.getHeaders().add("label", new LoaninClient().getCommonPartName());
if(logger.isDebugEnabled()){
logger.debug("to be created, loanin common");
LoggerFactory.getLogger(OrgAuthorityServiceTest.class);
// Instance variables specific to this test.
- private OrgAuthorityClient client = new OrgAuthorityClient();
- private ContactClient contactClient = new ContactClient();
final String SERVICE_PATH_COMPONENT = "orgauthorities";
final String ITEM_SERVICE_PATH_COMPONENT = "items";
final String CONTACT_SERVICE_PATH_COMPONENT = "contacts";
setupCreate(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
String identifier = createIdentifier();
String displayName = "displayName-" + identifier;
String refName = OrgAuthorityClientUtils.createOrgAuthRefName(displayName, true);
}
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
String identifier = createIdentifier();
String refName = OrgAuthorityClientUtils.createOrganizationRefName(knownResourceRefName, identifier, true);
Map<String, String> testOrgMap = new HashMap<String,String>();
}
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
String identifier = createIdentifier();
MultipartOutput multipart =
ContactClientUtils.createContactInstance(parentcsid,
- itemcsid, identifier, contactClient.getCommonPartName());
+ itemcsid, identifier, new ContactClient().getCommonPartName());
ClientResponse<Response> res =
client.createContact(parentcsid, itemcsid, multipart);
int statusCode = res.getStatus();
setupRead();
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
groups = {"read"}, dependsOnGroups = {"create"})
public void readByName(String testName) throws Exception {
- // Perform setup.
- setupRead();
-
- // Submit the request to the service and store the response.
- ClientResponse<MultipartInput> res = client.readByName(knownResourceDisplayName);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- //FIXME: remove the following try catch once Aron fixes signatures
- try {
- MultipartInput input = (MultipartInput) res.getEntity();
- OrgauthoritiesCommon orgAuthority = (OrgauthoritiesCommon) extractPart(input,
- client.getCommonPartName(), OrgauthoritiesCommon.class);
- Assert.assertNotNull(orgAuthority);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ // Perform setup.
+ setupRead();
+
+ // Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
+ ClientResponse<MultipartInput> res = client.readByName(knownResourceDisplayName);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ //FIXME: remove the following try catch once Aron fixes signatures
+ try {
+ MultipartInput input = (MultipartInput) res.getEntity();
+ OrgauthoritiesCommon orgAuthority = (OrgauthoritiesCommon) extractPart(input,
+ new OrgAuthorityClient().getCommonPartName(), OrgauthoritiesCommon.class);
+ Assert.assertNotNull(orgAuthority);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
+ }
/*
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
setupRead(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
setupUpdate(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
setupUpdateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
setupRead(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res =
client.readContact(knownResourceId, knownItemResourceId,
knownContactResourceId);
// Check whether we've received a contact.
MultipartInput input = (MultipartInput) res.getEntity();
ContactsCommon contact = (ContactsCommon) extractPart(input,
- contactClient.getCommonPartName(), ContactsCommon.class);
+ new ContactClient().getCommonPartName(), ContactsCommon.class);
Assert.assertNotNull(contact);
boolean showFull = true;
if(showFull && logger.isDebugEnabled()){
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res =
client.readContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<OrgauthoritiesCommonList> res = client.readList();
OrgauthoritiesCommonList list = res.getEntity();
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<OrganizationsCommonList> res = null;
-
if(vcsid!= null) {
- // Submit the request to the service and store the response.
res = client.readItemList(vcsid);
} else if(name!= null) {
- // Submit the request to the service and store the response.
res = client.readItemListForNamedAuthority(name);
} else {
Assert.fail("readItemList passed null csid and name!");
setupReadList(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<ContactsCommonList> res =
client.readContactList(parentcsid, itemcsid);
ContactsCommonList list = res.getEntity();
setupUpdate(testName);
// Retrieve the contents of a resource to update.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
// Perform setup.
setupUpdate(testName);
+ // Retrieve the contents of a resource to update.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res =
client.readItem(knownResourceId, knownItemResourceId);
if(logger.isDebugEnabled()){
// Perform setup.
setupUpdate(testName);
+ // Retrieve the contents of a resource to update.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<MultipartInput> res =
client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
if(logger.isDebugEnabled()){
}
MultipartInput input = (MultipartInput) res.getEntity();
ContactsCommon contact = (ContactsCommon) extractPart(input,
- contactClient.getCommonPartName(), ContactsCommon.class);
+ new ContactClient().getCommonPartName(), ContactsCommon.class);
Assert.assertNotNull(contact);
// Update the contents of this resource.
// Submit the updated resource to the service and store the response.
MultipartOutput output = new MultipartOutput();
OutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", contactClient.getCommonPartName());
+ commonPart.getHeaders().add("label", new ContactClient().getCommonPartName());
res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
int statusCode = res.getStatus();
input = (MultipartInput) res.getEntity();
ContactsCommon updatedContact =
(ContactsCommon) extractPart(input,
- contactClient.getCommonPartName(), ContactsCommon.class);
+ new ContactClient().getCommonPartName(), ContactsCommon.class);
Assert.assertNotNull(updatedContact);
// Verify that the updated resource received the correct data.
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
+ OrgAuthorityClient client = new OrgAuthorityClient();
MultipartOutput multipart = createOrgAuthorityInstance(NON_EXISTENT_ID);
ClientResponse<MultipartInput> res =
client.update(NON_EXISTENT_ID, multipart);
// Submit the request to the service and store the response.
// Note: The ID(s) used when creating the request payload may be arbitrary.
// The only relevant ID may be the one used in update(), below.
+ OrgAuthorityClient client = new OrgAuthorityClient();
Map<String, String> nonexOrgMap = new HashMap<String,String>();
nonexOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "Non-existent");
String refName = OrgAuthorityClientUtils.createOrganizationRefName(knownResourceRefName, NON_EXISTENT_ID, true);
}
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<Response> res =
client.deleteContact(knownResourceId, knownItemResourceId, knownContactResourceId);
int statusCode = res.getStatus();
}
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
}
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ OrgAuthorityClient client = new OrgAuthorityClient();
ClientResponse<Response> res =
client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
String contactResourceId;
// Clean up contact resources.
parentResourceId = knownResourceId;
+ OrgAuthorityClient client = new OrgAuthorityClient();
for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
contactResourceId = entry.getKey();
itemResourceId = entry.getValue();
String refName = OrgAuthorityClientUtils.createOrgAuthRefName(displayName, true);
return OrgAuthorityClientUtils.createOrgAuthorityInstance(
displayName, refName,
- client.getCommonPartName());
+ new OrgAuthorityClient().getCommonPartName());
}
}
\ No newline at end of file
LoggerFactory.getLogger(PersonAuthorityServiceTest.class);
// Instance variables specific to this test.
- private PersonAuthorityClient client = new PersonAuthorityClient();
- private ContactClient contactClient = new ContactClient();
final String SERVICE_PATH_COMPONENT = "personauthorities";
final String ITEM_SERVICE_PATH_COMPONENT = "items";
final String CONTACT_SERVICE_PATH_COMPONENT = "contacts";
setupCreate(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
String identifier = createIdentifier();
String displayName = "displayName-" + identifier;
String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(displayName, false);
}
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
String identifier = createIdentifier();
String refName = PersonAuthorityClientUtils.createPersonRefName(authRefName, "John Wayne", true);
Map<String, String> johnWayneMap = new HashMap<String,String>();
}
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
String identifier = createIdentifier();
MultipartOutput multipart =
ContactClientUtils.createContactInstance(parentcsid,
- itemcsid, identifier, contactClient.getCommonPartName());
+ itemcsid, identifier, new ContactClient().getCommonPartName());
ClientResponse<Response> res =
client.createContact(parentcsid, itemcsid, multipart);
int statusCode = res.getStatus();
setupRead();
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
public void readByName(String testName) throws Exception {
// Perform setup.
- setupRead();
-
- // Submit the request to the service and store the response.
- ClientResponse<MultipartInput> res = client.readByName(knownResourceDisplayName);
- int statusCode = res.getStatus();
-
- // Check the status code of the response: does it match
- // the expected response(s)?
- if(logger.isDebugEnabled()){
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- //FIXME: remove the following try catch once Aron fixes signatures
- try {
- MultipartInput input = (MultipartInput) res.getEntity();
- PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
- client.getCommonPartName(), PersonauthoritiesCommon.class);
- Assert.assertNotNull(personAuthority);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ setupRead();
+
+ // Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
+ ClientResponse<MultipartInput> res = client.readByName(knownResourceDisplayName);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ //FIXME: remove the following try catch once Aron fixes signatures
+ try {
+ MultipartInput input = (MultipartInput) res.getEntity();
+ PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
+ client.getCommonPartName(), PersonauthoritiesCommon.class);
+ Assert.assertNotNull(personAuthority);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
+ }
/*
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
setupRead(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
setupUpdate(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
setupUpdateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
setupRead(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res =
client.readContact(knownResourceId, knownItemResourceId,
knownContactResourceId);
// Check whether we've received a contact.
MultipartInput input = (MultipartInput) res.getEntity();
ContactsCommon contact = (ContactsCommon) extractPart(input,
- contactClient.getCommonPartName(), ContactsCommon.class);
+ new ContactClient().getCommonPartName(), ContactsCommon.class);
Assert.assertNotNull(contact);
boolean showFull = true;
if(showFull && logger.isDebugEnabled()){
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res =
client.readContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<PersonauthoritiesCommonList> res = client.readList();
PersonauthoritiesCommonList list = res.getEntity();
int statusCode = res.getStatus();
// Perform setup.
setupReadList(testName);
+ // Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<PersonsCommonList> res = null;
-
if(vcsid!= null) {
- // Submit the request to the service and store the response.
res = client.readItemList(vcsid);
} else if(name!= null) {
- // Submit the request to the service and store the response.
res = client.readItemListForNamedAuthority(name);
} else {
Assert.fail("readItemList passed null csid and name!");
setupReadList(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<ContactsCommonList> res =
client.readContactList(parentcsid, itemcsid);
ContactsCommonList list = res.getEntity();
setupUpdate(testName);
// Retrieve the contents of a resource to update.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
// Perform setup.
setupUpdate(testName);
+ // Retrieve the contents of a resource to update.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res =
client.readItem(knownResourceId, knownItemResourceId);
if(logger.isDebugEnabled()){
// Perform setup.
setupUpdate(testName);
+ // Retrieve the contents of a resource to update.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<MultipartInput> res =
client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
if(logger.isDebugEnabled()){
}
MultipartInput input = (MultipartInput) res.getEntity();
ContactsCommon contact = (ContactsCommon) extractPart(input,
- contactClient.getCommonPartName(), ContactsCommon.class);
+ new ContactClient().getCommonPartName(), ContactsCommon.class);
Assert.assertNotNull(contact);
// Update the contents of this resource.
// Submit the updated resource to the service and store the response.
MultipartOutput output = new MultipartOutput();
OutputPart commonPart = output.addPart(contact, MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", contactClient.getCommonPartName());
+ commonPart.getHeaders().add("label", new ContactClient().getCommonPartName());
res = client.updateContact(knownResourceId, knownItemResourceId, knownContactResourceId, output);
int statusCode = res.getStatus();
input = (MultipartInput) res.getEntity();
ContactsCommon updatedContact =
(ContactsCommon) extractPart(input,
- contactClient.getCommonPartName(), ContactsCommon.class);
+ new ContactClient().getCommonPartName(), ContactsCommon.class);
Assert.assertNotNull(updatedContact);
// Verify that the updated resource received the correct data.
// Submit the request to the service and store the response.
// Note: The ID(s) used when creating the request payload may be arbitrary.
// The only relevant ID may be the one used in update(), below.
- String displayName = "displayName-NON_EXISTENT_ID";
+ PersonAuthorityClient client = new PersonAuthorityClient();
+ String displayName = "displayName-NON_EXISTENT_ID";
String fullRefName = PersonAuthorityClientUtils.createPersonAuthRefName(displayName, true);
MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
displayName, fullRefName, client.getCommonPartName());
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
-
- // The only relevant ID may be the one used in update(), below.
+ PersonAuthorityClient client = new PersonAuthorityClient();
Map<String, String> nonexMap = new HashMap<String,String>();
nonexMap.put(PersonJAXBSchema.FORE_NAME, "John");
nonexMap.put(PersonJAXBSchema.SUR_NAME, "Wayne");
}
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<Response> res =
client.deleteContact(knownResourceId, knownItemResourceId, knownContactResourceId);
int statusCode = res.getStatus();
}
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
}
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ PersonAuthorityClient client = new PersonAuthorityClient();
ClientResponse<Response> res =
client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
String itemResourceId;
String contactResourceId;
// Clean up contact resources.
+ PersonAuthorityClient client = new PersonAuthorityClient();
parentResourceId = knownResourceId;
for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
contactResourceId = entry.getKey();
private final Logger logger =
LoggerFactory.getLogger(RelationServiceTest.class);
- private RelationClient client = new RelationClient();
final String SERVICE_PATH_COMPONENT = "relations";
private String knownResourceId = null;
private List<String> allResourceIdsCreated = new ArrayList();
setupCreate(testName);
// Submit the request to the service and store the response.
+ RelationClient client = new RelationClient();
String identifier = createIdentifier();
MultipartOutput multipart = createRelationInstance(identifier);
ClientResponse<Response> res = client.create(multipart);
setupRead(testName);
// Submit the request to the service and store the response.
+ RelationClient client = new RelationClient();
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ RelationClient client = new RelationClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ RelationClient client = new RelationClient();
ClientResponse<RelationsCommonList> res = client.readList();
RelationsCommonList list = res.getEntity();
int statusCode = res.getStatus();
setupUpdate(testName);
// Retrieve an existing resource that we can update.
+ RelationClient client = new RelationClient();
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
+ RelationClient client = new RelationClient();
MultipartOutput multipart = createRelationInstance(NON_EXISTENT_ID);
ClientResponse<MultipartInput> res =
client.update(NON_EXISTENT_ID, multipart);
setupDelete(testName);
// Submit the request to the service and store the response.
+ RelationClient client = new RelationClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ RelationClient client = new RelationClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
+ RelationClient client = new RelationClient();
for (String resourceId : allResourceIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
ClientResponse<Response> res = client.delete(resourceId);
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
multipart.addPart(relation, MediaType.APPLICATION_XML_TYPE);
- commonPart.getHeaders().add("label", client.getCommonPartName());
+ commonPart.getHeaders().add("label", new RelationClient().getCommonPartName());
if(logger.isDebugEnabled()){
logger.debug("to be created, relation common");
logger.debug(objectAsXmlString(relation, RelationsCommon.class));
LoggerFactory.getLogger(VocabularyServiceTest.class);
// Instance variables specific to this test.
- private VocabularyClient client = new VocabularyClient();
final String SERVICE_PATH_COMPONENT = "vocabularies";
final String ITEM_SERVICE_PATH_COMPONENT = "items";
private String knownResourceId = null;
setupCreate(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
String identifier = createIdentifier();
String displayName = "displayName-" + identifier;
String refName = VocabularyClientUtils.createVocabularyRefName(displayName, false);
@Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
dependsOnMethods = {"create"})
public void createItem(String testName) {
+
+ // Perform setup.
setupCreate(testName);
+ VocabularyClient client = new VocabularyClient();
HashMap<String, String> itemInfo = new HashMap<String, String>();
itemInfo.put(VocabularyItemJAXBSchema.DISPLAY_NAME, createIdentifier());
String newID = VocabularyClientUtils.createItemInVocabulary(knownResourceId,
knownResourceRefName, itemInfo, client);
+
// Store the ID returned from the first item resource created
// for additional tests below.
if (knownItemResourceId == null){
setupRead();
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<MultipartInput> res = client.read(knownResourceId);
int statusCode = res.getStatus();
setupRead(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
setupUpdateWithWrongXmlSchema(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadNonExistent(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<MultipartInput> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<VocabulariesCommonList> res = client.readList();
VocabulariesCommonList list = res.getEntity();
int statusCode = res.getStatus();
setupReadList(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<VocabularyitemsCommonList> res =
client.readItemList(vcsid);
VocabularyitemsCommonList list = res.getEntity();
setupUpdate(testName);
// Retrieve the contents of a resource to update.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<MultipartInput> res =
client.read(knownResourceId);
if(logger.isDebugEnabled()){
// Perform setup.
setupUpdate(testName);
+ // Retrieve the contents of a resource to update.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<MultipartInput> res =
client.readItem(knownResourceId, knownItemResourceId);
if(logger.isDebugEnabled()){
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
-
- // The only relevant ID may be the one used in update(), below.
+ VocabularyClient client = new VocabularyClient();
String displayName = "displayName-" + NON_EXISTENT_ID;
String refName = VocabularyClientUtils.createVocabularyRefName(displayName, false);
MultipartOutput multipart = VocabularyClientUtils.createEnumerationInstance(
// Submit the request to the service and store the response.
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
-
- // The only relevant ID may be the one used in update(), below.
+ VocabularyClient client = new VocabularyClient();
HashMap<String, String> itemInfo = new HashMap<String, String>();
itemInfo.put(VocabularyItemJAXBSchema.DISPLAY_NAME, "nonex");
MultipartOutput multipart =
setupDelete(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<Response> res = client.delete(knownResourceId);
int statusCode = res.getStatus();
setupDelete(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
int statusCode = res.getStatus();
setupDeleteNonExistent(testName);
// Submit the request to the service and store the response.
+ VocabularyClient client = new VocabularyClient();
ClientResponse<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
int statusCode = res.getStatus();
if (logger.isDebugEnabled()) {
logger.debug("Cleaning up temporary resources created for testing ...");
}
- // Clean up vocabulary item resources.
+ VocabularyClient client = new VocabularyClient();
String vocabularyResourceId;
String vocabularyItemResourceId;
+ // Clean up vocabulary item resources.
for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
vocabularyItemResourceId = entry.getKey();
vocabularyResourceId = entry.getValue();