exo-jcr SVN: r1243 - jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-12-29 11:07:55 -0500 (Tue, 29 Dec 2009)
New Revision: 1243
Modified:
jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
Log:
EXOJCR-330 : The cluster.test.client was changed.
Modified: jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2009-12-29 15:53:15 UTC (rev 1242)
+++ jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2009-12-29 16:07:55 UTC (rev 1243)
@@ -80,9 +80,12 @@
return Put(workspacePath + name, stream);
}
- public void removeNode(String name) throws IOException, ModuleException
+ public HTTPResponse removeNode(String name) throws IOException, ModuleException
{
- Delete(workspacePath + name).getStatusCode();
+ HTTPResponse response = Delete(workspacePath + name);
+ response.getStatusCode();
+
+ return response;
}
/*public void getNode(String name) throws IOException, ModuleException
@@ -234,11 +237,27 @@
MkCol(workspacePath + path).getStatusCode();
}
- public void restore(String node, String version) throws IOException, ModuleException
+ public HTTPResponse restore(String node, String version) throws IOException, ModuleException
{
NVPair[] query = new NVPair[1];
query[0] = new NVPair("version", version);
- Get(workspacePath + node, query).getStatusCode();
+
+ HTTPResponse response = Get(workspacePath + node, query);
+ response.getStatusCode();
+
+ return response;
}
+
+ public HTTPResponse moveNode(String path, String destination) throws IOException, ModuleException
+ {
+ NVPair[] headers = new NVPair[2];
+ headers[0] = new NVPair(ExtHttpHeaders.DESTINATION, this.getProtocol() + "://" + this.getHost() + ":" + this.getPort() + workspacePath + destination);
+ headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH, Integer.toString("".length()));
+ HTTPResponse response = ExtensionMethod("MOVE", workspacePath + path, "".getBytes(), headers);
+ response.getStatusCode();
+
+ return response;
+ }
+
}
\ No newline at end of file
16 years, 4 months
exo-jcr SVN: r1242 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: util and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-29 10:53:15 -0500 (Tue, 29 Dec 2009)
New Revision: 1242
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/NodeIteratorOnDemand.java
Log:
EXOJCR-338: remove pool parameter
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-29 15:16:22 UTC (rev 1241)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-29 15:53:15 UTC (rev 1242)
@@ -1407,30 +1407,27 @@
* @throws RepositoryException
* if errors is occurs
*/
- public NodeImpl wrapNodeData(NodeData data, InternalQName parentPrimaryTypeName,
- InternalQName[] parentMixinTypeNames, boolean pool) throws RepositoryException
+ public NodeImpl wrapNodeData(NodeData data, InternalQName parentPrimaryTypeName, InternalQName[] parentMixinTypeNames)
+ throws RepositoryException
{
NodeImpl item = itemFactory.createNode(data, parentPrimaryTypeName, parentMixinTypeNames);
session.getActionHandler().postRead(item);
- if (pool)
+ NodeImpl pooledItem = (NodeImpl)itemsPool.getItem(data.getIdentifier());
+ if (pooledItem == null)
{
- NodeImpl pooledItem = (NodeImpl)itemsPool.getItem(data.getIdentifier());
- if (pooledItem == null)
+ NodeData pooledData = (NodeData)itemsPool.getData(data.getIdentifier());
+ if (pooledData != null)
{
- NodeData pooledData = (NodeData)itemsPool.getData(data.getIdentifier());
- if (pooledData != null)
- {
- item.loadData(pooledData);
- }
-
- item = (NodeImpl)itemsPool.get(item);
+ item.loadData(pooledData);
}
- else
- {
- item = pooledItem;
- }
+
+ item = (NodeImpl)itemsPool.get(item);
}
+ else
+ {
+ item = pooledItem;
+ }
return item;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/NodeIteratorOnDemand.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/NodeIteratorOnDemand.java 2009-12-29 15:16:22 UTC (rev 1241)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/NodeIteratorOnDemand.java 2009-12-29 15:53:15 UTC (rev 1242)
@@ -53,8 +53,6 @@
private InternalQName[] parentMixinTypeNames;
- private boolean pool;
-
private int pos;
/**
@@ -67,13 +65,11 @@
* parent primary type name
* @param parentMixinTypeNames
* parent mixin type names
- * @param pool
- * indicates does the item fall in pool when NodeImpl will be created
* @param dataManager
* session data manager
*/
public NodeIteratorOnDemand(List list, SessionDataManager dataManager, InternalQName parentPrimaryTypeName,
- InternalQName[] parentMixinTypeNames, boolean pool)
+ InternalQName[] parentMixinTypeNames)
{
if (list == null)
this.list = new ArrayList();
@@ -83,7 +79,6 @@
this.dataManager = dataManager;
this.parentPrimaryTypeName = parentPrimaryTypeName;
this.parentMixinTypeNames = parentMixinTypeNames;
- this.pool = pool;
this.iter = list.iterator();
this.pos = 0;
@@ -170,7 +165,7 @@
{
try
{
- list.set(pos, dataManager.wrapNodeData((NodeData)item, parentPrimaryTypeName, parentMixinTypeNames, pool));
+ list.set(pos, dataManager.wrapNodeData((NodeData)item, parentPrimaryTypeName, parentMixinTypeNames));
}
catch (RepositoryException e)
{
16 years, 4 months
exo-jcr SVN: r1241 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-12-29 10:16:22 -0500 (Tue, 29 Dec 2009)
New Revision: 1241
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQuery.java
Log:
EXOJCR-325: Added sleep to thread for waiting till volatile index is flushed to FS.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQuery.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQuery.java 2009-12-29 15:15:27 UTC (rev 1240)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestLoadIndexerQuery.java 2009-12-29 15:16:22 UTC (rev 1241)
@@ -105,6 +105,14 @@
String word = wordNode.getName();
Long count = wordNode.getProperty(TestLoadIndexerWriter.COUNT).getLong();
+ try
+ {
+ Thread.sleep(2000);
+ }
+ catch (InterruptedException e1)
+ {
+ }
+
QueryManager qman = sessionLocal.getWorkspace().getQueryManager();
Query q = qman.createQuery("SELECT * FROM nt:base WHERE fn:name() = '" + word + "'", Query.SQL);
@@ -113,7 +121,7 @@
try
{
assertTrue("Exp: "+count+"\t found:"+sqlsize, sqlsize >= count);
- System.out.print("+("+sqlsize+")");
+ System.out.println("+("+sqlsize+")");
}
catch (AssertionFailedError e)
{
16 years, 4 months
exo-jcr SVN: r1240 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-29 10:15:27 -0500 (Tue, 29 Dec 2009)
New Revision: 1240
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
Log:
EXOJCR-344: formatting
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-29 14:50:43 UTC (rev 1239)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-29 15:15:27 UTC (rev 1240)
@@ -1569,7 +1569,7 @@
* Merges incoming node with changes stored in this log i.e: 1. incoming data still not modified
* if there are no corresponding changes 2. incoming data is refreshed with corresponding changes
* if any 3. new datas is added from changes 4. if chaged data is marked as "deleted" it removes
- * from outgoing list WARN. THIS METHOD HAS SIBLING - mergeList, see below
+ * from outgoing list WARN. THIS METHOD HAS SIBLING - mergeList, see below.
*
* @param rootData
* @return
@@ -1590,9 +1590,13 @@
{
ItemData data = state.getData();
if (!state.isDeleted())
+ {
descendants.put(data.getIdentifier(), data);
+ }
else
+ {
descendants.remove(data.getIdentifier());
+ }
}
Collection<ItemData> desc = descendants.values();
return new ArrayList<ItemData>(desc);
@@ -1607,7 +1611,7 @@
* Merges incoming property data with changes stored in this log i.e: 1. incoming data still not modified
* if there are no corresponding changes 2. incoming data is refreshed with corresponding changes
* if any 3. new datas is added from changes 4. if chaged data is marked as "deleted" it removes
- * from outgoing list WARN. THIS METHOD HAS SIBLING - mergeList, see below
+ * from outgoing list WARN. THIS METHOD HAS SIBLING - mergeList, see below.
*
* @param rootData
* @return
@@ -1628,9 +1632,13 @@
{
ItemData data = state.getData();
if (!state.isDeleted())
+ {
descendants.put(data.getIdentifier(), data);
+ }
else
+ {
descendants.remove(data.getIdentifier());
+ }
}
Collection<ItemData> desc = descendants.values();
return new ArrayList<ItemData>(desc);
@@ -1643,7 +1651,7 @@
/**
* Merge a list of nodes and properties of root data. NOTE. Properties in the list will have empty
- * value data. I.e. for operations not changes properties content. USED FOR DELETE
+ * value data. I.e. for operations not changes properties content. USED FOR DELETE.
*
* @param rootData
* @param dataManager
@@ -1671,9 +1679,13 @@
{
ItemData data = state.getData();
if (!state.isDeleted())
+ {
descendants.put(data.getIdentifier(), data);
+ }
else
+ {
descendants.remove(data.getIdentifier());
+ }
}
Collection<ItemData> desc = descendants.values();
List<ItemData> retval;
@@ -1686,7 +1698,9 @@
{
retval.add(itemData);
if (deep)
+ {
retval.addAll(mergeList(itemData, dataManager, true, action));
+ }
}
}
else
@@ -1724,9 +1738,6 @@
for (NodeData childNode : childNodes)
{
ret.put(childNode.getIdentifier(), childNode);
-
- if (log.isDebugEnabled())
- log.debug("Traverse stored (N) " + childNode.getQPath().getAsString());
}
}
if (action != MERGE_NODES)
@@ -1746,9 +1757,6 @@
}
}
ret.put(childProp.getIdentifier(), childProp);
-
- if (log.isDebugEnabled())
- log.debug("Traverse stored (P) " + childProp.getQPath().getAsString());
}
}
}
16 years, 4 months
exo-jcr SVN: r1239 - kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-12-29 09:50:43 -0500 (Tue, 29 Dec 2009)
New Revision: 1239
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml
Log:
EXOJCR-330 : Enable plugability of management layer : forgot to add those files in previous commit
Added: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration1.xml 2009-12-29 14:50:43 UTC (rev 1239)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+ <component>
+ <key>FooPortal1</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/portal-configuration2.xml 2009-12-29 14:50:43 UTC (rev 1239)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+ <component>
+ <key>FooPortal2</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
Added: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/management/root-configuration.xml 2009-12-29 14:50:43 UTC (rev 1239)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.container.management.ManagementProviderImpl</key>
+ <type>org.exoplatform.container.management.ManagementProviderImpl</type>
+ </component>
+
+ <component>
+ <key>FooRoot</key>
+ <type>org.exoplatform.container.management.Foo</type>
+ </component>
+
+</configuration>
\ No newline at end of file
16 years, 4 months
exo-jcr SVN: r1238 - in kernel/trunk/exo.kernel.container/src: main/java/org/exoplatform/container/management and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-12-29 09:49:30 -0500 (Tue, 29 Dec 2009)
New Revision: 1238
Removed:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java
Log:
EXOJCR-350 : Enable plugability of management layer : add testing for nested portal container
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2009-12-29 14:04:26 UTC (rev 1237)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2009-12-29 14:49:30 UTC (rev 1238)
@@ -333,7 +333,7 @@
pcontainer.start();
// Register the portal as an mbean
- managementContext.register(pcontainer);
+ getManagementContext().register(pcontainer);
//
executeInitTasks(pcontainer, PortalContainerPostInitTask.TYPE);
Deleted: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java 2009-12-29 14:04:26 UTC (rev 1237)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/KernelManagementContext.java 2009-12-29 14:49:30 UTC (rev 1238)
@@ -1,72 +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.container.management;
-
-import org.exoplatform.management.spi.ManagementProvider;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class KernelManagementContext
-{
-
- /** . */
- final ManagementContextImpl root;
-
- /** . */
- private final Set<ManagementProvider> providers;
-
- /** . */
- private final ManageableContainer container;
-
- public KernelManagementContext(ManageableContainer container)
- {
- this.providers = new HashSet<ManagementProvider>();
- this.container = container;
-
- // Done last as we pass 'this' as argument
- this.root = new ManagementContextImpl(this, container);
- }
-
- public synchronized Collection<ManagementProvider> getProviders() {
- return providers;
- }
-
- public synchronized boolean addProvider(ManagementProvider provider)
- {
- // Prevent double registration just in case...
- if (providers.contains(provider)) {
- return false;
- }
-
- //
- providers.add(provider);
-
- // Perform registration of already registered managed components
- root.install(provider);
-
- //
- return false;
- }
-}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java 2009-12-29 14:04:26 UTC (rev 1237)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableComponentAdapter.java 2009-12-29 14:49:30 UTC (rev 1238)
@@ -83,7 +83,7 @@
if (instance instanceof ManagementProvider)
{
ManagementProvider provider = (ManagementProvider)instance;
- container.managementContext.kernelContext.addProvider(provider);
+ container.addProvider(provider);
}
}
}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java 2009-12-29 14:04:26 UTC (rev 1237)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java 2009-12-29 14:49:30 UTC (rev 1238)
@@ -36,6 +36,7 @@
import java.lang.management.ManagementFactory;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -60,15 +61,20 @@
}
/** . */
- private static final ThreadLocal<ManageableComponentAdapterFactory> hack =
- new ThreadLocal<ManageableComponentAdapterFactory>();
+ private static final ThreadLocal<ManageableComponentAdapterFactory> hack = new ThreadLocal<ManageableComponentAdapterFactory>();
/** . */
- protected ManagementContextImpl managementContext;
+ final ManagementContextImpl managementContext;
/** . */
- protected MBeanServer server;
+ private MBeanServer server;
+ /** . */
+ private final Set<ManagementProvider> providers;
+
+ /** . */
+ private final ManageableContainer parent;
+
public ManageableContainer()
{
this((PicoContainer)null);
@@ -88,29 +94,32 @@
factory.container = this;
hack.set(null);
- // Reference the same mbean server that the parent has
+ // The synchronized wrapper, here will not impact runtime performances
+ // so it's fine
+ this.providers = Collections.synchronizedSet(new HashSet<ManagementProvider>());
+
+ //
+ ManagementContextImpl parentCtx = null;
if (parent instanceof ManageableContainer)
{
ManageableContainer manageableParent = (ManageableContainer)parent;
+ parentCtx = manageableParent.managementContext;
+ }
- //
- ManagementContextImpl parentManagementContext = manageableParent.managementContext;
- if (parentManagementContext != null)
- {
- managementContext = new ManagementContextImpl(parentManagementContext, this);
- }
+ //
+ this.parent = parent instanceof ManageableContainer ? (ManageableContainer)parent : null;
- // Get server from parent
- server = manageableParent.server;
- } else {
- KernelManagementContext kernelCtx = new KernelManagementContext(this);
-
- //
+ //
+ if (parentCtx != null)
+ {
+ server = parentCtx.container.server;
+ managementContext = new ManagementContextImpl(parentCtx, this);
+ }
+ else
+ {
server = findMBeanServer();
- managementContext = kernelCtx.root;
-
- //
- kernelCtx.addProvider(new JMXManagementProvider(server));
+ managementContext = new ManagementContextImpl(this);
+ addProvider(new JMXManagementProvider(server));
}
}
@@ -172,9 +181,50 @@
if (componentInstance instanceof ManagementProvider)
{
ManagementProvider provider = (ManagementProvider)componentInstance;
- managementContext.kernelContext.addProvider(provider);
+ addProvider(provider);
}
}
return adapter;
}
+
+ /**
+ * Returns the list of the providers which are relevant for this container.
+ *
+ * @return the providers
+ */
+ Collection<ManagementProvider> getProviders()
+ {
+ HashSet<ManagementProvider> allProviders = new HashSet<ManagementProvider>();
+ computeAllProviders(allProviders);
+ return allProviders;
+ }
+
+ private void computeAllProviders(Set<ManagementProvider> allProviders)
+ {
+ if (parent != null)
+ {
+ parent.computeAllProviders(allProviders);
+ }
+
+ //
+ allProviders.addAll(providers);
+ }
+
+ boolean addProvider(ManagementProvider provider)
+ {
+ // Prevent double registration just in case...
+ if (providers.contains(provider))
+ {
+ return false;
+ }
+
+ //
+ providers.add(provider);
+
+ // Perform registration of already registered managed components
+ managementContext.install(provider);
+
+ //
+ return true;
+ }
}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java 2009-12-29 14:04:26 UTC (rev 1237)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManagementContextImpl.java 2009-12-29 14:49:30 UTC (rev 1238)
@@ -23,7 +23,6 @@
import org.exoplatform.management.ManagementAware;
import org.exoplatform.management.spi.ManagedResource;
import org.exoplatform.management.spi.ManagedTypeMetaData;
-import org.exoplatform.container.management.MetaDataBuilder;
import org.exoplatform.management.spi.ManagementProvider;
import org.exoplatform.management.ManagementContext;
import org.exoplatform.management.annotations.ManagedBy;
@@ -49,29 +48,22 @@
private final Map<Object, ManagementContextImpl> registrations;
/** . */
- final Map<ManagementProvider, Object> bilto;
+ final Map<ManagementProvider, Object> managedSet;
/** . */
private final ManagementContextImpl parent;
/** . */
- final KernelManagementContext kernelContext;
-
- /** . */
private final Object resource;
/** . */
private final ManagedTypeMetaData typeMD;
/** An optional container setup when the management context is attached to a container. */
- private final ManageableContainer container;
+ final ManageableContainer container;
- public ManagementContextImpl(KernelManagementContext kernelContext, ManageableContainer container)
+ public ManagementContextImpl(ManageableContainer container)
{
- if (kernelContext == null)
- {
- throw new NullPointerException();
- }
if (container == null)
{
throw new NullPointerException();
@@ -88,11 +80,10 @@
}
//
- this.bilto = new HashMap<ManagementProvider, Object>();
+ this.managedSet = new HashMap<ManagementProvider, Object>();
this.registrations = new HashMap<Object, ManagementContextImpl>();
this.parent = null;
this.scopingDataList = new HashMap<Class<?>, Object>();
- this.kernelContext = kernelContext;
this.resource = resource;
this.typeMD = typeMD;
this.container = container;
@@ -120,11 +111,10 @@
}
//
- this.bilto = new HashMap<ManagementProvider, Object>();
+ this.managedSet = new HashMap<ManagementProvider, Object>();
this.registrations = new HashMap<Object, ManagementContextImpl>();
this.parent = parent;
this.scopingDataList = new HashMap<Class<?>, Object>();
- this.kernelContext = parent.kernelContext;
this.resource = resource;
this.typeMD = typeMD;
this.container = container;
@@ -142,11 +132,10 @@
}
//
- this.bilto = new HashMap<ManagementProvider, Object>();
+ this.managedSet = new HashMap<ManagementProvider, Object>();
this.registrations = new HashMap<Object, ManagementContextImpl>();
this.parent = parent;
this.scopingDataList = new HashMap<Class<?>, Object>();
- this.kernelContext = parent.kernelContext;
this.resource = resource;
this.typeMD = typeMD;
this.container = null;
@@ -220,12 +209,15 @@
registrations.put(resource, managementContext);
//
- for (ManagementProvider provider : kernelContext.getProviders())
+ ManageableContainer container = findContainer();
+
+ // Install for all the providers related
+ for (ManagementProvider provider : container.getProviders())
{
Object name = provider.manage(managementContext);
if (name != null)
{
- managementContext.bilto.put(provider, name);
+ managementContext.managedSet.put(provider, name);
}
}
@@ -243,7 +235,7 @@
ManagementContextImpl context = registrations.remove(o);
if (context != null)
{
- for (Map.Entry<ManagementProvider, Object> entry : context.bilto.entrySet()) {
+ for (Map.Entry<ManagementProvider, Object> entry : context.managedSet.entrySet()) {
entry.getKey().unmanage(entry.getValue());
}
}
@@ -310,16 +302,18 @@
}
void install(ManagementProvider provider) {
+
+ // Install the current resource if necessary
if (resource != null&& typeMD != null)
{
Object name = provider.manage(this);
if (name != null)
{
- bilto.put(provider, name);
+ managedSet.put(provider, name);
}
}
- // Install for all
+ // Install thie children except the container ones
for (ManagementContextImpl registration : registrations.values())
{
registration.install(provider);
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java 2009-12-29 14:04:26 UTC (rev 1237)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagedResource.java 2009-12-29 14:49:30 UTC (rev 1238)
@@ -55,4 +55,10 @@
{
context.setScopingData(ScopedData.class, data);
}
+
+ @Override
+ public String toString()
+ {
+ return "ManagedResource[key=" + key + ",resource=" + resource + "]";
+ }
}
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java 2009-12-29 14:04:26 UTC (rev 1237)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/ManagementProviderImpl.java 2009-12-29 14:49:30 UTC (rev 1238)
@@ -34,18 +34,22 @@
{
/** . */
- final List<org.exoplatform.container.management.ManagedResource> resources = new ArrayList<org.exoplatform.container.management.ManagedResource>();
+ final List<org.exoplatform.container.management.ManagedResource> managedResources = new ArrayList<org.exoplatform.container.management.ManagedResource>();
+ /** . */
+ final List<Object> resources = new ArrayList<Object>();
+
public Object manage(ManagedResource context)
{
org.exoplatform.container.management.ManagedResource mr = new org.exoplatform.container.management.ManagedResource(context.getResource(), context, context.getMetaData());
- resources.add(mr);
+ managedResources.add(mr);
+ resources.add(mr.resource);
return mr.key;
}
public void unmanage(Object key)
{
- for (Iterator<org.exoplatform.container.management.ManagedResource> i = resources.iterator();i.hasNext();)
+ for (Iterator<org.exoplatform.container.management.ManagedResource> i = managedResources.iterator();i.hasNext();)
{
org.exoplatform.container.management.ManagedResource mr = i.next();
if (mr.key == key)
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java 2009-12-29 14:04:26 UTC (rev 1237)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/management/TestManagementProvider.java 2009-12-29 14:49:30 UTC (rev 1238)
@@ -20,6 +20,7 @@
package org.exoplatform.container.management;
import junit.framework.TestCase;
+import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.RootContainer;
import org.exoplatform.container.support.ContainerBuilder;
@@ -47,11 +48,11 @@
URL url = getClass().getResource("configuration1.xml");
RootContainer container = new ContainerBuilder().withRoot(url).build();
ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
- assertEquals(1, provider.resources.size());
+ assertEquals(1, provider.managedResources.size());
Object foo = container.getComponentInstance("Foo");
assertNotNull(foo);
- assertEquals(2, provider.resources.size());
- ManagedResource fooMR = provider.resources.get(1);
+ assertEquals(2, provider.managedResources.size());
+ ManagedResource fooMR = provider.managedResources.get(1);
assertSame(foo, fooMR.resource);
assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingData(ScopedData.class));
fooMR.register();
@@ -68,8 +69,8 @@
assertNotNull(foo);
provider = new ManagementProviderImpl();
container.registerComponentInstance(provider);
- assertEquals(2, provider.resources.size());
- ManagedResource fooMR = provider.resources.get(1);
+ assertEquals(2, provider.managedResources.size());
+ ManagedResource fooMR = provider.managedResources.get(1);
assertSame(foo, fooMR.resource);
assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingData(ScopedData.class));
fooMR.register();
@@ -82,22 +83,54 @@
RootContainer container = new ContainerBuilder().withRoot(url).build();
ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
Foo foo = (Foo)container.getComponentInstance("Foo");
- assertEquals(2, provider.resources.size());
- ManagedResource fooMR = provider.resources.get(1);
+ assertEquals(2, provider.managedResources.size());
+ ManagedResource fooMR = provider.managedResources.get(1);
fooMR.register();
assertTrue(foo.isAware());
//
foo.deploy();
- assertEquals(3, provider.resources.size());
- ManagedResource barMR = provider.resources.get(2);
+ assertEquals(3, provider.managedResources.size());
+ ManagedResource barMR = provider.managedResources.get(2);
assertSame(foo.bar, barMR.resource);
barMR.register();
assertEquals(Arrays.asList(barMR.data, fooMR.data), barMR.context.getScopingData(ScopedData.class));
//
foo.undeploy();
- assertEquals(2, provider.resources.size());
- assertEquals(fooMR, provider.resources.get(1));
+ assertEquals(2, provider.managedResources.size());
+ assertEquals(fooMR, provider.managedResources.get(1));
}
+
+ public void testContainerScopedRegistration()
+ {
+ URL rootURL = getClass().getResource("root-configuration.xml");
+ URL portal1URL = getClass().getResource("portal-configuration1.xml");
+ URL portal2URL = getClass().getResource("portal-configuration2.xml");
+ RootContainer root = new ContainerBuilder().withRoot(rootURL).withPortal("portal1", portal1URL).withPortal("portal2", portal2URL).build();
+ Foo fooRoot = (Foo)root.getComponentInstanceOfType(Foo.class);
+ ManagementProviderImpl provider = (ManagementProviderImpl)root.getComponentInstanceOfType(ManagementProviderImpl.class);
+ PortalContainer portal1 = root.getPortalContainer("portal1");
+ Foo fooPortal1 = (Foo)portal1.getComponentInstanceOfType(Foo.class);
+ ManagementProviderImpl provider1 = (ManagementProviderImpl)portal1.getComponentInstanceOfType(ManagementProviderImpl.class);
+ PortalContainer portal2 = root.getPortalContainer("portal2");
+ Foo fooPortal2 = (Foo)portal2.getComponentInstanceOfType(Foo.class);
+ ManagementProviderImpl provider2 = (ManagementProviderImpl)portal2.getComponentInstanceOfType(ManagementProviderImpl.class);
+
+ //
+ assertEquals(6, provider.managedResources.size());
+ assertTrue(provider.resources.contains(root));
+ assertTrue(provider.resources.contains(root));
+ assertTrue(provider.resources.contains(portal1));
+ assertTrue(provider.resources.contains(portal2));
+ assertTrue(provider.resources.contains(fooRoot));
+ assertTrue(provider.resources.contains(fooPortal1));
+ assertTrue(provider.resources.contains(fooPortal2));
+ assertEquals(2, provider1.managedResources.size());
+ assertEquals(portal1, provider1.managedResources.get(0).resource);
+ assertEquals(fooPortal1, provider1.managedResources.get(1).resource);
+ assertEquals(2, provider2.managedResources.size());
+ assertEquals(portal2, provider2.managedResources.get(0).resource);
+ assertEquals(fooPortal2, provider2.managedResources.get(1).resource);
+ }
}
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java 2009-12-29 14:04:26 UTC (rev 1237)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/support/ContainerBuilder.java 2009-12-29 14:49:30 UTC (rev 1238)
@@ -30,20 +30,28 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
/**
- * An helper for building a root container and a portal container. I have done several attempt to make easily
- * and safe root/portal container boot for unit test. This one is my best attempt so far.
+ * <p>An helper for building a root container and a portal container. I have done several attempt to make easily
+ * and safe root/portal container boot for unit test. This one is my best attempt so far.</p>
*
+ * <p>Note that the portal container are booted in the order they are declared first.</p>
+ *
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
public class ContainerBuilder
{
+ /** A hack used during the boot of a portal container. */
+ private final ThreadLocal<String> bootedPortalName = new ThreadLocal<String>();
+
/** . */
private ClassLoader loader;
@@ -51,7 +59,7 @@
private List<URL> configURLs;
/** . */
- private List<URL> portalConfigURLs;
+ private LinkedHashMap<String, List<URL>> portalConfigURLs;
/** . */
private Set<String> profiles;
@@ -60,7 +68,7 @@
{
this.loader = Thread.currentThread().getContextClassLoader();
this.configURLs = new ArrayList<URL>();
- this.portalConfigURLs = new ArrayList<URL>();
+ this.portalConfigURLs = new LinkedHashMap<String, List<URL>>();
}
public ContainerBuilder withRoot(String configPath)
@@ -77,28 +85,33 @@
public ContainerBuilder withPortal(String configPath)
{
- portalConfigURLs.addAll(urls(configPath));
+ return withPortal("portal", configPath);
+ }
+
+ public ContainerBuilder withPortal(String portalName, String configPath)
+ {
+ for (URL configURL : urls(configPath))
+ {
+ withPortal(portalName, configURL);
+ }
return this;
}
public ContainerBuilder withPortal(URL configURL)
{
- portalConfigURLs.add(configURL);
- return this;
+ return withPortal("portal", configURL);
}
- private List<URL> urls(String path)
+ public ContainerBuilder withPortal(String portalName, URL configURL)
{
- try
+ List<URL> urls = portalConfigURLs.get(portalName);
+ if (urls == null)
{
- return Collections.list(loader.getResources(path));
+ urls = new ArrayList<URL>();
+ portalConfigURLs.put(portalName, urls);
}
- catch (IOException e)
- {
- AssertionFailedError err = new AssertionFailedError();
- err.initCause(e);
- throw err;
- }
+ urls.add(configURL);
+ return this;
}
public ContainerBuilder withLoader(ClassLoader loader)
@@ -113,6 +126,20 @@
return this;
}
+ private List<URL> urls(String path)
+ {
+ try
+ {
+ return Collections.list(loader.getResources(path));
+ }
+ catch (IOException e)
+ {
+ AssertionFailedError err = new AssertionFailedError();
+ err.initCause(e);
+ throw err;
+ }
+ }
+
public RootContainer build()
{
try
@@ -178,7 +205,8 @@
}
else if ("conf/portal/configuration.xml".equals(name))
{
- return Collections.enumeration(portalConfigURLs);
+ String portalName = bootedPortalName.get();
+ return Collections.enumeration(portalConfigURLs.get(portalName));
}
else if ("conf/portal/test-configuration.xml".equals(name))
{
@@ -204,9 +232,17 @@
root = RootContainer.getInstance();
//
- if (portalConfigURLs.size() > 0)
+ for (String portalName : portalConfigURLs.keySet())
{
- root.getPortalContainer("portal");
+ try
+ {
+ bootedPortalName.set(portalName);
+ root.getPortalContainer(portalName);
+ }
+ finally
+ {
+ bootedPortalName.set(null);
+ }
}
}
finally
16 years, 4 months
exo-jcr SVN: r1237 - in jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster: functional and 1 other directory.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-12-29 09:04:26 -0500 (Tue, 29 Dec 2009)
New Revision: 1237
Added:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavCreatePropertyTest.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavLockNodeTest.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemovePropertyTest.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavSetPropertyTest.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavVersionTest.java
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/BaseClusteringFunctionalTest.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddBLOBTest.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddNodeTest.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavMoveNodeTest.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemoveNodeTest.java
Log:
EXOJCR-330 : Add new functional cluster tests and changed existing tests.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/BaseClusteringFunctionalTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/BaseClusteringFunctionalTest.java 2009-12-29 14:02:02 UTC (rev 1236)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/BaseClusteringFunctionalTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -18,7 +18,6 @@
import junit.framework.TestCase;
-import org.exoplatform.common.http.client.CookieModule;
import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
import java.io.File;
@@ -36,32 +35,18 @@
*/
public abstract class BaseClusteringFunctionalTest extends TestCase
{
- protected JCRWebdavConnection connection1;
-
- protected JCRWebdavConnection connection2;
-
- protected JCRWebdavConnection connection3;
-
- protected JCRWebdavConnection connection4;
-
- private String host = "localhost";
-
- private int port1 = 8081;//8080;
-
- private int port2 = 8082;
-
- private int port3 = 8083;
-
- private int port4 = 8084;
-
+
private String realm = "eXo REST services";
- private String user = "root";
-
- private String password = "exo";
-
private String workspacePath = "/rest/jcr/repository/production/";
+ private JCRWebdavConnection[] connections = new JCRWebdavConnection[] {
+ new JCRWebdavConnection("localhost", 8080, "root", "exo", realm, workspacePath)/*,
+ new JCRWebdavConnection("localhost", 8082, "root", "exo", realm, workspacePath),
+ new JCRWebdavConnection("localhost", 8083, "root", "exo", realm, workspacePath),
+ new JCRWebdavConnection("localhost", 8084, "root", "exo", realm, workspacePath)*/
+ };
+
protected String nodeName;
/**
@@ -71,12 +56,6 @@
{
super.setUp();
- CookieModule.setCookiePolicyHandler(null);
- connection1 = new JCRWebdavConnection(host, port1, user, password, realm, workspacePath);
- connection2 = new JCRWebdavConnection(host, port2, user, password, realm, workspacePath);
- connection3 = new JCRWebdavConnection(host, port3, user, password, realm, workspacePath);
- connection4 = new JCRWebdavConnection(host, port4, user, password, realm, workspacePath);
-
nodeName = generateUniqueName("removed_node_over_webdav");
}
@@ -92,10 +71,28 @@
{
super.tearDown();
- connection1.removeNode(nodeName);
- connection1.stop();
+ connections[0].removeNode(nodeName);
+ connections[0].stop();
}
+
+ protected JCRWebdavConnection[] getConnections()
+ {
+ return connections;
+ }
+
+ protected JCRWebdavConnection getConnection()
+ {
+ return connections[(int) (Math.random() * 100) % connections.length];
+ }
+ /**
+ * Create BLOB.
+ *
+ * @param prefix
+ * @param sizeInKb
+ * @return
+ * @throws IOException
+ */
protected File createBLOBTempFile(String prefix, int sizeInKb) throws IOException
{
// create test file
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddBLOBTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddBLOBTest.java 2009-12-29 14:02:02 UTC (rev 1236)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddBLOBTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -19,6 +19,7 @@
import org.exoplatform.common.http.client.HTTPResponse;
import org.exoplatform.common.http.client.HttpOutputStream;
import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -48,42 +49,24 @@
Random random = new Random();
random.nextBytes(data);
+ JCRWebdavConnection conn = getConnection();
+
// add node with blob data
HttpOutputStream stream = new HttpOutputStream();
- HTTPResponse response = connection1.addNode(nodeName, stream);
+ HTTPResponse response = conn.addNode(nodeName, stream);
loadStream(stream, new ByteArrayInputStream(data));
stream.close();
response.getStatusCode();
// check results
- // cluster-node1
- response = connection1.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
- byte[] respData = response.getData();
- assertEquals(data.length, respData.length);
- assertTrue(java.util.Arrays.equals(data, respData));
-
- // cluster-node2
- response = connection2.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
- respData = response.getData();
- assertEquals(data.length, respData.length);
- assertTrue(java.util.Arrays.equals(data, respData));
-
- // cluster-node3
- response = connection3.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
- respData = response.getData();
- assertEquals(data.length, respData.length);
- assertTrue(java.util.Arrays.equals(data, respData));
-
- // cluster-node4
- response = connection4.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
- respData = response.getData();
- assertEquals(data.length, respData.length);
- assertTrue(java.util.Arrays.equals(data, respData));
-
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ response = connection.getNode(nodeName);
+ assertEquals(200, response.getStatusCode());
+ byte[] respData = response.getData();
+ assertEquals(data.length, respData.length);
+ assertTrue(java.util.Arrays.equals(data, respData));
+ }
}
protected void loadStream(HttpOutputStream stream, InputStream in) throws IOException
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddNodeTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddNodeTest.java 2009-12-29 14:02:02 UTC (rev 1236)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavAddNodeTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -18,6 +18,7 @@
import org.exoplatform.common.http.client.HTTPResponse;
import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
/**
* Created by The eXo Platform SAS.
@@ -32,30 +33,18 @@
public void testAddNode() throws Exception
{
+ JCRWebdavConnection conn = getConnection();
+
// add node
- connection1.addNode(nodeName, "_data_".getBytes());
+ conn.addNode(nodeName, "_data_".getBytes());
// check is node exist
- // cluster-node1
- HTTPResponse response = connection1.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
- assertTrue("_data_".equals(new String(response.getData())));
-
- // cluster-node2
- HTTPResponse response2 = connection2.getNode(nodeName);
- assertEquals(200, response2.getStatusCode());
- assertTrue("_data_".equals(new String(response2.getData())));
-
- // cluster-node3
- HTTPResponse response3 = connection3.getNode(nodeName);
- assertEquals(200, response3.getStatusCode());
- assertTrue("_data_".equals(new String(response3.getData())));
-
- // cluster-node4
- HTTPResponse response4 = connection4.getNode(nodeName);
- assertEquals(200, response4.getStatusCode());
- assertTrue("_data_".equals(new String(response4.getData())));
-
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.getNode(nodeName);
+ assertEquals(200, response.getStatusCode());
+ assertTrue("_data_".equals(new String(response.getData())));
+ }
}
}
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavCreatePropertyTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavCreatePropertyTest.java (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavCreatePropertyTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -0,0 +1,54 @@
+/*
+ * 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.cluster.functional;
+
+import org.exoplatform.common.http.client.HTTPResponse;
+import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public class WebdavCreatePropertyTest
+ extends BaseClusteringFunctionalTest
+{
+
+ public void testCreatePropertyTest() throws Exception
+ {
+ JCRWebdavConnection conn = getConnection();
+
+ String property = "D:testProp";
+
+ conn.addNode(nodeName, "nt:untstructured","".getBytes());
+ conn.addProperty(nodeName, property);
+ conn.setProperty(nodeName, property, "prop_value");
+
+ // check is property exist
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.getProperty(nodeName, property);
+ assertEquals(207, response.getStatusCode());
+ assertTrue("_data_".equals(new String(response.getData())));
+ }
+
+ }
+}
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavCreatePropertyTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavLockNodeTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavLockNodeTest.java (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavLockNodeTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -0,0 +1,67 @@
+/*
+ * 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.cluster.functional;
+
+import org.exoplatform.common.http.client.HTTPResponse;
+import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public class WebdavLockNodeTest
+ extends BaseClusteringFunctionalTest
+{
+ public void testLock() throws Exception
+ {
+ JCRWebdavConnection conn = getConnection();
+
+ // prepare
+ String lockedNodeName = "locked_node";
+
+ conn.addDir(nodeName);
+ conn.addNode(nodeName + "/" + lockedNodeName, "".getBytes());
+
+ // lock
+ String lockToken = conn.lock(nodeName);
+
+ // check
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.addNode(nodeName + "/" + "subnode", "should not be added".getBytes());
+
+ assertEquals(403, response.getStatusCode());
+ }
+
+ // unloc
+ conn.unlock(nodeName, lockToken);
+
+ // ckeck
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.addNode(nodeName + "/" + "subnode", "should be added".getBytes());
+
+ assertEquals(200, response.getStatusCode());
+ assertTrue("should be added".equals(new String(response.getData())));
+ }
+ }
+}
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavLockNodeTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavMoveNodeTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavMoveNodeTest.java 2009-12-29 14:02:02 UTC (rev 1236)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavMoveNodeTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -18,6 +18,7 @@
import org.exoplatform.common.http.client.HTTPResponse;
import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
/**
* Created by The eXo Platform SAS.
@@ -31,64 +32,38 @@
{
public void testMoveNode() throws Exception
{
+ JCRWebdavConnection conn = getConnection();
+
String newNodeName = nodeName + "new";
// add node
- connection1.addNode(nodeName, "".getBytes());
+ conn.addNode(nodeName, "".getBytes());
+
// check is node exist
- // cluster-node1
- HTTPResponse response = connection1.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.getNode(nodeName);
+ assertEquals(200, response.getStatusCode());
+ }
- // cluster-node2
- HTTPResponse response2 = connection2.getNode(nodeName);
- assertEquals(200, response2.getStatusCode());
-
- // cluster-node3
- HTTPResponse response3 = connection3.getNode(nodeName);
- assertEquals(200, response3.getStatusCode());
-
- // cluster-node4
- HTTPResponse response4 = connection4.getNode(nodeName);
- assertEquals(200, response4.getStatusCode());
-
- // move node on cluster-node3
-
- response = connection3.Move(nodeName, newNodeName);
+ // move node
+ conn = getConnection();
+
+ HTTPResponse response = conn.Move(nodeName, newNodeName);
response.getStatusCode();
// check is node not exist
- // cluster-node1
- response = connection1.getNode(nodeName);
- assertEquals(404, response.getStatusCode());
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ response = connection.getNode(nodeName);
+ assertEquals(404, response.getStatusCode());
+ }
- // cluster-node2
- response2 = connection2.getNode(nodeName);
- assertEquals(404, response2.getStatusCode());
-
- // cluster-node3
- response3 = connection3.getNode(nodeName);
- assertEquals(404, response3.getStatusCode());
-
- // cluster-node4
- response4 = connection4.getNode(nodeName);
- assertEquals(404, response4.getStatusCode());
-
// check is node exist
- // cluster-node1
- response = connection1.getNode(newNodeName);
- assertEquals(200, response.getStatusCode());
-
- // cluster-node2
- response2 = connection2.getNode(newNodeName);
- assertEquals(200, response2.getStatusCode());
-
- // cluster-node3
- response3 = connection3.getNode(newNodeName);
- assertEquals(200, response3.getStatusCode());
-
- // cluster-node4
- response4 = connection4.getNode(newNodeName);
- assertEquals(200, response4.getStatusCode());
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ response = connection.getNode(newNodeName);
+ assertEquals(200, response.getStatusCode());
+ }
}
}
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemoveNodeTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemoveNodeTest.java 2009-12-29 14:02:02 UTC (rev 1236)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemoveNodeTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -18,6 +18,7 @@
import org.exoplatform.common.http.client.HTTPResponse;
import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
/**
* Created by The eXo Platform SAS.
@@ -31,41 +32,26 @@
{
public void testRemoveNode() throws Exception
{
+
// add test node
- connection1.addNode(nodeName, "".getBytes());
+ getConnection().addNode(nodeName, "".getBytes());
- // check is exist cluster-node1
- HTTPResponse response = connection1.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
- //cluster-node2
- response = connection2.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
- //cluster-node3
- response = connection3.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
- //cluster-node4
- response = connection4.getNode(nodeName);
- assertEquals(200, response.getStatusCode());
+ // check is exist
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.getNode(nodeName);
+ assertEquals(200, response.getStatusCode());
+ }
- // remove node on cluster-node2
- connection2.removeNode(nodeName);
+ // remove node
+
+ getConnection().removeNode(nodeName);
- // check cluster-node1
- response = connection1.getNode(nodeName);
- assertEquals(404, response.getStatusCode());
-
- // cluster-node2
- response = connection2.getNode(nodeName);
- assertEquals(404, response.getStatusCode());
-
- // cluster-node3
- response = connection3.getNode(nodeName);
- assertEquals(404, response.getStatusCode());
-
- // cluster-node4
- response = connection4.getNode(nodeName);
- assertEquals(404, response.getStatusCode());
-
+ // check
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.getNode(nodeName);
+ assertEquals(404, response.getStatusCode());
+ }
}
-
}
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemovePropertyTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemovePropertyTest.java (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemovePropertyTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -0,0 +1,50 @@
+/*
+ * 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.cluster.functional;
+
+import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public class WebdavRemovePropertyTest
+ extends BaseClusteringFunctionalTest
+{
+ public void testRemoveProperty() throws Exception
+ {
+ JCRWebdavConnection conn = getConnection();
+
+ // prepare
+ conn.addNode(nodeName, "nt:untstructured", "".getBytes());
+ conn.setProperty(nodeName, "D:testProp", "the_value");
+
+ //check
+
+
+ //remove
+ conn.removeProperty(nodeName, "D:testProp");
+
+ //check
+
+ }
+}
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavRemovePropertyTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavSetPropertyTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavSetPropertyTest.java (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavSetPropertyTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -0,0 +1,50 @@
+/*
+ * 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.cluster.functional;
+
+import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public class WebdavSetPropertyTest
+ extends BaseClusteringFunctionalTest
+{
+ public void testSetProperty() throws Exception
+ {
+ JCRWebdavConnection conn = getConnection();
+
+ // prepare
+ conn.addNode(nodeName, "nt:untstructured", "".getBytes());
+ conn.addProperty(nodeName, "D:testProp");
+
+ // check
+
+
+ // set property
+ conn.setProperty(nodeName, "D:testProp", "testValue");
+
+
+ // check
+ }
+}
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavSetPropertyTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavVersionTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavVersionTest.java (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavVersionTest.java 2009-12-29 14:04:26 UTC (rev 1237)
@@ -0,0 +1,76 @@
+/*
+ * 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.cluster.functional;
+
+import org.exoplatform.common.http.client.HTTPResponse;
+import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public class WebdavVersionTest
+ extends BaseClusteringFunctionalTest
+{
+ public void testVersioning() throws Exception
+ {
+ JCRWebdavConnection conn = getConnection();
+
+ conn.addNode(nodeName, "v1".getBytes());
+
+ conn.addVersionControl(nodeName);
+
+ conn.checkIn(nodeName);
+ conn.checkOut(nodeName);
+
+ // check
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.getNode(nodeName);
+ assertEquals(200, response.getStatusCode());
+ assertTrue("v1".equals(new String(response.getData())));
+ }
+
+ conn.checkIn(nodeName);
+ conn.addNode(nodeName, "v2".getBytes());
+ conn.checkOut(nodeName);
+
+ // check
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.getNode(nodeName);
+ assertEquals(200, response.getStatusCode());
+ assertTrue("v2".equals(new String(response.getData())));
+ }
+
+ // restore
+ conn.restore(nodeName, "1");
+
+ //check
+ for (JCRWebdavConnection connection : getConnections())
+ {
+ HTTPResponse response = connection.getNode(nodeName);
+ assertEquals(200, response.getStatusCode());
+ assertTrue("v1".equals(new String(response.getData())));
+ }
+ }
+}
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavVersionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
16 years, 4 months
exo-jcr SVN: r1236 - jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-12-29 09:02:02 -0500 (Tue, 29 Dec 2009)
New Revision: 1236
Modified:
jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
Log:
EXOJCR-330 : The cluster.test.client was changed.
Modified: jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2009-12-29 13:38:10 UTC (rev 1235)
+++ jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2009-12-29 14:02:02 UTC (rev 1236)
@@ -20,6 +20,7 @@
import javax.ws.rs.core.HttpHeaders;
+import org.exoplatform.common.http.client.CookieModule;
import org.exoplatform.common.http.client.HTTPConnection;
import org.exoplatform.common.http.client.HTTPResponse;
import org.exoplatform.common.http.client.HttpHeaderElement;
@@ -50,6 +51,8 @@
{
super(host, port);
+ CookieModule.setCookiePolicyHandler(null);
+
this.user = user;
this.pass = password;
this.realm = realm;
@@ -58,16 +61,18 @@
addBasicAuthorization(this.realm, this.user, this.pass);
}
- public void addNode(String name, byte[] data) throws IOException, ModuleException
+ public HTTPResponse addNode(String name, byte[] data) throws IOException, ModuleException
{
- Put(workspacePath + name, data).getStatusCode();
+ HTTPResponse response = Put(workspacePath + name, data);
+ response.getStatusCode();
+ return response;
}
public void addNode(String name, String nodeType, byte[] data) throws IOException, ModuleException
{
NVPair[] headers = new NVPair[1];
headers[0] = new NVPair("File-NodeType", nodeType);
- Put(workspacePath + name, data).getStatusCode();
+ Put(workspacePath + name, data, headers).getStatusCode();
}
public HTTPResponse addNode(String name, HttpOutputStream stream) throws IOException, ModuleException
@@ -93,7 +98,7 @@
}
- public void addProperty(String nodeName, String property) throws IOException, ModuleException
+ public HTTPResponse addProperty(String nodeName, String property) throws IOException, ModuleException
{
String xmlBody =
"<?xml version='1.0' encoding='utf-8' ?>" + "<D:propertyupdate xmlns:D='DAV:'>" + "<D:set>" + "<D:prop>" + "<"
@@ -103,10 +108,13 @@
headers[0] = new NVPair(HttpHeaders.CONTENT_TYPE, "text/xml; charset='utf-8'");
headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH, Integer.toString(xmlBody.length()));
- ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers).getStatusCode();
+ HTTPResponse response = ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers);
+ response.getStatusCode();
+
+ return response;
}
- public void setProperty(String nodeName, String property, String value) throws IOException, ModuleException
+ public HTTPResponse setProperty(String nodeName, String property, String value) throws IOException, ModuleException
{
String xmlBody =
"<?xml version='1.0' encoding='utf-8' ?>" + "<D:propertyupdate xmlns:D='DAV:'>" + "<D:set>" + "<D:prop>" + "<"
@@ -119,9 +127,28 @@
HTTPResponse response = ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers);
response.getStatusCode();
+ return response;
}
+
+ public HTTPResponse getProperty(String nodeName, String property) throws IOException, ModuleException
+ {
+ String xmlBody =
+ "<?xml version='1.0' encoding='utf-8' ?>"
+ + "<D:propfind xmlns:D='DAV:' >"
+ + "<D:prop><" + property + "/></D:prop>"
+ + "</D:propfind>";
- public void removeProperty(String nodeName, String property) throws IOException, ModuleException
+ NVPair[] headers = new NVPair[2];
+ headers[0] = new NVPair(HttpHeaders.CONTENT_TYPE, "text/xml; charset='utf-8'");
+ headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH, Integer.toString(xmlBody.length()));
+
+ HTTPResponse response = ExtensionMethod("PROPFIND", workspacePath + nodeName, xmlBody.getBytes(), headers);
+ response.getStatusCode();
+
+ return response;
+ }
+
+ public HTTPResponse removeProperty(String nodeName, String property) throws IOException, ModuleException
{
String xmlBody =
"<?xml version='1.0' encoding='utf-8' ?>"
@@ -132,7 +159,10 @@
headers[0] = new NVPair(HttpHeaders.CONTENT_TYPE, "text/xml; charset='utf-8'");
headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH, Integer.toString(xmlBody.length()));
- ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers).getStatusCode();
+ HTTPResponse response = ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers);
+ response.getStatusCode();
+
+ return response;
}
public String lock(String nodeName) throws IOException, ModuleException
@@ -203,7 +233,7 @@
{
MkCol(workspacePath + path).getStatusCode();
}
-
+
public void restore(String node, String version) throws IOException, ModuleException
{
NVPair[] query = new NVPair[1];
16 years, 4 months
exo-jcr SVN: r1235 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-29 08:38:10 -0500 (Tue, 29 Dec 2009)
New Revision: 1235
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
Log:
EXOJCR-271: test modified
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java 2009-12-29 13:34:34 UTC (rev 1234)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java 2009-12-29 13:38:10 UTC (rev 1235)
@@ -35,10 +35,12 @@
{
private static final String testName = "testRoot";
- private static final int sessionCount = 1;
+ private static final int sessionCount = 100;
- private static final int tryCount = 1;
+ private static final int nodesCount = 50000;
+ private static final int timesCount = 5;
+
private Session[] sessions = new Session[sessionCount];
private GetNodesThread[] threads = new GetNodesThread[sessionCount];
@@ -54,7 +56,6 @@
session.save();
log.info("adding...");
- int nodesCount = 50000;
for (int i = 0; i < nodesCount; i++)
{
testRoot.addNode("_" + i + "_node");
@@ -70,7 +71,7 @@
long usedMemory = rt.totalMemory() - rt.freeMemory();
log.info("getting nodes...");
- for (int k = 0; k < tryCount; k++)
+ for (int k = 0; k < timesCount; k++)
{
for (int i = 0; i < sessionCount; i++)
{
@@ -119,6 +120,10 @@
long startTime = System.currentTimeMillis();
nodes = testRoot.getNodes();
+ while (nodes.hasNext())
+ {
+ nodes.next();
+ }
log.info("Total time: " + (System.currentTimeMillis() - startTime) + "ms");
}
16 years, 4 months
exo-jcr SVN: r1234 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl/core/value and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-29 08:34:34 -0500 (Tue, 29 Dec 2009)
New Revision: 1234
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/value/ExtendedValue.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractPersistedValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CleanableFilePersistedValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
Log:
EXOJCR-300: code cleanup
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/value/ExtendedValue.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/value/ExtendedValue.java 2009-12-29 12:38:58 UTC (rev 1233)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/value/ExtendedValue.java 2009-12-29 13:34:34 UTC (rev 1234)
@@ -39,14 +39,6 @@
*/
public int getOrderNumber();
- // TODO cleanup
-// /**
-// * Set order value in the list
-// *
-// * @return order value in the list
-// */
-// public void setOrderNumber(int orderNumber);
-
/**
* Return length of the value .
*
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java 2009-12-29 12:38:58 UTC (rev 1233)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java 2009-12-29 13:34:34 UTC (rev 1234)
@@ -296,25 +296,9 @@
}
}
- // TODO cleanup
-// /**
-// * {@inheritDoc}
-// */
-// public void setOrderNumber(int order)
-// {
-// try
-// {
-// getLocalData(type == PropertyType.BINARY).setOrderNumber(order);
-// }
-// catch (IOException e)
-// {
-// throw new RuntimeException(e);
-// }
-// }
-
/**
- * {@inheritDoc}
- */
+ * {@inheritDoc}
+ */
public long read(OutputStream stream, long length, long position) throws IOException, RepositoryException
{
return getInternalData().read(stream, length, position);
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractPersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractPersistedValueData.java 2009-12-29 12:38:58 UTC (rev 1233)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractPersistedValueData.java 2009-12-29 13:34:34 UTC (rev 1234)
@@ -61,13 +61,12 @@
return false;
}
-
+
/**
* Create transient copy of persisted data.
*
* @return TransientValueData
* @throws RepositoryException if error ocurs
*/
- @Deprecated
public abstract TransientValueData createTransientCopy() throws RepositoryException;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2009-12-29 12:38:58 UTC (rev 1233)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2009-12-29 13:34:34 UTC (rev 1234)
@@ -383,38 +383,7 @@
return new String(getAsByteArray(), Constants.DEFAULT_ENCODING);
}
- // ///////////////////////////////////
/**
- * Make sense for stream storage only.
- *
- * @param cleaner
- * FileCleaner
- */
- @Deprecated
- public void setFileCleaner(FileCleaner cleaner)
- {
- this.fileCleaner = cleaner;
- }
-
- // TODO
- // /**
- // * @param tempDirectory
- // */
- // public void setTempDirectory(File tempDirectory)
- // {
- // this.tempDirectory = tempDirectory;
- // }
-
- /**
- * @param maxBufferSize
- */
- @Deprecated
- public void setMaxBufferSize(int maxBufferSize)
- {
- this.maxBufferSize = maxBufferSize;
- }
-
- /**
* {@inheritDoc}
*/
protected void finalize() throws Throwable
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CleanableFilePersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CleanableFilePersistedValueData.java 2009-12-29 12:38:58 UTC (rev 1233)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CleanableFilePersistedValueData.java 2009-12-29 13:34:34 UTC (rev 1234)
@@ -94,7 +94,6 @@
* {@inheritDoc}
*/
@Override
- @Deprecated
public TransientValueData createTransientCopy() throws RepositoryException
{
return new TransientValueData(this);
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2009-12-29 12:38:58 UTC (rev 1233)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2009-12-29 13:34:34 UTC (rev 1234)
@@ -176,7 +176,6 @@
* {@inheritDoc}
*/
@Override
- @Deprecated
public TransientValueData createTransientCopy() throws RepositoryException
{
return new TransientValueData(this);
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2009-12-29 12:38:58 UTC (rev 1233)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2009-12-29 13:34:34 UTC (rev 1234)
@@ -63,7 +63,7 @@
{
this(orderNumber, tempFile, null);
}
-
+
/**
* StreamPersistedValueData constructor for stream data with know destenation file.
* <p/>
@@ -93,21 +93,7 @@
super(orderNumber, destFile);
this.tempFile = tempFile;
this.stream = null;
- }
-//
-// /**
-// * StreamPersistedValueData constructor for spooled file.
-// *
-// * @param file File
-// * @param stream InputStream
-// * @param orderNumber int
-// */
-// public StreamPersistedValueData(File file, File tempFile, InputStream stream, int orderNumber)
-// {
-// super(orderNumber, file);
-// this.tempFile = tempFile;
-// this.stream = stream;
-// }
+ }
/**
* Return original data stream or null. <br/>
@@ -153,7 +139,6 @@
this.stream = null;
}
-
/**
* Return status of persisted state.
*
@@ -216,7 +201,6 @@
* {@inheritDoc}
*/
@Override
- @Deprecated
public TransientValueData createTransientCopy() throws RepositoryException
{
return new TransientValueData(this);
16 years, 4 months