Merged HEAD (5.2) to 5.2.N (5.2.1)

126495 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      122697 jvonka: (Quick) Shared Links API - first-cut for shared links api tests (+ve & -ve)
      - also tweaks to REST api test 'fwk' (harness)
      RA-773, RA-708, RA-776, RA-750, RA-829, RA-775


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126839 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 11:44:55 +00:00
parent a6f75435a2
commit b6eec668c7
6 changed files with 401 additions and 49 deletions

View File

@@ -156,7 +156,7 @@ public class AuthenticatedHttp extends AbstractHttp
/**
* Execute the given method, authenticated as the given user using Basic Authentication.
* @param method method to execute
* @param userName name of user to authenticate
* @param userName name of user to authenticate (note: if null then attempts to run with no authentication - eq. Quick/Shared Link test)
* @param callback called after http-call is executed. When callback returns, the
* response stream is closed, so all respose-related operations should be done in the callback. Can be null.
* @return result returned by the callback or null if no callback is given.
@@ -166,9 +166,13 @@ public class AuthenticatedHttp extends AbstractHttp
try
{
HttpState state = new HttpState();
state.setCredentials(
if (userName != null)
{
state.setCredentials(
new AuthScope(null, AuthScope.ANY_PORT),
new UsernamePasswordCredentials(userName, password));
}
httpProvider.getHttpClient().executeMethod(null, method, state);

View File

@@ -46,20 +46,26 @@ public class UserAuthenticationDetailsProviderImpl implements AuthenticationDeta
public String getPasswordForUser(String userName)
{
UserData user = userDataService.findUserByUserName(userName);
if(user != null)
if (userName != null)
{
return user.getPassword();
UserData user = userDataService.findUserByUserName(userName);
if (user != null)
{
return user.getPassword();
}
}
return null;
}
public String getTicketForUser(String userName)
{
UserData user = userDataService.findUserByUserName(userName);
if(user != null)
if (userName != null)
{
return user.getTicket();
UserData user = userDataService.findUserByUserName(userName);
if (user != null)
{
return user.getTicket();
}
}
return null;
}

View File

@@ -35,31 +35,15 @@ import static org.junit.Assert.assertTrue;
*/
public class Document extends Node
{
private ContentInfo contentInfo;
public Document() {
super();
}
public ContentInfo getContent()
{
return contentInfo;
}
public void setContent(ContentInfo contentInfo)
{
this.contentInfo = contentInfo;
}
@Override
public void expected(Object o)
{
super.expected(o);
assertTrue(o instanceof Document);
Document other = (Document) o;
contentInfo.expected(other.getContent());
}
}

View File

@@ -25,8 +25,6 @@
*/
package org.alfresco.rest.api.tests.client.data;
import org.junit.Assert;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -63,6 +61,8 @@ public class Node
protected Map<String, Object> properties;
protected ContentInfo contentInfo;
public Node()
{
}
@@ -197,6 +197,16 @@ public class Node
this.properties = properties;
}
public void setContent(ContentInfo contentInfo)
{
this.contentInfo = contentInfo;
}
public ContentInfo getContent()
{
return this.contentInfo;
}
public void expected(Object o)
{
Node other = (Node) o;
@@ -283,8 +293,22 @@ public class Node
AssertUtil.assertEquals("isFile", isFile, other.getIsFile());
AssertUtil.assertEquals("isLink", isLink, other.getIsLink());
if (path != null) {
if (path != null)
{
path.expected(other.getPath());
}
else
{
assertNull(other.getPath());
}
if (contentInfo != null)
{
contentInfo.expected(other.getContent());
}
else
{
assertNull(other.getContent());
}
}
}