ALF-11546 Tracking queries on alf_transaction table do not have an upper bound

- Part 2 - refactor API + collateral damage
- Fix tracking tests to cope with the presence of background transactions - should fix Oracle build and other intermittent build failures

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32824 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2011-12-16 19:35:21 +00:00
parent 925ba4d00d
commit e564eda697
3 changed files with 12 additions and 4 deletions

View File

@@ -50,13 +50,17 @@ public class AclChangeSetsGet extends DeclarativeWebScript
{
String fromIdParam = req.getParameter("fromId");
String fromTimeParam = req.getParameter("fromTime");
String toIdParam = req.getParameter("toId");
String toTimeParam = req.getParameter("toTime");
String maxResultsParam = req.getParameter("maxResults");
Long fromId = (fromIdParam == null ? null : Long.valueOf(fromIdParam));
Long fromTime = (fromTimeParam == null ? null : Long.valueOf(fromTimeParam));
Long toId = (toIdParam == null ? null : Long.valueOf(toIdParam));
Long toTime = (toTimeParam == null ? null : Long.valueOf(toTimeParam));
int maxResults = (maxResultsParam == null ? 1024 : Integer.valueOf(maxResultsParam));
List<AclChangeSet> changesets = solrTrackingComponent.getAclChangeSets(fromId, fromTime, maxResults);
List<AclChangeSet> changesets = solrTrackingComponent.getAclChangeSets(fromId, fromTime, toId, toTime, maxResults);
Map<String, Object> model = new HashMap<String, Object>(1, 1.0f);
model.put("aclChangeSets", changesets);

View File

@@ -158,7 +158,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
public void testAclsGet() throws Exception
{
List<AclChangeSet> aclChangeSets = solrTrackingComponent.getAclChangeSets(null, null, 100);
List<AclChangeSet> aclChangeSets = solrTrackingComponent.getAclChangeSets(null, null, null, null, 100);
if (aclChangeSets.size() == 0)
{
return; // Can't test, but very unlikely
@@ -202,7 +202,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
public void testAclReadersGet() throws Exception
{
List<AclChangeSet> aclChangeSets = solrTrackingComponent.getAclChangeSets(null, null, 1024);
List<AclChangeSet> aclChangeSets = solrTrackingComponent.getAclChangeSets(null, null, null, null, 1024);
List<Long> aclChangeSetIds = new ArrayList<Long>(50);
for (AclChangeSet aclChangeSet : aclChangeSets)
{

View File

@@ -50,13 +50,17 @@ public class TransactionsGet extends DeclarativeWebScript
{
String minTxnIdParam = req.getParameter("minTxnId");
String fromCommitTimeParam = req.getParameter("fromCommitTime");
String maxTxnIdParam = req.getParameter("maxTxnId");
String toCommitTimeParam = req.getParameter("toCommitTime");
String maxResultsParam = req.getParameter("maxResults");
Long minTxnId = (minTxnIdParam == null ? null : Long.valueOf(minTxnIdParam));
Long fromCommitTime = (fromCommitTimeParam == null ? null : Long.valueOf(fromCommitTimeParam));
Long maxTxnId = (maxTxnIdParam == null ? null : Long.valueOf(maxTxnIdParam));
Long toCommitTime = (toCommitTimeParam == null ? null : Long.valueOf(toCommitTimeParam));
int maxResults = (maxResultsParam == null ? 1024 : Integer.valueOf(maxResultsParam));
List<Transaction> transactions = solrTrackingComponent.getTransactions(minTxnId, fromCommitTime, maxResults);
List<Transaction> transactions = solrTrackingComponent.getTransactions(minTxnId, fromCommitTime, maxTxnId, toCommitTime, maxResults);
Map<String, Object> model = new HashMap<String, Object>(1, 1.0f);
model.put("transactions", transactions);