mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-30 18:15:39 +00:00
Merged V2.2 to HEAD
11053: Reinstate transaction count for FULL index recover 11055: Build fix 11056: Fix bug/Build - finding deleted people 11057: Clean any people that should not be there at the start of the tests .. 11063: Throw detailed failure message when Authority list size is incorrect 11075: Build fix 11145: Fixed FK index name git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11222 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
ad23a594f5
commit
c5f08a8f06
@ -59,7 +59,7 @@
|
||||
column="store_id"
|
||||
not-null="true"
|
||||
lazy="false"
|
||||
foreign-key="fk_alf_n_store"
|
||||
foreign-key="fk_alf_node_store"
|
||||
fetch="join" />
|
||||
<!-- the store-unique identifier -->
|
||||
<property name="uuid" column="uuid" type="string" length="36" />
|
||||
|
@ -122,6 +122,13 @@
|
||||
]]>
|
||||
</query>
|
||||
|
||||
<query name="txn.CountTransactions">
|
||||
select
|
||||
count(txn.id)
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.TransactionImpl as txn
|
||||
</query>
|
||||
|
||||
<query name="txn.GetTxnUpdateCountForStore">
|
||||
select
|
||||
count(node.uuid)
|
||||
|
@ -1868,7 +1868,7 @@ public class IndexInfo
|
||||
File location = new File(indexDirectory, id).getCanonicalFile();
|
||||
if (IndexReader.indexExists(location))
|
||||
{
|
||||
if (size > config.getMaxDocsForInMemoryMerge())
|
||||
if ((config != null) && (size > config.getMaxDocsForInMemoryMerge()))
|
||||
{
|
||||
reader = IndexReader.open(location);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ package org.alfresco.repo.security.authority;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
@ -324,6 +325,20 @@ public class AuthorityServiceTest extends TestCase
|
||||
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.ROLE).size());
|
||||
}
|
||||
|
||||
private void checkAuthorityCollectionSize(int expected, Set<String> actual, AuthorityType type)
|
||||
{
|
||||
if (actual.size() != expected)
|
||||
{
|
||||
String msg =
|
||||
"Incorrect number of authorities.\n" +
|
||||
" Type: " + type + "\n" +
|
||||
" Expected Count: " + expected + "\n" +
|
||||
" Actual Count: " + actual.size() + "\n" +
|
||||
" Authorities: " + actual;
|
||||
fail(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public void testCreateAuthTree()
|
||||
{
|
||||
personService.getPerson("andy");
|
||||
@ -357,12 +372,12 @@ public class AuthorityServiceTest extends TestCase
|
||||
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||
|
||||
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
||||
checkAuthorityCollectionSize(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER), AuthorityType.USER);
|
||||
pubAuthorityService.addAuthority(auth5, "andy");
|
||||
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||
// The next call looks for people not users :-)
|
||||
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
||||
checkAuthorityCollectionSize(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER), AuthorityType.USER);
|
||||
assertEquals(2, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth5));
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth2));
|
||||
@ -380,7 +395,7 @@ public class AuthorityServiceTest extends TestCase
|
||||
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||
// The next call looks for people not users :-)
|
||||
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
||||
checkAuthorityCollectionSize(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER), AuthorityType.USER);
|
||||
assertEquals(0, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
|
||||
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, auth5, false).size());
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, auth5, false).contains(auth2));
|
||||
@ -426,7 +441,7 @@ public class AuthorityServiceTest extends TestCase
|
||||
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||
// The next call looks for people not users :-)
|
||||
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
||||
checkAuthorityCollectionSize(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER), AuthorityType.USER);
|
||||
assertEquals(3, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth5));
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth2));
|
||||
@ -445,7 +460,7 @@ public class AuthorityServiceTest extends TestCase
|
||||
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||
// The next call looks for people not users :-)
|
||||
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
||||
checkAuthorityCollectionSize(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER), AuthorityType.USER);
|
||||
assertEquals(2, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth5));
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth2));
|
||||
@ -486,14 +501,14 @@ public class AuthorityServiceTest extends TestCase
|
||||
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||
|
||||
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
||||
checkAuthorityCollectionSize(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER), AuthorityType.USER);
|
||||
pubAuthorityService.addAuthority(auth5, "andy");
|
||||
pubAuthorityService.addAuthority(auth1, "andy");
|
||||
|
||||
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||
// The next call looks for people not users :-)
|
||||
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
||||
checkAuthorityCollectionSize(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER), AuthorityType.USER);
|
||||
assertEquals(3, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth5));
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth2));
|
||||
@ -513,7 +528,7 @@ public class AuthorityServiceTest extends TestCase
|
||||
assertEquals(6, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||
assertEquals(3, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||
// The next call looks for people not users :-)
|
||||
assertEquals(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
||||
checkAuthorityCollectionSize(3, pubAuthorityService.getAllAuthorities(AuthorityType.USER), AuthorityType.USER);
|
||||
assertEquals(4, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth5));
|
||||
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth2));
|
||||
|
@ -71,11 +71,12 @@ public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
|
||||
{
|
||||
public Object doInHibernate(Session session)
|
||||
{
|
||||
SQLQuery query = getSession().createSQLQuery("SELECT {n.*} FROM alf_node n JOIN alf_node_properties p ON n.id = p.node_id JOIN alf_child_assoc c on c.child_node_id = n.id WHERE c.qname_localname = :userName1 AND p.qname_id = :qnameId AND p.string_value = :userName2");
|
||||
SQLQuery query = getSession().createSQLQuery("SELECT {n.*} FROM alf_node n JOIN alf_node_properties p ON n.id = p.node_id JOIN alf_child_assoc c on c.child_node_id = n.id WHERE c.qname_localname = :userName1 AND p.qname_id = :qnameId AND p.string_value = :userName2 and n.node_deleted = :False");
|
||||
query.addEntity("n", NodeImpl.class);
|
||||
query.setParameter("qnameId", qNameId);
|
||||
query.setParameter("userName1", searchUserName);
|
||||
query.setParameter("userName2", searchUserName);
|
||||
query.setParameter("False", Boolean.FALSE);
|
||||
return query.list();
|
||||
}
|
||||
};
|
||||
@ -127,9 +128,10 @@ public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
|
||||
{
|
||||
public Object doInHibernate(Session session)
|
||||
{
|
||||
SQLQuery query = getSession().createSQLQuery("SELECT {n.*} FROM alf_node n JOIN alf_node_properties p ON n.id = p.node_id WHERE p.qname_id = :qnameId");
|
||||
SQLQuery query = getSession().createSQLQuery("SELECT {n.*} FROM alf_node n JOIN alf_node_properties p ON n.id = p.node_id WHERE p.qname_id = :qnameId and n.node_deleted = :False");
|
||||
query.addEntity("n", NodeImpl.class);
|
||||
query.setParameter("qnameId", qNameId);
|
||||
query.setParameter("False", Boolean.FALSE);
|
||||
return query.list();
|
||||
}
|
||||
};
|
||||
|
@ -74,7 +74,7 @@ public abstract class TestWithUserUtils
|
||||
|
||||
HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
|
||||
properties.put(ContentModel.PROP_USERNAME, userName);
|
||||
nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, properties);
|
||||
nodeService.createNode(typesNodeRef, children, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, userName) , container, properties);
|
||||
|
||||
// Create the users
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user