Merged V4.1-BUG-FIX to HEAD

43114: ALF-15986: ALF-15986: Upgrade to Bitrock 8.5.1 in order to improve font scaling and adaptive layout with Gtk
   - Helps I18N
   43131: Fix for ALF-16510 (webview link incorrect style in High Constrast theme) and also corrected background color class in Activities title in High Contrast them.
   43147: ALF-14395: AccessDeniedException Thrown When Adding ch:contentHits Aspect from CustomAspect SDK Project
      Now sets a runAs user in the execution thread (using the correct tenant)
      Also fixes a bug where the read list was being used as the write list!
   43154: Merged BRANCHES/DEV/FEATURES/CLOUD1_DISCUSSIONS to BRANCHES/DEV/V4.1-BUG-FIX:
      43145: CLOUD-889: Fix noderefs to use base name for nested replies. Convert integration test to run all tests within a tenant (ALF-16498)
   43172: Merged V3.4-BUG-FIX to V4.1-BUG-FIX
      43166: ALF-14306 Add priorities to transformers
         << incomplete - initial steps >>
         - Addition of a TransformerSelector with the same logic as was there before.
           Makes changing the selection transformers simpler in future.
         - Addition of TransformerLog that logs a single DEBUG line for each top level transformer attempt (includes no transformers available).
           Records: sourceMimetype, targetMimetype, INFO/WARN/ERROR, FileName, FileSize, TransformerName, FailureMessage, TimeTaken
           Makes adding a true transformer log in future simpler.
      43169: Merged V3.4 to V3.4-BUG-FIX
         43167: ALF-16379: Performance degradation detected in benchmark test
            - Contention found in concurrent searches
            - Due to a correction in path generation behaviour in ALF-15171, there were a lot more 'container' (path) documents in the index. This meant that searches by node ID would hit a lot of path documents as well as the node document with ISNODE=T. This meant that whatever caches were in the indexreaders would be exhausted so concurrent searches would contend with each other on cache loading.
            - Using the ALF-15077 solution, LeafScorer now directly locates 'leaf' nodes using LEAFID=<noderef> (when possible) and avoids exhausting the caches and hitting container documents.
      43171: Merged V3.4 to V3.4-BUG-FIX (RECORD ONLY)
         43168: ALF-16379: Merged PATCHES/V4.1.1 to V3.4
            42592: ALF-16332: Alternative version of AbstractWebScriptViewResolver that uses a ConcurrentHashMap and thus allows multiple views to be resolved at the same time!
   43173: Merged V3.4-BUG-FIX to V4.1-BUG-FIX (RECORD ONLY)
      43170: Merged V4.1-BUG-FIX to V3.4-BUG-FIX
         42741: Fix for ALF-16332 - Alternative version of AbstractWebScriptViewResolver that uses a ConcurrentHashMap and thus allows multiple views to be resolved at the same time!


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@43175 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-10-28 11:02:01 +00:00
parent 05c5279912
commit 8fd64e42ec
8 changed files with 400 additions and 320 deletions

View File

