exo-jcr SVN: r525 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-09 11:00:47 -0500 (Mon, 09 Nov 2009)
New Revision: 525
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
Log:
EXOJCR-201 : test JDBCCacheLoadetTest.
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java 2009-11-09 15:54:36 UTC (rev 524)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java 2009-11-09 16:00:47 UTC (rev 525)
@@ -85,32 +85,27 @@
*/
protected void setUp() throws Exception
{
- try {
- super.setUp();
-
- // JBossCache
- initJBCConfig();
-
- cache = new DefaultCacheFactory<Serializable, Object>().createCache(jbcConfig, false);
-
- initJBC();
-
- // run cache
- cache.create();
- cache.start();
-
- Node<Serializable, Object> cacheRoot = cache.getRoot();
-
- // prepare cache structures
- nodes = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.NODES));
- props = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.PROPS));
-
- // JCR connection
- conn = new JBossCacheStorageConnection(cache, nodes, props);
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
- }
+ super.setUp();
+
+ // JBossCache
+ initJBCConfig();
+
+ cache = new DefaultCacheFactory<Serializable, Object>().createCache(jbcConfig, false);
+
+ initJBC();
+
+ // run cache
+ cache.create();
+ cache.start();
+
+ Node<Serializable, Object> cacheRoot = cache.getRoot();
+
+ // prepare cache structures
+ nodes = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.NODES));
+ props = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.PROPS));
+
+ // JCR connection
+ conn = new JBossCacheStorageConnection(cache, nodes, props);
}
protected void initJBCConfig()
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-09 15:54:36 UTC (rev 524)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-09 16:00:47 UTC (rev 525)
@@ -20,10 +20,7 @@
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import org.exoplatform.services.jcr.config.ContainerEntry;
import org.exoplatform.services.jcr.config.RepositoryEntry;
16 years, 8 months
exo-jcr SVN: r524 - in jcr/branches/1.12.0-JBC/component/core/src: main/java/org/exoplatform/services/jcr/impl/storage/jdbc and 1 other directories.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-09 10:54:36 -0500 (Mon, 09 Nov 2009)
New Revision: 524
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
Log:
EXOJCR-201 : test JDBCCacheLoadetTest.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-09 15:53:08 UTC (rev 523)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-09 15:54:36 UTC (rev 524)
@@ -49,6 +49,7 @@
import org.jboss.cache.Modification;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.loader.AbstractCacheLoader;
import java.util.LinkedHashMap;
@@ -67,16 +68,18 @@
*/
public class JDBCCacheLoader extends AbstractCacheLoader
{
-
private WorkspaceDataContainer dataContainer;
+ public JDBCCacheLoader() {
+ }
+
/**
* Init the loader DataContainer with given WorkspaceDataContainer instance.
*
* @param dataContainer WorkspaceDataContainer
*/
@Inject
- public void initDataContainer(WorkspaceDataContainer dataContainer) throws RepositoryConfigurationException
+ public void injectDependencies(WorkspaceDataContainer dataContainer) throws RepositoryConfigurationException
{
if (this.dataContainer != null)
{
@@ -86,13 +89,13 @@
this.dataContainer = dataContainer;
}
-
/**
* {@inheritDoc}
*/
public void put(List<Modification> modifications) throws Exception
{
// TODO
+ System.out.println(modifications);
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2009-11-09 15:53:08 UTC (rev 523)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2009-11-09 15:54:36 UTC (rev 524)
@@ -40,6 +40,7 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.naming.InitialContextInitializer;
+import org.jboss.cache.factories.annotations.NonVolatile;
import org.picocontainer.Startable;
import java.io.File;
@@ -57,6 +58,7 @@
* @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
* @version $Id:GenericWorkspaceDataContainer.java 13433 2007-03-15 16:07:23Z peterit $
*/
+@NonVolatile
public class JDBCWorkspaceDataContainer extends WorkspaceDataContainerBase implements Startable
{
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java 2009-11-09 15:53:08 UTC (rev 523)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java 2009-11-09 15:54:36 UTC (rev 524)
@@ -85,27 +85,32 @@
*/
protected void setUp() throws Exception
{
- super.setUp();
-
- // JBossCache
- initJBCConfig();
-
- cache = new DefaultCacheFactory<Serializable, Object>().createCache(jbcConfig);
-
- initJBC();
-
- // run cache
- cache.create();
- cache.start();
-
- Node<Serializable, Object> cacheRoot = cache.getRoot();
-
- // prepare cache structures
- nodes = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.NODES));
- props = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.PROPS));
-
- // JCR connection
- conn = new JBossCacheStorageConnection(cache, nodes, props);
+ try {
+ super.setUp();
+
+ // JBossCache
+ initJBCConfig();
+
+ cache = new DefaultCacheFactory<Serializable, Object>().createCache(jbcConfig, false);
+
+ initJBC();
+
+ // run cache
+ cache.create();
+ cache.start();
+
+ Node<Serializable, Object> cacheRoot = cache.getRoot();
+
+ // prepare cache structures
+ nodes = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.NODES));
+ props = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.PROPS));
+
+ // JCR connection
+ conn = new JBossCacheStorageConnection(cache, nodes, props);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
}
protected void initJBCConfig()
@@ -113,7 +118,7 @@
jbcConfig = "conf/standalone/test-jbosscache-config-jdbcloader.xml";
}
- protected void initJBC()
+ protected void initJBC() throws Exception
{
// empty here
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-09 15:53:08 UTC (rev 523)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-09 15:54:36 UTC (rev 524)
@@ -18,7 +18,25 @@
*/
package org.exoplatform.services.jcr.impl.storage.jbosscache;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.exoplatform.services.jcr.config.ContainerEntry;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
+import org.exoplatform.services.jcr.impl.storage.value.StandaloneStoragePluginProvider;
+import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+import org.exoplatform.services.jcr.util.ConfigurationHelper;
+import org.jboss.cache.CacheSPI;
+
+
/**
* @author <a href="mailto:reshetnyak.alex@gmail.com">Alex Reshetnyak</a>
* @version $Id$
@@ -44,14 +62,32 @@
}
@Override
- protected void initJBC()
+ protected void initJBC() throws Exception
{
// persistence container
//WorkspaceDataContainer persistentContainer = new JDBCWorkspaceDataContainerTester();
+
+ // Create WorkspaceEntry
+ ConfigurationHelper configurationHelper = ConfigurationHelper.getInstence();
+
+ ContainerEntry containerEntry = new ContainerEntry();
+ List<SimpleParameterEntry> params = new ArrayList<SimpleParameterEntry>();
+ params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_DIALECT, "hsqldb"));
+ params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.SWAPDIR_PROP, "/target/temp/swap/ws"));
+ containerEntry.setParameters(params);
+
+ WorkspaceEntry ws = configurationHelper.getNewWs("ws_to_jbdc_cache_loader", true, "data-source", "/target/temp/ws_to_jbdc_cache_loader/lalues", containerEntry);
+
+ RepositoryEntry re = new RepositoryEntry();
+ re.addWorkspace(ws);
+
+ ValueStoragePluginProvider valueStoragePluginProvider = new StandaloneStoragePluginProvider(ws);
+
+ JDBCWorkspaceDataContainer persistentContainer = new JDBCWorkspaceDataContainer(ws, re, null, valueStoragePluginProvider);
- //((CacheSPI<Serializable, Object>)cache).getComponentRegistry().registerComponent(persistentContainer,
- // WorkspaceDataContainer.class);
+ ((CacheSPI<Serializable, Object>)cache).getComponentRegistry().registerComponent(persistentContainer,
+ WorkspaceDataContainer.class);
}
@Override
16 years, 8 months
exo-jcr SVN: r523 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-11-09 10:53:08 -0500 (Mon, 09 Nov 2009)
New Revision: 523
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
Log:
EXOJCR-202 : add node test
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-09 15:36:43 UTC (rev 522)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-09 15:53:08 UTC (rev 523)
@@ -18,6 +18,33 @@
*/
package org.exoplatform.services.jcr.impl.storage.jbosscache;
+import org.exoplatform.services.jcr.access.AccessControlList;
+import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.SessionDataManager;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.impl.core.query.IndexException;
+import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
+import org.exoplatform.services.jcr.impl.core.query.SearchManager;
+import org.exoplatform.services.jcr.impl.core.query.cacheloader.IndexerCacheLoader;
+import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
+import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
+import org.jboss.cache.Modification;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.jcr.Node;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.query.InvalidQueryException;
+import javax.jcr.query.Query;
+
/**
* @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
* @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
@@ -25,5 +52,135 @@
*/
public class IndexerCacheLoaderTest extends AbstractCacheLoaderTest
{
+ private IndexerCacheLoader indexerCacheLoader;
+ private DummySearchManager searchManager;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception
+ {
+ // TODO Auto-generated method stub
+ super.setUp();
+ searchManager = new DummySearchManager();
+ indexerCacheLoader = new IndexerCacheLoader();
+ indexerCacheLoader.registerSearchManager(searchManager);
+ }
+
+ /**
+ * Add new Node
+ */
+ public void testAddNode() throws Exception
+ {
+ QPath node1path = QPath.parse("[]:1[]node:1");
+ NodeData newNode =
+ new TransientNodeData(node1path, "n123456", 1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
+ Constants.ROOT_UUID, new AccessControlList());
+
+ QPath prop1path = QPath.makeChildPath(node1path, Constants.JCR_PRIMARYTYPE);
+ PropertyData newProperty =
+ new TransientPropertyData(prop1path, "p123456", 0, PropertyType.NAME, "n123456", false);
+
+ List<Modification> modification = new ArrayList<Modification>();
+
+ modification.add(addNode(newNode));
+ modification.add(addProperty(newProperty));
+ indexerCacheLoader.put(modification);
+ assertNotNull(searchManager.getAddedNodes());
+ assertNotNull(searchManager.getRemovedNodes());
+ }
+
+ private class DummySearchManager implements SearchManager
+ {
+
+ private Set<String> removedNodes;
+
+ private Set<String> addedNodes;
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#createQuery(org.exoplatform.services.jcr.impl.core.SessionImpl, org.exoplatform.services.jcr.impl.core.SessionDataManager, javax.jcr.Node)
+ */
+ public Query createQuery(SessionImpl session, SessionDataManager sessionDataManager, Node node)
+ throws InvalidQueryException, RepositoryException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#createQuery(org.exoplatform.services.jcr.impl.core.SessionImpl, org.exoplatform.services.jcr.impl.core.SessionDataManager, java.lang.String, java.lang.String)
+ */
+ public Query createQuery(SessionImpl session, SessionDataManager sessionDataManager, String statement,
+ String language) throws InvalidQueryException, RepositoryException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#getFieldNames()
+ */
+ public Set<String> getFieldNames() throws IndexException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#getHandler()
+ */
+ public QueryHandler getHandler()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#getNodesByNodeType(org.exoplatform.services.jcr.datamodel.InternalQName)
+ */
+ public Set<String> getNodesByNodeType(InternalQName nodeType) throws RepositoryException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#getNodesByUri(java.lang.String)
+ */
+ public Set<String> getNodesByUri(String uri) throws RepositoryException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#updateIndex(java.util.Set, java.util.Set)
+ */
+ public void updateIndex(Set<String> removedNodes, Set<String> addedNodes) throws RepositoryException, IOException
+ {
+ this.removedNodes = removedNodes;
+ // TODO Auto-generated method stub
+ this.addedNodes = addedNodes;
+
+ }
+
+ /**
+ * @return the removedNodes
+ */
+ public Set<String> getRemovedNodes()
+ {
+ return removedNodes;
+ }
+
+ /**
+ * @return the addedNodes
+ */
+ public Set<String> getAddedNodes()
+ {
+ return addedNodes;
+ }
+
+ }
}
16 years, 8 months
exo-jcr SVN: r522 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-09 10:36:43 -0500 (Mon, 09 Nov 2009)
New Revision: 522
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java
Log:
EXOJCR-202: IndexerCacheLoader updated
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java 2009-11-09 15:36:10 UTC (rev 521)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java 2009-11-09 15:36:43 UTC (rev 522)
@@ -16,7 +16,6 @@
*/
package org.exoplatform.services.jcr.impl.core.query.cacheloader;
-import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.impl.storage.jbosscache.AbstractWriteOnlyCacheLoader;
import org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheStorage;
@@ -26,10 +25,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
/**
@@ -92,8 +89,12 @@
final Set<String> removedNodes = new HashSet<String>();
// nodes that need to be added to the index.
final Set<String> addedNodes = new HashSet<String>();
- final Map<String, List<ItemState>> updatedNodes = new HashMap<String, List<ItemState>>();
+ // node thst must be updated
+ final Set<String> updateNodes = new HashSet<String>();
+
+ //final Map<String, List<ItemState>> updatedNodes = new HashMap<String, List<ItemState>>();
+
for (Modification m : modifications)
{
@@ -104,50 +105,71 @@
switch (m.getType())
{
case PUT_DATA :
- // add node
- // TODO do we need there update for property?
- // if this is property ignore
if (isNode(m.getFqn()))
{
+ // add node
addedNodes.add(uuid);
}
-
+ else
+ {
+ // this is property
+ // TODO do update of node - need uuid of owner node
+ }
break;
case PUT_DATA_ERASE :
- // must be never called
// update node
if (isNode(m.getFqn()))
{
removedNodes.add(uuid);
addedNodes.add(uuid);
}
+ else
+ {
+ // TODO do update of node - need uuid of owner node
+ }
+
break;
case PUT_KEY_VALUE :
// must be never called
// update node
if (isNode(m.getFqn()))
{
- removedNodes.add(uuid);
- addedNodes.add(uuid);
+ if (addedNodes.contains(uuid))
+ {
+ // do nothing - node by uuid will be indexed
+ }
+ else
+ {
+ // update document by this uuid
+ updateNodes.add(uuid);
+ }
}
break;
case REMOVE_DATA :
- // must be never called
// update node
if (isNode(m.getFqn()))
{
addedNodes.add(uuid);
removedNodes.add(uuid);
}
+ else
+ {
+ //TODO do update of owner node
+ //updateNodes.add(owner_uuid);
+ }
break;
case REMOVE_KEY_VALUE :
- // must be never called
- // removed property what to do
+ // removed property - do update node
if (isNode(m.getFqn()))
{
- addedNodes.add(uuid);
- removedNodes.add(uuid);
+ updateNodes.add(uuid);
}
+ else
+ {
+ //TODO do update of owner node
+ //updateNodes.add(owner_uuid);
+ }
+
break;
case REMOVE_NODE :
// if node - remove it, otherwise ignore it
@@ -155,6 +177,11 @@
{
removedNodes.add(uuid);
}
+ else
+ {
+ //TODO do update of owner node
+ //updateNodes.add(owner_uuid);
+ }
break;
case MOVE :
@@ -249,7 +276,7 @@
// }
// }
- for (String uuid : updatedNodes.keySet())
+ for (String uuid : updateNodes)
{
removedNodes.add(uuid);
addedNodes.add(uuid);
16 years, 8 months
exo-jcr SVN: r521 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-11-09 10:36:10 -0500 (Mon, 09 Nov 2009)
New Revision: 521
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
Log:
EXOJCR-204: Test in now based on abstract class
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-09 15:34:11 UTC (rev 520)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-09 15:36:10 UTC (rev 521)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.jbosscache;
-import junit.framework.TestCase;
-
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.core.NamespaceAccessor;
import org.exoplatform.services.jcr.datamodel.InternalQName;
@@ -32,9 +30,7 @@
import org.exoplatform.services.jcr.impl.core.observation.ObservationManagerRegistry;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
-import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.Modification.ModificationType;
import java.util.ArrayList;
import java.util.HashMap;
@@ -53,7 +49,7 @@
* @version $Id: ObservationCacheLoaderTest.java 34360 2009-07-22 23:58:59Z aheritier $
*
*/
-public class ObservationCacheLoaderTest extends TestCase
+public class ObservationCacheLoaderTest extends AbstractCacheLoaderTest
{
private ObservationCacheLoader loader;
@@ -99,6 +95,25 @@
});
}
+ public void testFilterByUUID() throws Exception
+ {
+ QPath node1path = QPath.parse("[]:1[]node:1");
+ NodeData newNode =
+ new TransientNodeData(node1path, Constants.SYSTEM_UUID, 1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
+ Constants.ROOT_UUID, new AccessControlList());
+ DummyListener listener = new DummyListener();
+ registry.addEventListener(listener, new ListenerCriteria(Event.NODE_ADDED, null, true,
+ new String[]{Constants.ROOT_UUID}, null, false, "asd"));
+
+ List<Modification> modifications = new ArrayList<Modification>();
+ modifications.add(addNode(newNode));
+ loader.put(modifications);
+ assertEquals(1, listener.eventList.size());
+ Event event = listener.eventList.get(0);
+ assertEquals(Event.NODE_ADDED, event.getType());
+ assertEquals(lf.createJCRPath(node1path).getAsString(false), event.getPath());
+ }
+
public void testAddNode() throws Exception
{
QPath node1path = QPath.parse("[]:1[]node:1");
@@ -174,7 +189,7 @@
assertEquals(Event.PROPERTY_CHANGED, event.getType());
assertEquals(lf.createJCRPath(prop1path).getAsString(false), event.getPath());
}
-
+
public void testRemoveProperty() throws Exception
{
QPath prop1path = QPath.parse("[]:1[]node:1[]property:1");
@@ -194,47 +209,6 @@
assertEquals(lf.createJCRPath(prop1path).getAsString(false), event.getPath());
}
- public Modification addNode(NodeData data)
- {
- String fqn = "/" + JBossCacheStorage.NODES + "/" + data.getIdentifier();
- return new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- }
-
- public Modification removeNode(NodeData data)
- {
- String fqn = "/" + JBossCacheStorage.NODES + "/" + data.getIdentifier();
- return new Modification(ModificationType.REMOVE_NODE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- }
-
- public Modification addProperty(PropertyData data)
- {
- String fqn = "/" + JBossCacheStorage.PROPS + "/" + data.getIdentifier();
- return new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- }
-
- public Modification updateProperty(PropertyData data)
- {
- String fqn = "/" + JBossCacheStorage.PROPS + "/" + data.getIdentifier();
- Modification modification =
- new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- modification.setOldValue(data);
- return modification;
- }
-
- public Modification removeProperty(PropertyData data)
- {
- String fqn = "/" + JBossCacheStorage.PROPS + "/" + data.getIdentifier();
- Modification modification =
- new Modification(ModificationType.REMOVE_NODE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
- (Object)data);
- modification.setOldValue(data);
- return modification;
- }
-
@Override
protected void tearDown() throws Exception
{
16 years, 8 months
exo-jcr SVN: r520 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-11-09 10:34:11 -0500 (Mon, 09 Nov 2009)
New Revision: 520
Added:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
Log:
EXOJCR-202 : indexer cache loader test
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-09 15:34:11 UTC (rev 520)
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.storage.jbosscache;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public class IndexerCacheLoaderTest extends AbstractCacheLoaderTest
+{
+
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 8 months
exo-jcr SVN: r519 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-11-09 10:30:08 -0500 (Mon, 09 Nov 2009)
New Revision: 519
Added:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
Log:
EXOJCR-204: Added abstract test-class
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java 2009-11-09 15:30:08 UTC (rev 519)
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.storage.jbosscache;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Modification;
+import org.jboss.cache.Modification.ModificationType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This abstract class contains only methods for creating a fake {@link Modification} instances. It doesn't use real cache.
+ *
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id: AbstractCacheLoaderClass.java 34360 2009-07-22 23:58:59Z aheritier $
+ *
+ */
+public abstract class AbstractCacheLoaderTest extends TestCase
+{
+
+ /**
+ * Returns {@link Modification} like as node added. NodeData is written to /$NODE/IDxxxx as an attribute by key ITEM_DATA.
+ *
+ * @param data
+ * @return
+ */
+ public Modification addNode(NodeData data)
+ {
+ String fqn = "/" + JBossCacheStorage.NODES + "/" + data.getIdentifier();
+ return new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
+ (Object)data);
+ }
+
+ /**
+ * Returns {@link Modification} like as node removed. But it is thought, that list is already modified by JDBC loader,
+ * so {@link Modification} instance contains additional data: Key=ITEM_DATA, value=NodeData - data of already removed
+ * node.
+ *
+ * @param data
+ * @return
+ */
+ public Modification removeNode(NodeData data)
+ {
+ String fqn = "/" + JBossCacheStorage.NODES + "/" + data.getIdentifier();
+ return new Modification(ModificationType.REMOVE_NODE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
+ (Object)data);
+ }
+
+ /**
+ * Returns {@link Modification} like as property added. PropertyData is written to /$PROPERTY/IDxxxx as an attribute by key ITEM_DATA.
+ *
+ * @param data
+ * @return
+ */
+ public Modification addProperty(PropertyData data)
+ {
+ String fqn = "/" + JBossCacheStorage.PROPS + "/" + data.getIdentifier();
+ return new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
+ (Object)data);
+ }
+
+ /**
+ * Returns {@link Modification} like as property updated. PropertyData is written to /$PROPERTY/IDxxxx as an attribute by key ITEM_DATA.
+ * But it is thought, that list is already modified by JDBC loader,so {@link Modification} instance contains additional data: Old_Value
+ * filed of {@link Modification} instance contains same PropertyData (meaning that there was an old value, so this is an update, no add
+ * action)
+ *
+ * @param data
+ * @return
+ */
+ public Modification updateProperty(PropertyData data)
+ {
+ String fqn = "/" + JBossCacheStorage.PROPS + "/" + data.getIdentifier();
+ Modification modification =
+ new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
+ (Object)data);
+ modification.setOldValue(data);
+ return modification;
+ }
+
+ /**
+ * Returns {@link Modification} like as property removed. But it is thought, that list is already modified by JDBC loader,
+ * so {@link Modification} instance contains additional data: Key=ITEM_DATA, value=PropertyData - data of already removed
+ * node.
+ *
+ * @param data
+ * @return
+ */
+ public Modification removeProperty(PropertyData data)
+ {
+ String fqn = "/" + JBossCacheStorage.PROPS + "/" + data.getIdentifier();
+ Modification modification =
+ new Modification(ModificationType.REMOVE_NODE, Fqn.fromString(fqn), (Object)JBossCacheStorage.ITEM_DATA,
+ (Object)data);
+ modification.setOldValue(data);
+ return modification;
+ }
+
+ /**
+ * Generates list of {@link Modification}-s, containing add to /$SESSION attribute sessionId and userId with corresponding values.
+ * This imitates situation when WorkspaceDataManager walks thought transaction changes log, and on the beginning of each plain
+ * changes log, such sequence is generated.
+ *
+ * @param sessionId
+ * @param userId
+ * @return
+ */
+ public List<Modification> setSession(String sessionId, String userId)
+ {
+ List<Modification> list = new ArrayList<Modification>();
+ // add SessionID by the key SESSION_ID
+ list.add(new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString("/" + JBossCacheStorage.SESSION),
+ JBossCacheStorage.SESSION_ID, sessionId));
+ // add UserID by the key USER_ID
+ list.add(new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString("/" + JBossCacheStorage.SESSION),
+ JBossCacheStorage.USER_ID, userId));
+ // remove all the attributes from /$SESSION
+ list.add(new Modification(ModificationType.REMOVE_DATA, Fqn.fromString("/" + JBossCacheStorage.SESSION)));
+ // return
+ return list;
+ }
+
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 8 months
exo-jcr SVN: r518 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-11-09 10:07:10 -0500 (Mon, 09 Nov 2009)
New Revision: 518
Removed:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
Log:
EXOJCR-202 : removed test
Deleted: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java 2009-11-09 14:55:24 UTC (rev 517)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java 2009-11-09 15:07:10 UTC (rev 518)
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.storage.jbosscache;
-
-import junit.framework.TestCase;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
- *
- */
-public abstract class AbstractCacheLoaderTest extends TestCase
-{
- protected Cache<Serializable, Object> cache;
-
- protected JBossCacheStorageConnection jBossCacheStorageConnection;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- CacheFactory<Serializable, Object> factory = new DefaultCacheFactory<Serializable, Object>();
- cache = factory.createCache(createCacheConfiguration());
-
- Node<Serializable, Object> cacheRoot = cache.getRoot();
-
- // run cache
- cache.create();
- cache.start();
- cache.startBatch();
- // prepare cache structures
- Node<Serializable, Object> nodes = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.NODES));
- Node<Serializable, Object> props = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.PROPS));
-
- this.cache.endBatch(true);
-
- // JCR connection
- jBossCacheStorageConnection = new JBossCacheStorageConnection(cache, nodes, props);
- }
-
- /**
- * Create cache configuration.
- * @return
- */
- protected Configuration createCacheConfiguration()
- {
- Configuration config = new Configuration();
- config.setInvocationBatchingEnabled(true);
- config.setCacheLoaderConfig(createCacheLoaderConfig());
- return config;
- }
-
- /**
- * Create cache configuration.
- * @return
- */
- protected CacheLoaderConfig createCacheLoaderConfig()
- {
- CacheLoaderConfig cacheLoaderConfig = new CacheLoaderConfig();
- cacheLoaderConfig.setPassivation(false);
- cacheLoaderConfig.setShared(false);
- cacheLoaderConfig.addIndividualCacheLoaderConfig(createIndividualCacheLoaderConfig());
- return cacheLoaderConfig;
- };
-
- protected abstract IndividualCacheLoaderConfig createIndividualCacheLoaderConfig();
-
-}
Deleted: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-09 14:55:24 UTC (rev 517)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-09 15:07:10 UTC (rev 518)
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.storage.jbosscache;
-
-import org.exoplatform.services.jcr.access.AccessControlList;
-import org.exoplatform.services.jcr.datamodel.InternalQName;
-import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.core.SessionDataManager;
-import org.exoplatform.services.jcr.impl.core.SessionImpl;
-import org.exoplatform.services.jcr.impl.core.query.IndexException;
-import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
-import org.exoplatform.services.jcr.impl.core.query.SearchManager;
-import org.exoplatform.services.jcr.impl.core.query.cacheloader.IndexerCacheLoader;
-import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.jboss.cache.Modification;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.query.InvalidQueryException;
-import javax.jcr.query.Query;
-
-/**
- * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
- *
- */
-public class IndexerCacheLoaderTest extends AbstractCacheLoaderTest
-{
- private final Log log = ExoLogger.getLogger(IndexerCacheLoaderTest.class.getName());
-
- private IndexerCacheLoader loader;
-
- private FakeSearchManager manager;
-
- public void testAddNode() throws Exception
- {
-
- }
-
- public void testAddRoot() throws Exception
- {
- // add root (/)
- jBossCacheStorageConnection.add(new TransientNodeData(Constants.ROOT_PATH, Constants.ROOT_UUID, 1,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], 0, null, new AccessControlList()));
- jBossCacheStorageConnection.commit();
-
- assertTrue(manager.getRemovedNodes().isEmpty());
- assertFalse(manager.getAddedNodes().isEmpty());
-
- }
-
- /**
- * @see org.exoplatform.services.jcr.impl.storage.jbosscache.AbstractCacheLoaderTest#createIndividualCacheLoaderConfig()
- */
- @Override
- protected IndividualCacheLoaderConfig createIndividualCacheLoaderConfig()
- {
- IndividualCacheLoaderConfig individualCacheLoaderConfig = new IndividualCacheLoaderConfig();
- loader = new IndexerCacheLoader();
- manager = new FakeSearchManager();
- loader.registerSearchManager(manager);
- individualCacheLoaderConfig.setCacheLoader(loader);
- return individualCacheLoaderConfig;
- }
-
- class FakeSearchManager implements SearchManager
- {
-
- private Set<String> removedNodes;
-
- private Set<String> addedNodes;
-
- public Query createQuery(SessionImpl session, SessionDataManager sessionDataManager, Node node)
- throws InvalidQueryException, RepositoryException
- {
- return null;
- }
-
- public Query createQuery(SessionImpl session, SessionDataManager sessionDataManager, String statement,
- String language) throws InvalidQueryException, RepositoryException
- {
- return null;
- }
-
- public Set<String> getAddedNodes()
- {
- return addedNodes;
- }
-
- public Set<String> getFieldNames() throws IndexException
- {
- return null;
- }
-
- public QueryHandler getHandler()
- {
- return null;
- }
-
- public Set<String> getNodesByNodeType(InternalQName nodeType) throws RepositoryException
- {
- return null;
- }
-
- public Set<String> getNodesByUri(String uri) throws RepositoryException
- {
- return null;
- }
-
- public Set<String> getRemovedNodes()
- {
- return removedNodes;
- }
-
- public void updateIndex(Set<String> removedNodes, Set<String> addedNodes) throws RepositoryException, IOException
- {
- this.removedNodes = removedNodes;
- this.addedNodes = addedNodes;
- }
- }
-
- private class DummyCacheLoader extends AbstractWriteOnlyCacheLoader
- {
-
- /**
- * @see org.exoplatform.services.jcr.impl.storage.jbosscache.AbstractWriteOnlyCacheLoader#put(java.util.List)
- */
- @Override
- public void put(List<Modification> modifications) throws Exception
- {
- log.info("put:" + modifications);
-
- }
- }
-}
16 years, 8 months
exo-jcr SVN: r517 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-09 09:55:24 -0500 (Mon, 09 Nov 2009)
New Revision: 517
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCWorkspaceDataContainerTester.java
Log:
EXOJCR-201 : test JDBCCacheLoadetTest.
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-09 14:50:44 UTC (rev 516)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-09 14:55:24 UTC (rev 517)
@@ -19,6 +19,11 @@
package org.exoplatform.services.jcr.impl.storage.jbosscache;
+/**
+ * @author <a href="mailto:reshetnyak.alex@gmail.com">Alex Reshetnyak</a>
+ * @version $Id$
+ *
+ */
public class JDBCCacheLoaderTest extends JBossCacheStorageConnectionTest
{
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCWorkspaceDataContainerTester.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCWorkspaceDataContainerTester.java 2009-11-09 14:50:44 UTC (rev 516)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCWorkspaceDataContainerTester.java 2009-11-09 14:55:24 UTC (rev 517)
@@ -26,6 +26,11 @@
import org.jboss.cache.factories.annotations.NonVolatile;
import org.picocontainer.Startable;
+/**
+ * @author <a href="mailto:reshetnyak.alex@gmail.com">Alex Reshetnyak</a>
+ * @version $Id$
+ *
+ */
@NonVolatile
class JDBCWorkspaceDataContainerTester extends WorkspaceDataContainerBase implements Startable
{
16 years, 8 months
exo-jcr SVN: r516 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-09 09:50:44 -0500 (Mon, 09 Nov 2009)
New Revision: 516
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
Log:
EXOJCR-201: test for loader update
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-09 14:43:13 UTC (rev 515)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-09 14:50:44 UTC (rev 516)
@@ -18,14 +18,10 @@
*/
package org.exoplatform.services.jcr.impl.storage.jbosscache;
-import java.io.Serializable;
-import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
-import org.jboss.cache.CacheSPI;
-
public class JDBCCacheLoaderTest extends JBossCacheStorageConnectionTest
{
-
+
/**
* {@inheritDoc}
*/
@@ -45,10 +41,12 @@
@Override
protected void initJBC()
{
- WorkspaceDataContainer persistentContainer = new JDBCWorkspaceDataContainerTester();
+
+ // persistence container
+ //WorkspaceDataContainer persistentContainer = new JDBCWorkspaceDataContainerTester();
- ((CacheSPI<Serializable, Object>)cache).getComponentRegistry().registerComponent(persistentContainer,
- WorkspaceDataContainer.class);
+ //((CacheSPI<Serializable, Object>)cache).getComponentRegistry().registerComponent(persistentContainer,
+ // WorkspaceDataContainer.class);
}
@Override
@@ -59,8 +57,11 @@
public void testAddNode() throws Exception
{
+ // prepare
super.testAddNode();
conn.commit();
+
+ // tests it
}
}
16 years, 8 months