mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-22 15:12:38 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
60595: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3)
60362: Merged DEV to V4.2-BUG-FIX (4.2.2)
58112: Added missing transaction(s) in CheckOutCheckInServiceImplTest (MNT-9806)
58113: Added missing transaction(s) in LockableAspectInterceptorTest (MNT-9806)
58114: Added missing transaction(s) in LockableAspectInterceptorTest (MNT-9806)
58115: Added missing transaction(s) in TransactionCleanupTest (MNT-9806)
58116: Added missing transaction(s) in GetChildrenCannedQueryTest (MNT-9806)
58118: Added missing transaction(s) in RatingServiceIntegrationTest (MNT-9806)
58119: Added missing transaction(s) in ReplicationServiceIntegrationTest (MNT-9806)
58121: Added missing transaction(s) in PersonTest (MNT-9806)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62326 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -679,10 +679,10 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
|
|||||||
|
|
||||||
final NodeRef finalNodeRef = origNodeRef;
|
final NodeRef finalNodeRef = origNodeRef;
|
||||||
|
|
||||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(
|
NodeRef wk3 = this.transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||||
new RetryingTransactionCallback<Object>()
|
new RetryingTransactionCallback<NodeRef>()
|
||||||
{
|
{
|
||||||
public Object execute()
|
public NodeRef execute()
|
||||||
{
|
{
|
||||||
NodeRef wk2 = cociService.getWorkingCopy(finalNodeRef);
|
NodeRef wk2 = cociService.getWorkingCopy(finalNodeRef);
|
||||||
assertNotNull(wk2);
|
assertNotNull(wk2);
|
||||||
@@ -692,11 +692,9 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
|
|||||||
assertEquals(origNodeRef, orig2);
|
assertEquals(origNodeRef, orig2);
|
||||||
|
|
||||||
cociService.cancelCheckout(workingCopy);
|
cociService.cancelCheckout(workingCopy);
|
||||||
return null;
|
return cociService.getWorkingCopy(nodeRef);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
NodeRef wk3 = cociService.getWorkingCopy(this.nodeRef);
|
|
||||||
assertNull(wk3);
|
assertNull(wk3);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -730,21 +728,19 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
|
|||||||
|
|
||||||
final NodeRef finalNodeRef = origNodeRef;
|
final NodeRef finalNodeRef = origNodeRef;
|
||||||
|
|
||||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(
|
NodeRef wk3 = this.transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||||
new RetryingTransactionCallback<Object>()
|
new RetryingTransactionCallback<NodeRef>()
|
||||||
{
|
{
|
||||||
public Object execute()
|
public NodeRef execute()
|
||||||
{
|
{
|
||||||
NodeRef wk2 = cociService.getWorkingCopy(finalNodeRef);
|
NodeRef wk2 = cociService.getWorkingCopy(finalNodeRef);
|
||||||
assertNotNull(wk2);
|
assertNotNull(wk2);
|
||||||
assertEquals(workingCopy, wk2);
|
assertEquals(workingCopy, wk2);
|
||||||
|
|
||||||
cociService.cancelCheckout(workingCopy);
|
cociService.cancelCheckout(workingCopy);
|
||||||
return null;
|
return cociService.getWorkingCopy(nodeRef);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
NodeRef wk3 = cociService.getWorkingCopy(this.nodeRef);
|
|
||||||
assertNull(wk3);
|
assertNull(wk3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,8 +147,8 @@ public class LinksServiceImplTest
|
|||||||
assertNotNull(link.getNodeRef());
|
assertNotNull(link.getNodeRef());
|
||||||
assertNotNull(link.getSystemName());
|
assertNotNull(link.getSystemName());
|
||||||
|
|
||||||
NodeRef container = NODE_SERVICE.getPrimaryParent(link.getNodeRef()).getParentRef();
|
NodeRef container = PUBLIC_NODE_SERVICE.getPrimaryParent(link.getNodeRef()).getParentRef();
|
||||||
NodeRef site = NODE_SERVICE.getPrimaryParent(container).getParentRef();
|
NodeRef site = PUBLIC_NODE_SERVICE.getPrimaryParent(container).getParentRef();
|
||||||
assertEquals(LINKS_SITE.getNodeRef(), site);
|
assertEquals(LINKS_SITE.getNodeRef(), site);
|
||||||
|
|
||||||
|
|
||||||
@@ -199,11 +199,11 @@ public class LinksServiceImplTest
|
|||||||
|
|
||||||
|
|
||||||
// Check the underlying node
|
// Check the underlying node
|
||||||
assertEquals("Title", NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_TITLE));
|
assertEquals("Title", PUBLIC_NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_TITLE));
|
||||||
assertEquals("Description", NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_DESCRIPTION));
|
assertEquals("Description", PUBLIC_NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_DESCRIPTION));
|
||||||
assertEquals("http://www.alfresco.com/", NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_URL));
|
assertEquals("http://www.alfresco.com/", PUBLIC_NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_URL));
|
||||||
assertEquals("http://www.alfresco.com/", CONTENT_SERVICE.getReader(link.getNodeRef(), ContentModel.PROP_CONTENT).getContentString());
|
assertEquals("http://www.alfresco.com/", CONTENT_SERVICE.getReader(link.getNodeRef(), ContentModel.PROP_CONTENT).getContentString());
|
||||||
assertEquals(false, NODE_SERVICE.hasAspect(link.getNodeRef(), LinksModel.ASPECT_INTERNAL_LINK));
|
assertEquals(false, PUBLIC_NODE_SERVICE.hasAspect(link.getNodeRef(), LinksModel.ASPECT_INTERNAL_LINK));
|
||||||
|
|
||||||
|
|
||||||
// Change it
|
// Change it
|
||||||
@@ -225,11 +225,11 @@ public class LinksServiceImplTest
|
|||||||
|
|
||||||
|
|
||||||
// Check the underlying node now
|
// Check the underlying node now
|
||||||
assertEquals("New Title", NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_TITLE));
|
assertEquals("New Title", PUBLIC_NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_TITLE));
|
||||||
assertEquals("Description", NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_DESCRIPTION));
|
assertEquals("Description", PUBLIC_NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_DESCRIPTION));
|
||||||
assertEquals("http://share.alfresco.com/", NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_URL));
|
assertEquals("http://share.alfresco.com/", PUBLIC_NODE_SERVICE.getProperty(link.getNodeRef(), LinksModel.PROP_URL));
|
||||||
assertEquals("http://share.alfresco.com/", CONTENT_SERVICE.getReader(link.getNodeRef(), ContentModel.PROP_CONTENT).getContentString());
|
assertEquals("http://share.alfresco.com/", CONTENT_SERVICE.getReader(link.getNodeRef(), ContentModel.PROP_CONTENT).getContentString());
|
||||||
assertEquals(true, NODE_SERVICE.hasAspect(link.getNodeRef(), LinksModel.ASPECT_INTERNAL_LINK));
|
assertEquals(true, PUBLIC_NODE_SERVICE.hasAspect(link.getNodeRef(), LinksModel.ASPECT_INTERNAL_LINK));
|
||||||
|
|
||||||
|
|
||||||
// Delete it
|
// Delete it
|
||||||
|
|||||||
@@ -18,11 +18,13 @@ import java.util.concurrent.Future;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.cmr.lock.LockType;
|
import org.alfresco.service.cmr.lock.LockType;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.alfresco.util.ApplicationContextHelper;
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -33,6 +35,7 @@ import org.springframework.context.ApplicationContext;
|
|||||||
public class LockableAspectInterceptorTest
|
public class LockableAspectInterceptorTest
|
||||||
{
|
{
|
||||||
private static ApplicationContext appCtx;
|
private static ApplicationContext appCtx;
|
||||||
|
private TransactionService transactionService;
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
private NodeService rawNodeService;
|
private NodeService rawNodeService;
|
||||||
private LockStore lockStore;
|
private LockStore lockStore;
|
||||||
@@ -61,6 +64,7 @@ public class LockableAspectInterceptorTest
|
|||||||
// The 'current' user.
|
// The 'current' user.
|
||||||
userName = AuthenticationUtil.getAdminUserName();
|
userName = AuthenticationUtil.getAdminUserName();
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(userName);
|
AuthenticationUtil.setFullyAuthenticatedUser(userName);
|
||||||
|
transactionService = (TransactionService) appCtx.getBean("TransactionService");
|
||||||
nodeService = (NodeService) appCtx.getBean("NodeService");
|
nodeService = (NodeService) appCtx.getBean("NodeService");
|
||||||
rawNodeService = (NodeService) appCtx.getBean("dbNodeService");
|
rawNodeService = (NodeService) appCtx.getBean("dbNodeService");
|
||||||
lockStore = (LockStore) appCtx.getBean("lockStore");
|
lockStore = (LockStore) appCtx.getBean("lockStore");
|
||||||
@@ -202,7 +206,25 @@ public class LockableAspectInterceptorTest
|
|||||||
// Spoofed - wasn't explicitly added.
|
// Spoofed - wasn't explicitly added.
|
||||||
assertEquals(Lifetime.PERSISTENT, readProps.get(ContentModel.PROP_LOCK_LIFETIME));
|
assertEquals(Lifetime.PERSISTENT, readProps.get(ContentModel.PROP_LOCK_LIFETIME));
|
||||||
// Double check - not really present
|
// Double check - not really present
|
||||||
assertFalse(rawNodeService.getProperties(nodeRef).containsKey(ContentModel.PROP_LOCK_LIFETIME));
|
ensurePropertyNotPresent(nodeRef, ContentModel.PROP_LOCK_LIFETIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the raw NodeService to ensure that the given property is not present
|
||||||
|
*/
|
||||||
|
private void ensurePropertyNotPresent(final NodeRef nodeRef, final QName propQName)
|
||||||
|
{
|
||||||
|
RetryingTransactionCallback<Boolean> check = new RetryingTransactionCallback<Boolean>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Boolean execute() throws Throwable
|
||||||
|
{
|
||||||
|
return rawNodeService.getProperties(nodeRef).containsKey(propQName);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
assertFalse(
|
||||||
|
"Node should not have the " + propQName + " property present.",
|
||||||
|
transactionService.getRetryingTransactionHelper().doInTransaction(check));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -296,8 +318,8 @@ public class LockableAspectInterceptorTest
|
|||||||
assertEquals(now, nodeService.getProperty(nodeRef, ContentModel.PROP_EXPIRY_DATE));
|
assertEquals(now, nodeService.getProperty(nodeRef, ContentModel.PROP_EXPIRY_DATE));
|
||||||
// Spoofed property
|
// Spoofed property
|
||||||
assertEquals(Lifetime.PERSISTENT.toString(), nodeService.getProperty(nodeRef, ContentModel.PROP_LOCK_LIFETIME));
|
assertEquals(Lifetime.PERSISTENT.toString(), nodeService.getProperty(nodeRef, ContentModel.PROP_LOCK_LIFETIME));
|
||||||
// Double check, not really present
|
// Double check - not really present
|
||||||
assertNull(rawNodeService.getProperty(nodeRef, ContentModel.PROP_LOCK_LIFETIME));
|
ensurePropertyNotPresent(nodeRef, ContentModel.PROP_LOCK_LIFETIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -365,7 +387,7 @@ public class LockableAspectInterceptorTest
|
|||||||
nodeName,
|
nodeName,
|
||||||
ContentModel.TYPE_BASE).getChildRef();
|
ContentModel.TYPE_BASE).getChildRef();
|
||||||
|
|
||||||
Map<QName, Serializable> properties = rawNodeService.getProperties(nodeRef);
|
Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
|
||||||
|
|
||||||
// With the exception of cm:lockLifetime, lock properties should be unaffected after setProperties()
|
// With the exception of cm:lockLifetime, lock properties should be unaffected after setProperties()
|
||||||
properties.put(ContentModel.PROP_AUTHOR, "Joe Bloggs");
|
properties.put(ContentModel.PROP_AUTHOR, "Joe Bloggs");
|
||||||
@@ -380,7 +402,7 @@ public class LockableAspectInterceptorTest
|
|||||||
nodeService.setProperties(nodeRef, properties);
|
nodeService.setProperties(nodeRef, properties);
|
||||||
|
|
||||||
// Check the persisted properties
|
// Check the persisted properties
|
||||||
properties = rawNodeService.getProperties(nodeRef);
|
properties = nodeService.getProperties(nodeRef);
|
||||||
assertEquals("Joe Bloggs", properties.get(ContentModel.PROP_AUTHOR));
|
assertEquals("Joe Bloggs", properties.get(ContentModel.PROP_AUTHOR));
|
||||||
assertEquals("A Name", properties.get(ContentModel.PROP_NAME));
|
assertEquals("A Name", properties.get(ContentModel.PROP_NAME));
|
||||||
assertEquals(LockType.NODE_LOCK.toString(), properties.get(ContentModel.PROP_LOCK_TYPE));
|
assertEquals(LockType.NODE_LOCK.toString(), properties.get(ContentModel.PROP_LOCK_TYPE));
|
||||||
@@ -388,7 +410,7 @@ public class LockableAspectInterceptorTest
|
|||||||
assertEquals(expiryDate, properties.get(ContentModel.PROP_EXPIRY_DATE));
|
assertEquals(expiryDate, properties.get(ContentModel.PROP_EXPIRY_DATE));
|
||||||
|
|
||||||
// cm:lockLifetime is not persisted.
|
// cm:lockLifetime is not persisted.
|
||||||
assertFalse(properties.containsKey(ContentModel.PROP_LOCK_LIFETIME));
|
ensurePropertyNotPresent(nodeRef, ContentModel.PROP_LOCK_LIFETIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -401,7 +423,7 @@ public class LockableAspectInterceptorTest
|
|||||||
nodeName,
|
nodeName,
|
||||||
ContentModel.TYPE_BASE).getChildRef();
|
ContentModel.TYPE_BASE).getChildRef();
|
||||||
|
|
||||||
Map<QName, Serializable> properties = rawNodeService.getProperties(nodeRef);
|
Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
|
||||||
// Non-lock properties should be unaffected after setProperties()
|
// Non-lock properties should be unaffected after setProperties()
|
||||||
properties.put(ContentModel.PROP_AUTHOR, "Joe Bloggs");
|
properties.put(ContentModel.PROP_AUTHOR, "Joe Bloggs");
|
||||||
properties.put(ContentModel.PROP_NAME, "A Name");
|
properties.put(ContentModel.PROP_NAME, "A Name");
|
||||||
@@ -416,7 +438,7 @@ public class LockableAspectInterceptorTest
|
|||||||
nodeService.setProperties(nodeRef, properties);
|
nodeService.setProperties(nodeRef, properties);
|
||||||
|
|
||||||
// Check the persisted properties
|
// Check the persisted properties
|
||||||
properties = rawNodeService.getProperties(nodeRef);
|
properties = nodeService.getProperties(nodeRef);
|
||||||
assertEquals("Joe Bloggs", properties.get(ContentModel.PROP_AUTHOR));
|
assertEquals("Joe Bloggs", properties.get(ContentModel.PROP_AUTHOR));
|
||||||
assertEquals("A Name", properties.get(ContentModel.PROP_NAME));
|
assertEquals("A Name", properties.get(ContentModel.PROP_NAME));
|
||||||
// Check the filtered properties
|
// Check the filtered properties
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.transaction.UserTransaction;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.cache.SimpleCache;
|
import org.alfresco.repo.cache.SimpleCache;
|
||||||
import org.alfresco.repo.domain.node.NodeDAO;
|
import org.alfresco.repo.domain.node.NodeDAO;
|
||||||
@@ -170,8 +172,8 @@ public class TransactionCleanupTest
|
|||||||
// run the transaction cleaner to clean up any existing unused transactions
|
// run the transaction cleaner to clean up any existing unused transactions
|
||||||
worker.doClean();
|
worker.doClean();
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
Long minTxnId = nodeDAO.getMinTxnId();
|
final Long minTxnId = nodeDAO.getMinTxnId();
|
||||||
|
|
||||||
final Map<NodeRef, List<String>> txnIds = createTransactions();
|
final Map<NodeRef, List<String>> txnIds = createTransactions();
|
||||||
final List<String> txnIds1 = txnIds.get(nodeRef1);
|
final List<String> txnIds1 = txnIds.get(nodeRef1);
|
||||||
@@ -182,8 +184,17 @@ public class TransactionCleanupTest
|
|||||||
|
|
||||||
// Double-check that n4 and n5 are present in deleted form
|
// Double-check that n4 and n5 are present in deleted form
|
||||||
nodesCache.clear();
|
nodesCache.clear();
|
||||||
|
UserTransaction txn = transactionService.getUserTransaction(true);
|
||||||
|
txn.begin();
|
||||||
|
try
|
||||||
|
{
|
||||||
assertNotNull("Node 4 is deleted but not purged", nodeDAO.getNodeRefStatus(nodeRef4));
|
assertNotNull("Node 4 is deleted but not purged", nodeDAO.getNodeRefStatus(nodeRef4));
|
||||||
assertNotNull("Node 5 is deleted but not purged", nodeDAO.getNodeRefStatus(nodeRef5));
|
assertNotNull("Node 5 is deleted but not purged", nodeDAO.getNodeRefStatus(nodeRef5));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
txn.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
// run the transaction cleaner
|
// run the transaction cleaner
|
||||||
worker.setPurgeSize(5); // small purge size
|
worker.setPurgeSize(5); // small purge size
|
||||||
@@ -194,7 +205,15 @@ public class TransactionCleanupTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get transactions committed after the test started
|
// Get transactions committed after the test started
|
||||||
List<Transaction> txns = nodeDAO.getTxnsByCommitTimeAscending(Long.valueOf(start), Long.valueOf(Long.MAX_VALUE), Integer.MAX_VALUE, null, false);
|
RetryingTransactionCallback<List<Transaction>> getTxnsCallback = new RetryingTransactionCallback<List<Transaction>>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public List<Transaction> execute() throws Throwable
|
||||||
|
{
|
||||||
|
return nodeDAO.getTxnsByCommitTimeAscending(Long.valueOf(start), Long.valueOf(Long.MAX_VALUE), Integer.MAX_VALUE, null, false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
List<Transaction> txns = transactionService.getRetryingTransactionHelper().doInTransaction(getTxnsCallback, true, false);
|
||||||
|
|
||||||
List<String> expectedUnusedTxnIds = new ArrayList<String>(10);
|
List<String> expectedUnusedTxnIds = new ArrayList<String>(10);
|
||||||
expectedUnusedTxnIds.addAll(txnIds1.subList(0, txnIds1.size() - 1));
|
expectedUnusedTxnIds.addAll(txnIds1.subList(0, txnIds1.size() - 1));
|
||||||
@@ -233,7 +252,16 @@ public class TransactionCleanupTest
|
|||||||
|
|
||||||
assertEquals(3, numFoundUsedTxnIds);
|
assertEquals(3, numFoundUsedTxnIds);
|
||||||
|
|
||||||
List<Long> txnsUnused = nodeDAO.getTxnsUnused(minTxnId, Long.MAX_VALUE, Integer.MAX_VALUE);
|
// Get transactions committed after the test started
|
||||||
|
RetryingTransactionCallback<List<Long>> getTxnsUnusedCallback = new RetryingTransactionCallback<List<Long>>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public List<Long> execute() throws Throwable
|
||||||
|
{
|
||||||
|
return nodeDAO.getTxnsUnused(minTxnId, Long.MAX_VALUE, Integer.MAX_VALUE);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
List<Long> txnsUnused = transactionService.getRetryingTransactionHelper().doInTransaction(getTxnsUnusedCallback, true, false);
|
||||||
assertEquals(0, txnsUnused.size());
|
assertEquals(0, txnsUnused.size());
|
||||||
|
|
||||||
// Double-check that n4 and n5 were removed as well
|
// Double-check that n4 and n5 were removed as well
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import org.alfresco.repo.node.getchildren.FilterPropString.FilterTypeString;
|
|||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityBean;
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityBean;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.rating.RatingScheme;
|
import org.alfresco.service.cmr.rating.RatingScheme;
|
||||||
import org.alfresco.service.cmr.rating.RatingService;
|
import org.alfresco.service.cmr.rating.RatingService;
|
||||||
@@ -72,6 +73,7 @@ import org.alfresco.service.cmr.security.PermissionService;
|
|||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||||
import org.alfresco.util.ApplicationContextHelper;
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
@@ -97,6 +99,7 @@ public class GetChildrenCannedQueryTest extends TestCase
|
|||||||
|
|
||||||
private Repository repositoryHelper;
|
private Repository repositoryHelper;
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
private TransactionService transactionService;
|
||||||
private DictionaryService dictionaryService;
|
private DictionaryService dictionaryService;
|
||||||
private ContentService contentService;
|
private ContentService contentService;
|
||||||
private MimetypeService mimetypeService;
|
private MimetypeService mimetypeService;
|
||||||
@@ -145,6 +148,7 @@ public class GetChildrenCannedQueryTest extends TestCase
|
|||||||
repositoryHelper = (Repository)ctx.getBean("repositoryHelper");
|
repositoryHelper = (Repository)ctx.getBean("repositoryHelper");
|
||||||
|
|
||||||
nodeService = (NodeService)ctx.getBean("NodeService");
|
nodeService = (NodeService)ctx.getBean("NodeService");
|
||||||
|
transactionService = (TransactionService)ctx.getBean("TransactionService");
|
||||||
contentService = (ContentService)ctx.getBean("ContentService");
|
contentService = (ContentService)ctx.getBean("ContentService");
|
||||||
mimetypeService = (MimetypeService)ctx.getBean("MimetypeService");
|
mimetypeService = (MimetypeService)ctx.getBean("MimetypeService");
|
||||||
dictionaryService = (DictionaryService)ctx.getBean("DictionaryService");
|
dictionaryService = (DictionaryService)ctx.getBean("DictionaryService");
|
||||||
@@ -818,6 +822,7 @@ public class GetChildrenCannedQueryTest extends TestCase
|
|||||||
assertEquals(2, children.size());
|
assertEquals(2, children.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public void testAspectFiltering() throws Exception
|
public void testAspectFiltering() throws Exception
|
||||||
{
|
{
|
||||||
NodeRef parentNodeRef = repositoryHelper.getCompanyHome();
|
NodeRef parentNodeRef = repositoryHelper.getCompanyHome();
|
||||||
@@ -898,10 +903,18 @@ public class GetChildrenCannedQueryTest extends TestCase
|
|||||||
|
|
||||||
// get canned query
|
// get canned query
|
||||||
GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CQ_FACTORY_NAME);
|
GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CQ_FACTORY_NAME);
|
||||||
GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(parentNodeRef, pattern, null, null, null, null, null, sortProps, pagingRequest);
|
final GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(parentNodeRef, pattern, null, null, null, null, null, sortProps, pagingRequest);
|
||||||
|
|
||||||
// execute canned query
|
// execute canned query
|
||||||
CannedQueryResults<NodeRef> results = cq.execute();
|
RetryingTransactionCallback<CannedQueryResults<NodeRef>> callback = new RetryingTransactionCallback<CannedQueryResults<NodeRef>>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public CannedQueryResults<NodeRef> execute() throws Throwable
|
||||||
|
{
|
||||||
|
return cq.execute();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
CannedQueryResults<NodeRef> results = transactionService.getRetryingTransactionHelper().doInTransaction(callback, true);
|
||||||
|
|
||||||
List<NodeRef> nodeRefs = results.getPages().get(0);
|
List<NodeRef> nodeRefs = results.getPages().get(0);
|
||||||
|
|
||||||
@@ -1182,10 +1195,18 @@ public class GetChildrenCannedQueryTest extends TestCase
|
|||||||
|
|
||||||
// get canned query (note: test the fileFolder extension - including support for sorting folders first)
|
// get canned query (note: test the fileFolder extension - including support for sorting folders first)
|
||||||
GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CQ_FACTORY_NAME);
|
GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CQ_FACTORY_NAME);
|
||||||
GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(parentNodeRef, null, null, childTypeQNames, null, null, filterProps, sortProps, pagingRequest);
|
final GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(parentNodeRef, null, null, childTypeQNames, null, null, filterProps, sortProps, pagingRequest);
|
||||||
|
|
||||||
// execute canned query
|
// execute canned query
|
||||||
CannedQueryResults<NodeRef> results = cq.execute();
|
RetryingTransactionCallback<CannedQueryResults<NodeRef>> callback = new RetryingTransactionCallback<CannedQueryResults<NodeRef>>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public CannedQueryResults<NodeRef> execute() throws Throwable
|
||||||
|
{
|
||||||
|
return cq.execute();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
CannedQueryResults<NodeRef> results = transactionService.getRetryingTransactionHelper().doInTransaction(callback, true);
|
||||||
|
|
||||||
List<NodeRef> nodeRefs = results.getPages().get(0);
|
List<NodeRef> nodeRefs = results.getPages().get(0);
|
||||||
|
|
||||||
@@ -1206,10 +1227,18 @@ public class GetChildrenCannedQueryTest extends TestCase
|
|||||||
|
|
||||||
// get canned query
|
// get canned query
|
||||||
GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CQ_FACTORY_NAME);
|
GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CQ_FACTORY_NAME);
|
||||||
GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(parentNodeRef, null, assocTypeQNames, childTypeQNames, inclusiveAspects, exclusiveAspects, filterProps, sortProps, pagingRequest);
|
final GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(parentNodeRef, null, assocTypeQNames, childTypeQNames, inclusiveAspects, exclusiveAspects, filterProps, sortProps, pagingRequest);
|
||||||
|
|
||||||
// execute canned query
|
// execute canned query
|
||||||
CannedQueryResults<NodeRef> results = cq.execute();
|
RetryingTransactionCallback<CannedQueryResults<NodeRef>> callback = new RetryingTransactionCallback<CannedQueryResults<NodeRef>>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public CannedQueryResults<NodeRef> execute() throws Throwable
|
||||||
|
{
|
||||||
|
return cq.execute();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
CannedQueryResults<NodeRef> results = transactionService.getRetryingTransactionHelper().doInTransaction(callback, true);
|
||||||
|
|
||||||
List<NodeRef> nodeRefs = results.getPages().get(0);
|
List<NodeRef> nodeRefs = results.getPages().get(0);
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ public class RatingServiceIntegrationTest
|
|||||||
private static NodeRef COPY_DEST_FOLDER;
|
private static NodeRef COPY_DEST_FOLDER;
|
||||||
private static NodeRef TEST_FOLDER;
|
private static NodeRef TEST_FOLDER;
|
||||||
private NodeRef testDoc_Admin;
|
private NodeRef testDoc_Admin;
|
||||||
private NodeRef testDoc_Copy;
|
|
||||||
private NodeRef testDoc_UserOne;
|
private NodeRef testDoc_UserOne;
|
||||||
private NodeRef testDoc_UserTwo;
|
private NodeRef testDoc_UserTwo;
|
||||||
|
|
||||||
@@ -188,11 +187,19 @@ public class RatingServiceIntegrationTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyIllegalRating(NodeRef nodeRef, float illegalRating, String schemeName)
|
private void applyIllegalRating(final NodeRef nodeRef, final float illegalRating, final String schemeName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void execute() throws Throwable
|
||||||
{
|
{
|
||||||
RATING_SERVICE.applyRating(nodeRef, illegalRating, schemeName);
|
RATING_SERVICE.applyRating(nodeRef, illegalRating, schemeName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (RatingServiceException expectedException)
|
catch (RatingServiceException expectedException)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
jobLockService = (JobLockService) ctx.getBean("jobLockService");
|
jobLockService = (JobLockService) ctx.getBean("jobLockService");
|
||||||
actionService = (ActionService) ctx.getBean("actionService");
|
actionService = (ActionService) ctx.getBean("actionService");
|
||||||
scriptService = (ScriptService)ctx.getBean("scriptService");
|
scriptService = (ScriptService)ctx.getBean("scriptService");
|
||||||
nodeService = (NodeService) ctx.getBean("nodeService");
|
nodeService = (NodeService) ctx.getBean("NodeService");
|
||||||
lockService = (LockService) ctx.getBean("lockService");
|
lockService = (LockService) ctx.getBean("lockService");
|
||||||
repositoryHelper = (Repository) ctx.getBean("repositoryHelper");
|
repositoryHelper = (Repository) ctx.getBean("repositoryHelper");
|
||||||
actionTrackingService = (ActionTrackingService) ctx.getBean("actionTrackingService");
|
actionTrackingService = (ActionTrackingService) ctx.getBean("actionTrackingService");
|
||||||
|
|||||||
@@ -1460,7 +1460,15 @@ public class PersonTest extends TestCase
|
|||||||
testTX.rollback();
|
testTX.rollback();
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
|
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void execute() throws Throwable
|
||||||
|
{
|
||||||
personService.deletePerson(TEST_PERSON);
|
personService.deletePerson(TEST_PERSON);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDisableEnablePerson()
|
public void testDisableEnablePerson()
|
||||||
|
|||||||
Reference in New Issue
Block a user