[exo-jcr-commits] exo-jcr SVN: r526 - in jcr/branches/1.12.0-JBC/component/core/src: test/java/org/exoplatform/services/jcr/impl/storage/jbosscache and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Nov 9 11:03:31 EST 2009


Author: tolusha
Date: 2009-11-09 11:03:30 -0500 (Mon, 09 Nov 2009)
New Revision: 526

Added:
   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/TesterLockManagerImpl.java
Modified:
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java
Log:
EXOJCR-205: base test added

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-09 16:00:47 UTC (rev 525)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java	2009-11-09 16:03:30 UTC (rev 526)
@@ -51,7 +51,7 @@
    /**
     * Lock manager.
     */
-   private LockManagerImpl lockManager;
+   private final LockManagerImpl lockManager;
 
    /**
     * Logger.
@@ -59,6 +59,16 @@
    private final Log log = ExoLogger.getLogger("jcr.LockCacheLoader");
 
    /**
+    * LockCacheLoader  constructor.
+    *
+    * @param lockManager
+    */
+   public LockCacheLoader(LockManagerImpl lockManager)
+   {
+      this.lockManager = lockManager;
+   }
+
+   /**
     * {@inheritDoc}
     */
    @Override
@@ -77,11 +87,12 @@
                case PUT_DATA_ERASE :
                   break;
                case PUT_DATA :
-                  // changesLog begin
-                  int pos = getElementPosition(m.getFqn(), JBossCacheStorage.SESSION);
-                  sessionId = (String)m.getFqn().get(pos + 1);
                   break;
                case PUT_KEY_VALUE :
+                  if (m.getKey().equals(JBossCacheStorage.SESSION_ID))
+                  {
+                     sessionId = (String)m.getValue();
+                  }
                   break;
                case REMOVE_DATA :
                   break;

Added: 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	                        (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java	2009-11-09 16:03:30 UTC (rev 526)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jbosscache;
+
+import com.sun.tools.corba.se.idl.toJavaPortable.ValueFactory;
+
+import com.thoughtworks.xstream.core.ReferenceByIdMarshaller.IDGenerator;
+
+import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.LocationFactory;
+import org.exoplatform.services.jcr.impl.core.NamespaceRegistryImpl;
+import org.exoplatform.services.jcr.impl.core.lock.LockManager;
+import org.exoplatform.services.jcr.impl.core.lock.LockManagerImpl;
+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.util.IdGenerator;
+import org.jboss.cache.Modification;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.PropertyType;
+
+import junit.framework.TestCase;
+
+/**
+ * Created by The eXo Platform SAS.
+ * 
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:anatoliy.bazko at exoplatform.com.ua">Anatoliy Bazko</a> 
+ * @version $Id$
+ */
+public class LockCacheLoaderTest extends AbstractCacheLoaderTest
+{
+
+   private LockManagerImpl lockManager;
+
+   private LockCacheLoader lockCacheLoader;
+
+   private ValueFactoryImpl valueFactory;
+
+   private final QPath testRoot = QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName("", "testRoot"));
+
+   public void setUp() throws Exception
+   {
+
+      this.valueFactory = new ValueFactoryImpl(new LocationFactory(new NamespaceRegistryImpl()));
+      this.lockManager = new TesterLockManagerImpl();
+      this.lockCacheLoader = new LockCacheLoader(lockManager);
+   }
+
+   public void testLock() throws Exception
+   {
+      List<Modification> modifcations = new ArrayList<Modification>();
+      String parentIdentifier = IdGenerator.generate();
+
+      TransientPropertyData propertyData =
+         new TransientPropertyData(QPath.makeChildPath(testRoot, Constants.JCR_LOCKISDEEP), IdGenerator.generate(), 1,
+            PropertyType.BOOLEAN, parentIdentifier, false);
+
+      propertyData =
+         new TransientPropertyData(QPath.makeChildPath(testRoot, Constants.JCR_LOCKOWNER), IdGenerator.generate(), 1,
+            PropertyType.BOOLEAN, parentIdentifier, false);
+
+      modifcations.add(addProperty(propertyData));
+   }
+
+   public void testUnLock() throws Exception
+   {
+
+   }
+}


Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: 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	                        (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/TesterLockManagerImpl.java	2009-11-09 16:03:30 UTC (rev 526)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jbosscache;
+
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.core.lock.LockManagerImpl;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
+
+/**
+ * Created by The eXo Platform SAS.
+ * 
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:anatoliy.bazko at exoplatform.com.ua">Anatoliy Bazko</a> 
+ * @version $Id$
+ */
+public class TesterLockManagerImpl extends LockManagerImpl
+{
+
+   public TesterLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config)
+   {
+      super(dataManager, config);
+   }
+
+   public TesterLockManagerImpl()
+   {
+      this(null, null);
+   }
+}


Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/TesterLockManagerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the exo-jcr-commits mailing list