use of org.alfresco.solr.TrackerState in project SearchServices by Alfresco.
the class MetadataTrackerTest method doTrackWithOneTransactionUpdatesOnce.
@Test
@Ignore("Superseded by AlfrescoSolrTrackerTest")
public void doTrackWithOneTransactionUpdatesOnce() throws AuthenticationException, IOException, JSONException, EncoderException {
TrackerState state = new TrackerState();
state.setTimeToStopIndexing(2L);
when(srv.getTrackerInitialState()).thenReturn(state);
// TrackerState is persisted per tracker
when(this.metadataTracker.getTrackerState()).thenReturn(state);
List<Transaction> txsList = new ArrayList<>();
Transaction tx = new Transaction();
tx.setCommitTimeMs(1L);
tx.setDeletes(1);
tx.setUpdates(1);
txsList.add(tx);
Transactions txs = mock(Transactions.class);
when(txs.getTransactions()).thenReturn(txsList);
// Subsequent calls to getTransactions must return a different set of transactions to avoid an infinite loop
when(repositoryClient.getTransactions(anyLong(), anyLong(), anyLong(), anyLong(), anyInt())).thenReturn(txs).thenReturn(txs).thenReturn(mock(Transactions.class));
when(repositoryClient.getTransactions(anyLong(), anyLong(), anyLong(), anyLong(), anyInt(), isNull(ShardState.class))).thenReturn(txs).thenReturn(txs).thenReturn(mock(Transactions.class));
when(repositoryClient.getTransactions(anyLong(), anyLong(), anyLong(), anyLong(), anyInt(), any(ShardState.class))).thenReturn(txs).thenReturn(txs).thenReturn(mock(Transactions.class));
List<Node> nodes = new ArrayList<>();
Node node = new Node();
nodes.add(node);
when(repositoryClient.getNodes(any(GetNodesParameters.class), anyInt())).thenReturn(nodes);
this.metadataTracker.doTrack();
InOrder inOrder = inOrder(srv);
inOrder.verify(srv).indexNodes(nodes, true, false);
inOrder.verify(srv).indexTransaction(tx, true);
inOrder.verify(srv).commit();
}
use of org.alfresco.solr.TrackerState in project SearchServices by Alfresco.
the class AclTracker method trackRepository.
protected void trackRepository() throws IOException, AuthenticationException, JSONException {
checkShutdown();
if (!isMaster && isSlave) {
return;
}
TrackerState state = super.getTrackerState();
// Check we are tracking the correct repository
if (state.getTrackerCycles() == 0) {
// We have a new tracker state so do the checks.
checkRepoAndIndexConsistency(state);
}
checkShutdown();
trackAclChangeSets();
}
Aggregations