[exo-jcr-commits] exo-jcr SVN: r5187 - in jcr/trunk/exo.jcr.component.core: src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent and 5 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Nov 15 04:34:56 EST 2011
Author: zavizionov
Date: 2011-11-15 04:34:55 -0500 (Tue, 15 Nov 2011)
New Revision: 5187
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/TestLinkedWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestCompressedChangesBuffer.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TesterISPNCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TesterJBossCacheWorkspaceStorageCache.java
Removed:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
Log:
EXOJCR-1630 Exclude some tests when choosing profile without cache
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-11-15 08:01:12 UTC (rev 5186)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-11-15 09:34:55 UTC (rev 5187)
@@ -37,12 +37,11 @@
<statistics.enabled>false</statistics.enabled>
<properties.url.suffix>.properties</properties.url.suffix>
<properties.url.prefix>classpath:/conf/standalone/default</properties.url.prefix>
- <jbc.specific.1>**/jbc/**</jbc.specific.1>
- <jbc.specific.2>**/jbosscache/**</jbc.specific.2>
- <ispn.specific.1>**/ispn/**</ispn.specific.1>
- <ispn.specific.2>**/infinispan/**</ispn.specific.2>
- <impl.specific.exclude.1>${ispn.specific.1}</impl.specific.exclude.1>
- <impl.specific.exclude.2>${ispn.specific.2}</impl.specific.exclude.2>
+ <test.cache.jbc>**/persistent/cache/jbosscache/**</test.cache.jbc>
+ <test.cache.ispn>**/persistent/cache/infinispan/**</test.cache.ispn>
+ <test.cache.all>**/persistent/cache/**</test.cache.all>
+ <!-- ispn specific exclude by default -->
+ <test.cache.exclude>${test.cache.ispn}</test.cache.exclude>
</properties>
<dependencies>
<dependency>
@@ -364,8 +363,7 @@
<exclude>org/exoplatform/services/jcr/usecases/common/RemoveSameNameSiblingUnfixedTest.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/SQLBenchmarkTest.java</exclude>
<!-- Implementation Specific Excludes -->
- <exclude>${impl.specific.exclude.1}</exclude>
- <exclude>${impl.specific.exclude.2}</exclude>
+ <exclude>${test.cache.exclude}</exclude>
</excludes>
</configuration>
</plugin>
@@ -710,8 +708,7 @@
<exclude>org/apache/jackrabbit/test/api/**/Abstract*.java</exclude>
<exclude>org/apache/jackrabbit/test/api/**/FrozenNodeTest.java</exclude>
<!-- Implementation Specific Excludes -->
- <exclude>${impl.specific.exclude.1}</exclude>
- <exclude>${impl.specific.exclude.2}</exclude>
+ <exclude>${test.cache.exclude}</exclude>
</excludes>
</configuration>
</plugin>
@@ -986,6 +983,7 @@
<id>cache-disabled</id>
<properties>
<cache.enabled>false</cache.enabled>
+ <test.cache.exclude>${test.cache.all}</test.cache.exclude>
</properties>
</profile>
<profile>
@@ -1011,8 +1009,7 @@
<id>ispn</id>
<properties>
<jcr.test.configuration.file>/conf/standalone/test-configuration.xml</jcr.test.configuration.file>
- <impl.specific.exclude.1>${jbc.specific.1}</impl.specific.exclude.1>
- <impl.specific.exclude.2>${jbc.specific.2}</impl.specific.exclude.2>
+ <test.cache.exclude>${test.cache.jbc}</test.cache.exclude>
</properties>
<dependencies>
<dependency>
@@ -1038,8 +1035,7 @@
<id>ispn-sjdbc</id>
<properties>
<jcr.test.configuration.file>/conf/standalone/test-configuration-sjdbc.xml</jcr.test.configuration.file>
- <impl.specific.exclude.1>${jbc.specific.1}</impl.specific.exclude.1>
- <impl.specific.exclude.2>${jbc.specific.2}</impl.specific.exclude.2>
+ <test.cache.exclude>${test.cache.jbc}</test.cache.exclude>
<properties.url.suffix>-sjdbc.properties</properties.url.suffix>
</properties>
<dependencies>
@@ -1066,8 +1062,7 @@
<id>ispn-cluster</id>
<properties>
<jcr.test.configuration.file>/conf/standalone/cluster/test-configuration.xml</jcr.test.configuration.file>
- <impl.specific.exclude.1>${jbc.specific.1}</impl.specific.exclude.1>
- <impl.specific.exclude.2>${jbc.specific.2}</impl.specific.exclude.2>
+ <test.cache.exclude>${test.cache.jbc}</test.cache.exclude>
</properties>
<dependencies>
<dependency>
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedWorkspaceStorageCache.java 2011-11-15 08:01:12 UTC (rev 5186)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedWorkspaceStorageCache.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -1,44 +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.dataflow.persistent;
-
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * @author <a href="mailto:peter.nedonosko at exoplatform.com.ua">Peter Nedonosko</a>
- * @version $Id$
- */
-public class TestLinkedWorkspaceStorageCache extends WorkspaceStorageCacheBaseCase
-{
-
- @Override
- public WorkspaceStorageCache getCacheImpl() throws Exception
- {
- /*String name, boolean enabled, int maxSize, long liveTimeSec,
- long cleanerPeriodMillis, long statisticPeriodMillis, boolean deepDelete, boolean cleanStatistics,
- int blockingUsers, boolean showStatistic*/
- return new LinkedWorkspaceStorageCacheImpl("test_WorkspaceStorageCacheBaseCase", true,
- 100 * 1024, 120, 5 * 60000, 30000, false, true, 0, false);
- //return new LinkedWorkspaceStorageCacheImpl((WorkspaceEntry)session.getContainer().getComponentInstanceOfType(
- // WorkspaceEntry.class));
- }
-}
Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/TestLinkedWorkspaceStorageCache.java (from rev 5185, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedWorkspaceStorageCache.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/TestLinkedWorkspaceStorageCache.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/TestLinkedWorkspaceStorageCache.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -0,0 +1,46 @@
+/*
+ * 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.dataflow.persistent.cache;
+
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspaceStorageCacheBaseCase;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * @author <a href="mailto:peter.nedonosko at exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id$
+ */
+public class TestLinkedWorkspaceStorageCache extends WorkspaceStorageCacheBaseCase
+{
+
+ @Override
+ public WorkspaceStorageCache getCacheImpl() throws Exception
+ {
+ /*String name, boolean enabled, int maxSize, long liveTimeSec,
+ long cleanerPeriodMillis, long statisticPeriodMillis, boolean deepDelete, boolean cleanStatistics,
+ int blockingUsers, boolean showStatistic*/
+ return new LinkedWorkspaceStorageCacheImpl("test_WorkspaceStorageCacheBaseCase", true,
+ 100 * 1024, 120, 5 * 60000, 30000, false, true, 0, false);
+ //return new LinkedWorkspaceStorageCacheImpl((WorkspaceEntry)session.getContainer().getComponentInstanceOfType(
+ // WorkspaceEntry.class));
+ }
+}
Property changes on: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/TestLinkedWorkspaceStorageCache.java
___________________________________________________________________
Added: svn:keywords
+ Id
Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCache.java (from rev 5185, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCache.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCache.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCache.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003-2011 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.dataflow.persistent.cache.infinispan;
+
+import org.exoplatform.container.configuration.ConfigurationManagerImpl;
+import org.exoplatform.services.jcr.config.CacheEntry;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.cache.jbosscache.TestJBossCacheWorkspaceStorageCache;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache;
+
+import java.util.ArrayList;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy at gmail.com">Karpenko Sergiy</a>
+ * @version $Id: TestISPNCacheWorkspaceStorageCache.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class TestISPNCacheWorkspaceStorageCache extends TestJBossCacheWorkspaceStorageCache
+{
+ @Override
+ public WorkspaceStorageCache getCacheImpl() throws Exception
+ {
+ ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
+ list.add(new SimpleParameterEntry("infinispan-configuration", "jar:/conf/standalone/test-infinispan-config.xml"));
+
+ CacheEntry entry = new CacheEntry(list);
+ entry.setEnabled(true);
+ WorkspaceEntry workspaceEntry = new WorkspaceEntry();
+ workspaceEntry.setUniqueName("WS_UUID");
+ workspaceEntry.setCache(entry);
+ return new ISPNCacheWorkspaceStorageCache(workspaceEntry, new ConfigurationManagerImpl());
+ }
+}
\ No newline at end of file
Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java (from rev 5185, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2011 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.dataflow.persistent.cache.infinispan;
+
+import org.exoplatform.container.configuration.ConfigurationManagerImpl;
+import org.exoplatform.services.jcr.config.CacheEntry;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.TestWorkspaceStorageCacheInClusterMode;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.TesterISPNCacheWorkspaceStorageCache;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache;
+import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:nfilotto at exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class TestISPNCacheWorkspaceStorageCacheInClusterMode extends TestWorkspaceStorageCacheInClusterMode<ISPNCacheWorkspaceStorageCache>
+{
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public ISPNCacheWorkspaceStorageCache getCacheImpl() throws Exception
+ {
+ // Clear the Cache Factory to avoid getting several times the same cache
+ Field singletonField = ISPNCacheFactory.class.getDeclaredField("CACHE_MANAGERS");
+ singletonField.setAccessible(true);
+ Map map = (Map)singletonField.get(null);
+ Map backupMap = new HashMap(map);
+ map.clear();
+ ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
+ list.add(new SimpleParameterEntry(ISPNCacheFactory.INFINISPAN_CONFIG,
+ "jar:/conf/standalone/cluster/test-infinispan-config.xml"));
+ list.add(new SimpleParameterEntry("infinispan-cluster-name", "TestISPNCacheWorkspaceStorageCacheInClusterMode"));
+ list.add(new SimpleParameterEntry("jgroups-configuration", "classpath:/flush-udp.xml"));
+
+ CacheEntry entry = new CacheEntry(list);
+ entry.setEnabled(true);
+ WorkspaceEntry workspaceEntry = new WorkspaceEntry();
+ workspaceEntry.setCache(entry);
+ workspaceEntry.setUniqueName("MyWorkspace");
+ try
+ {
+ return new ISPNCacheWorkspaceStorageCache(workspaceEntry, new ConfigurationManagerImpl());
+ }
+ finally
+ {
+ map.clear();
+ map.putAll(backupMap);
+ }
+ }
+
+ protected void finalize(ISPNCacheWorkspaceStorageCache cache)
+ {
+ TesterISPNCacheWorkspaceStorageCache.stop(cache);
+ }
+}
\ No newline at end of file
Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestCompressedChangesBuffer.java (from rev 5185, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestCompressedChangesBuffer.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestCompressedChangesBuffer.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2010 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.dataflow.persistent.cache.jbosscache;
+
+import java.util.HashMap;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.CompressedChangesBuffer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.PutObjectContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.RemoveNodeContainer;
+import org.jboss.cache.Fqn;
+
+/**
+ * @author <a href="mailto:foo at bar.org">Foo Bar</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z aheritier $
+ *
+ */
+public class TestCompressedChangesBuffer extends TestCase
+{
+
+ public void testPutOmit()
+ {
+ CompressedChangesBuffer buffer = new CompressedChangesBuffer();
+ ChangesContainer put1 =
+ new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+ ChangesContainer put2 =
+ new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+ ChangesContainer rm1 =
+ new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
+ .getHistoryIndex(), false, false, 0);
+ buffer.add(put1);
+ buffer.add(put2);
+ assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
+ assertTrue("List MUST contain put container", buffer.getSortedList().contains(put2));
+ buffer.add(rm1);
+ assertFalse("List still contains put container", buffer.getSortedList().contains(put1));
+ assertFalse("List still contains put container", buffer.getSortedList().contains(put2));
+ assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm1));
+ buffer.add(put1);
+ buffer.add(put2);
+ assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm1));
+ assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
+ assertTrue("List MUST contain put container", buffer.getSortedList().contains(put2));
+ }
+
+ public void testRemoveOmit()
+ {
+ CompressedChangesBuffer buffer = new CompressedChangesBuffer();
+ ChangesContainer put1 =
+ new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+
+ ChangesContainer put2 =
+ new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+ ChangesContainer rm1 =
+ new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"), null,
+ buffer.getHistoryIndex(), false, false, 0);
+ ChangesContainer rm2 =
+ new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
+ .getHistoryIndex(), false, false, 0);
+ buffer.add(put1);
+ buffer.add(put2);
+ assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
+ assertTrue("List MUST contain put container", buffer.getSortedList().contains(put2));
+ buffer.add(rm1);
+ assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
+ assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm1));
+ buffer.add(rm2);
+ assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm2));
+ assertFalse("List still contains put container", buffer.getSortedList().contains(put1));
+ assertFalse("List still contains put container", buffer.getSortedList().contains(put2));
+ assertFalse("List still contains put container", buffer.getSortedList().contains(rm1));
+ }
+
+ public void testNoChangeOnRegion()
+ {
+ CompressedChangesBuffer buffer = new CompressedChangesBuffer();
+ ChangesContainer put1 =
+ new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"),
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+
+ ChangesContainer rm1 =
+ new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"), null,
+ buffer.getHistoryIndex(), false, false, 0);
+ buffer.add(put1);
+ assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
+ buffer.add(rm1);
+ assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
+ assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm1));
+ }
+
+}
Property changes on: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestCompressedChangesBuffer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCache.java (from rev 5185, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCache.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCache.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCache.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -0,0 +1,404 @@
+/*
+ * 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.dataflow.persistent.cache.jbosscache;
+
+import org.exoplatform.container.configuration.ConfigurationManagerImpl;
+import org.exoplatform.services.jcr.config.CacheEntry;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
+import org.exoplatform.services.jcr.dataflow.ItemState;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
+import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
+import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
+import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.ACLHolder;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspaceStorageCacheBaseCase;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache;
+import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
+import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
+import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.transaction.TransactionService;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * @author <a href="mailto:peter.nedonosko at exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id$
+ */
+public class TestJBossCacheWorkspaceStorageCache extends WorkspaceStorageCacheBaseCase
+{
+
+ @Override
+ public WorkspaceStorageCache getCacheImpl() throws Exception
+ {
+ TransactionService transactionService =
+ (TransactionService)container.getComponentInstanceOfType(TransactionService.class);
+
+ ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
+ list.add(new SimpleParameterEntry(JBossCacheWorkspaceStorageCache.JBOSSCACHE_CONFIG,
+ "jar:/conf/standalone/test-jbosscache-config.xml"));
+
+ CacheEntry entry = new CacheEntry(list);
+ entry.setEnabled(true);
+ WorkspaceEntry workspaceEntry = new WorkspaceEntry();
+ workspaceEntry.setUniqueName("WS_UUID");
+ workspaceEntry.setCache(entry);
+ return new JBossCacheWorkspaceStorageCache(workspaceEntry,
+ transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
+ }
+
+ public void testRaceConditions() throws Exception
+ {
+ MyWorkspaceStorageConnection con = new MyWorkspaceStorageConnection();
+ WorkspaceDataContainer wdc = new MyWorkspaceDataContainer(con);
+ WorkspaceContainerFacade wsc = repository.getWorkspaceContainer("ws");
+ WorkspaceEntry wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
+ final CacheableWorkspaceDataManager cwdm =
+ new CacheableWorkspaceDataManager(wconf, wdc, getCacheImpl(), new SystemDataContainerHolder(wdc));
+ String idNode = "foo1";
+ executeConcurrentReadNWrite(con, cwdm, Mode.READ_FIRST, idNode);
+ assertNotNull(cwdm.getItemData(idNode));
+ idNode = "foo2";
+ executeConcurrentReadNWrite(con, cwdm, Mode.WRITE_FIRST, idNode);
+ assertNotNull(cwdm.getItemData(idNode));
+ }
+
+ /**
+ * @param con
+ * @param cwdm
+ * @param mode
+ * @param idNode
+ * @throws InterruptedException
+ */
+ private void executeConcurrentReadNWrite(MyWorkspaceStorageConnection con, final CacheableWorkspaceDataManager cwdm,
+ final Mode mode, final String idNode) throws InterruptedException
+ {
+ final CountDownLatch goSignal = con.setMode(mode);
+ final AtomicReference<Exception> ex = new AtomicReference<Exception>();
+ final CountDownLatch startSignal = new CountDownLatch(1);
+ final CountDownLatch doneSignal = new CountDownLatch(2);
+ Thread writer = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ startSignal.await();
+ PlainChangesLog chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createAddedState(new PersistedNodeData(idNode, Constants.ROOT_PATH, "parent-id", 1, 0,
+ Constants.NT_UNSTRUCTURED, null, null)));
+ cwdm.save(chlog);
+ if (mode == Mode.WRITE_FIRST) goSignal.countDown();
+ }
+ catch (Exception e)
+ {
+ ex.set(e);
+ }
+ finally
+ {
+ doneSignal.countDown();
+ }
+ }
+ };
+ writer.start();
+ Thread reader = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ startSignal.await();
+ cwdm.getItemData(idNode);
+ if (mode == Mode.READ_FIRST) goSignal.countDown();
+ }
+ catch (Exception e)
+ {
+ ex.set(e);
+ }
+ finally
+ {
+ doneSignal.countDown();
+ }
+ }
+ };
+ reader.start();
+ startSignal.countDown();
+ doneSignal.await();
+ assertNull(ex.get());
+ }
+
+ private static enum Mode
+ {
+ READ_FIRST, WRITE_FIRST;
+ }
+ private static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
+ {
+
+
+ private Mode mode;
+ private CountDownLatch goSignal;
+
+ public CountDownLatch setMode(Mode mode)
+ {
+ this.mode = mode;
+ this.goSignal = new CountDownLatch(1);
+ return goSignal;
+ }
+
+
+ public void add(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void close() throws IllegalStateException, RepositoryException
+ {
+ }
+
+ public void commit() throws IllegalStateException, RepositoryException
+ {
+ if (mode == Mode.READ_FIRST)
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+
+ public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public int getChildNodesCount(NodeData parent) throws RepositoryException
+ {
+ return -1;
+ }
+
+ public List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException
+ {
+ return null;
+ }
+
+ public List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException,
+ IllegalStateException
+ {
+ return null;
+ }
+
+ public List<PropertyData> getChildPropertiesData(NodeData parent, List<QPathEntryFilter> pattern)
+ throws RepositoryException, IllegalStateException
+ {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,
+ IllegalStateException
+ {
+ return getItemData(parentData, name, ItemType.UNKNOWN);
+ }
+
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException
+ {
+ return null;
+ }
+
+ public ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException
+ {
+ if (mode == Mode.WRITE_FIRST)
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ return null;
+ }
+
+ public List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException,
+ IllegalStateException, UnsupportedOperationException
+ {
+ return null;
+ }
+
+ public boolean isOpened()
+ {
+ return true;
+ }
+
+ public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException,
+ IllegalStateException
+ {
+ return null;
+ }
+
+ public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void rollback() throws IllegalStateException, RepositoryException
+ {
+ }
+
+ public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public void update(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ }
+
+ public int getLastOrderNumber(NodeData parent) throws RepositoryException
+ {
+ return -1;
+ }
+
+ public List<NodeData> getChildNodesData(NodeData parent, List<QPathEntryFilter> pattern) throws RepositoryException,
+ IllegalStateException
+ {
+ return getChildNodesData(parent);
+ }
+
+ public ValueData getValue(String propertyId, int orderNumb, int persistedVersion) throws IllegalStateException,
+ RepositoryException
+ {
+ return null;
+ }
+
+ public boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int limit, List<NodeData> childs)
+ throws RepositoryException
+ {
+ return false;
+ }
+
+
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getACLHolders()
+ */
+ @Override
+ public List<ACLHolder> getACLHolders() throws RepositoryException, IllegalStateException,
+ UnsupportedOperationException
+ {
+ return null;
+ }
+
+ };
+
+ private static class MyWorkspaceDataContainer extends WorkspaceDataContainerBase
+ {
+
+ private WorkspaceStorageConnection con;
+
+ public MyWorkspaceDataContainer(WorkspaceStorageConnection con)
+ {
+ this.con = con;
+ }
+
+ public boolean isCheckSNSNewConnection()
+ {
+ return false;
+ }
+
+ public boolean isSame(WorkspaceDataContainer another)
+ {
+ return false;
+ }
+
+ public WorkspaceStorageConnection openConnection() throws RepositoryException
+ {
+ return con;
+ }
+
+ public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
+ {
+ return con;
+ }
+
+ public WorkspaceStorageConnection reuseConnection(WorkspaceStorageConnection original) throws RepositoryException
+ {
+ return con;
+ }
+
+ public String getInfo()
+ {
+ return "MyWorkspaceDataContainer";
+ }
+
+ public String getName()
+ {
+ return "MyWorkspaceDataContainer";
+ }
+
+ public String getStorageVersion()
+ {
+ return "0";
+ }
+
+ public String getUniqueName()
+ {
+ return "MyWorkspaceDataContainer";
+ }
+ };
+
+}
Property changes on: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCache.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Id
Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java (from rev 5185, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 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.dataflow.persistent.cache.jbosscache;
+
+import org.exoplatform.container.configuration.ConfigurationManagerImpl;
+import org.exoplatform.services.jcr.config.CacheEntry;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.TestWorkspaceStorageCacheInClusterMode;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.TesterJBossCacheWorkspaceStorageCache;
+import org.exoplatform.services.transaction.TransactionService;
+
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:nicolas.filotto at exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ */
+public class TestJBossCacheWorkspaceStorageCacheInClusterMode extends TestWorkspaceStorageCacheInClusterMode<JBossCacheWorkspaceStorageCache>
+{
+
+ public JBossCacheWorkspaceStorageCache getCacheImpl() throws Exception
+ {
+ TransactionService transactionService =
+ (TransactionService)container.getComponentInstanceOfType(TransactionService.class);
+
+ ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
+ list.add(new SimpleParameterEntry(JBossCacheWorkspaceStorageCache.JBOSSCACHE_CONFIG,
+ "jar:/conf/standalone/cluster/test-jbosscache-data-no-mux.xml"));
+ list.add(new SimpleParameterEntry("jbosscache-cluster-name", "TestJBossCacheWorkspaceStorageCacheInClusterMode"));
+
+ CacheEntry entry = new CacheEntry(list);
+ entry.setEnabled(true);
+ WorkspaceEntry workspaceEntry = new WorkspaceEntry();
+ workspaceEntry.setCache(entry);
+ workspaceEntry.setUniqueName("MyWorkspace");
+ JBossCacheWorkspaceStorageCache cache = new JBossCacheWorkspaceStorageCache(workspaceEntry,
+ transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
+ cache.start();
+ return cache;
+ }
+
+ protected void finalize(JBossCacheWorkspaceStorageCache cache)
+ {
+ TesterJBossCacheWorkspaceStorageCache.stop(cache);
+ }
+}
\ No newline at end of file
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCache.java 2011-11-15 08:01:12 UTC (rev 5186)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCache.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2003-2011 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.dataflow.persistent.infinispan;
-
-import org.exoplatform.container.configuration.ConfigurationManagerImpl;
-import org.exoplatform.services.jcr.config.CacheEntry;
-import org.exoplatform.services.jcr.config.SimpleParameterEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.TestJBossCacheWorkspaceStorageCache;
-
-import java.util.ArrayList;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * <br/>Date:
- *
- * @author <a href="karpenko.sergiy at gmail.com">Karpenko Sergiy</a>
- * @version $Id: TestISPNCacheWorkspaceStorageCache.java 111 2008-11-11 11:11:11Z serg $
- */
-public class TestISPNCacheWorkspaceStorageCache extends TestJBossCacheWorkspaceStorageCache
-{
- @Override
- public WorkspaceStorageCache getCacheImpl() throws Exception
- {
- ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
- list.add(new SimpleParameterEntry("infinispan-configuration", "jar:/conf/standalone/test-infinispan-config.xml"));
-
- CacheEntry entry = new CacheEntry(list);
- entry.setEnabled(true);
- WorkspaceEntry workspaceEntry = new WorkspaceEntry();
- workspaceEntry.setUniqueName("WS_UUID");
- workspaceEntry.setCache(entry);
- return new ISPNCacheWorkspaceStorageCache(workspaceEntry, new ConfigurationManagerImpl());
- }
-}
\ No newline at end of file
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java 2011-11-15 08:01:12 UTC (rev 5186)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2011 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.dataflow.persistent.infinispan;
-
-import org.exoplatform.container.configuration.ConfigurationManagerImpl;
-import org.exoplatform.services.jcr.config.CacheEntry;
-import org.exoplatform.services.jcr.config.SimpleParameterEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.TestWorkspaceStorageCacheInClusterMode;
-import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:nfilotto at exoplatform.com">Nicolas Filotto</a>
- * @version $Id$
- *
- */
-public class TestISPNCacheWorkspaceStorageCacheInClusterMode extends TestWorkspaceStorageCacheInClusterMode<ISPNCacheWorkspaceStorageCache>
-{
-
- @SuppressWarnings({"rawtypes", "unchecked"})
- public ISPNCacheWorkspaceStorageCache getCacheImpl() throws Exception
- {
- // Clear the Cache Factory to avoid getting several times the same cache
- Field singletonField = ISPNCacheFactory.class.getDeclaredField("CACHE_MANAGERS");
- singletonField.setAccessible(true);
- Map map = (Map)singletonField.get(null);
- Map backupMap = new HashMap(map);
- map.clear();
- ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
- list.add(new SimpleParameterEntry(ISPNCacheFactory.INFINISPAN_CONFIG,
- "jar:/conf/standalone/cluster/test-infinispan-config.xml"));
- list.add(new SimpleParameterEntry("infinispan-cluster-name", "TestISPNCacheWorkspaceStorageCacheInClusterMode"));
- list.add(new SimpleParameterEntry("jgroups-configuration", "classpath:/flush-udp.xml"));
-
- CacheEntry entry = new CacheEntry(list);
- entry.setEnabled(true);
- WorkspaceEntry workspaceEntry = new WorkspaceEntry();
- workspaceEntry.setCache(entry);
- workspaceEntry.setUniqueName("MyWorkspace");
- try
- {
- return new ISPNCacheWorkspaceStorageCache(workspaceEntry, new ConfigurationManagerImpl());
- }
- finally
- {
- map.clear();
- map.putAll(backupMap);
- }
- }
-
- protected void finalize(ISPNCacheWorkspaceStorageCache cache)
- {
- cache.cache.stop();
- }
-}
\ No newline at end of file
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TesterISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TesterISPNCacheWorkspaceStorageCache.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TesterISPNCacheWorkspaceStorageCache.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 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.dataflow.persistent.infinispan;
+
+/**
+ *
+ * @author <a href="mailto:azavizionov at exoplatform.com">Alexey Zavizionov</a>
+ * @version $Id: TesterISPNCacheWorkspaceStorageCache.java 34360 2009-07-22 23:58:59Z zavizionov $
+ *
+ */
+public class TesterISPNCacheWorkspaceStorageCache
+{
+
+ public static void stop(ISPNCacheWorkspaceStorageCache cache)
+ {
+ cache.cache.stop();
+ }
+
+}
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java 2011-11-15 08:01:12 UTC (rev 5186)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2010 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.dataflow.persistent.jbosscache;
-
-import java.util.HashMap;
-
-import junit.framework.TestCase;
-
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.PutObjectContainer;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.RemoveNodeContainer;
-import org.jboss.cache.Fqn;
-
-/**
- * @author <a href="mailto:foo at bar.org">Foo Bar</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z aheritier $
- *
- */
-public class TestCompressedChangesBuffer extends TestCase
-{
-
- public void testPutOmit()
- {
- CompressedChangesBuffer buffer = new CompressedChangesBuffer();
- ChangesContainer put1 =
- new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
- ChangesContainer put2 =
- new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
- ChangesContainer rm1 =
- new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
- .getHistoryIndex(), false, false, 0);
- buffer.add(put1);
- buffer.add(put2);
- assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
- assertTrue("List MUST contain put container", buffer.getSortedList().contains(put2));
- buffer.add(rm1);
- assertFalse("List still contains put container", buffer.getSortedList().contains(put1));
- assertFalse("List still contains put container", buffer.getSortedList().contains(put2));
- assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm1));
- buffer.add(put1);
- buffer.add(put2);
- assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm1));
- assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
- assertTrue("List MUST contain put container", buffer.getSortedList().contains(put2));
- }
-
- public void testRemoveOmit()
- {
- CompressedChangesBuffer buffer = new CompressedChangesBuffer();
- ChangesContainer put1 =
- new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
-
- ChangesContainer put2 =
- new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
- ChangesContainer rm1 =
- new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"), null,
- buffer.getHistoryIndex(), false, false, 0);
- ChangesContainer rm2 =
- new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
- .getHistoryIndex(), false, false, 0);
- buffer.add(put1);
- buffer.add(put2);
- assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
- assertTrue("List MUST contain put container", buffer.getSortedList().contains(put2));
- buffer.add(rm1);
- assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
- assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm1));
- buffer.add(rm2);
- assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm2));
- assertFalse("List still contains put container", buffer.getSortedList().contains(put1));
- assertFalse("List still contains put container", buffer.getSortedList().contains(put2));
- assertFalse("List still contains put container", buffer.getSortedList().contains(rm1));
- }
-
- public void testNoChangeOnRegion()
- {
- CompressedChangesBuffer buffer = new CompressedChangesBuffer();
- ChangesContainer put1 =
- new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
-
- ChangesContainer rm1 =
- new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"), null,
- buffer.getHistoryIndex(), false, false, 0);
- buffer.add(put1);
- assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
- buffer.add(rm1);
- assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
- assertTrue("List MUST contain remove container", buffer.getSortedList().contains(rm1));
- }
-
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCache.java 2011-11-15 08:01:12 UTC (rev 5186)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCache.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -1,403 +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.dataflow.persistent.jbosscache;
-
-import org.exoplatform.container.configuration.ConfigurationManagerImpl;
-import org.exoplatform.services.jcr.config.CacheEntry;
-import org.exoplatform.services.jcr.config.SimpleParameterEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
-import org.exoplatform.services.jcr.dataflow.ItemState;
-import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
-import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
-import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
-import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
-import org.exoplatform.services.jcr.datamodel.ItemData;
-import org.exoplatform.services.jcr.datamodel.ItemType;
-import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.datamodel.PropertyData;
-import org.exoplatform.services.jcr.datamodel.QPathEntry;
-import org.exoplatform.services.jcr.datamodel.ValueData;
-import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.ACLHolder;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspaceStorageCacheBaseCase;
-import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
-import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
-import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
-import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
-import org.exoplatform.services.transaction.TransactionService;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.RepositoryException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * @author <a href="mailto:peter.nedonosko at exoplatform.com.ua">Peter Nedonosko</a>
- * @version $Id$
- */
-public class TestJBossCacheWorkspaceStorageCache extends WorkspaceStorageCacheBaseCase
-{
-
- @Override
- public WorkspaceStorageCache getCacheImpl() throws Exception
- {
- TransactionService transactionService =
- (TransactionService)container.getComponentInstanceOfType(TransactionService.class);
-
- ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
- list.add(new SimpleParameterEntry(JBossCacheWorkspaceStorageCache.JBOSSCACHE_CONFIG,
- "jar:/conf/standalone/test-jbosscache-config.xml"));
-
- CacheEntry entry = new CacheEntry(list);
- entry.setEnabled(true);
- WorkspaceEntry workspaceEntry = new WorkspaceEntry();
- workspaceEntry.setUniqueName("WS_UUID");
- workspaceEntry.setCache(entry);
- return new JBossCacheWorkspaceStorageCache(workspaceEntry,
- transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
- }
-
- public void testRaceConditions() throws Exception
- {
- MyWorkspaceStorageConnection con = new MyWorkspaceStorageConnection();
- WorkspaceDataContainer wdc = new MyWorkspaceDataContainer(con);
- WorkspaceContainerFacade wsc = repository.getWorkspaceContainer("ws");
- WorkspaceEntry wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
- final CacheableWorkspaceDataManager cwdm =
- new CacheableWorkspaceDataManager(wconf, wdc, getCacheImpl(), new SystemDataContainerHolder(wdc));
- String idNode = "foo1";
- executeConcurrentReadNWrite(con, cwdm, Mode.READ_FIRST, idNode);
- assertNotNull(cwdm.getItemData(idNode));
- idNode = "foo2";
- executeConcurrentReadNWrite(con, cwdm, Mode.WRITE_FIRST, idNode);
- assertNotNull(cwdm.getItemData(idNode));
- }
-
- /**
- * @param con
- * @param cwdm
- * @param mode
- * @param idNode
- * @throws InterruptedException
- */
- private void executeConcurrentReadNWrite(MyWorkspaceStorageConnection con, final CacheableWorkspaceDataManager cwdm,
- final Mode mode, final String idNode) throws InterruptedException
- {
- final CountDownLatch goSignal = con.setMode(mode);
- final AtomicReference<Exception> ex = new AtomicReference<Exception>();
- final CountDownLatch startSignal = new CountDownLatch(1);
- final CountDownLatch doneSignal = new CountDownLatch(2);
- Thread writer = new Thread()
- {
- public void run()
- {
- try
- {
- startSignal.await();
- PlainChangesLog chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createAddedState(new PersistedNodeData(idNode, Constants.ROOT_PATH, "parent-id", 1, 0,
- Constants.NT_UNSTRUCTURED, null, null)));
- cwdm.save(chlog);
- if (mode == Mode.WRITE_FIRST) goSignal.countDown();
- }
- catch (Exception e)
- {
- ex.set(e);
- }
- finally
- {
- doneSignal.countDown();
- }
- }
- };
- writer.start();
- Thread reader = new Thread()
- {
- public void run()
- {
- try
- {
- startSignal.await();
- cwdm.getItemData(idNode);
- if (mode == Mode.READ_FIRST) goSignal.countDown();
- }
- catch (Exception e)
- {
- ex.set(e);
- }
- finally
- {
- doneSignal.countDown();
- }
- }
- };
- reader.start();
- startSignal.countDown();
- doneSignal.await();
- assertNull(ex.get());
- }
-
- private static enum Mode
- {
- READ_FIRST, WRITE_FIRST;
- }
- private static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
- {
-
-
- private Mode mode;
- private CountDownLatch goSignal;
-
- public CountDownLatch setMode(Mode mode)
- {
- this.mode = mode;
- this.goSignal = new CountDownLatch(1);
- return goSignal;
- }
-
-
- public void add(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- public void close() throws IllegalStateException, RepositoryException
- {
- }
-
- public void commit() throws IllegalStateException, RepositoryException
- {
- if (mode == Mode.READ_FIRST)
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- }
-
- public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- public int getChildNodesCount(NodeData parent) throws RepositoryException
- {
- return -1;
- }
-
- public List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException
- {
- return null;
- }
-
- public List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException,
- IllegalStateException
- {
- return null;
- }
-
- public List<PropertyData> getChildPropertiesData(NodeData parent, List<QPathEntryFilter> pattern)
- throws RepositoryException, IllegalStateException
- {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,
- IllegalStateException
- {
- return getItemData(parentData, name, ItemType.UNKNOWN);
- }
-
- public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
- IllegalStateException
- {
- return null;
- }
-
- public ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException
- {
- if (mode == Mode.WRITE_FIRST)
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- return null;
- }
-
- public List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException,
- IllegalStateException, UnsupportedOperationException
- {
- return null;
- }
-
- public boolean isOpened()
- {
- return true;
- }
-
- public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException,
- IllegalStateException
- {
- return null;
- }
-
- public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- public void rollback() throws IllegalStateException, RepositoryException
- {
- }
-
- public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- public void update(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- public int getLastOrderNumber(NodeData parent) throws RepositoryException
- {
- return -1;
- }
-
- public List<NodeData> getChildNodesData(NodeData parent, List<QPathEntryFilter> pattern) throws RepositoryException,
- IllegalStateException
- {
- return getChildNodesData(parent);
- }
-
- public ValueData getValue(String propertyId, int orderNumb, int persistedVersion) throws IllegalStateException,
- RepositoryException
- {
- return null;
- }
-
- public boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int limit, List<NodeData> childs)
- throws RepositoryException
- {
- return false;
- }
-
-
- /**
- * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getACLHolders()
- */
- @Override
- public List<ACLHolder> getACLHolders() throws RepositoryException, IllegalStateException,
- UnsupportedOperationException
- {
- return null;
- }
-
- };
-
- private static class MyWorkspaceDataContainer extends WorkspaceDataContainerBase
- {
-
- private WorkspaceStorageConnection con;
-
- public MyWorkspaceDataContainer(WorkspaceStorageConnection con)
- {
- this.con = con;
- }
-
- public boolean isCheckSNSNewConnection()
- {
- return false;
- }
-
- public boolean isSame(WorkspaceDataContainer another)
- {
- return false;
- }
-
- public WorkspaceStorageConnection openConnection() throws RepositoryException
- {
- return con;
- }
-
- public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
- {
- return con;
- }
-
- public WorkspaceStorageConnection reuseConnection(WorkspaceStorageConnection original) throws RepositoryException
- {
- return con;
- }
-
- public String getInfo()
- {
- return "MyWorkspaceDataContainer";
- }
-
- public String getName()
- {
- return "MyWorkspaceDataContainer";
- }
-
- public String getStorageVersion()
- {
- return "0";
- }
-
- public String getUniqueName()
- {
- return "MyWorkspaceDataContainer";
- }
- };
-
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java 2011-11-15 08:01:12 UTC (rev 5186)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2011 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.dataflow.persistent.jbosscache;
-
-import org.exoplatform.container.configuration.ConfigurationManagerImpl;
-import org.exoplatform.services.jcr.config.CacheEntry;
-import org.exoplatform.services.jcr.config.SimpleParameterEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.TestWorkspaceStorageCacheInClusterMode;
-import org.exoplatform.services.transaction.TransactionService;
-
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:nicolas.filotto at exoplatform.com">Nicolas Filotto</a>
- * @version $Id$
- */
-public class TestJBossCacheWorkspaceStorageCacheInClusterMode extends TestWorkspaceStorageCacheInClusterMode<JBossCacheWorkspaceStorageCache>
-{
-
- public JBossCacheWorkspaceStorageCache getCacheImpl() throws Exception
- {
- TransactionService transactionService =
- (TransactionService)container.getComponentInstanceOfType(TransactionService.class);
-
- ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
- list.add(new SimpleParameterEntry(JBossCacheWorkspaceStorageCache.JBOSSCACHE_CONFIG,
- "jar:/conf/standalone/cluster/test-jbosscache-data-no-mux.xml"));
- list.add(new SimpleParameterEntry("jbosscache-cluster-name", "TestJBossCacheWorkspaceStorageCacheInClusterMode"));
-
- CacheEntry entry = new CacheEntry(list);
- entry.setEnabled(true);
- WorkspaceEntry workspaceEntry = new WorkspaceEntry();
- workspaceEntry.setCache(entry);
- workspaceEntry.setUniqueName("MyWorkspace");
- JBossCacheWorkspaceStorageCache cache = new JBossCacheWorkspaceStorageCache(workspaceEntry,
- transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
- cache.start();
- return cache;
- }
-
- protected void finalize(JBossCacheWorkspaceStorageCache cache)
- {
- cache.cache.stop();
- }
-}
\ No newline at end of file
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TesterJBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TesterJBossCacheWorkspaceStorageCache.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TesterJBossCacheWorkspaceStorageCache.java 2011-11-15 09:34:55 UTC (rev 5187)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 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.dataflow.persistent.jbosscache;
+
+/**
+ *
+ * @author <a href="mailto:azavizionov at exoplatform.com">Alexey Zavizionov</a>
+ * @version $Id: TesterJBossCacheWorkspaceStorageCache.java 34360 2009-07-22 23:58:59Z zavizionov $
+ *
+ */
+public class TesterJBossCacheWorkspaceStorageCache
+{
+
+ public static void stop(JBossCacheWorkspaceStorageCache cache)
+ {
+ cache.cache.stop();
+ }
+
+}
More information about the exo-jcr-commits
mailing list