Merged 5.1-MC1 (5.1.0) to HEAD (5.1)

119558 gcornwell: Merged code coverage improvements to 5.1-MC1 (5.1.0)
      r117774 gjames: RA-567: Increase /workflow/processes API code coverage
      r117773 gjames: RA-567: /workflow/processes coverage, removed unused ActivitiTypeConverter
      r116883 gjames: RA-531: reapplied change after merge, for MultiTServiceImpl test coverage
      r116629 gjames: RA-568 Increase /workflow/process-definitions API code coverage
      r116574 gjames: RA-569 Increase /workflow/tasks API code coverage
      r116286 gjames: RA-567: Increase /workflow/processes API code coverage
      r115853 gjames: RA-566: Increasing /people api coverage (description field)
      r115811 gjames: RA-566: Increasing /people api coverage
      r113007 gjames: Adding additional test coverage for DictionaryNamespaceComponent and DynamicNamespacePrefixResolver RA-521
      r113006 gjames: Adding additional test coverage for DictionaryNamespaceComponent and DictionaryComponent RA-514
      r112969 gjames: Adding additional test coverage for TemplateServiceImpl RA-530
      r112960 gjames: Alternative test approach for ModuleServiceImpl RA-520
      r112703 gjames: Adding additional test coverage for NodeLocatorService RA-522
      r112702 gjames: Adding additional test coverage for JobLockServiceImpl RA-516
      r112699 gjames: Adding additional test coverage for ModuleServiceImpl RA-520
      r112508 gjames: Adding additional test coverage for RenditionServiceImpl RA-526
      r112476 gjames: Adding additional test coverage for ContentServiceImpl RA-513
      r112475 gjames: Adding additional test coverage for MimetypeMap RA-519
      r112238 gjames: Adding additional test coverage for MimetypeMap RA-519
      r112237 gjames: Adding additional test coverage for TaggingService RA-529
      r112236 gjames: Adding additional test coverage for MultiTServiceImpl RA-531
      r112206 gjames: Adding additional test coverage for ContentServiceImpl RA-513
      r112167 gcornwell: RA-523: Increase NodeService code coverage (removed redundant code that was testing a version store we no longer use)
      r112102 gjames: Reverted changes to PermissionServiceImpl for RA-524
      r112048 gjames: Temporarily removed some PermissionServiceImpl code. I need to put it back.
      r111620 gjames: Adding additional test coverage for PermissionService RA-524
      r111619 gjames: Added some @Override to make Sonar happier
      r111456 gjames: Adding additional test coverage for AuthenticationService RA-509
      r111427 gjames: Adding additional test coverage for AttributeService RA-509
      r111317 gjames: Adding additional test coverage for WorkflowService RA-533


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@119945 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jean-Pierre Huynh
2015-12-10 10:35:05 +00:00
parent e0ff2eacee
commit f8fa061ba3
14 changed files with 297 additions and 223 deletions

View File

@@ -47,6 +47,7 @@ import org.alfresco.query.PagingResults;
import org.alfresco.repo.activities.feed.FeedGenerator;
import org.alfresco.repo.activities.feed.cleanup.FeedCleaner;
import org.alfresco.repo.activities.post.lookup.PostLookup;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.cleanup.ContentStoreCleaner;
import org.alfresco.repo.domain.activities.ActivityFeedEntity;
import org.alfresco.repo.domain.activities.ActivityPostDAO;
@@ -56,6 +57,7 @@ import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory;
import org.alfresco.repo.model.filefolder.HiddenAspect;
import org.alfresco.repo.model.filefolder.HiddenAspect.Visibility;
import org.alfresco.repo.node.index.NodeIndexer;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.site.SiteDoesNotExistException;
@@ -68,6 +70,7 @@ import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.repo.version.VersionModel;
import org.alfresco.repo.web.scripts.invitation.InvitationWebScriptTest;
import org.alfresco.rest.api.Activities;
import org.alfresco.rest.api.impl.node.ratings.RatingScheme;
import org.alfresco.rest.api.tests.client.data.Activity;
@@ -364,7 +367,30 @@ public class RepoService
{
lockService.unlock(nodeRef);
}
public NodeRef addUserDescription(final String personId, final TestNetwork network, final String personDescription)
{
return AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
{
//@Override
public NodeRef doWork() throws Exception
{
NodeRef userRef = personService.getPersonOrNull(personId);
if (userRef == null)
{
throw new AuthenticationException("User name does not exist: " + personId);
}
ContentWriter writer = contentService.getWriter(userRef, ContentModel.PROP_PERSONDESC, true);
writer.setMimetype(MimetypeMap.MIMETYPE_HTML);
writer.putContent(personDescription);
log("Updated person description " + personId + (network != null ? " in network " + network : ""));
return userRef;
}
});
}
public TestPerson createUser(final PersonInfo personInfo, final String username, final TestNetwork network)
{
return AuthenticationUtil.runAsSystem(new RunAsWork<TestPerson>()
@@ -390,11 +416,17 @@ public class RepoService
});
}
personService.createPerson(props);
NodeRef createdPerson = personService.createPerson(props);
// create authentication to represent user
authenticationService.createAuthentication(username, personInfo.getPassword().toCharArray());
if (EnterpriseTestFixture.WITH_AVATAR.equals(personInfo.getInstantmsg()))
{
InvitationWebScriptTest.makeAvatar(nodeService,createdPerson);
log("Made avatar for " + testPerson.getId() + (network != null ? " in network " + network : ""));
}
log("Created person " + testPerson.getId() + (network != null ? " in network " + network : ""));
publicApiContext.addUser(testPerson.getId());
@@ -1301,6 +1333,19 @@ public class RepoService
return person;
}
public NodeRef addUserDescription(final String personId, final String personDescription)
{
NodeRef personRef = TenantUtil.runAsTenant(new TenantRunAsWork<NodeRef>()
{
public NodeRef doWork() throws Exception
{
return RepoService.this.addUserDescription(personId, TestNetwork.this, personDescription);
}
}, getId());
return personRef;
}
public TestPerson createUser(final PersonInfo personInfo)
{
final String username = publicApiContext.createUserName(personInfo.getUsername(), getId());
@@ -1746,7 +1791,7 @@ public class RepoService
public TestPerson(String firstName, String lastName, String username, String password, Company company, TestNetwork defaultAccount, String skype, String location, String tel,
String mob, String instantmsg, String google)
{
super(username, username, true, firstName, lastName, company, skype, location, tel, mob, instantmsg, google);
super(username, username, true, firstName, lastName, company, skype, location, tel, mob, instantmsg, google, null);
this.password = password;
this.enabled = true;
this.defaultAccount = defaultAccount;