Merged V2.1 to HEAD:

6556: AVM performance tweaks
   6557: WCM-758.
   6558: Fixes WCM-753.
   6559: better handling of rename, copy and paste for form instance data and renditions.  addresses WCM-752 and partially addresses WCM-559.
   6560: Renamed JndiTest.java until we decide to keep it or not.
   6561: Oops.
   6562: probable fix WCM-669      
   6563: Build fix after the removal of flushing suport 
   6564: Fix for WCM-728
   6566: Support for avm index clustering via tracking - WCM-762
   6567: Test fix after flush changes
   6568: Fixed AWC-1517: Can now create space based on existing top-level space
   6569: misc IE fixes.
   6570: Various changes to improve AVM import performance and submit performance.
   6571: Session flushing is now deprecated and doesn't fail with an exception.
   6572: Reduced the iteration count to stress nextResults calls a bit more
   6573: WS query sessions put back into cache after more results have been fetched.
   6574: AR-1347: RepositoryServiceSoapBindingStub.queryAssociated() returns nothing when direction=target
   6575: Fixed AR-1680: XPath metadata extraction now handles Node, NodeList and String return values
   6577: Fix for AWC-1518 (User Homes renaming issue, and unreported issue with client config overriding of users home location)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6745 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-11 02:37:29 +00:00
parent 652b9406db
commit 19e1af2314
34 changed files with 2883 additions and 2279 deletions

View File

