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 aac8f44c59
commit d7f79daba2
8 changed files with 367 additions and 244 deletions

View File

@@ -52,6 +52,12 @@
<if test="fromIdInclusive != null"> <if test="fromIdInclusive != null">
<![CDATA[and acs.id >= #{fromIdInclusive}]]> <![CDATA[and acs.id >= #{fromIdInclusive}]]>
</if> </if>
<if test="toCommitTimeExclusive != null">
<![CDATA[acs.commit_time_ms < #{toCommitTimeExclusive}]]>
</if>
<if test="toIdExclusive != null">
<![CDATA[and acs.id < #{toIdExclusive}]]>
</if>
</where> </where>
order by acs.commit_time_ms ASC, acs.id ASC order by acs.commit_time_ms ASC, acs.id ASC
</select> </select>
@@ -106,6 +112,12 @@
<if test="fromIdInclusive != null"> <if test="fromIdInclusive != null">
<![CDATA[and txn.id >= #{fromIdInclusive}]]> <![CDATA[and txn.id >= #{fromIdInclusive}]]>
</if> </if>
<if test="toCommitTimeExclusive != null">
<![CDATA[txn.commit_time_ms < #{toCommitTimeExclusive}]]>
</if>
<if test="toIdExclusive != null">
<![CDATA[and txn.id < #{toIdExclusive}]]>
</if>
</where> </where>
order by txn.commit_time_ms ASC, txn.id ASC order by txn.commit_time_ms ASC, txn.id ASC
</select> </select>

View File

@@ -38,10 +38,12 @@ public interface SOLRDAO
* *
* @param minAclChangeSetId minimum ACL changeset ID - (inclusive and optional) * @param minAclChangeSetId minimum ACL changeset ID - (inclusive and optional)
* @param fromCommitTime minimum ACL commit time - (inclusive and optional) * @param fromCommitTime minimum ACL commit time - (inclusive and optional)
* @param maxAclChangeSetId maximum ACL changeset ID - (exclusive and optional)
* @param toCommitTime maximum ACL commit time - (exclusive and optional)
* @param maxResults limit the results (must be greater than zero and less than MAX) * @param maxResults limit the results (must be greater than zero and less than MAX)
* @return list of ACL changesets (no details) * @return list of ACL changesets (no details)
*/ */
public List<AclChangeSet> getAclChangeSets(Long minAclChangeSetId, Long fromCommitTime, int maxResults); public List<AclChangeSet> getAclChangeSets(Long minAclChangeSetId, Long fromCommitTime, Long maxAclChangeSetId, Long toCommitTime, int maxResults);
/** /**
* Get the ACLs (no rollup count) for the given ACL ChangeSets * Get the ACLs (no rollup count) for the given ACL ChangeSets
@@ -58,10 +60,12 @@ public interface SOLRDAO
* *
* @param minTxnId greater than or equal to minTxnId * @param minTxnId greater than or equal to minTxnId
* @param fromCommitTime greater than or equal to transaction commit time * @param fromCommitTime greater than or equal to transaction commit time
* @param maxTxnId less than maxTxnId
* @param toCommitTime less than toCommitTime
* @param maxResults limit the results. 0 or Integer.MAX_VALUE does not limit the results * @param maxResults limit the results. 0 or Integer.MAX_VALUE does not limit the results
* @return list of transactions * @return list of transactions
*/ */
public List<Transaction> getTransactions(Long minTxnId, Long fromCommitTime, int maxResults); public List<Transaction> getTransactions(Long minTxnId, Long fromCommitTime, Long maxTxnId, Long toCommitTime, int maxResults);
/** /**
* Get the nodes satisfying the constraints in nodeParameters * Get the nodes satisfying the constraints in nodeParameters

View File

@@ -64,7 +64,7 @@ public class SOLRDAOTest extends TestCase
try try
{ {
solrDAO.getAclChangeSets(null, startTime, 0); solrDAO.getAclChangeSets(null, startTime, null, null, 0);
fail("Must have result limit"); fail("Must have result limit");
} }
catch (IllegalArgumentException e) catch (IllegalArgumentException e)
@@ -76,13 +76,13 @@ public class SOLRDAOTest extends TestCase
public void testQueryChangeSets_Time() public void testQueryChangeSets_Time()
{ {
long startTime = System.currentTimeMillis() + (5 * 60000L); // The future long startTime = System.currentTimeMillis() + (5 * 60000L); // The future
List<AclChangeSet> results = solrDAO.getAclChangeSets(null, startTime, 50); List<AclChangeSet> results = solrDAO.getAclChangeSets(null, startTime, null, null, 50);
assertTrue("ChangeSet count not limited", results.size() == 0); assertTrue("ChangeSet count not limited", results.size() == 0);
} }
public void testQueryChangeSets_Limit() public void testQueryChangeSets_Limit()
{ {
List<AclChangeSet> results = solrDAO.getAclChangeSets(null, 0L, 50); List<AclChangeSet> results = solrDAO.getAclChangeSets(null, 0L, null, null, 50);
assertTrue("Transaction count not limited", results.size() <= 50); assertTrue("Transaction count not limited", results.size() <= 50);
} }
@@ -116,7 +116,7 @@ public class SOLRDAOTest extends TestCase
public void testQueryAcls_All() public void testQueryAcls_All()
{ {
// Do a query for some changesets // Do a query for some changesets
List<AclChangeSet> aclChangeSets = solrDAO.getAclChangeSets(null, 0L, 50); List<AclChangeSet> aclChangeSets = solrDAO.getAclChangeSets(null, 0L, null, null, 50);
// Choose some changesets with changes // Choose some changesets with changes
int aclTotal = 0; int aclTotal = 0;
@@ -155,7 +155,7 @@ public class SOLRDAOTest extends TestCase
public void testQueryAcls_Single() public void testQueryAcls_Single()
{ {
List<AclChangeSet> aclChangeSets = solrDAO.getAclChangeSets(null, 0L, 1000); List<AclChangeSet> aclChangeSets = solrDAO.getAclChangeSets(null, 0L, null, null, 1000);
// Find one with multiple ALCs // Find one with multiple ALCs
AclChangeSet aclChangeSet = null; AclChangeSet aclChangeSet = null;
for (AclChangeSet aclChangeSetLoop : aclChangeSets) for (AclChangeSet aclChangeSetLoop : aclChangeSets)
@@ -208,7 +208,7 @@ public class SOLRDAOTest extends TestCase
try try
{ {
solrDAO.getTransactions(null, startTime, 0); solrDAO.getTransactions(null, startTime, null, null, 0);
fail("Must have result limit"); fail("Must have result limit");
} }
catch (IllegalArgumentException e) catch (IllegalArgumentException e)
@@ -220,13 +220,13 @@ public class SOLRDAOTest extends TestCase
public void testQueryTransactions_Time() public void testQueryTransactions_Time()
{ {
long startTime = System.currentTimeMillis() + (5 * 60000L); // The future long startTime = System.currentTimeMillis() + (5 * 60000L); // The future
List<Transaction> results = solrDAO.getTransactions(null, startTime, 50); List<Transaction> results = solrDAO.getTransactions(null, startTime, null, null, 50);
assertTrue("Transaction count not limited", results.size() == 0); assertTrue("Transaction count not limited", results.size() == 0);
} }
public void testQueryTransactions_Limit() public void testQueryTransactions_Limit()
{ {
List<Transaction> results = solrDAO.getTransactions(null, 0L, 50); List<Transaction> results = solrDAO.getTransactions(null, 0L, null, null, 50);
assertTrue("Transaction count not limited", results.size() <= 50); assertTrue("Transaction count not limited", results.size() <= 50);
} }
@@ -234,7 +234,7 @@ public class SOLRDAOTest extends TestCase
{ {
long startTime = 0L; long startTime = 0L;
List<Transaction> txns = solrDAO.getTransactions(null, startTime, 500); List<Transaction> txns = solrDAO.getTransactions(null, startTime, null, null, 500);
List<Long> txnIds = toTxnIds(txns); List<Long> txnIds = toTxnIds(txns);
@@ -249,7 +249,7 @@ public class SOLRDAOTest extends TestCase
public void testGetNodesForStore() public void testGetNodesForStore()
{ {
List<Transaction> txns = solrDAO.getTransactions(null, null, 500); List<Transaction> txns = solrDAO.getTransactions(null, null, null, null, 500);
List<Long> txnIds = toTxnIds(txns); List<Long> txnIds = toTxnIds(txns);
@@ -262,7 +262,7 @@ public class SOLRDAOTest extends TestCase
public void testGetNodesForTxnRange() public void testGetNodesForTxnRange()
{ {
List<Transaction> txns = solrDAO.getTransactions(null, null, 500); List<Transaction> txns = solrDAO.getTransactions(null, null, null, null, 500);
List<Long> txnIds = toTxnIds(txns); List<Long> txnIds = toTxnIds(txns);

View File

@@ -31,8 +31,9 @@ public class SOLRTrackingParameters
private Long fromIdInclusive; private Long fromIdInclusive;
private Long fromCommitTimeInclusive; private Long fromCommitTimeInclusive;
private List<Long> ids; private List<Long> ids;
private Long fromRelatedIdInclusive; private Long toIdExclusive;
private Long toRelatedIdExclusive; private Long toCommitTimeExclusive;
private boolean trueOrFalse; private boolean trueOrFalse;
public Long getFromIdInclusive() public Long getFromIdInclusive()
@@ -65,26 +66,6 @@ public class SOLRTrackingParameters
this.ids = ids; this.ids = ids;
} }
public Long getFromRelatedIdInclusive()
{
return fromRelatedIdInclusive;
}
public void setFromRelatedIdInclusive(Long fromRelatedIdInclusive)
{
this.fromRelatedIdInclusive = fromRelatedIdInclusive;
}
public Long getToRelatedIdExclusive()
{
return toRelatedIdExclusive;
}
public void setToRelatedIdExclusive(Long toRelatedIdExclusive)
{
this.toRelatedIdExclusive = toRelatedIdExclusive;
}
/** /**
* Helper for cross-DB boolean support * Helper for cross-DB boolean support
* *
@@ -121,17 +102,97 @@ public class SOLRTrackingParameters
this.trueOrFalse = trueOrFalse; this.trueOrFalse = trueOrFalse;
} }
public Long getToIdExclusive()
{
return toIdExclusive;
}
public void setToIdExclusive(Long toIdExclusive)
{
this.toIdExclusive = toIdExclusive;
}
public Long getToCommitTimeExclusive()
{
return toCommitTimeExclusive;
}
public void setToCommitTimeExclusive(Long toCommitTimeExclusive)
{
this.toCommitTimeExclusive = toCommitTimeExclusive;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((fromCommitTimeInclusive == null) ? 0 : fromCommitTimeInclusive.hashCode());
result = prime * result + ((fromIdInclusive == null) ? 0 : fromIdInclusive.hashCode());
result = prime * result + ((ids == null) ? 0 : ids.hashCode());
result = prime * result + ((toCommitTimeExclusive == null) ? 0 : toCommitTimeExclusive.hashCode());
result = prime * result + ((toIdExclusive == null) ? 0 : toIdExclusive.hashCode());
result = prime * result + (trueOrFalse ? 1231 : 1237);
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SOLRTrackingParameters other = (SOLRTrackingParameters) obj;
if (fromCommitTimeInclusive == null)
{
if (other.fromCommitTimeInclusive != null)
return false;
}
else if (!fromCommitTimeInclusive.equals(other.fromCommitTimeInclusive))
return false;
if (fromIdInclusive == null)
{
if (other.fromIdInclusive != null)
return false;
}
else if (!fromIdInclusive.equals(other.fromIdInclusive))
return false;
if (ids == null)
{
if (other.ids != null)
return false;
}
else if (!ids.equals(other.ids))
return false;
if (toCommitTimeExclusive == null)
{
if (other.toCommitTimeExclusive != null)
return false;
}
else if (!toCommitTimeExclusive.equals(other.toCommitTimeExclusive))
return false;
if (toIdExclusive == null)
{
if (other.toIdExclusive != null)
return false;
}
else if (!toIdExclusive.equals(other.toIdExclusive))
return false;
if (trueOrFalse != other.trueOrFalse)
return false;
return true;
}
@Override @Override
public String toString() public String toString()
{ {
StringBuilder sb = new StringBuilder(512); return "SOLRTrackingParameters [fromIdInclusive="
sb.append("SOLRTrackingParameters") + fromIdInclusive + ", fromCommitTimeInclusive=" + fromCommitTimeInclusive + ", ids=" + ids + ", toIdExclusive=" + toIdExclusive + ", toCommitTimeExclusive="
.append(", fromIdInclusive").append(fromIdInclusive) + toCommitTimeExclusive + ", trueOrFalse=" + trueOrFalse + "]";
.append(", ids").append(ids == null ? null : ids.size())
.append(", fromCommitTimeInclusive").append(fromCommitTimeInclusive == null ? null : new Date(fromCommitTimeInclusive))
.append(", fromRelatedIdInclusive=").append(fromRelatedIdInclusive)
.append(", toRelatedIdExclusive").append(toRelatedIdExclusive)
.append("]");
return sb.toString();
} }
} }

View File

@@ -72,7 +72,7 @@ public class SOLRDAOImpl implements SOLRDAO
*/ */
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<AclChangeSet> getAclChangeSets(Long minAclChangeSetId, Long fromCommitTime, int maxResults) public List<AclChangeSet> getAclChangeSets(Long minAclChangeSetId, Long fromCommitTime, Long maxAclChangeSetId, Long toCommitTime, int maxResults)
{ {
if (maxResults <= 0 || maxResults == Integer.MAX_VALUE) if (maxResults <= 0 || maxResults == Integer.MAX_VALUE)
{ {
@@ -82,6 +82,8 @@ public class SOLRDAOImpl implements SOLRDAO
SOLRTrackingParameters params = new SOLRTrackingParameters(); SOLRTrackingParameters params = new SOLRTrackingParameters();
params.setFromIdInclusive(minAclChangeSetId); params.setFromIdInclusive(minAclChangeSetId);
params.setFromCommitTimeInclusive(fromCommitTime); params.setFromCommitTimeInclusive(fromCommitTime);
params.setToIdExclusive(maxAclChangeSetId);
params.setToCommitTimeExclusive(toCommitTime);
return (List<AclChangeSet>) template.selectList(SELECT_CHANGESETS_SUMMARY, params, new RowBounds(0, maxResults)); return (List<AclChangeSet>) template.selectList(SELECT_CHANGESETS_SUMMARY, params, new RowBounds(0, maxResults));
} }
@@ -118,7 +120,7 @@ public class SOLRDAOImpl implements SOLRDAO
*/ */
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<Transaction> getTransactions(Long minTxnId, Long fromCommitTime, int maxResults) public List<Transaction> getTransactions(Long minTxnId, Long fromCommitTime, Long maxTxnId, Long toCommitTime, int maxResults)
{ {
if (maxResults <= 0 || maxResults == Integer.MAX_VALUE) if (maxResults <= 0 || maxResults == Integer.MAX_VALUE)
{ {
@@ -128,6 +130,8 @@ public class SOLRDAOImpl implements SOLRDAO
SOLRTrackingParameters params = new SOLRTrackingParameters(); SOLRTrackingParameters params = new SOLRTrackingParameters();
params.setFromIdInclusive(minTxnId); params.setFromIdInclusive(minTxnId);
params.setFromCommitTimeInclusive(fromCommitTime); params.setFromCommitTimeInclusive(fromCommitTime);
params.setToIdExclusive(maxTxnId);
params.setToCommitTimeExclusive(toCommitTime);
return (List<Transaction>) template.selectList(SELECT_TRANSACTIONS, params, new RowBounds(0, maxResults)); return (List<Transaction>) template.selectList(SELECT_TRANSACTIONS, params, new RowBounds(0, maxResults));
} }

View File

@@ -36,10 +36,12 @@ public interface SOLRTrackingComponent
* *
* @param minAclChangeSetId minimum ACL changeset ID - (inclusive and optional) * @param minAclChangeSetId minimum ACL changeset ID - (inclusive and optional)
* @param fromCommitTime minimum ACL commit time - (inclusive and optional) * @param fromCommitTime minimum ACL commit time - (inclusive and optional)
* @param maxAclChangeSetId max ACL changeset ID - (exclusive and optional)
* @param toCommitTime max ACL commit time - (exclusive and optional)
* @param maxResults limit the results. 0 or Integer.MAX_VALUE does not limit the results * @param maxResults limit the results. 0 or Integer.MAX_VALUE does not limit the results
* @return list of ACL changesets * @return list of ACL changesets
*/ */
public List<AclChangeSet> getAclChangeSets(Long minAclChangeSetId, Long fromCommitTime, int maxResults); public List<AclChangeSet> getAclChangeSets(Long minAclChangeSetId, Long fromCommitTime, Long maxAclChangeSetId, Long toCommitTime, int maxResults);
/** /**
* Get the ACLs with paging options for a specific ACL ChangeSet * Get the ACLs with paging options for a specific ACL ChangeSet
@@ -64,10 +66,12 @@ public interface SOLRTrackingComponent
* *
* @param minTxnId greater than or equal to minTxnId * @param minTxnId greater than or equal to minTxnId
* @param fromCommitTime greater than or equal to transaction commit time * @param fromCommitTime greater than or equal to transaction commit time
* @param maxTxnId less than maxTxnId
* @param toCommitTimeint less then toCommitTimeint
* @param maxResults limit the results. 0 or Integer.MAX_VALUE does not limit the results * @param maxResults limit the results. 0 or Integer.MAX_VALUE does not limit the results
* @return list of transactions * @return list of transactions
*/ */
public List<Transaction> getTransactions(Long minTxnId, Long fromCommitTime, int maxResults); public List<Transaction> getTransactions(Long minTxnId, Long fromCommitTime, Long maxTxnId, Long toCommitTimeint, int maxResults);
/** /**
* Get the nodes satisfying the constraints in nodeParameters * Get the nodes satisfying the constraints in nodeParameters

View File

@@ -150,11 +150,11 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
} }
@Override @Override
public List<AclChangeSet> getAclChangeSets(Long minAclChangeSetId, Long fromCommitTime, int maxResults) public List<AclChangeSet> getAclChangeSets(Long minAclChangeSetId, Long fromCommitTime, Long maxAclChangeSetId, Long toCommitTime, int maxResults)
{ {
if(enabled) if(enabled)
{ {
List<AclChangeSet> changesets = solrDAO.getAclChangeSets(minAclChangeSetId, fromCommitTime, maxResults); List<AclChangeSet> changesets = solrDAO.getAclChangeSets(minAclChangeSetId, fromCommitTime, maxAclChangeSetId, toCommitTime, maxResults);
return changesets; return changesets;
} }
else else
@@ -272,11 +272,11 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
} }
@Override @Override
public List<Transaction> getTransactions(Long minTxnId, Long fromCommitTime, int maxResults) public List<Transaction> getTransactions(Long minTxnId, Long fromCommitTime, Long maxTxnId, Long toCommitTime, int maxResults)
{ {
if(enabled) if(enabled)
{ {
List<Transaction> txns = solrDAO.getTransactions(minTxnId, fromCommitTime, maxResults); List<Transaction> txns = solrDAO.getTransactions(minTxnId, fromCommitTime, maxTxnId, toCommitTime, maxResults);
return txns; return txns;
} }
else else

View File

@@ -23,6 +23,7 @@ import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@@ -66,7 +67,7 @@ import org.springframework.context.ConfigurableApplicationContext;
public class SOLRTrackingComponentTest extends TestCase public class SOLRTrackingComponentTest extends TestCase
{ {
private static final Log logger = LogFactory.getLog(SOLRTrackingComponentTest.class); private static final Log logger = LogFactory.getLog(SOLRTrackingComponentTest.class);
private ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) ApplicationContextHelper.getApplicationContext(); private ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) ApplicationContextHelper.getApplicationContext();
private static enum NodeStatus private static enum NodeStatus
{ {
@@ -83,17 +84,17 @@ public class SOLRTrackingComponentTest extends TestCase
private NodeDAO nodeDAO; private NodeDAO nodeDAO;
private DictionaryDAO dictionaryDAO; private DictionaryDAO dictionaryDAO;
private SOLRTrackingComponent solrTrackingComponent; private SOLRTrackingComponent solrTrackingComponent;
private StoreRef storeRef; private StoreRef storeRef;
private NodeRef rootNodeRef; private NodeRef rootNodeRef;
@Override @Override
public void setUp() throws Exception public void setUp() throws Exception
{ {
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
transactionService = serviceRegistry.getTransactionService(); transactionService = serviceRegistry.getTransactionService();
txnHelper = transactionService.getRetryingTransactionHelper(); txnHelper = transactionService.getRetryingTransactionHelper();
solrTrackingComponent = (SOLRTrackingComponent) ctx.getBean("solrTrackingComponent"); solrTrackingComponent = (SOLRTrackingComponent) ctx.getBean("solrTrackingComponent");
nodeDAO = (NodeDAO)ctx.getBean("nodeDAO"); nodeDAO = (NodeDAO)ctx.getBean("nodeDAO");
dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO"); dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO");
@@ -102,16 +103,16 @@ public class SOLRTrackingComponentTest extends TestCase
dictionaryService = serviceRegistry.getDictionaryService(); dictionaryService = serviceRegistry.getDictionaryService();
namespaceService = serviceRegistry.getNamespaceService(); namespaceService = serviceRegistry.getNamespaceService();
authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent"); authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
authenticationComponent.setSystemUserAsCurrentUser(); authenticationComponent.setSystemUserAsCurrentUser();
storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, getName() + System.currentTimeMillis()); storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, getName() + System.currentTimeMillis());
rootNodeRef = nodeService.getRootNode(storeRef); rootNodeRef = nodeService.getRootNode(storeRef);
} }
public void testGetAcls_Simple() public void testGetAcls_Simple()
{ {
List<AclChangeSet> cs = solrTrackingComponent.getAclChangeSets(null, null, 50); List<AclChangeSet> cs = solrTrackingComponent.getAclChangeSets(null, null, null, null, 50);
assertTrue("Expected results to be limited in number", cs.size() <= 50); assertTrue("Expected results to be limited in number", cs.size() <= 50);
List<Long> aclChangeSetIds = new ArrayList<Long>(50); List<Long> aclChangeSetIds = new ArrayList<Long>(50);
int totalAcls = 0; int totalAcls = 0;
@@ -135,71 +136,71 @@ public class SOLRTrackingComponentTest extends TestCase
// Double check number of ACLs // Double check number of ACLs
assertEquals("ACL count should have matched", totalAcls, totalAclsCheck); assertEquals("ACL count should have matched", totalAcls, totalAclsCheck);
} }
public void testGetNodeMetaData() public void testGetNodeMetaData()
{ {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
SOLRTest st = new SOLRTest3(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testGetNodeMetaData", true, true); SOLRTest st = new SOLRTest3(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testGetNodeMetaData", true, true);
st.buildTransactions(); List<Long> createdTransactions = st.buildTransactions();
List<Transaction> txns = solrTrackingComponent.getTransactions(null, startTime, 50); List<Transaction> txns = solrTrackingComponent.getTransactions(null, startTime, null, null, 50);
int[] updates = new int[] {1, 1}; int[] updates = new int[] {1, 1};
int[] deletes = new int[] {0, 1}; int[] deletes = new int[] {0, 1};
List<Long> txnIds = checkTransactions(txns, 2, updates, deletes); List<Long> txnIds = checkTransactions(txns, createdTransactions, updates, deletes);
NodeParameters nodeParameters = new NodeParameters(); NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(txnIds); nodeParameters.setTransactionIds(txnIds);
getNodes(nodeParameters, st); getNodes(nodeParameters, st);
NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters(); NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters();
nodeMetaDataParams.setNodeIds(st.getNodeIds()); nodeMetaDataParams.setNodeIds(st.getNodeIds());
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
} }
public void testGetNodeMetaDataExludesResidualProperties() public void testGetNodeMetaDataExludesResidualProperties()
{ {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
SOLRTest st = new SOLRTestResidualProperties(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataNullPropertyValue", true, true); SOLRTest st = new SOLRTestResidualProperties(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataNullPropertyValue", true, true);
st.buildTransactions(); List<Long> createdTransactions = st.buildTransactions();
List<Transaction> txns = solrTrackingComponent.getTransactions(null, startTime, 50); List<Transaction> txns = solrTrackingComponent.getTransactions(null, startTime, null, null, 50);
int[] updates = new int[] {2}; int[] updates = new int[] {2};
int[] deletes = new int[] {0}; int[] deletes = new int[] {0};
List<Long> txnIds = checkTransactions(txns, 1, updates, deletes); List<Long> txnIds = checkTransactions(txns, createdTransactions, updates, deletes);
NodeParameters nodeParameters = new NodeParameters(); NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(txnIds); nodeParameters.setTransactionIds(txnIds);
getNodes(nodeParameters, st); getNodes(nodeParameters, st);
NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters(); NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters();
nodeMetaDataParams.setNodeIds(st.getNodeIds()); nodeMetaDataParams.setNodeIds(st.getNodeIds());
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
} }
public void testGetNodeMetaData100Nodes() public void testGetNodeMetaData100Nodes()
{ {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
SOLRTest st = new SOLRTest100Nodes(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testGetNodeMetaData", true, true); SOLRTest st = new SOLRTest100Nodes(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testGetNodeMetaData", true, true);
st.buildTransactions(); List<Long> createdTransactions = st.buildTransactions();
List<Transaction> txns = solrTrackingComponent.getTransactions(null, startTime, 50); List<Transaction> txns = solrTrackingComponent.getTransactions(null, startTime, null, null, 50);
int[] updates = new int[] {100}; int[] updates = new int[] {100};
int[] deletes = new int[] {0}; int[] deletes = new int[] {0};
List<Long> txnIds = checkTransactions(txns, 1, updates, deletes); List<Long> txnIds = checkTransactions(txns, createdTransactions, updates, deletes);
NodeParameters nodeParameters = new NodeParameters(); NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(txnIds); nodeParameters.setTransactionIds(txnIds);
getNodes(nodeParameters, st); getNodes(nodeParameters, st);
// assertEquals("Unxpected number of nodes", 3, nodeQueryCallback.getSuccessCount()); // assertEquals("Unxpected number of nodes", 3, nodeQueryCallback.getSuccessCount());
NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters(); NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters();
nodeMetaDataParams.setNodeIds(st.getNodeIds()); nodeMetaDataParams.setNodeIds(st.getNodeIds());
@@ -207,27 +208,27 @@ public class SOLRTrackingComponentTest extends TestCase
nodeMetaDataParams.setMaxResults(20); nodeMetaDataParams.setMaxResults(20);
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
// assertEquals("Unxpected number of nodes", 3, bt.getSuccessCount()); // assertEquals("Unxpected number of nodes", 3, bt.getSuccessCount());
} }
public void testNodeMetaDataManyNodes() throws Exception public void testNodeMetaDataManyNodes() throws Exception
{ {
long fromCommitTime = System.currentTimeMillis(); long fromCommitTime = System.currentTimeMillis();
SOLRTest st = new SOLRTest4(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataManyNodes", true, false); SOLRTest st = new SOLRTest4(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataManyNodes", true, false);
st.buildTransactions(); List<Long> createdTransactions = st.buildTransactions();
List<Transaction> txns = solrTrackingComponent.getTransactions(null, fromCommitTime, 50); List<Transaction> txns = solrTrackingComponent.getTransactions(null, fromCommitTime, null, null, 50);
int[] updates = new int[] {2001}; int[] updates = new int[] {2001};
int[] deletes = new int[] {0}; int[] deletes = new int[] {0};
List<Long> txnIds = checkTransactions(txns, 1, updates, deletes); List<Long> txnIds = checkTransactions(txns, createdTransactions, updates, deletes);
NodeParameters nodeParameters = new NodeParameters(); NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(txnIds); nodeParameters.setTransactionIds(txnIds);
getNodes(nodeParameters, st); getNodes(nodeParameters, st);
// make sure caches are warm - time last call // make sure caches are warm - time last call
logger.debug("Cold cache"); logger.debug("Cold cache");
NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters(); NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters();
@@ -236,7 +237,7 @@ public class SOLRTrackingComponentTest extends TestCase
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
logger.debug("Warm cache"); logger.debug("Warm cache");
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
// clear out node caches // clear out node caches
nodeDAO.clear(); nodeDAO.clear();
@@ -246,24 +247,24 @@ public class SOLRTrackingComponentTest extends TestCase
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
logger.debug("Warm cache"); logger.debug("Warm cache");
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
logger.debug("Cold cache - explicit clear"); logger.debug("Cold cache - explicit clear");
nodeMetaDataParams.setMaxResults(500); nodeMetaDataParams.setMaxResults(500);
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
logger.debug("Warm cache"); logger.debug("Warm cache");
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
logger.debug("Cold cache - explicit clear"); logger.debug("Cold cache - explicit clear");
nodeMetaDataParams.setMaxResults(200); nodeMetaDataParams.setMaxResults(200);
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
logger.debug("Warm cache"); logger.debug("Warm cache");
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
// clear out node caches // clear out node caches
nodeDAO.clear(); nodeDAO.clear();
logger.debug("Cold cache - explicit clear"); logger.debug("Cold cache - explicit clear");
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
} }
@@ -273,18 +274,18 @@ public class SOLRTrackingComponentTest extends TestCase
long fromCommitTime = System.currentTimeMillis(); long fromCommitTime = System.currentTimeMillis();
SOLRTest st = new SOLRTest4(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataManyNodes", true, false); SOLRTest st = new SOLRTest4(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataManyNodes", true, false);
st.buildTransactions(); List<Long> createdTransactions = st.buildTransactions();
List<Transaction> txns = solrTrackingComponent.getTransactions(null, fromCommitTime, 50); List<Transaction> txns = solrTrackingComponent.getTransactions(null, fromCommitTime, null, null, 50);
int[] updates = new int[] {2001}; int[] updates = new int[] {2001};
int[] deletes = new int[] {0}; int[] deletes = new int[] {0};
List<Long> txnIds = checkTransactions(txns, 1, updates, deletes); List<Long> txnIds = checkTransactions(txns, createdTransactions, updates, deletes);
NodeParameters nodeParameters = new NodeParameters(); NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(txnIds); nodeParameters.setTransactionIds(txnIds);
getNodes(nodeParameters, st); getNodes(nodeParameters, st);
// clear out node caches // clear out node caches
nodeDAO.clear(); nodeDAO.clear();
@@ -297,42 +298,42 @@ public class SOLRTrackingComponentTest extends TestCase
filter.setIncludeChildAssociations(false); filter.setIncludeChildAssociations(false);
getNodeMetaData(nodeMetaDataParams, filter, st); getNodeMetaData(nodeMetaDataParams, filter, st);
} }
public void testNodeMetaDataNullPropertyValue() throws Exception public void testNodeMetaDataNullPropertyValue() throws Exception
{ {
long fromCommitTime = System.currentTimeMillis(); long fromCommitTime = System.currentTimeMillis();
SOLRTest st = new SOLRTest5(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataNullPropertyValue", true, true); SOLRTest st = new SOLRTest5(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataNullPropertyValue", true, true);
st.buildTransactions(); List<Long> createdTransactions = st.buildTransactions();
List<Transaction> txns = solrTrackingComponent.getTransactions(null, fromCommitTime, 50); List<Transaction> txns = solrTrackingComponent.getTransactions(null, fromCommitTime, null, null, 50);
int[] updates = new int[] {11}; int[] updates = new int[] {11};
int[] deletes = new int[] {0}; int[] deletes = new int[] {0};
List<Long> txnIds = checkTransactions(txns, 1, updates, deletes); List<Long> txnIds = checkTransactions(txns, createdTransactions, updates, deletes);
NodeParameters nodeParameters = new NodeParameters(); NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(txnIds); nodeParameters.setTransactionIds(txnIds);
getNodes(nodeParameters, st); getNodes(nodeParameters, st);
NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters(); NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters();
nodeMetaDataParams.setNodeIds(st.getNodeIds()); nodeMetaDataParams.setNodeIds(st.getNodeIds());
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
} }
public void testFilters() public void testFilters()
{ {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
SOLRTest st = new SOLRTest1(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testFilters", true, true); SOLRTest st = new SOLRTest1(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, "testFilters", true, true);
st.buildTransactions(); List<Long> createdTransactions = st.buildTransactions();
List<Transaction> txns = solrTrackingComponent.getTransactions(null, startTime, 50); List<Transaction> txns = solrTrackingComponent.getTransactions(null, startTime, null, null, 50);
int[] updates = new int[] {1, 1}; int[] updates = new int[] {1, 1};
int[] deletes = new int[] {0, 1}; int[] deletes = new int[] {0, 1};
List<Long> txnIds = checkTransactions(txns, 2, updates, deletes); List<Long> txnIds = checkTransactions(txns, createdTransactions, updates, deletes);
NodeParameters nodeParameters = new NodeParameters(); NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(txnIds); nodeParameters.setTransactionIds(txnIds);
getNodes(nodeParameters, st); getNodes(nodeParameters, st);
@@ -341,11 +342,11 @@ public class SOLRTrackingComponentTest extends TestCase
nodeMetaDataParams.setNodeIds(st.getNodeIds()); nodeMetaDataParams.setNodeIds(st.getNodeIds());
getNodeMetaData(nodeMetaDataParams, null, st); getNodeMetaData(nodeMetaDataParams, null, st);
} }
public void testModelDiffs() public void testModelDiffs()
{ {
Collection<QName> allModels = dictionaryService.getAllModels(); Collection<QName> allModels = dictionaryService.getAllModels();
ModelDiffsTracker tracker = new ModelDiffsTracker(); ModelDiffsTracker tracker = new ModelDiffsTracker();
ModelDiffResults diffResults = tracker.diff(); ModelDiffResults diffResults = tracker.diff();
@@ -375,7 +376,7 @@ public class SOLRTrackingComponentTest extends TestCase
M2Type anotherType = testModel.createType("anothertype"); M2Type anotherType = testModel.createType("anothertype");
M2Property prop1 = anotherType.createProperty("prop1"); M2Property prop1 = anotherType.createProperty("prop1");
prop1.setType("d:text"); prop1.setType("d:text");
// call model diffs - should detect test model changes // call model diffs - should detect test model changes
ModelDiffResults diffResults2 = tracker.diff(); ModelDiffResults diffResults2 = tracker.diff();
List<AlfrescoModelDiff> changedModels = diffResults2.getChangedModels(); List<AlfrescoModelDiff> changedModels = diffResults2.getChangedModels();
@@ -389,10 +390,10 @@ public class SOLRTrackingComponentTest extends TestCase
assertNotNull("", changedModel.getOldChecksum().longValue()); assertNotNull("", changedModel.getOldChecksum().longValue());
assertEquals("Old checksum value is incorrect", testModelChecksum.longValue(), changedModel.getOldChecksum().longValue()); assertEquals("Old checksum value is incorrect", testModelChecksum.longValue(), changedModel.getOldChecksum().longValue());
assertNotSame("Expected checksums to be different", changedModel.getOldChecksum(), changedModel.getNewChecksum()); assertNotSame("Expected checksums to be different", changedModel.getOldChecksum(), changedModel.getNewChecksum());
// remove the model // remove the model
dictionaryDAO.removeModel(QName.createQName(testModel.getName(), namespaceService)); dictionaryDAO.removeModel(QName.createQName(testModel.getName(), namespaceService));
// call model diffs - check that the model has been removed // call model diffs - check that the model has been removed
ModelDiffResults diffResults3 = tracker.diff(); ModelDiffResults diffResults3 = tracker.diff();
List<AlfrescoModelDiff> removedModels = diffResults3.getRemovedModels(); List<AlfrescoModelDiff> removedModels = diffResults3.getRemovedModels();
@@ -439,7 +440,7 @@ public class SOLRTrackingComponentTest extends TestCase
private class ModelDiffsTracker private class ModelDiffsTracker
{ {
private Map<QName, Long> trackedModels = new HashMap<QName, Long>(); private Map<QName, Long> trackedModels = new HashMap<QName, Long>();
public ModelDiffResults diff() public ModelDiffResults diff()
{ {
List<AlfrescoModelDiff> modelDiffs = solrTrackingComponent.getModelDiffs(trackedModels); List<AlfrescoModelDiff> modelDiffs = solrTrackingComponent.getModelDiffs(trackedModels);
@@ -466,13 +467,13 @@ public class SOLRTrackingComponentTest extends TestCase
return new ModelDiffResults(newModels, changedModels, removedModels); return new ModelDiffResults(newModels, changedModels, removedModels);
} }
public Long getChecksum(QName modelName) public Long getChecksum(QName modelName)
{ {
return trackedModels.get(modelName); return trackedModels.get(modelName);
} }
} }
private static class NodeAssertions private static class NodeAssertions
{ {
private Set<QName> aspects; private Set<QName> aspects;
@@ -490,7 +491,7 @@ public class SOLRTrackingComponentTest extends TestCase
{ {
super(); super();
} }
public boolean isExpectType() public boolean isExpectType()
{ {
return expectType; return expectType;
@@ -547,9 +548,23 @@ public class SOLRTrackingComponentTest extends TestCase
} }
} }
private List<Long> checkTransactions(List<Transaction> txns, int numTransactions, int[] updates, int[] deletes) private List<Long> checkTransactions(List<Transaction> txns, List<Long> createdTransaction, int[] updates, int[] deletes)
{ {
assertEquals("Number of transactions is incorrect", numTransactions, txns.size()); ArrayList<Transaction> matchedTransactions = new ArrayList<Transaction>();
HashSet<Long> toMatch = new HashSet<Long>();
toMatch.addAll(createdTransaction);
for(Transaction found : txns)
{
if(found != null)
{
if(toMatch.contains(found.getId()))
{
matchedTransactions.add(found);
}
}
}
assertEquals("Number of transactions is incorrect", createdTransaction.size(), txns.size());
List<Long> txnIds = new ArrayList<Long>(txns.size()); List<Long> txnIds = new ArrayList<Long>(txns.size());
int i = 0; int i = 0;
@@ -561,42 +576,42 @@ public class SOLRTrackingComponentTest extends TestCase
txnIds.add(txn.getId()); txnIds.add(txn.getId());
} }
return txnIds; return txnIds;
} }
private void getNodes(NodeParameters nodeParameters, SOLRTest bt) private void getNodes(NodeParameters nodeParameters, SOLRTest bt)
{ {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
solrTrackingComponent.getNodes(nodeParameters, bt); solrTrackingComponent.getNodes(nodeParameters, bt);
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
bt.runNodeChecks(nodeParameters.getMaxResults()); bt.runNodeChecks(nodeParameters.getMaxResults());
logger.debug("Got " + bt.getActualNodeCount() + " nodes in " + (endTime - startTime) + " ms"); logger.debug("Got " + bt.getActualNodeCount() + " nodes in " + (endTime - startTime) + " ms");
} }
private void getNodeMetaData(final NodeMetaDataParameters params, final MetaDataResultsFilter filter, final SOLRTest bt) private void getNodeMetaData(final NodeMetaDataParameters params, final MetaDataResultsFilter filter, final SOLRTest bt)
{ {
bt.clearNodesMetaData(); bt.clearNodesMetaData();
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>() txnHelper.doInTransaction(new RetryingTransactionCallback<Void>()
{ {
@Override @Override
public Void execute() throws Throwable public Void execute() throws Throwable
{ {
solrTrackingComponent.getNodesMetadata(params, filter, bt); solrTrackingComponent.getNodesMetadata(params, filter, bt);
return null; return null;
} }
}, true, true); }, true, true);
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
bt.runNodeMetaDataChecks(params.getMaxResults()); bt.runNodeMetaDataChecks(params.getMaxResults());
logger.debug("Got " + bt.getActualNodeMetaDataCount() + " node metadatas in " + (endTime - startTime) + " ms"); logger.debug("Got " + bt.getActualNodeMetaDataCount() + " node metadatas in " + (endTime - startTime) + " ms");
} }
private static abstract class SOLRTest implements NodeQueryCallback, NodeMetaDataQueryCallback private static abstract class SOLRTest implements NodeQueryCallback, NodeMetaDataQueryCallback
{ {
protected FileFolderService fileFolderService; protected FileFolderService fileFolderService;
@@ -608,7 +623,7 @@ public class SOLRTrackingComponentTest extends TestCase
protected String containerName; protected String containerName;
protected Map<NodeRef, NodeAssertions> nodeAssertions; protected Map<NodeRef, NodeAssertions> nodeAssertions;
protected boolean doChecks; protected boolean doChecks;
protected boolean doNodeChecks; protected boolean doNodeChecks;
protected boolean doMetaDataChecks; protected boolean doMetaDataChecks;
@@ -617,30 +632,30 @@ public class SOLRTrackingComponentTest extends TestCase
protected int failureCount = 0; protected int failureCount = 0;
protected List<Long> nodeIds; protected List<Long> nodeIds;
protected long expectedNumMetaDataNodes = 0; protected long expectedNumMetaDataNodes = 0;
protected long actualNodeCount = 0; protected long actualNodeCount = 0;
protected long actualNodeMetaDataCount = 0; protected long actualNodeMetaDataCount = 0;
SOLRTest(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService, SOLRTest(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService,
NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks) NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks)
{ {
this.txnHelper = txnHelper; this.txnHelper = txnHelper;
this.nodeService = nodeService; this.nodeService = nodeService;
this.rootNodeRef = rootNodeRef; this.rootNodeRef = rootNodeRef;
this.fileFolderService = fileFolderService; this.fileFolderService = fileFolderService;
this.nodeDAO = nodeDAO; this.nodeDAO = nodeDAO;
this.dictionaryService = dictionaryService; this.dictionaryService = dictionaryService;
this.containerName = containerName; this.containerName = containerName;
this.nodeAssertions = new HashMap<NodeRef, NodeAssertions>(); this.nodeAssertions = new HashMap<NodeRef, NodeAssertions>();
this.nodeIds = new ArrayList<Long>(getExpectedNumNodes()); this.nodeIds = new ArrayList<Long>(getExpectedNumNodes());
this.doNodeChecks = doNodeChecks; this.doNodeChecks = doNodeChecks;
this.doMetaDataChecks = doMetaDataChecks; this.doMetaDataChecks = doMetaDataChecks;
this.doChecks = doNodeChecks || doMetaDataChecks; this.doChecks = doNodeChecks || doMetaDataChecks;
} }
void runNodeChecks(int maxResults) void runNodeChecks(int maxResults)
{ {
@@ -670,7 +685,7 @@ public class SOLRTrackingComponentTest extends TestCase
assertEquals("Number of returned nodes is incorrect", getExpectedNumMetaDataNodes(), getActualNodeMetaDataCount()); assertEquals("Number of returned nodes is incorrect", getExpectedNumMetaDataNodes(), getActualNodeMetaDataCount());
} }
} }
void clearNodesMetaData() void clearNodesMetaData()
{ {
successCount = 0; successCount = 0;
@@ -688,14 +703,14 @@ public class SOLRTrackingComponentTest extends TestCase
{ {
return actualNodeMetaDataCount; return actualNodeMetaDataCount;
} }
protected long getExpectedNumMetaDataNodes() protected long getExpectedNumMetaDataNodes()
{ {
return expectedNumMetaDataNodes; return expectedNumMetaDataNodes;
} }
protected abstract int getExpectedNumNodes(); protected abstract int getExpectedNumNodes();
protected abstract void buildTransactionsInternal(); protected abstract List<Long> buildTransactionsInternal();
public NodeAssertions getNodeAssertions(NodeRef nodeRef) public NodeAssertions getNodeAssertions(NodeRef nodeRef)
{ {
@@ -707,26 +722,26 @@ public class SOLRTrackingComponentTest extends TestCase
} }
return assertions; return assertions;
} }
protected void setExpectedNodeStatus(NodeRef nodeRef, NodeStatus nodeStatus) protected void setExpectedNodeStatus(NodeRef nodeRef, NodeStatus nodeStatus)
{ {
if(nodeStatus == NodeStatus.UPDATED) if(nodeStatus == NodeStatus.UPDATED)
{ {
expectedNumMetaDataNodes++; expectedNumMetaDataNodes++;
} }
if(doChecks) if(doChecks)
{ {
NodeAssertions nodeAssertions = getNodeAssertions(nodeRef); NodeAssertions nodeAssertions = getNodeAssertions(nodeRef);
nodeAssertions.setNodeStatus(nodeStatus); nodeAssertions.setNodeStatus(nodeStatus);
} }
} }
void buildTransactions() List<Long> buildTransactions()
{ {
buildTransactionsInternal(); return buildTransactionsInternal();
} }
@Override @Override
public boolean handleNode(Node node) { public boolean handleNode(Node node) {
actualNodeCount++; actualNodeCount++;
@@ -736,13 +751,13 @@ public class SOLRTrackingComponentTest extends TestCase
NodeRef nodeRef = node.getNodeRef(); NodeRef nodeRef = node.getNodeRef();
Boolean isDeleted = node.getDeleted(); Boolean isDeleted = node.getDeleted();
nodeIds.add(node.getId()); nodeIds.add(node.getId());
NodeAssertions expectedStatus = getNodeAssertions(nodeRef); NodeAssertions expectedStatus = getNodeAssertions(nodeRef);
if(expectedStatus == null) if(expectedStatus == null)
{ {
throw new RuntimeException("Unexpected missing assertion for NodeRef " + nodeRef); throw new RuntimeException("Unexpected missing assertion for NodeRef " + nodeRef);
} }
if((expectedStatus.getNodeStatus() == NodeStatus.DELETED && isDeleted) || if((expectedStatus.getNodeStatus() == NodeStatus.DELETED && isDeleted) ||
(expectedStatus.getNodeStatus() == NodeStatus.UPDATED && !isDeleted)) (expectedStatus.getNodeStatus() == NodeStatus.UPDATED && !isDeleted))
{ {
@@ -770,7 +785,7 @@ public class SOLRTrackingComponentTest extends TestCase
} }
return props; return props;
} }
@Override @Override
public boolean handleNodeMetaData(NodeMetaData nodeMetaData) { public boolean handleNodeMetaData(NodeMetaData nodeMetaData) {
actualNodeMetaDataCount++; actualNodeMetaDataCount++;
@@ -791,7 +806,7 @@ public class SOLRTrackingComponentTest extends TestCase
assertEquals("Properties are incorrect", actualProperties, properties); assertEquals("Properties are incorrect", actualProperties, properties);
NodeAssertions assertions = getNodeAssertions(nodeRef); NodeAssertions assertions = getNodeAssertions(nodeRef);
// NodeAssertions assertions = nodes.get(nodeRef); // NodeAssertions assertions = nodes.get(nodeRef);
Set<QName> expectedAspects = assertions.getAspects(); Set<QName> expectedAspects = assertions.getAspects();
if(expectedAspects != null) if(expectedAspects != null)
@@ -801,7 +816,7 @@ public class SOLRTrackingComponentTest extends TestCase
assertTrue("Expected aspect" + aspect, aspects.contains(aspect)); assertTrue("Expected aspect" + aspect, aspects.contains(aspect));
} }
} }
Map<QName, Serializable> expectedProperties = assertions.getProperties(); Map<QName, Serializable> expectedProperties = assertions.getProperties();
if(expectedProperties != null) if(expectedProperties != null)
{ {
@@ -815,10 +830,10 @@ public class SOLRTrackingComponentTest extends TestCase
} }
// TODO complete path tests // TODO complete path tests
// List<Path> actualPaths = nodeMetaData.getPaths(); // List<Path> actualPaths = nodeMetaData.getPaths();
// List<Path> expectedPaths = nodeService.getPaths(nodeRef, false); // List<Path> expectedPaths = nodeService.getPaths(nodeRef, false);
// assertEquals("Paths are incorrect", expectedPaths, actualPaths); // assertEquals("Paths are incorrect", expectedPaths, actualPaths);
boolean expectAspects = assertions.isExpectAspects(); boolean expectAspects = assertions.isExpectAspects();
if(expectAspects && nodeMetaData.getAspects() == null) if(expectAspects && nodeMetaData.getAspects() == null)
{ {
@@ -828,7 +843,7 @@ public class SOLRTrackingComponentTest extends TestCase
{ {
fail("Not expecting aspects but got aspects"); fail("Not expecting aspects but got aspects");
} }
boolean expectProperties = assertions.isExpectProperties(); boolean expectProperties = assertions.isExpectProperties();
if(expectProperties && nodeMetaData.getProperties() == null) if(expectProperties && nodeMetaData.getProperties() == null)
{ {
@@ -848,7 +863,7 @@ public class SOLRTrackingComponentTest extends TestCase
{ {
fail("Not expecting type but got type"); fail("Not expecting type but got type");
} }
boolean expectAclId = assertions.isExpectAclId(); boolean expectAclId = assertions.isExpectAclId();
if(expectAclId && nodeMetaData.getAclId() == null) if(expectAclId && nodeMetaData.getAclId() == null)
{ {
@@ -858,7 +873,7 @@ public class SOLRTrackingComponentTest extends TestCase
{ {
fail("Not expecting acl id but got acl id"); fail("Not expecting acl id but got acl id");
} }
boolean expectPaths = assertions.isExpectPaths(); boolean expectPaths = assertions.isExpectPaths();
if(expectPaths && nodeMetaData.getPaths() == null) if(expectPaths && nodeMetaData.getPaths() == null)
{ {
@@ -878,7 +893,7 @@ public class SOLRTrackingComponentTest extends TestCase
{ {
fail("Not expecting associations but got associations"); fail("Not expecting associations but got associations");
} }
boolean expectOwner = assertions.isExpectOwner(); boolean expectOwner = assertions.isExpectOwner();
if(expectOwner && nodeMetaData.getOwner() == null) if(expectOwner && nodeMetaData.getOwner() == null)
{ {
@@ -889,12 +904,12 @@ public class SOLRTrackingComponentTest extends TestCase
fail("Not expecting owner but got owner"); fail("Not expecting owner but got owner");
} }
} }
successCount++; successCount++;
return true; return true;
} }
public int getSuccessCount() public int getSuccessCount()
{ {
return successCount; return successCount;
@@ -916,24 +931,26 @@ public class SOLRTrackingComponentTest extends TestCase
private NodeRef container; private NodeRef container;
private NodeRef content1; private NodeRef content1;
private NodeRef content2; private NodeRef content2;
SOLRTest1( SOLRTest1(
RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService, RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService,
NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks) NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks)
{ {
super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks); super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks);
} }
public int getExpectedNumNodes() public int getExpectedNumNodes()
{ {
return 3; return 3;
} }
protected void buildTransactionsInternal() protected List<Long> buildTransactionsInternal()
{ {
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>() ArrayList<Long> txs = new ArrayList<Long>(2);
{
public Void execute() throws Throwable txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{
public Long execute() throws Throwable
{ {
PropertyMap props = new PropertyMap(); PropertyMap props = new PropertyMap();
props.put(ContentModel.PROP_NAME, "Container1"); props.put(ContentModel.PROP_NAME, "Container1");
@@ -947,29 +964,30 @@ public class SOLRTrackingComponentTest extends TestCase
FileInfo contentInfo = fileFolderService.create(container, "Content1", ContentModel.TYPE_CONTENT); FileInfo contentInfo = fileFolderService.create(container, "Content1", ContentModel.TYPE_CONTENT);
content1 = contentInfo.getNodeRef(); content1 = contentInfo.getNodeRef();
return null; return nodeDAO.getNodeRefStatus(content1).getDbTxnId();
} }
}); }));
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>() txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{ {
public Void execute() throws Throwable public Long execute() throws Throwable
{ {
FileInfo contentInfo = fileFolderService.create(container, "Content2", ContentModel.TYPE_CONTENT); FileInfo contentInfo = fileFolderService.create(container, "Content2", ContentModel.TYPE_CONTENT);
content2 = contentInfo.getNodeRef(); content2 = contentInfo.getNodeRef();
fileFolderService.delete(content1); fileFolderService.delete(content1);
return null; return nodeDAO.getNodeRefStatus(content1).getDbTxnId();
} }
}); }));
setExpectedNodeStatus(container, NodeStatus.UPDATED); setExpectedNodeStatus(container, NodeStatus.UPDATED);
setExpectedNodeStatus(content1, NodeStatus.DELETED); setExpectedNodeStatus(content1, NodeStatus.DELETED);
setExpectedNodeStatus(content2, NodeStatus.UPDATED); setExpectedNodeStatus(content2, NodeStatus.UPDATED);
return txs;
} }
} }
private static class SOLRTest3 extends SOLRTest private static class SOLRTest3 extends SOLRTest
{ {
private NodeRef container; private NodeRef container;
@@ -978,20 +996,22 @@ public class SOLRTrackingComponentTest extends TestCase
SOLRTest3(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService, SOLRTest3(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService,
NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks) NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks)
{ {
super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks); super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks);
} }
public int getExpectedNumNodes() public int getExpectedNumNodes()
{ {
return 3; return 3;
} }
protected void buildTransactionsInternal() protected List<Long> buildTransactionsInternal()
{ {
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>() ArrayList<Long> txs = new ArrayList<Long>(2);
{
public Void execute() throws Throwable txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{
public Long execute() throws Throwable
{ {
PropertyMap props = new PropertyMap(); PropertyMap props = new PropertyMap();
props.put(ContentModel.PROP_NAME, "Container1"); props.put(ContentModel.PROP_NAME, "Container1");
@@ -1001,56 +1021,60 @@ public class SOLRTrackingComponentTest extends TestCase
ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN,
ContentModel.TYPE_FOLDER, ContentModel.TYPE_FOLDER,
props).getChildRef(); props).getChildRef();
FileInfo contentInfo = fileFolderService.create(container, "Content1", ContentModel.TYPE_CONTENT); FileInfo contentInfo = fileFolderService.create(container, "Content1", ContentModel.TYPE_CONTENT);
content1 = contentInfo.getNodeRef(); content1 = contentInfo.getNodeRef();
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(); Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>();
aspectProperties.put(ContentModel.PROP_AUTHOR, "steve"); aspectProperties.put(ContentModel.PROP_AUTHOR, "steve");
nodeService.addAspect(content1, ContentModel.ASPECT_AUTHOR, aspectProperties); nodeService.addAspect(content1, ContentModel.ASPECT_AUTHOR, aspectProperties);
return null; return nodeDAO.getNodeRefStatus(content1).getDbTxnId();
} }
}); }));
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>() txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{ {
public Void execute() throws Throwable public Long execute() throws Throwable
{ {
FileInfo contentInfo = fileFolderService.create(container, "Content2", ContentModel.TYPE_CONTENT); FileInfo contentInfo = fileFolderService.create(container, "Content2", ContentModel.TYPE_CONTENT);
content2 = contentInfo.getNodeRef(); content2 = contentInfo.getNodeRef();
nodeService.addAspect(content2, ContentModel.ASPECT_TEMPORARY, null); nodeService.addAspect(content2, ContentModel.ASPECT_TEMPORARY, null);
fileFolderService.delete(content1); fileFolderService.delete(content1);
return null; return nodeDAO.getNodeRefStatus(content1).getDbTxnId();
} }
}); }));
setExpectedNodeStatus(container, NodeStatus.UPDATED); setExpectedNodeStatus(container, NodeStatus.UPDATED);
setExpectedNodeStatus(content1, NodeStatus.DELETED); setExpectedNodeStatus(content1, NodeStatus.DELETED);
setExpectedNodeStatus(content2, NodeStatus.UPDATED); setExpectedNodeStatus(content2, NodeStatus.UPDATED);
return txs;
} }
} }
private static class SOLRTest100Nodes extends SOLRTest private static class SOLRTest100Nodes extends SOLRTest
{ {
SOLRTest100Nodes(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService, SOLRTest100Nodes(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService,
NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks) NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks)
{ {
super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks); super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks);
} }
public int getExpectedNumNodes() public int getExpectedNumNodes()
{ {
return 100; return 100;
} }
protected void buildTransactionsInternal() protected List<Long> buildTransactionsInternal()
{ {
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>() ArrayList<Long> txs = new ArrayList<Long>(2);
{
public Void execute() throws Throwable txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{
public Long execute() throws Throwable
{ {
PropertyMap props = new PropertyMap(); PropertyMap props = new PropertyMap();
props.put(ContentModel.PROP_NAME, "Container100Nodes"); props.put(ContentModel.PROP_NAME, "Container100Nodes");
@@ -1069,33 +1093,36 @@ public class SOLRTrackingComponentTest extends TestCase
setExpectedNodeStatus(nodeRef, NodeStatus.UPDATED); setExpectedNodeStatus(nodeRef, NodeStatus.UPDATED);
} }
return null; return nodeDAO.getNodeRefStatus(container).getDbTxnId();
} }
}); }));
return txs;
} }
} }
private static class SOLRTest4 extends SOLRTest private static class SOLRTest4 extends SOLRTest
{ {
private int numContentNodes = 2000; private int numContentNodes = 2000;
SOLRTest4(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService, SOLRTest4(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService,
NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks) NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks)
{ {
super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks); super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks);
} }
public int getExpectedNumNodes() public int getExpectedNumNodes()
{ {
return numContentNodes + 1; return numContentNodes + 1;
} }
public void buildTransactionsInternal() public List<Long> buildTransactionsInternal()
{ {
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>() ArrayList<Long> txs = new ArrayList<Long>(2);
{
public Void execute() throws Throwable txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{
public Long execute() throws Throwable
{ {
PropertyMap props = new PropertyMap(); PropertyMap props = new PropertyMap();
props.put(ContentModel.PROP_NAME, containerName); props.put(ContentModel.PROP_NAME, containerName);
@@ -1120,38 +1147,42 @@ public class SOLRTrackingComponentTest extends TestCase
setExpectedNodeStatus(nodeRef, NodeStatus.UPDATED); setExpectedNodeStatus(nodeRef, NodeStatus.UPDATED);
} }
return null; return nodeDAO.getNodeRefStatus(container).getDbTxnId();
} }
}); }));
return txs;
} }
} }
private static class SOLRTest5 extends SOLRTest private static class SOLRTest5 extends SOLRTest
{ {
private int numContentNodes = 10; private int numContentNodes = 10;
SOLRTest5(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService, SOLRTest5(RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService,
NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks) NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks)
{ {
super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks); super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService, rootNodeRef, containerName, doNodeChecks, doMetaDataChecks);
} }
public int getExpectedNumNodes() public int getExpectedNumNodes()
{ {
return numContentNodes + 1; return numContentNodes + 1;
} }
public void buildTransactionsInternal() public List<Long> buildTransactionsInternal()
{ {
ArrayList<Long> txs = new ArrayList<Long>(2);
final String titles[] = final String titles[] =
{ {
"caf\u00E9", "\u00E7edilla", "\u00E0\u00E1\u00E2\u00E3", "\u00EC\u00ED\u00EE\u00EF", "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6", "caf\u00E9", "\u00E7edilla", "\u00E0\u00E1\u00E2\u00E3", "\u00EC\u00ED\u00EE\u00EF", "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6",
"caf\u00E9", "\u00E7edilla", "\u00E0\u00E1\u00E2\u00E3", "\u00EC\u00ED\u00EE\u00EF", "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6" "caf\u00E9", "\u00E7edilla", "\u00E0\u00E1\u00E2\u00E3", "\u00EC\u00ED\u00EE\u00EF", "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6"
}; };
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>() txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{ {
public Void execute() throws Throwable public Long execute() throws Throwable
{ {
PropertyMap props = new PropertyMap(); PropertyMap props = new PropertyMap();
props.put(ContentModel.PROP_NAME, containerName); props.put(ContentModel.PROP_NAME, containerName);
@@ -1182,35 +1213,39 @@ public class SOLRTrackingComponentTest extends TestCase
setExpectedNodeStatus(nodeRef, NodeStatus.UPDATED); setExpectedNodeStatus(nodeRef, NodeStatus.UPDATED);
} }
return null; return nodeDAO.getNodeRefStatus(container).getDbTxnId();
} }
}); }));
return txs;
} }
} }
private static class SOLRTestResidualProperties extends SOLRTest private static class SOLRTestResidualProperties extends SOLRTest
{ {
private NodeRef container; private NodeRef container;
private NodeRef content; private NodeRef content;
SOLRTestResidualProperties( SOLRTestResidualProperties(
RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService, RetryingTransactionHelper txnHelper, FileFolderService fileFolderService, NodeDAO nodeDAO, NodeService nodeService, DictionaryService dictionaryService,
NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks) NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks)
{ {
super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService,rootNodeRef, containerName, doNodeChecks, doMetaDataChecks); super(txnHelper, fileFolderService, nodeDAO, nodeService, dictionaryService,rootNodeRef, containerName, doNodeChecks, doMetaDataChecks);
} }
public int getExpectedNumNodes() public int getExpectedNumNodes()
{ {
return 2; return 2;
} }
protected void buildTransactionsInternal() protected List<Long> buildTransactionsInternal()
{ {
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>() ArrayList<Long> txs = new ArrayList<Long>(2);
{
public Void execute() throws Throwable txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{
public Long execute() throws Throwable
{ {
PropertyMap props = new PropertyMap(); PropertyMap props = new PropertyMap();
props.put(ContentModel.PROP_NAME, "ContainerResidual"); props.put(ContentModel.PROP_NAME, "ContainerResidual");
@@ -1225,12 +1260,15 @@ public class SOLRTrackingComponentTest extends TestCase
content = contentInfo.getNodeRef(); content = contentInfo.getNodeRef();
nodeService.setProperty(content, QName.createQName("{rubbish}rubbish"), "Rubbish"); nodeService.setProperty(content, QName.createQName("{rubbish}rubbish"), "Rubbish");
return null;
return nodeDAO.getNodeRefStatus(container).getDbTxnId();
} }
}); }));
setExpectedNodeStatus(container, NodeStatus.UPDATED); setExpectedNodeStatus(container, NodeStatus.UPDATED);
setExpectedNodeStatus(content, NodeStatus.UPDATED); setExpectedNodeStatus(content, NodeStatus.UPDATED);
return txs;
} }
} }
} }