@@ -94,16 +94,13 @@ public class DiscussionServiceImplTest
private static TaggingService TAGGING_SERVICE;
private static TenantAdminService TENANT_ADMIN_SERVICE;
private static final String TEST_USER = DiscussionServiceImplTest.class.getSimpleName() + "_testuser";
private static final String ADMIN_USER = AuthenticationUtil.getAdminUserName();
private static final String TENANT_DOMAIN = (DiscussionServiceImplTest.class.getSimpleName() + "Tenant").toLowerCase();
private static final String TENANT_ADMIN_USER = ADMIN_USER + "@" + TENANT_DOMAIN;
private static final String TENANT_TEST_USER = TEST_USER + "@" + TENANT_DOMAIN;
private static final String TEST_USER = DiscussionServiceImplTest.class.getSimpleName() + "_testuser@" + TENANT_DOMAIN;
private static final String ADMIN_USER = AuthenticationUtil.getAdminUserName() + "@" + TENANT_DOMAIN;
private static SiteInfo DISCUSSION_SITE;
private static SiteInfo ALTERNATE_DISCUSSION_SITE;
private static SiteInfo TENANT_DISCUSSION_SITE;
private static NodeRef FORUM_NODE;
/**
@@ -130,8 +127,8 @@ public class DiscussionServiceImplTest
TAGGING_SERVICE = (TaggingService)testContext.getBean("TaggingService");
TENANT_ADMIN_SERVICE = testContext.getBean("tenantAdminService", TenantAdminService.class);
createTenantAndTestSites();
createTenant();
// Do the setup as admin
AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER);
createUser(TEST_USER);
@@ -391,99 +388,7 @@ public class DiscussionServiceImplTest
}
}
@Test
public void tenantCreateNewTopicAndPostAndReply() throws Exception
{
TenantUtil.runAsUserTenant(new TenantRunAsWork<Object>(){
@Override
public Object doWork() throws Exception
{
TopicInfo siteTopic;
PostInfo post;
PostInfo reply1;
// Nothing to start with
PagingResults<TopicInfo> results = DISCUSSION_SERVICE.listTopics(TENANT_DISCUSSION_SITE.getShortName(), true, new PagingRequest(10));
assertEquals(0, results.getPage().size());
// Create two topics, one node and one site based
siteTopic = DISCUSSION_SERVICE.createTopic(TENANT_DISCUSSION_SITE.getShortName(),
"Site Title");
testNodesToTidy.add(siteTopic.getNodeRef());
// There are no posts to start with
PagingResults<PostInfo> posts = DISCUSSION_SERVICE.listPosts(siteTopic, new PagingRequest(10));
assertEquals(0, posts.getPage().size());
// The topic has no primary post
assertEquals(null, DISCUSSION_SERVICE.getPrimaryPost(siteTopic));
// Which means no recent post
assertEquals(null, DISCUSSION_SERVICE.getMostRecentPost(siteTopic));
// Create the first post
String contents = "This Is Some Content";
post = DISCUSSION_SERVICE.createPost(siteTopic, contents);
// Ensure it got a NodeRef, a Name and the Topic
assertNotNull(post.getNodeRef());
assertNotNull(post.getSystemName());
assertEquals(siteTopic, post.getTopic());
// Ensure it shares a name with the topic
assertEquals(siteTopic.getSystemName(), post.getSystemName());
// As this is the primary post, it'll share the topic title
assertEquals(siteTopic.getTitle(), post.getTitle());
// It will have contents and a creator
assertEquals(contents, post.getContents());
// Fetch and check
post = DISCUSSION_SERVICE.getPost(siteTopic, post.getSystemName());
assertNotNull(post.getNodeRef());
assertNotNull(post.getSystemName());
assertEquals(siteTopic, post.getTopic());
assertEquals(siteTopic.getTitle(), post.getTitle());
assertEquals(contents, post.getContents());
// Topic will now have a primary post
assertNotNull(DISCUSSION_SERVICE.getPrimaryPost(siteTopic));
assertEquals(post.getNodeRef(), DISCUSSION_SERVICE.getPrimaryPost(siteTopic).getNodeRef());
// Topic will now have one post listed
posts = DISCUSSION_SERVICE.listPosts(siteTopic, new PagingRequest(10));
assertEquals(1, posts.getPage().size());
// Add a reply
String reply1Contents = "Reply Contents";
reply1 = DISCUSSION_SERVICE.createReply(post, reply1Contents);
assertNotNull(reply1.getNodeRef());
assertNotNull(reply1.getSystemName());
assertEquals(siteTopic, reply1.getTopic());
assertEquals(null, reply1.getTitle()); // No title by default for
// replies
assertEquals(reply1Contents, reply1.getContents());
// Fetch and check
PostWithReplies postWithReplies = DISCUSSION_SERVICE.listPostReplies(siteTopic, 1);
assertNotNull(postWithReplies);
assertEquals(1, postWithReplies.getReplies().size());
PostInfo reply2 = postWithReplies.getReplies().get(0).getPost();
assertNotNull(reply2.getNodeRef());
assertNotNull(reply2.getSystemName());
assertEquals(siteTopic, reply2.getTopic());
assertEquals(null, reply2.getTitle()); // No title by default for
// replies
assertEquals(reply1Contents, reply1.getContents());
return null;
}
}, TENANT_TEST_USER, TENANT_DOMAIN);
}
@Test public void createUpdateDeleteEntries() throws Exception
{
TopicInfo siteTopic;
@@ -1951,53 +1856,6 @@ public class DiscussionServiceImplTest
AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER);
}
private static void createTenantAndTestSites()
{
AuthenticationUtil.runAs(new RunAsWork<Object>(){
@Override
public Object doWork() throws Exception
{
createTenant();
return null;
}
}, ADMIN_USER);
createTenantUser();
TenantUtil.runAsUserTenant(new TenantRunAsWork<Object>() {
@Override
public Object doWork() throws Exception
{
createTenantTestSites();
return null;
}
}, TENANT_TEST_USER, TENANT_DOMAIN);
}
private static void createTenantTestSites() throws Exception
{
final DiscussionServiceImpl privateDiscussionService = (DiscussionServiceImpl)testContext.getBean("discussionService");
TENANT_DISCUSSION_SITE = TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<SiteInfo>()
{
@Override
public SiteInfo execute() throws Throwable
{
SiteInfo site = SITE_SERVICE.createSite(
TEST_SITE_PREFIX,
DiscussionServiceImplTest.class.getSimpleName() + "_testSite" + System.currentTimeMillis(),
"test site title", "test site description",
SiteVisibility.PUBLIC);
privateDiscussionService.getSiteDiscussionsContainer(site.getShortName(), true);
CLASS_TEST_NODES_TO_TIDY.add(site.getNodeRef());
return site;
}
});
}
private static void createTenant()
{
@@ -2015,20 +1873,6 @@ public class DiscussionServiceImplTest
});
}
private static void createTenantUser()
{
TenantUtil.runAsUserTenant(new TenantRunAsWork<Object>(){
@Override
public Object doWork() throws Exception
{
createUser(TENANT_TEST_USER);
return null;
}
}, TENANT_ADMIN_USER, TENANT_DOMAIN);
}
/**
* By default, all tests are run as the admin user.
*/
@@ -2046,7 +1890,6 @@ public class DiscussionServiceImplTest
{
performDeletionOfNodes(CLASS_TEST_NODES_TO_TIDY);
deleteUser(TEST_USER);
deleteUser(TENANT_TEST_USER);
deleteTenant();
}