@@ -40,6 +40,7 @@ import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.MLText;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.EqualsHelper;
@@ -251,7 +252,7 @@ public class MLPropertyInterceptor implements MethodInterceptor
*/
private NodeRef getPivotNodeRef(NodeRef nodeRef)
{
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
if (!nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM) && nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
{
return multilingualContentService.getPivotTranslation(nodeRef);
}

View File

@@ -355,7 +355,7 @@ public class ArchiveAndRestoreTest extends TestCase
verifyNodeExistence(bb_, true);
// flush
AlfrescoTransactionSupport.flush();
//AlfrescoTransactionSupport.flush();
// check that the required properties are present and correct
Map<QName, Serializable> bb_Properties = nodeService.getProperties(bb_);
@@ -383,7 +383,7 @@ public class ArchiveAndRestoreTest extends TestCase
verifyChildAssocExistence(childAssocBtoBB_, true);
// flush
AlfrescoTransactionSupport.flush();
//AlfrescoTransactionSupport.flush();
// restore the node
nodeService.restoreNode(b_, null, null, null);
@@ -398,7 +398,7 @@ public class ArchiveAndRestoreTest extends TestCase
nodeService.deleteNode(a);
// flush
AlfrescoTransactionSupport.flush();
//AlfrescoTransactionSupport.flush();
// restore in reverse order
nodeService.restoreNode(a_, null, null, null);
@@ -414,7 +414,7 @@ public class ArchiveAndRestoreTest extends TestCase
nodeService.deleteNode(b);
// flush
AlfrescoTransactionSupport.flush();
//AlfrescoTransactionSupport.flush();
// restore in reverse order
nodeService.restoreNode(b_, null, null, null);
@@ -430,7 +430,7 @@ public class ArchiveAndRestoreTest extends TestCase
nodeService.deleteNode(b);
// flush
AlfrescoTransactionSupport.flush();
//AlfrescoTransactionSupport.flush();
// in restoring 'a' first, there will be some associations that won't be recreated
nodeService.restoreNode(a_, null, null, null);
@@ -486,7 +486,7 @@ public class ArchiveAndRestoreTest extends TestCase
cumulatedArchiveTimeNs += (end - start);
// flush
AlfrescoTransactionSupport.flush();
//AlfrescoTransactionSupport.flush();
// now restore
start = System.nanoTime();

View File

@@ -29,7 +29,6 @@ import java.lang.reflect.Method;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.node.BaseNodeServiceTest;
import org.alfresco.repo.node.db.DbNodeServiceImpl;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.repo.transaction.TransactionResourceInterceptor;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.NamespaceService;
@@ -53,7 +52,7 @@ public class SessionSizeManagementTest extends BaseNodeServiceTest
{
try
{
Class clazz = SessionSizeManagementTest.class;
Class<SessionSizeManagementTest> clazz = SessionSizeManagementTest.class;
createNodesMethod = clazz.getMethod(
"createNodes",
new Class[] {NodeService.class, Integer.TYPE, Boolean.TYPE});
@@ -118,9 +117,6 @@ public class SessionSizeManagementTest extends BaseNodeServiceTest
NodeService nodeService = getNodeService();
createNodes(nodeService, LOAD_COUNT, false);
// We can't check the session size as this is dependent on machine speed
// Now flush integrity to be sure things are not broken
AlfrescoTransactionSupport.flush();
}
/**
@@ -136,8 +132,5 @@ public class SessionSizeManagementTest extends BaseNodeServiceTest
}
createNodes(nodeService, LOAD_COUNT, true);
// Now flush integrity to be sure things are not broken
AlfrescoTransactionSupport.flush();
}
}

View File

@@ -1,5 +1,6 @@
package org.alfresco.repo.node.index;
import java.util.LinkedHashMap;
import java.util.List;
import org.alfresco.repo.node.index.FullIndexRecoveryComponent.RecoveryMode;
@@ -50,15 +51,13 @@ public class AVMFullIndexRecoveryComponent extends AbstractReindexComponent
{
this.lockServer = lockServer;
}
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
public void setAvmSnapShotTriggeredIndexingMethodInterceptor(
AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor)
public void setAvmSnapShotTriggeredIndexingMethodInterceptor(AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor)
{
this.avmSnapShotTriggeredIndexingMethodInterceptor = avmSnapShotTriggeredIndexingMethodInterceptor;
}
@@ -72,77 +71,180 @@ public class AVMFullIndexRecoveryComponent extends AbstractReindexComponent
private void processStores()
{
List<AVMStoreDescriptor> stores = avmService.getStores();
if(stores.size() == 0)
LinkedHashMap<String, RecoveryMode> actions = new LinkedHashMap<String, RecoveryMode>();
if (stores.size() == 0)
{
return;
}
int count = 0;
int tracker = -1;
logger.info("Checking indexes for AVM Stores");
for (AVMStoreDescriptor store : stores)
switch (recoveryMode)
{
if (isShuttingDown())
case AUTO:
case VALIDATE:
int count = 0;
int tracker = -1;
if (logger.isDebugEnabled())
{
return;
logger.debug("Checking indexes for AVM Stores: " + recoveryMode);
}
processStore(store.getName());
count++;
if (count*10l/stores.size() > tracker)
{
tracker = (int)(count*10l/stores.size());
logger.info(" Stores "+(tracker*10)+"% complete");
for (AVMStoreDescriptor store : stores)
{
if (isShuttingDown())
{
return;
}
actions.put(store.getName(), checkStore(store.getName()));
count++;
if (count * 10l / stores.size() > tracker)
{
tracker = (int) (count * 10l / stores.size());
if (logger.isDebugEnabled())
{
logger.debug(" Store check " + (tracker * 10) + "% complete");
}
}
}
if (logger.isDebugEnabled())
{
logger.debug("Finished checking indexes for AVM Stores");
}
break;
case FULL:
case NONE:
for (AVMStoreDescriptor store : stores)
{
if (isShuttingDown())
{
return;
}
actions.put(store.getName(), checkStore(store.getName()));
}
break;
default:
}
int full = 0;
int auto = 0;
int invalid = 0;
for (String store : actions.keySet())
{
RecoveryMode mode = actions.get(store);
switch (mode)
{
case AUTO:
auto++;
break;
case FULL:
full++;
break;
case VALIDATE:
invalid++;
break;
case NONE:
default:
}
}
logger.info("Finished checking indexes for AVM Stores");
if (recoveryMode != RecoveryMode.NONE)
{
if (logger.isDebugEnabled())
{
logger.debug("Invalid indexes: " + invalid);
logger.debug("Indexes for full rebuild: " + full);
logger.debug("Indexes for auto update: " + auto);
}
}
int count = 0;
int tracker = -1;
int total = full + auto;
if (total > 0)
{
logger.info("Rebuilding indexes for " + total + " AVM Stores");
for (String store : actions.keySet())
{
RecoveryMode mode = actions.get(store);
if (isShuttingDown())
{
return;
}
if ((mode == RecoveryMode.FULL) || (mode == RecoveryMode.AUTO))
{
processStore(store, mode);
count++;
}
if (count * 10l / total > tracker)
{
tracker = (int) (count * 10l / total);
logger.info(" Reindex " + (tracker * 10) + "% complete");
}
}
logger.info("Finished rebuilding indexes for AVM Stores");
}
}
private void processStore(String store)
private RecoveryMode checkStore(String store)
{
if (logger.isDebugEnabled())
{
logger.debug("Performing AVM index recovery for type: " + recoveryMode + " on store " + store);
logger.debug("Checking AVM store for index recovery: " + recoveryMode + " on store " + store);
}
// do we just ignore
if (recoveryMode == RecoveryMode.NONE)
{
return;
return RecoveryMode.NONE;
}
// check the level of cover required
boolean fullRecoveryRequired = false;
// Nothing to do for unindexed stores
if (avmSnapShotTriggeredIndexingMethodInterceptor.getIndexMode(store) == IndexMode.UNINDEXED)
{
if (!avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated(store))
{
logger.warn(" Index for avm store " + store + " is out of date");
return recoveryMode;
}
else
{
return RecoveryMode.NONE;
}
}
if (recoveryMode == RecoveryMode.FULL) // no validate required
{
fullRecoveryRequired = true;
return RecoveryMode.FULL;
}
else
// validate first
{
if(avmSnapShotTriggeredIndexingMethodInterceptor.getIndexMode(store) == IndexMode.UNINDEXED)
if (!avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated(store))
{
return;
logger.warn(" Index for avm store " + store + " is out of date");
return recoveryMode;
}
int lastActualSnapshotId = avmService.getLatestSnapshotID(store);
if (lastActualSnapshotId <= 0)
{
return;
return RecoveryMode.NONE;
}
int lastIndexedSnapshotId = avmSnapShotTriggeredIndexingMethodInterceptor.getLastIndexedSnapshot(store);
if (lastActualSnapshotId != lastIndexedSnapshotId)
{
logger.warn("Index for avm store " + store + " is out of date");
// this store isn't up to date
if (recoveryMode == RecoveryMode.VALIDATE)
{
// the store is out of date - validation failed
}
else if (recoveryMode == RecoveryMode.AUTO)
{
fullRecoveryRequired = true;
}
logger.warn(" Index for avm store " + store + " is out of date");
return recoveryMode;
}
else
{
return recoveryMode.NONE;
}
}
}
private void processStore(String store, RecoveryMode mode)
{
// put the server into read-only mode for the duration
boolean allowWrite = !transactionService.isReadOnly();
try
@@ -153,11 +255,8 @@ public class AVMFullIndexRecoveryComponent extends AbstractReindexComponent
transactionService.setAllowWrite(false);
}
// do we need to perform a full recovery
if (fullRecoveryRequired)
{
recoverStore(store);
}
recoverStore(store, mode);
}
finally
{
@@ -167,56 +266,97 @@ public class AVMFullIndexRecoveryComponent extends AbstractReindexComponent
}
private void recoverStore(String store)
private void recoverStore(String store, RecoveryMode mode)
{
int tracker = -1;
int latest = avmService.getLatestSnapshotID(store);
if(latest <= 0)
if (mode == RecoveryMode.AUTO)
{
return;
logger.info(" Auto recovering index for " + store);
}
logger.info("Recovery for "+store);
if(!avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated(store))
else if (mode == RecoveryMode.FULL)
{
logger.info(" Rebuilding index for " + store);
}
if (!avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated(store))
{
avmSnapShotTriggeredIndexingMethodInterceptor.createIndex(store);
}
for (int i = 0; i <= latest; i++)
int latest = avmService.getLatestSnapshotID(store);
if (latest <= 0)
{
if (isShuttingDown())
return;
}
boolean wasRecovered = false;
if (avmSnapShotTriggeredIndexingMethodInterceptor.getIndexMode(store) != IndexMode.UNINDEXED)
{
for (int i = 0; i <= latest; i++)
{
return;
}
recoverSnapShot(store, i);
if (i*10l/latest > tracker)
{
tracker = (int)(i*10l/latest);
logger.info(" Store "+store +" "+(tracker*10)+"% complete");
if (isShuttingDown())
{
return;
}
wasRecovered = recoverSnapShot(store, i, mode, wasRecovered);
if (i * 10l / latest > tracker)
{
tracker = (int) (i * 10l / latest);
if (logger.isDebugEnabled())
{
logger.debug(" Store " + store + " " + (tracker * 10) + "% complete");
}
}
}
}
logger.info("Recovery for "+store+" done");
if (logger.isDebugEnabled())
{
logger.debug(" Index updated for " + store);
}
}
private void recoverSnapShot(final String store, final int id)
private boolean recoverSnapShot(final String store, final int id, final RecoveryMode mode, final boolean wasRecovered)
{
if (logger.isDebugEnabled())
{
logger.debug("Reindexing avm store: " + store + " snapshot id " + id);
logger.debug(" Reindexing avm store: " + store + " snapshot id " + id);
}
RetryingTransactionCallback<Object> reindexWork = new RetryingTransactionCallback<Object>()
RetryingTransactionCallback<Boolean> reindexWork = new RetryingTransactionCallback<Boolean>()
{
public Object execute() throws Exception
public Boolean execute() throws Exception
{
if (!avmSnapShotTriggeredIndexingMethodInterceptor.isSnapshotIndexed(store, id))
if (wasRecovered)
{
avmSnapShotTriggeredIndexingMethodInterceptor.indexSnapshot(store, id - 1, id);
return true;
}
// done
return null;
else
{
if (mode == RecoveryMode.AUTO)
{
if (!avmSnapShotTriggeredIndexingMethodInterceptor.isSnapshotIndexed(store, id))
{
avmSnapShotTriggeredIndexingMethodInterceptor.indexSnapshot(store, id - 1, id);
return true;
}
else
{
return wasRecovered;
}
}
else
{
avmSnapShotTriggeredIndexingMethodInterceptor.indexSnapshot(store, id - 1, id);
return true;
}
}
}
};
transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true, true);
return transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true, true);
// done
}

View File

@@ -0,0 +1,129 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.node.index;
import java.util.List;
import org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Track and update when snapshots are created and indexed in a cluster
*/
public class AVMRemoteSnapshotTracker extends AbstractReindexComponent
{
private static Log logger = LogFactory.getLog(AVMRemoteSnapshotTracker.class);
private AVMService avmService;
private AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor;
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
public void setAvmSnapShotTriggeredIndexingMethodInterceptor(AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor)
{
this.avmSnapShotTriggeredIndexingMethodInterceptor = avmSnapShotTriggeredIndexingMethodInterceptor;
}
@Override
protected void reindexImpl()
{
processStores();
}
/**
* Loop throught the avm stores and compare the latest snapshot to that in the index.
* Update the index if it has fallen behind.
*
*/
private void processStores()
{
List<AVMStoreDescriptor> stores = avmService.getStores();
if (stores.size() == 0)
{
return;
}
boolean upToDate;
do
{
upToDate = true;
for (AVMStoreDescriptor store : stores)
{
if (isShuttingDown())
{
break;
}
int current = avmService.getLatestSnapshotID(store.getName());
int lastIndexed = avmSnapShotTriggeredIndexingMethodInterceptor.getLastIndexedSnapshot(store.getName());
if (lastIndexed < current)
{
if(logger.isDebugEnabled())
{
logger.debug("Updating index for store "+store.getName()+" from snapshot "+lastIndexed+ " to "+current);
}
recoverSnapShot(store.getName(), lastIndexed, current);
upToDate = false;
}
}
}
while(!upToDate);
}
/**
* Do the index update in one lump (not individual snapshots)
*
* @param store
* @param lastIndexed
* @param current
*/
private void recoverSnapShot(final String store, final int lastIndexed, final int current)
{
RetryingTransactionCallback<Object> reindexWork = new RetryingTransactionCallback<Object>()
{
public Object execute() throws Exception
{
if(lastIndexed == -1)
{
avmSnapShotTriggeredIndexingMethodInterceptor.createIndex(store);
}
avmSnapShotTriggeredIndexingMethodInterceptor.indexSnapshot(store, lastIndexed, current);
return null;
}
};
transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true);
}
}

View File

@@ -0,0 +1,206 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.node.index;
import javax.transaction.Status;
import javax.transaction.UserTransaction;
import org.alfresco.repo.content.ContentStore;
import org.alfresco.repo.node.db.NodeDaoService;
import org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor;
import org.alfresco.repo.search.Indexer;
import org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexer;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.transaction.TransactionServiceImpl;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.BaseSpringTest;
/**
* Test that the index tracker catches up
*
* @author andyh
*/
public class AVMRemoteSnapshotTrackerTest extends BaseSpringTest
{
private AuthenticationComponent authenticationComponent;
private AVMService avmService;
private AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor;
private TransactionService transactionService;
private UserTransaction testTX;
private SearchService searchService;
private NodeService nodeService;
private FullTextSearchIndexer ftsIndexer;
private Indexer indexer;
private NodeDaoService nodeDaoService;
public AVMRemoteSnapshotTrackerTest()
{
// TODO Auto-generated constructor stub
}
@Override
protected void onSetUpInTransaction() throws Exception
{
super.onSetUpInTransaction();
ServiceRegistry serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
avmService = (AVMService) applicationContext.getBean("AVMService");
avmSnapShotTriggeredIndexingMethodInterceptor = (AVMSnapShotTriggeredIndexingMethodInterceptor) applicationContext.getBean("avmSnapShotTriggeredIndexingMethodInterceptor");
transactionService = (TransactionService) applicationContext.getBean("transactionComponent");
searchService = serviceRegistry.getSearchService();
nodeService = serviceRegistry.getNodeService();
ftsIndexer = (FullTextSearchIndexer) applicationContext.getBean("LuceneFullTextSearchIndexer");
indexer = (Indexer) applicationContext.getBean("indexerComponent");
nodeDaoService = (NodeDaoService) applicationContext.getBean("nodeDaoService");
testTX = transactionService.getUserTransaction();
testTX.begin();
authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
authenticationComponent.setSystemUserAsCurrentUser();
}
@Override
protected void onTearDownInTransaction() throws Exception
{
if (testTX.getStatus() == Status.STATUS_ACTIVE)
{
testTX.rollback();
}
try
{
authenticationComponent.clearCurrentSecurityContext();
}
catch (Throwable e)
{
// do nothing
}
super.onTearDownInTransaction();
}
public void testCatchUp()
{
assertFalse(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("one"));
assertFalse(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("two"));
assertFalse(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("three"));
assertFalse(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("four"));
// initial state
avmService.createStore("one");
//assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("one"));
avmService.createDirectory("one:/", "a");
avmService.createSnapshot("one", null, null);
avmService.createStore("two");
avmService.createDirectory("two:/", "a");
avmService.createStore("three");
// Check state
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("one"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("one"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("two"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("two"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("three"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("three"));
assertFalse(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("four"));
// Disable the indexer and do updates
avmSnapShotTriggeredIndexingMethodInterceptor.setEnableIndexing(false);
// one unchanged
// two snap shot
avmService.createSnapshot("two", null, null);
// three update and snapshot
avmService.createDirectory("three:/", "a");
avmService.createSnapshot("three", null, null);
// four create
avmService.createStore("four");
avmService.createDirectory("four:/", "a");
avmService.createSnapshot("four", null, null);
avmService.createDirectory("four:/", "b");
avmService.createSnapshot("four", null, null);
//
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("one"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("one"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("two"));
assertFalse(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("two"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("three"));
assertFalse(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("three"));
assertFalse(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("four"));
assertFalse(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("four"));
avmSnapShotTriggeredIndexingMethodInterceptor.setEnableIndexing(true);
AVMRemoteSnapshotTracker tracker = new AVMRemoteSnapshotTracker();
tracker.setAuthenticationComponent(authenticationComponent);
tracker.setAvmService(avmService);
tracker.setAvmSnapShotTriggeredIndexingMethodInterceptor(avmSnapShotTriggeredIndexingMethodInterceptor);
tracker.setTransactionService((TransactionServiceImpl) transactionService);
tracker.setFtsIndexer(ftsIndexer);
tracker.setIndexer(indexer);
tracker.setNodeDaoService(nodeDaoService);
tracker.setNodeService(nodeService);
tracker.setSearcher(searchService);
tracker.reindex();
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("one"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("one"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("two"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("two"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("three"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("three"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.hasIndexBeenCreated("four"));
assertTrue(avmSnapShotTriggeredIndexingMethodInterceptor.isIndexUpToDate("four"));
}
}