Merged WEBAPP-API (5.2.1) to 5.2.N (5.2.1)

135878 jkaabimofrad: APPSREPO-118: A few minor tweaks based on peer review.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@135933 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2017-03-16 19:39:42 +00:00
parent 1aff84d8f7
commit 29aecf23fe
3 changed files with 8 additions and 8 deletions

View File

@@ -1760,12 +1760,12 @@ public class TestPeople extends AbstractBaseApiTest
assertEquals("A reset password email should have been sent.", 1, emailUtil.getSentCount()); assertEquals("A reset password email should have been sent.", 1, emailUtil.getSentCount());
MimeMessage msg = emailUtil.getLastEmail(); MimeMessage msg = emailUtil.getLastEmail();
assertNotNull(msg); assertNotNull("There should be an email.", msg);
assertEquals("Should've been only one email recipient.", 1, msg.getAllRecipients().length); assertEquals("Should've been only one email recipient.", 1, msg.getAllRecipients().length);
// Check the recipient is the person who requested the reset password // Check the recipient is the person who requested the reset password
assertEquals(person.getEmail(), msg.getAllRecipients()[0].toString()); assertEquals(person.getEmail(), msg.getAllRecipients()[0].toString());
// There should be a subject // There should be a subject
assertNotNull(msg.getSubject()); assertNotNull("There should be a subject.", msg.getSubject());
// Check the reset password url. // Check the reset password url.
String resetPasswordUrl = (String) emailUtil.getLastEmailTemplateModelValue("reset_password_url"); String resetPasswordUrl = (String) emailUtil.getLastEmailTemplateModelValue("reset_password_url");
@@ -1786,11 +1786,11 @@ public class TestPeople extends AbstractBaseApiTest
post(getResetPasswordUrl(person.getUserName()), RestApiUtil.toJsonAsString(passwordReset), 202); post(getResetPasswordUrl(person.getUserName()), RestApiUtil.toJsonAsString(passwordReset), 202);
assertEquals("A reset password confirmation email should have been sent.", 1, emailUtil.getSentCount()); assertEquals("A reset password confirmation email should have been sent.", 1, emailUtil.getSentCount());
msg = emailUtil.getLastEmail(); msg = emailUtil.getLastEmail();
assertNotNull(msg); assertNotNull("There should be an email.", msg);
assertEquals("Should've been only one email recipient.", 1, msg.getAllRecipients().length); assertEquals("Should've been only one email recipient.", 1, msg.getAllRecipients().length);
assertEquals(person.getEmail(), msg.getAllRecipients()[0].toString()); assertEquals(person.getEmail(), msg.getAllRecipients()[0].toString());
// There should be a subject // There should be a subject
assertNotNull(msg.getSubject()); assertNotNull("There should be a subject.", msg.getSubject());
// Try to login with old credential // Try to login with old credential
post("tickets", RestApiUtil.toJsonAsString(loginRequest), null, null, "authentication", 403); post("tickets", RestApiUtil.toJsonAsString(loginRequest), null, null, "authentication", 403);
@@ -1804,7 +1804,7 @@ public class TestPeople extends AbstractBaseApiTest
/* /*
* -ve tests * Negative tests
*/ */
// First, reset the email helper // First, reset the email helper
emailUtil.reset(); emailUtil.reset();
@@ -1815,7 +1815,7 @@ public class TestPeople extends AbstractBaseApiTest
post(getResetPasswordUrl(person.getUserName()), RestApiUtil.toJsonAsString(passwordReset), 202); post(getResetPasswordUrl(person.getUserName()), RestApiUtil.toJsonAsString(passwordReset), 202);
assertEquals("No email should have been sent.", 0, emailUtil.getSentCount()); assertEquals("No email should have been sent.", 0, emailUtil.getSentCount());
// Request reset password - Invalid user (user dose not exist) // Request reset password - Invalid user (user does not exist)
post(getRequestResetPasswordUrl(System.currentTimeMillis() + "noUser"), RestApiUtil.toJsonAsString(client), 202); post(getRequestResetPasswordUrl(System.currentTimeMillis() + "noUser"), RestApiUtil.toJsonAsString(client), 202);
assertEquals("No email should have been sent.", 0, emailUtil.getSentCount()); assertEquals("No email should have been sent.", 0, emailUtil.getSentCount());

View File

@@ -133,7 +133,7 @@ public class AuthenticatedHttp extends AbstractHttp
} }
} }
public <T extends Object> T executeHttpMethodUnAuthenticated(HttpMethod method, HttpRequestCallback<T> callback) public <T extends Object> T executeHttpMethodUnauthenticated(HttpMethod method, HttpRequestCallback<T> callback)
{ {
try try
{ {

View File

@@ -277,7 +277,7 @@ public class PublicApiHttpClient
} }
else else
{ {
response = authenticatedHttp.executeHttpMethodUnAuthenticated(req, callback); response = authenticatedHttp.executeHttpMethodUnauthenticated(req, callback);
} }
return response; return response;
} }