exo-jcr SVN: r545 - in jcr/branches/1.12.0-JBC/component/core/src: test/java/org/exoplatform/services/jcr/impl/storage/jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-10 05:53:27 -0500 (Tue, 10 Nov 2009)
New Revision: 545
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/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
Log:
EXOJCR-202: IndexerCacheLoaderTest tests 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-10 10:46:45 UTC (rev 544)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java 2009-11-10 10:53:27 UTC (rev 545)
@@ -98,10 +98,13 @@
for (Modification m : modifications)
{
- String uuid = parseUUID(m.getFqn());
+ // check do we need skip modification
+ // $NODES ,$PROPS cache-node modification and child cache-node (/$NODES/nodeUUID/[]childNodeName) are skipped
+ // we process only modifications with Fqn like /[$NODES | $PROPS]/UUID
+ if (m.getFqn().size() == 2)
+ {
+ String uuid = parseUUID(m.getFqn());
- if (uuid != null)
- {
switch (m.getType())
{
case PUT_DATA :
@@ -130,7 +133,6 @@
break;
case PUT_KEY_VALUE :
- // must be never called
// update node
if (isNode(m.getFqn()))
{
@@ -149,7 +151,6 @@
// update node
if (isNode(m.getFqn()))
{
- addedNodes.add(uuid);
removedNodes.add(uuid);
}
else
@@ -162,7 +163,10 @@
// removed property - do update node
if (isNode(m.getFqn()))
{
- updateNodes.add(uuid);
+ if (!removedNodes.contains(uuid))
+ {
+ updateNodes.add(uuid);
+ }
}
else
{
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-10 10:46:45 UTC (rev 544)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-10 10:53:27 UTC (rev 545)
@@ -36,6 +36,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -88,9 +89,15 @@
modification.addAll(addNode(newNode));
modification.addAll(addProperty(newProperty));
indexerCacheLoader.put(modification);
- assertNotNull(searchManager.getAddedNodes());
- assertNotNull(searchManager.getRemovedNodes());
+
+ //check
+ assertFalse(searchManager.getAddedNodes().isEmpty());
assertTrue(searchManager.getRemovedNodes().isEmpty());
+
+ Set<String> expectedAddUUID = new HashSet<String>();
+ expectedAddUUID.add("n123456");
+ assertEquals(expectedAddUUID.size(), searchManager.getAddedNodes().size());
+ assertTrue(expectedAddUUID.containsAll(searchManager.getAddedNodes()));
}
public void testRemoveNode() throws Exception
@@ -109,11 +116,144 @@
modification.addAll(removeProperty(prop));
indexerCacheLoader.put(modification);
assertTrue(searchManager.getAddedNodes().isEmpty());
- assertNotNull(searchManager.getRemovedNodes());
assertFalse(searchManager.getRemovedNodes().isEmpty());
+ Set<String> expectedRemUUID = new HashSet<String>();
+ expectedRemUUID.add("n123456");
+ assertEquals(searchManager.getRemovedNodes().size(), expectedRemUUID.size());
+ assertTrue(expectedRemUUID.containsAll(searchManager.getRemovedNodes()));
}
+ public void testUpdateProperty() throws Exception
+ {
+ // two updates on same node
+ QPath node1path = QPath.parse("[]:1[]node:1");
+ QPath prop1path = QPath.makeChildPath(node1path, Constants.JCR_PRIMARYTYPE);
+ QPath prop2path = QPath.makeChildPath(node1path, new InternalQName(Constants.NS_JCR_URI, "myType"));
+ PropertyData prop1 = new TransientPropertyData(prop1path, "p111123456", 0, PropertyType.NAME, "n123456", false);
+ PropertyData prop2 = new TransientPropertyData(prop2path, "p222123456", 0, PropertyType.STRING, "n123456", false);
+
+ // one update on another node
+ QPath node2path = QPath.parse("[]:1[]node:1");
+ QPath prop3path = QPath.makeChildPath(node1path, Constants.JCR_PRIMARYTYPE);
+ PropertyData prop3 = new TransientPropertyData(prop1path, "p333123456", 0, PropertyType.NAME, "n2123456", false);
+ List<Modification> modification = new ArrayList<Modification>();
+
+ modification.addAll(updateProperty(prop1));
+ modification.addAll(updateProperty(prop2));
+ modification.addAll(updateProperty(prop3));
+ indexerCacheLoader.put(modification);
+ assertFalse(searchManager.getAddedNodes().isEmpty());
+ assertFalse(searchManager.getRemovedNodes().isEmpty());
+
+ Set<String> expectedRemUUID = new HashSet<String>();
+ expectedRemUUID.add("n123456");
+ expectedRemUUID.add("n2123456");
+ assertEquals(searchManager.getRemovedNodes().size(), expectedRemUUID.size());
+ assertTrue(expectedRemUUID.containsAll(searchManager.getRemovedNodes()));
+
+ Set<String> expectedAddUUID = new HashSet<String>();
+ expectedAddUUID.add("n123456");
+ expectedAddUUID.add("n2123456");
+ assertEquals(searchManager.getAddedNodes().size(), expectedAddUUID.size());
+ assertTrue(expectedAddUUID.containsAll(searchManager.getAddedNodes()));
+ }
+
+ public void testAddNewPropertyUpdate() throws Exception
+ {
+ QPath node1path = QPath.parse("[]:1[]node:1");
+
+ QPath prop1path = QPath.makeChildPath(node1path, new InternalQName(Constants.NS_JCR_URI, "myProp"));
+ PropertyData prop1 = new TransientPropertyData(prop1path, "p222123456", 0, PropertyType.STRING, "n123456", false);
+
+ List<Modification> modification = new ArrayList<Modification>();
+
+ modification.addAll(addProperty(prop1));
+ indexerCacheLoader.put(modification);
+
+ assertFalse(searchManager.getAddedNodes().isEmpty());
+ assertFalse(searchManager.getRemovedNodes().isEmpty());
+
+ Set<String> expectedRemUUID = new HashSet<String>();
+ expectedRemUUID.add("n123456");
+ assertEquals(searchManager.getRemovedNodes().size(), expectedRemUUID.size());
+ assertTrue(expectedRemUUID.containsAll(searchManager.getRemovedNodes()));
+
+ Set<String> expectedAddUUID = new HashSet<String>();
+ expectedAddUUID.add("n123456");
+ assertEquals(searchManager.getAddedNodes().size(), expectedAddUUID.size());
+ assertTrue(expectedAddUUID.containsAll(searchManager.getAddedNodes()));
+ }
+
+ public void testRemovePropertyUpdate() throws Exception
+ {
+ QPath node1path = QPath.parse("[]:1[]node:1");
+
+ QPath prop1path = QPath.makeChildPath(node1path, new InternalQName(Constants.NS_JCR_URI, "myProp"));
+ PropertyData prop1 = new TransientPropertyData(prop1path, "p222123456", 0, PropertyType.STRING, "n123456", false);
+
+ List<Modification> modification = new ArrayList<Modification>();
+
+ modification.addAll(this.removeProperty(prop1));
+ indexerCacheLoader.put(modification);
+
+ assertFalse(searchManager.getAddedNodes().isEmpty());
+ assertFalse(searchManager.getRemovedNodes().isEmpty());
+
+ Set<String> expectedRemUUID = new HashSet<String>();
+ expectedRemUUID.add("n123456");
+ assertEquals(searchManager.getRemovedNodes().size(), expectedRemUUID.size());
+ assertTrue(expectedRemUUID.containsAll(searchManager.getRemovedNodes()));
+
+ Set<String> expectedAddUUID = new HashSet<String>();
+ expectedAddUUID.add("n123456");
+ assertEquals(searchManager.getAddedNodes().size(), expectedAddUUID.size());
+ assertTrue(expectedAddUUID.containsAll(searchManager.getAddedNodes()));
+ }
+
+ public void testMoveNode() throws Exception
+ {
+ QPath srcpath = QPath.parse("[]:1[]node:1");
+ QPath destpath = QPath.parse("[]:1[]nodeDest:1");
+ NodeData srcNode =
+ new TransientNodeData(srcpath, "n123456", 1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
+ Constants.ROOT_UUID, new AccessControlList());
+
+ QPath prop1path = QPath.makeChildPath(srcpath, Constants.JCR_PRIMARYTYPE);
+ PropertyData srcProperty =
+ new TransientPropertyData(prop1path, "p123456", 0, PropertyType.NAME, "n123456", false);
+
+ NodeData destNode =
+ new TransientNodeData(destpath, "n222222", 1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
+ Constants.ROOT_UUID, new AccessControlList());
+
+ QPath prop2path = QPath.makeChildPath(destpath, Constants.JCR_PRIMARYTYPE);
+ PropertyData destProperty =
+ new TransientPropertyData(prop2path, "p222222", 0, PropertyType.NAME, "n222222", false);
+
+ List<Modification> modification = new ArrayList<Modification>();
+
+ modification.addAll(addNode(destNode));
+ modification.addAll(addProperty(destProperty));
+ modification.addAll(removeNode(srcNode));
+ modification.addAll(removeProperty(srcProperty));
+ indexerCacheLoader.put(modification);
+
+ //check
+ assertFalse(searchManager.getAddedNodes().isEmpty());
+ assertFalse(searchManager.getRemovedNodes().isEmpty());
+
+ Set<String> expectedAddUUID = new HashSet<String>();
+ expectedAddUUID.add("n222222");
+ assertEquals(searchManager.getAddedNodes().size(), expectedAddUUID.size());
+ assertTrue(expectedAddUUID.containsAll(searchManager.getAddedNodes()));
+
+ Set<String> expectedRemoveUUID = new HashSet<String>();
+ expectedRemoveUUID.add("n123456");
+ assertEquals(searchManager.getRemovedNodes().size(), expectedRemoveUUID.size());
+ assertTrue(expectedRemoveUUID.containsAll(searchManager.getRemovedNodes()));
+ }
+
private class DummySearchManager implements SearchManager
{
16 years, 8 months
exo-jcr SVN: r544 - 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-10 05:46:45 -0500 (Tue, 10 Nov 2009)
New Revision: 544
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 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-10 10:32:38 UTC (rev 543)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-10 10:46:45 UTC (rev 544)
@@ -19,13 +19,28 @@
package org.exoplatform.services.jcr.impl.storage.jbosscache;
import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+import org.apache.commons.dbcp.BasicDataSourceFactory;
import org.exoplatform.services.idgenerator.impl.IDGeneratorServiceImpl;
+import org.exoplatform.services.jcr.config.CacheEntry;
import org.exoplatform.services.jcr.config.ContainerEntry;
+import org.exoplatform.services.jcr.config.LockManagerEntry;
+import org.exoplatform.services.jcr.config.LockPersisterEntry;
+import org.exoplatform.services.jcr.config.QueryHandlerEntry;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.ValueStorageEntry;
+import org.exoplatform.services.jcr.config.ValueStorageFilterEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
@@ -35,6 +50,7 @@
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
import org.exoplatform.services.jcr.util.ConfigurationHelper;
import org.exoplatform.services.jcr.util.IdGenerator;
+import org.exoplatform.services.naming.InitialContextInitializer;
import org.jboss.cache.CacheSPI;
@@ -71,8 +87,6 @@
//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"));
@@ -81,13 +95,20 @@
// Initialize id generator.
new IdGenerator(new IDGeneratorServiceImpl());
+
+ // Set system property Context.INITIAL_CONTEXT_FACTORY to initial context.
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.exoplatform.services.naming.SimpleContextFactory");
+
+ // Create data source. Will be created new data source to new test.
+ String dataSourceName = "jdbcjcr_" + IdGenerator.generate();
+ createNewDataSource(dataSourceName);
- WorkspaceEntry ws = configurationHelper.getNewWs("ws_to_jbdc_cache_loader", true, "data-source", "/target/temp/ws_to_jbdc_cache_loader/lalues", containerEntry);
+ WorkspaceEntry ws = getNewWs("ws_to_jbdc_cache_loader", true, dataSourceName, "/target/temp/ws_to_jbdc_cache_loader/lalues", containerEntry);
RepositoryEntry re = new RepositoryEntry();
re.addWorkspace(ws);
- ValueStoragePluginProvider valueStoragePluginProvider = new StandaloneStoragePluginProvider(ws);
+ ValueStoragePluginProvider valueStoragePluginProvider = new StandaloneStoragePluginProvider(ws);
persistentContainer = new JDBCWorkspaceDataContainer(ws, re, null, valueStoragePluginProvider);
@@ -124,5 +145,121 @@
// tests it
}
+
+ public WorkspaceEntry getNewWs(String wsName, boolean isMultiDb, String dsName, String vsPath, ContainerEntry entry)
+ throws Exception
+ {
+
+ List params = new ArrayList();
+
+ params.add(new SimpleParameterEntry("sourceName", dsName));
+ params.add(new SimpleParameterEntry("db-type", "generic"));
+ params.add(new SimpleParameterEntry("multi-db", isMultiDb ? "true" : "false"));
+ params.add(new SimpleParameterEntry("update-storage", "true"));
+ params.add(new SimpleParameterEntry("max-buffer-size", "204800"));
+
+ if (entry.getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT) != null)
+ {
+ params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_DIALECT, entry
+ .getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT)));
+ }
+
+ String oldSwap = entry.getParameterValue("swap-directory");
+ String newSwap = oldSwap.substring(0, oldSwap.lastIndexOf('/')) + '/' + wsName;
+
+ params.add(new SimpleParameterEntry("swap-directory", newSwap));
+
+ ContainerEntry containerEntry =
+ new ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
+ (ArrayList) params);
+ containerEntry.setParameters(params);
+
+ if (vsPath != null)
+ {
+
+ ArrayList<ValueStorageFilterEntry> vsparams = new ArrayList<ValueStorageFilterEntry>();
+ ValueStorageFilterEntry filterEntry = new ValueStorageFilterEntry();
+ filterEntry.setPropertyType("Binary");
+ vsparams.add(filterEntry);
+
+ ValueStorageEntry valueStorageEntry =
+ new ValueStorageEntry("org.exoplatform.services.jcr.impl.storage.value.fs.SimpleFileValueStorage",
+ vsparams);
+ ArrayList<SimpleParameterEntry> spe = new ArrayList<SimpleParameterEntry>();
+ spe.add(new SimpleParameterEntry("path", vsPath));
+ valueStorageEntry.setId(IdGenerator.generate());
+ valueStorageEntry.setParameters(spe);
+ valueStorageEntry.setFilters(vsparams);
+
+ // containerEntry.setValueStorages();
+ containerEntry.setParameters(params);
+ ArrayList list = new ArrayList(1);
+ list.add(valueStorageEntry);
+
+ containerEntry.setValueStorages(list);
+
+ }
+
+ // Indexer
+ ArrayList qParams = new ArrayList();
+ qParams.add(new SimpleParameterEntry("indexDir", "../temp/index/" + IdGenerator.generate()));
+ QueryHandlerEntry qEntry =
+ new QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex", qParams);
+
+ WorkspaceEntry workspaceEntry =
+ new WorkspaceEntry(wsName != null ? wsName : IdGenerator.generate(), "nt:unstructured");
+ workspaceEntry.setContainer(containerEntry);
+
+ ArrayList cacheParams = new ArrayList();
+
+ cacheParams.add(new SimpleParameterEntry("maxSize", "2000"));
+ cacheParams.add(new SimpleParameterEntry("liveTime", "20m"));
+ CacheEntry cacheEntry = new CacheEntry(cacheParams);
+ cacheEntry.setType("org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl");
+
+ workspaceEntry.setCache(cacheEntry);
+
+ workspaceEntry.setQueryHandler(qEntry);
+
+ LockManagerEntry lockManagerEntry = new LockManagerEntry();
+ lockManagerEntry.setTimeout(900000);
+ LockPersisterEntry persisterEntry = new LockPersisterEntry();
+ persisterEntry.setType("org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister");
+ ArrayList lpParams = new ArrayList();
+ lpParams.add(new SimpleParameterEntry("path", "../temp/lock"));
+ persisterEntry.setParameters(lpParams);
+ lockManagerEntry.setPersister(persisterEntry);
+ workspaceEntry.setLockManager(lockManagerEntry);
+
+ // workspaceEntry
+ return workspaceEntry;
+ }
+
+ public void createNewDataSource(String dataSourceName) throws Exception
+ {
+
+ Properties properties = new Properties();
+
+ properties.setProperty("driverClassName", "org.hsqldb.jdbcDriver");
+ String newurl = "jdbc:hsqldb:file:target/temp/data/" + dataSourceName;
+
+ properties.setProperty("url", newurl);
+ properties.setProperty("username", "sa");
+ properties.setProperty("password", "");
+ DataSource bds = BasicDataSourceFactory.createDataSource(properties);
+ if (!newurl.contains("hsqldb"))
+ {
+ createDatabase(bds, dataSourceName);
+ }
+
+ new InitialContext().rebind(dataSourceName, bds);
+ }
+
+ private void createDatabase(DataSource ds, String dbName) throws SQLException
+ {
+ Connection connection = ds.getConnection();
+ PreparedStatement st = connection.prepareStatement("create database " + dbName);
+ st.executeQuery();
+ }
}
16 years, 8 months
exo-jcr SVN: r543 - 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-10 05:32:38 -0500 (Tue, 10 Nov 2009)
New Revision: 543
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
Log:
EXOJCR-204: Updated abstract test-class
Modified: 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-10 10:17:00 UTC (rev 542)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java 2009-11-10 10:32:38 UTC (rev 543)
@@ -180,7 +180,6 @@
String fqn = "/" + JBossCacheStorage.PROPS + "/" + data.getIdentifier();
Modification modification =
new Modification(ModificationType.REMOVE_NODE, Fqn.fromString(fqn), JBossCacheStorage.ITEM_DATA, data);
- modification.setOldValue(data);
list.add(modification);
return list;
}
16 years, 8 months
exo-jcr SVN: r542 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-10 05:17:00 -0500 (Tue, 10 Nov 2009)
New Revision: 542
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java
Log:
EXOJCR-205: add print debug information
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java 2009-11-10 10:14:41 UTC (rev 541)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java 2009-11-10 10:17:00 UTC (rev 542)
@@ -238,7 +238,7 @@
{
if (lockManager.hasPendingLocks(nodeIdentifier))
{
- log.info("Perform lock operation nodeIdentifier=" + nodeIdentifier);
+ System.out.println("Perform lock operation nodeIdentifier=" + nodeIdentifier);
lockManager.internalLock(nodeIdentifier);
}
else
@@ -288,7 +288,7 @@
{
try
{
- log.info("Perform lock operation nodeIdentifier=" + nodeIdentifier + " sessionId=" + sessionId);
+ System.out.println("Perform unlock operation nodeIdentifier=" + nodeIdentifier + " sessionId=" + sessionId);
lockManager.internalUnLock(nodeIdentifier, sessionId);
}
catch (LockException e)
16 years, 8 months
exo-jcr SVN: r541 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-10 05:14:41 -0500 (Tue, 10 Nov 2009)
New Revision: 541
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java
Log:
EXOJCR-205: fix test
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java 2009-11-10 10:01:36 UTC (rev 540)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java 2009-11-10 10:14:41 UTC (rev 541)
@@ -107,11 +107,11 @@
{
performLock(lockChanges, sessionId);
}
- else if (lockChanges.get(0).getType() == ModificationType.REMOVE_KEY_VALUE
- && lockChanges.get(1).getType() == ModificationType.REMOVE_KEY_VALUE)
+ else if (lockChanges.get(0).getType() == ModificationType.REMOVE_NODE
+ && lockChanges.get(1).getType() == ModificationType.REMOVE_NODE)
{
PropertyData propertyData = (PropertyData)lockChanges.get(0).getOldValue();
- performUnLock(lockChanges, sessionId, propertyData.getParentIdentifier());
+ performUnLock(lockChanges, propertyData.getParentIdentifier(), sessionId);
}
else
{
@@ -161,6 +161,8 @@
case REMOVE_DATA :
break;
case REMOVE_KEY_VALUE :
+ break;
+ case REMOVE_NODE :
if (m.getKey().equals(JBossCacheStorage.ITEM_DATA))
{
PropertyData propertyData = (PropertyData)m.getValue();
@@ -172,8 +174,6 @@
}
}
break;
- case REMOVE_NODE :
- break;
case MOVE :
break;
default :
@@ -183,34 +183,41 @@
else if (m.getFqn().hasElement(JBossCacheStorage.NODES))
{
int nodesPos = getElementPosition(m.getFqn(), JBossCacheStorage.NODES);
- if (m.getFqn().size() == nodesPos + 1)
+ if (m.getFqn().size() == nodesPos + 2)
{
// this is a node and node is locked
String nodeIdentifier = (String)m.getFqn().get(nodesPos + 1);
- if (lockManager.hasLockNode(nodeIdentifier))
+
+ switch (m.getType())
{
- switch (m.getType())
- {
- case PUT_DATA_ERASE :
- break;
- case PUT_DATA :
+ case PUT_DATA_ERASE :
+ break;
+ case PUT_DATA :
+ if (lockManager.hasLockNode(nodeIdentifier))
+ {
removedLock.remove(nodeIdentifier);
- break;
- case PUT_KEY_VALUE :
- break;
- case REMOVE_DATA :
- break;
- case REMOVE_KEY_VALUE :
- break;
- case REMOVE_NODE :
+ }
+ break;
+ case PUT_KEY_VALUE :
+ break;
+ case REMOVE_DATA :
+ break;
+ case REMOVE_KEY_VALUE :
+ break;
+ case REMOVE_NODE :
+ if (lockManager.hasLockNode(nodeIdentifier))
+ {
removedLock.add(nodeIdentifier);
- break;
- case MOVE :
+ }
+ break;
+ case MOVE :
+ if (lockManager.hasLockNode(nodeIdentifier))
+ {
removedLock.remove(nodeIdentifier);
- break;
- default :
- throw new CacheException("Unknown modification " + m.getType());
- }
+ }
+ break;
+ default :
+ throw new CacheException("Unknown modification " + m.getType());
}
}
}
@@ -231,6 +238,7 @@
{
if (lockManager.hasPendingLocks(nodeIdentifier))
{
+ log.info("Perform lock operation nodeIdentifier=" + nodeIdentifier);
lockManager.internalLock(nodeIdentifier);
}
else
@@ -276,11 +284,12 @@
}
}
- private void performUnLock(List<Modification> lockChanges, String sessionId, String nodeIdentifier)
+ private void performUnLock(List<Modification> lockChanges, String nodeIdentifier, String sessionId)
{
try
{
- lockManager.internalUnLock(sessionId, nodeIdentifier);
+ log.info("Perform lock operation nodeIdentifier=" + nodeIdentifier + " sessionId=" + sessionId);
+ lockManager.internalUnLock(nodeIdentifier, sessionId);
}
catch (LockException e)
{
16 years, 8 months
exo-jcr SVN: r540 - 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-10 05:01:36 -0500 (Tue, 10 Nov 2009)
New Revision: 540
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
Log:
EXOJCR-204: Updated test
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-10 09:03:50 UTC (rev 539)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-10 10:01:36 UTC (rev 540)
@@ -70,10 +70,12 @@
final Map<String, String> nss = new HashMap<String, String>();
- ns.put("jcr", "http:jcr");
+ ns.put("jcr", "http://jcr");
+ nss.put("http://jcr", "jcr");
ns.put("", "");
- nss.put("http:jcr", "jcr");
nss.put("", "");
+ ns.put("nt", "http://nt");
+ nss.put("http://nt", "nt");
this.lf = new LocationFactory(new NamespaceAccessor()
{
@@ -216,6 +218,29 @@
assertEquals(userId, event.getUserID());
}
+ public void testFilterByNodeType() 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());
+ NodeData newNode2 =
+ new TransientNodeData(node1path, Constants.SYSTEM_UUID, 1, Constants.NT_RESOURCE, new InternalQName[0], 0,
+ Constants.ROOT_UUID, new AccessControlList());
+ DummyListener listener = new DummyListener();
+ // listening only to NT_RESOURCE nodes
+ registry.addEventListener(listener, new ListenerCriteria(Event.NODE_ADDED,
+ lf.parseAbsPath("/").getInternalPath(), true, null, new InternalQName[]{Constants.NT_RESOURCE}, false, "session1"));
+
+ List<Modification> modifications = new ArrayList<Modification>(setSession("session1", "admin"));
+ modifications.addAll(addNode(newNode));
+ modifications.addAll(addNode(newNode2));
+ modifications.addAll(removeSession());
+ loader.put(modifications);
+ // one event expected
+ assertEvent(Event.NODE_ADDED, node1path, listener, "admin");
+ }
+
@Override
protected void tearDown() throws Exception
{
16 years, 8 months
exo-jcr SVN: r539 - in jcr/branches/1.12.0-JBC/component/core/src: test/java/org/exoplatform/services/jcr/impl/storage/jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-11-10 04:03:50 -0500 (Tue, 10 Nov 2009)
New Revision: 539
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
Log:
EXOJCR-204: Updated test and cache loader
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoader.java 2009-11-10 09:00:50 UTC (rev 538)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoader.java 2009-11-10 09:03:50 UTC (rev 539)
@@ -31,6 +31,7 @@
import org.exoplatform.services.log.Log;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
+import org.jboss.cache.Modification.ModificationType;
import org.jboss.cache.factories.annotations.Inject;
import java.util.List;
@@ -53,8 +54,10 @@
private final Fqn nodeFqn = Fqn.fromString(JBossCacheStorage.NODES);
- private final Fqn propFqn = Fqn.fromString(JBossCacheStorage.PROPS);
+ private final Fqn propertyFqn = Fqn.fromString(JBossCacheStorage.PROPS);
+ private final Fqn sessionFqn = Fqn.fromString(JBossCacheStorage.SESSION);
+
private ObservationManagerRegistry observationManagerRegistry = null;
/**
@@ -78,12 +81,9 @@
{
// get SessionID from list
- // TODO: get real user ID
- String userId = "admin-dummy-id";
-
+ String userId = "";
// get UserID from list
- // TODO: get real session ID
- String sessionId = "user-session-dummy-id";
+ String sessionId = "";
// extract real list from list of modification
// real - means list with out fake modifications containing UserID & etc
@@ -105,35 +105,47 @@
for (Modification m : modifications)
{
- if (m.getFqn().isDirectChildOf(nodeFqn) || m.getFqn().isDirectChildOf(propFqn))
+ if (isItemSubtree(m))
{
ItemData item = getItemData(m);
// TODO: remove hardcode
- if (item == null)
+ if (item != null)
{
- break;
+ int eventType = eventType(m);
+ boolean result = true;
+ // check event type
+ result &= isTypeMatch(criteria, eventType);
+ // check Path
+ result &= isPathMatch(criteria, item);
+ // check UUID
+ result &= isIdentifierMatch(criteria, item);
+ // check NodeType
+ // TODO: FIX nodetype checks
+ //result &= isNodeTypeMatch(criteria, item, changesLog);
+ // check session
+ result &= isSessionMatch(criteria, sessionId);
+ if (result)
+ {
+ String path =
+ observationManagerRegistry.getLocationFactory().createJCRPath(item.getQPath()).getAsString(
+ false);
+ events.add(new EventImpl(eventType, path, userId));
+ }
} // it wasn't able to retrive item's data
- int eventType = eventType(m);
- boolean result = true;
- // check event type
- result &= isTypeMatch(criteria, eventType);
- // check Path
- result &= isPathMatch(criteria, item);
- // check UUID
- result &= isIdentifierMatch(criteria, item);
- // check NodeType
- // TODO: FIX nodetype checks
- //result &= isNodeTypeMatch(criteria, item, changesLog);
- // check session
- result &= isSessionMatch(criteria, sessionId);
- if (result)
- {
- String path =
- observationManagerRegistry.getLocationFactory().createJCRPath(item.getQPath()).getAsString(
- false);
- events.add(new EventImpl(eventType, path, userId));
- }
}
+ // if this is session
+ else if (isSessionSubtree(m))
+ {
+ if (m.getType() == ModificationType.PUT_KEY_VALUE){
+ if (m.getKey().equals(JBossCacheStorage.SESSION_ID))
+ sessionId = (String)m.getValue();
+ else if (m.getKey().equals(JBossCacheStorage.USER_ID))
+ userId = (String)m.getValue();}
+ else if (m.getType() == ModificationType.REMOVE_NODE){
+ sessionId = "";
+ userId = "";
+ }
+ }
}
if (events.size() > 0)
@@ -159,7 +171,7 @@
// node added
return Event.NODE_ADDED;
}
- else if (modification.getFqn().isDirectChildOf(propFqn))
+ else if (modification.getFqn().isDirectChildOf(propertyFqn))
{
// property added or changed
if (modification.getOldValue() != null)
@@ -182,7 +194,7 @@
// node removed
return Event.NODE_REMOVED;
}
- else if (modification.getFqn().isDirectChildOf(propFqn))
+ else if (modification.getFqn().isDirectChildOf(propertyFqn))
{
// property removed
return Event.PROPERTY_REMOVED;
@@ -206,7 +218,6 @@
private boolean isIdentifierMatch(ListenerCriteria criteria, ItemData item)
{
-
if (criteria.getIdentifier() == null)
return true;
// for each uuid in list
@@ -217,19 +228,24 @@
return true;
}
return false;
-
}
+ /**
+ * Check associated parent node path.
+ *
+ * @param criteria
+ * @param item
+ * @return
+ */
private boolean isPathMatch(ListenerCriteria criteria, ItemData item)
{
if (criteria.getAbsPath() == null)
return true;
- // 8.3.3 Only events whose associated parent node is at absPath (or
- // within its subtree, if isDeep is true) will be received.
QPath itemPath = item.getQPath();
return itemPath.isDescendantOf(criteria.getAbsPath(), !criteria.isDeep());
}
+ // shoud be changed in order to obtain parent's data elsewhere. Cache is not accessible from cacheloader.put(List)
@Deprecated
private boolean isNodeTypeMatch(ListenerCriteria criteria, ItemData item, List<Modification> modifications)
throws RepositoryException
@@ -282,9 +298,23 @@
return false;
}
+ protected boolean isItemSubtree(Modification modification)
+ {
+ return modification.getFqn().isDirectChildOf(nodeFqn) || modification.getFqn().isDirectChildOf(propertyFqn);
+ }
+
+ protected boolean isSessionSubtree(Modification modification)
+ {
+ return modification.getFqn().isDirectChildOf(sessionFqn) || modification.getFqn().isChildOrEquals(sessionFqn);
+ }
+
protected ItemData getItemData(Modification m)
{
- return (ItemData)m.getValue();
+ if (m.getValue() instanceof ItemData)
+ {
+ return (ItemData)m.getValue();
+ }
+ return null;
}
}
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-10 09:00:50 UTC (rev 538)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-10 09:03:50 UTC (rev 539)
@@ -103,15 +103,17 @@
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"));
+ new String[]{Constants.ROOT_UUID}, null, false, "session1"));
- List<Modification> modifications = new ArrayList<Modification>();
+ List<Modification> modifications = new ArrayList<Modification>(setSession("session1", "admin"));
modifications.addAll(addNode(newNode));
+ modifications.addAll(removeSession());
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());
+ assertEquals("admin", event.getUserID());
}
public void testAddNode() throws Exception
@@ -122,15 +124,14 @@
Constants.ROOT_UUID, new AccessControlList());
DummyListener listener = new DummyListener();
registry.addEventListener(listener, new ListenerCriteria(Event.NODE_ADDED,
- lf.parseAbsPath("/").getInternalPath(), true, null, null, false, "asd"));
+ lf.parseAbsPath("/").getInternalPath(), true, null, null, false, "session1"));
- List<Modification> modifications = new ArrayList<Modification>();
+ List<Modification> modifications = new ArrayList<Modification>(setSession("session1", "admin"));
modifications.addAll(addNode(newNode));
+ modifications.addAll(removeSession());
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());
+
+ assertEvent(Event.NODE_ADDED, node1path, listener, "admin");
}
public void testRemoveNode() throws Exception
@@ -141,15 +142,14 @@
Constants.ROOT_UUID, new AccessControlList());
DummyListener listener = new DummyListener();
registry.addEventListener(listener, new ListenerCriteria(Event.NODE_REMOVED, lf.parseAbsPath("/")
- .getInternalPath(), true, null, null, false, "asd"));
+ .getInternalPath(), true, null, null, false, "session1"));
- List<Modification> modifications = new ArrayList<Modification>();
+ List<Modification> modifications = new ArrayList<Modification>(setSession("session1", "admin"));
modifications.addAll(removeNode(newNode));
+ modifications.addAll(removeSession());
loader.put(modifications);
- assertEquals(1, listener.eventList.size());
- Event event = listener.eventList.get(0);
- assertEquals(Event.NODE_REMOVED, event.getType());
- assertEquals(lf.createJCRPath(node1path).getAsString(false), event.getPath());
+
+ assertEvent(Event.NODE_REMOVED, node1path, listener, "admin");
}
public void testAddProperty() throws Exception
@@ -160,15 +160,14 @@
DummyListener listener = new DummyListener();
registry.addEventListener(listener, new ListenerCriteria(Event.PROPERTY_ADDED, lf.parseAbsPath("/")
- .getInternalPath(), true, null, null, false, "asd"));
+ .getInternalPath(), true, null, null, false, "session1"));
- List<Modification> modifications = new ArrayList<Modification>();
+ List<Modification> modifications = new ArrayList<Modification>(setSession("session1", "admin"));
modifications.addAll(addProperty(newProperty));
+ modifications.addAll(removeSession());
loader.put(modifications);
- assertEquals(1, listener.eventList.size());
- Event event = listener.eventList.get(0);
- assertEquals(Event.PROPERTY_ADDED, event.getType());
- assertEquals(lf.createJCRPath(prop1path).getAsString(false), event.getPath());
+
+ assertEvent(Event.PROPERTY_ADDED, prop1path, listener, "admin");
}
public void testUpdateProperty() throws Exception
@@ -179,15 +178,14 @@
DummyListener listener = new DummyListener();
registry.addEventListener(listener, new ListenerCriteria(Event.PROPERTY_CHANGED, lf.parseAbsPath("/")
- .getInternalPath(), true, null, null, false, "asd"));
+ .getInternalPath(), true, null, null, false, "session1"));
- List<Modification> modifications = new ArrayList<Modification>();
+ List<Modification> modifications = new ArrayList<Modification>(setSession("session1", "admin"));
modifications.addAll(updateProperty(newProperty));
+ modifications.addAll(removeSession());
loader.put(modifications);
- assertEquals(1, listener.eventList.size());
- Event event = listener.eventList.get(0);
- assertEquals(Event.PROPERTY_CHANGED, event.getType());
- assertEquals(lf.createJCRPath(prop1path).getAsString(false), event.getPath());
+
+ assertEvent(Event.PROPERTY_CHANGED, prop1path, listener, "admin");
}
public void testRemoveProperty() throws Exception
@@ -198,15 +196,24 @@
DummyListener listener = new DummyListener();
registry.addEventListener(listener, new ListenerCriteria(Event.PROPERTY_REMOVED, lf.parseAbsPath("/")
- .getInternalPath(), true, null, null, false, "asd"));
+ .getInternalPath(), true, null, null, false, "session1"));
- List<Modification> modifications = new ArrayList<Modification>();
+ List<Modification> modifications = new ArrayList<Modification>(setSession("session1", "admin"));
modifications.addAll(removeProperty(newProperty));
+ modifications.addAll(removeSession());
loader.put(modifications);
+
+ assertEvent(Event.PROPERTY_REMOVED, prop1path, listener, "admin");
+ }
+
+ protected void assertEvent(int eventType, QPath prop1path, DummyListener listener, String userId)
+ throws RepositoryException
+ {
assertEquals(1, listener.eventList.size());
Event event = listener.eventList.get(0);
- assertEquals(Event.PROPERTY_REMOVED, event.getType());
+ assertEquals(eventType, event.getType());
assertEquals(lf.createJCRPath(prop1path).getAsString(false), event.getPath());
+ assertEquals(userId, event.getUserID());
}
@Override
@@ -222,17 +229,14 @@
super(null, null, null);
}
- // TODO: remove hardcode
public LocationFactory getLocationFactory()
{
return lf;
}
-
}
class DummyListener implements EventListener
{
-
public List<Event> eventList = new ArrayList<Event>();
public void onEvent(EventIterator events)
16 years, 8 months
exo-jcr SVN: r538 - 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: tolusha
Date: 2009-11-10 04:00:50 -0500 (Tue, 10 Nov 2009)
New Revision: 538
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java
Log:
EXOJCR-205: test fix
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-10 09:00:35 UTC (rev 537)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-10 09:00:50 UTC (rev 538)
@@ -105,8 +105,8 @@
List<Modification> modification = new ArrayList<Modification>();
- modification.add(removeNode(node));
- modification.add(removeProperty(prop));
+ modification.addAll(removeNode(node));
+ modification.addAll(removeProperty(prop));
indexerCacheLoader.put(modification);
assertTrue(searchManager.getAddedNodes().isEmpty());
assertNotNull(searchManager.getRemovedNodes());
16 years, 8 months
exo-jcr SVN: r537 - jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2009-11-10 04:00:35 -0500 (Tue, 10 Nov 2009)
New Revision: 537
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
Log:
EXOJCR-28 save added to updateContent() method
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java 2009-11-10 09:00:00 UTC (rev 536)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java 2009-11-10 09:00:35 UTC (rev 537)
@@ -219,8 +219,8 @@
{
content.addMixin(mixinName);
}
-
}
+ node.getSession().save();
}
16 years, 8 months
exo-jcr SVN: r536 - in jcr/branches/1.12.0-JBC/component/core/src: test/java/org/exoplatform/services/jcr/impl/storage/jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-10 04:00:00 -0500 (Tue, 10 Nov 2009)
New Revision: 536
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
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/LockCacheLoaderTest.java
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/TesterLockManagerImpl.java
Log:
EXOJCR-205: test fix
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2009-11-10 08:56:46 UTC (rev 535)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2009-11-10 09:00:00 UTC (rev 536)
@@ -117,8 +117,10 @@
/**
* Map NodeIdentifier -- lockData
+ *
+ * TODO: changed from private to protected
*/
- private final Map<String, LockData> pendingLocks;
+ protected final Map<String, LockData> pendingLocks;
/**
* Map lockToken --lockData
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-10 08:56:46 UTC (rev 535)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IndexerCacheLoaderTest.java 2009-11-10 09:00:00 UTC (rev 536)
@@ -85,8 +85,8 @@
List<Modification> modification = new ArrayList<Modification>();
- modification.add(addNode(newNode));
- modification.add(addProperty(newProperty));
+ modification.addAll(addNode(newNode));
+ modification.addAll(addProperty(newProperty));
indexerCacheLoader.put(modification);
assertNotNull(searchManager.getAddedNodes());
assertNotNull(searchManager.getRemovedNodes());
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java 2009-11-10 08:56:46 UTC (rev 535)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java 2009-11-10 09:00:00 UTC (rev 536)
@@ -17,9 +17,13 @@
package org.exoplatform.services.jcr.impl.storage.jbosscache;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
+import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.util.IdGenerator;
@@ -73,10 +77,12 @@
TransientValueData lockOwner = new TransientValueData("__system");
lockOwnerData.setValue(lockOwner);
+ lockManager.addPendingLock(nodeIdentifier, new LockData(nodeIdentifier, "token", false, false, "__system", -1));
+
modifications.addAll(setSession(sessionId, "userId"));
- modifications.add(addProperty(lockIsDeepData));
- modifications.add(addProperty(lockOwnerData));
- modifications.add(removeSession());
+ modifications.addAll(addProperty(lockIsDeepData));
+ modifications.addAll(addProperty(lockOwnerData));
+ modifications.addAll(removeSession());
lockCacheLoader.put(modifications);
assertEquals(nodeIdentifier, lockManager.getNodeIdentifier());
@@ -101,9 +107,9 @@
lockOwnerData.setValue(lockOwner);
modifications.addAll(setSession(sessionId, "userId"));
- modifications.add(removeProperty(lockIsDeepData));
- modifications.add(removeProperty(lockOwnerData));
- modifications.add(removeSession());
+ modifications.addAll(removeProperty(lockIsDeepData));
+ modifications.addAll(removeProperty(lockOwnerData));
+ modifications.addAll(removeSession());
lockCacheLoader.put(modifications);
assertEquals(nodeIdentifier, lockManager.getNodeIdentifier());
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-10 08:56:46 UTC (rev 535)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-10 09:00:00 UTC (rev 536)
@@ -106,7 +106,7 @@
new String[]{Constants.ROOT_UUID}, null, false, "asd"));
List<Modification> modifications = new ArrayList<Modification>();
- modifications.add(addNode(newNode));
+ modifications.addAll(addNode(newNode));
loader.put(modifications);
assertEquals(1, listener.eventList.size());
Event event = listener.eventList.get(0);
@@ -125,7 +125,7 @@
lf.parseAbsPath("/").getInternalPath(), true, null, null, false, "asd"));
List<Modification> modifications = new ArrayList<Modification>();
- modifications.add(addNode(newNode));
+ modifications.addAll(addNode(newNode));
loader.put(modifications);
assertEquals(1, listener.eventList.size());
Event event = listener.eventList.get(0);
@@ -144,7 +144,7 @@
.getInternalPath(), true, null, null, false, "asd"));
List<Modification> modifications = new ArrayList<Modification>();
- modifications.add(removeNode(newNode));
+ modifications.addAll(removeNode(newNode));
loader.put(modifications);
assertEquals(1, listener.eventList.size());
Event event = listener.eventList.get(0);
@@ -163,7 +163,7 @@
.getInternalPath(), true, null, null, false, "asd"));
List<Modification> modifications = new ArrayList<Modification>();
- modifications.add(addProperty(newProperty));
+ modifications.addAll(addProperty(newProperty));
loader.put(modifications);
assertEquals(1, listener.eventList.size());
Event event = listener.eventList.get(0);
@@ -182,7 +182,7 @@
.getInternalPath(), true, null, null, false, "asd"));
List<Modification> modifications = new ArrayList<Modification>();
- modifications.add(updateProperty(newProperty));
+ modifications.addAll(updateProperty(newProperty));
loader.put(modifications);
assertEquals(1, listener.eventList.size());
Event event = listener.eventList.get(0);
@@ -201,7 +201,7 @@
.getInternalPath(), true, null, null, false, "asd"));
List<Modification> modifications = new ArrayList<Modification>();
- modifications.add(removeProperty(newProperty));
+ modifications.addAll(removeProperty(newProperty));
loader.put(modifications);
assertEquals(1, listener.eventList.size());
Event event = listener.eventList.get(0);
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/TesterLockManagerImpl.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/TesterLockManagerImpl.java 2009-11-10 08:56:46 UTC (rev 535)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/TesterLockManagerImpl.java 2009-11-10 09:00:00 UTC (rev 536)
@@ -16,10 +16,15 @@
*/
package org.exoplatform.services.jcr.impl.storage.jbosscache;
+import sun.security.util.PendingException;
+
import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.core.lock.LockManagerImpl;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
+import java.util.Map;
+
import javax.jcr.lock.LockException;
/**
@@ -74,4 +79,9 @@
return sessionId;
}
+ public void addPendingLock(String nodeIdentifier, LockData lData)
+ {
+ pendingLocks.put(nodeIdentifier, lData);
+ }
+
}
16 years, 8 months