Index: distribution-test/cluster-tests/pom.xml
===================================================================
--- distribution-test/cluster-tests/pom.xml	(revision 0)
+++ distribution-test/cluster-tests/pom.xml	(revision 0)
@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * 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.
+ *
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>com.xpn.xwiki.products</groupId>
+    <artifactId>xwiki-enterprise-test</artifactId>
+    <version>2.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>xwiki-enterprise-test-cluster</artifactId>
+  <name>XWiki Products - Enterprise - Cluster Functional Tests</name>
+  <packaging>pom</packaging>
+  <description>XWiki Products - Enterprise - Cluster Functional Tests</description>
+  <dependencies>
+    <dependency>
+      <groupId>com.xpn.xwiki.products</groupId>
+      <artifactId>xwiki-enterprise-test-selenium</artifactId>
+      <version>${pom.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.xwiki.platform</groupId>
+      <artifactId>xwiki-core-observation-remote</artifactId>
+      <version>${pom.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- Needed at test time. Some versions of Maven don't inherit provided dependencies. -->
+    <dependency>
+      <groupId>org.seleniumhq.selenium.client-drivers</groupId>
+      <artifactId>selenium-java-client-driver</artifactId>
+      <version>${selenium.version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <properties>
+    <database.directory>${project.build.directory}/database</database.directory>
+    <application.directory>${project.build.directory}/xwiki-enterprise-jetty-${xwiki.db}-${pom.version}</application.directory>
+  </properties>
+  <build>
+    <plugins>
+      <!-- Step 1: Compile the JUnit Clustering Tests and copy test resources files -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+      </plugin>
+      <!-- Step 2: Create jar containing integration tests which will be installed -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+      </plugin>
+      <!-- Step 3: Generate hibernate configuration for hsqldb in server mode -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-remote-resources-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>xwiki-configuration-resources</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>process</goal>
+            </goals>
+            <configuration>
+              <resourceBundles>
+                <resourceBundle>org.xwiki.platform.tools:xwiki-configuration-resources:${platform.tool.configuration.version}</resourceBundle>
+              </resourceBundles>
+              <properties>
+                <xwikiDbConnectionUrl>jdbc:hsqldb:hsql://localhost/xwiki_db</xwikiDbConnectionUrl>
+              </properties>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <!-- Step 4: Unpack the database and XWiki distribution -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>unzip-database</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>com.xpn.xwiki.products</groupId>
+                  <artifactId>xwiki-enterprise-database-hsqldb</artifactId>
+                  <version>${pom.version}</version>
+                  <type>zip</type>
+                </artifactItem>
+              </artifactItems>
+              <outputDirectory>${project.build.directory}/database</outputDirectory>
+            </configuration>
+          </execution>
+          <execution>
+            <id>unzip-application</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>com.xpn.xwiki.products</groupId>
+                  <artifactId>xwiki-enterprise-jetty-hsqldb</artifactId>
+                  <version>${pom.version}</version>
+                  <type>zip</type>
+                </artifactItem>
+              </artifactItems>
+              <outputDirectory>${project.build.directory}</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <!-- Step 5: Customize distribution for external database server -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.3</version>
+        <executions>
+          <execution>
+            <phase>pre-integration-test</phase>
+            <configuration>
+              <tasks>
+                <copy overwrite="true" file="${project.build.directory}/maven-shared-archive-resources/hibernate.cfg.xml" todir="${application.directory}/webapps/xwiki/WEB-INF"/>
+                <delete dir="${application.directory}/database"/>
+                <copy todir="${application.directory}-1">
+                  <fileset dir="${application.directory}"/>
+                </copy>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <!-- Step 6: Start Selenium -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>selenium-maven-plugin</artifactId>
+        <version>1.0-beta-3</version>
+        <executions>
+          <execution>
+            <id>start-selenium</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>start-server</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <background>true</background>
+          <multiWindow>true</multiWindow>
+          <port>4444</port>
+        </configuration>
+      </plugin>
+      <!-- Step 7: Start Hsqldb -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>maven-hsqldb-plugin</artifactId>
+        <version>1.0-xwiki-20090820</version>
+        <executions>
+          <execution>
+            <id>start-hsqldb</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <dbName>xwiki_db</dbName>
+          <dbPath>${database.directory}/</dbPath>
+          <isTransient>false</isTransient>
+        </configuration>
+      </plugin>
+      <!-- Step 8: Start XWiki, Execute the tests and Stop XWiki -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+  <profiles>
+    <profile>
+      <id>firefox</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <browser>*firefox</browser>
+      </properties>
+    </profile>
+    <profile>
+      <id>iexplore</id>
+      <properties>
+        <browser>*iexplore</browser>
+      </properties>
+    </profile>
+    <profile>
+      <id>konqueror</id>
+      <properties>
+        <browser>*konqueror</browser>
+      </properties>
+    </profile>
+    <profile>
+      <id>otherbrowser</id>
+      <properties>
+        <browser>*custom ${browserPath}</browser>
+      </properties>
+    </profile>
+  </profiles>
+</project>
Index: distribution-test/cluster-tests/src/test/it/com/xpn/xwiki/it/AllTests.java
===================================================================
--- distribution-test/cluster-tests/src/test/it/com/xpn/xwiki/it/AllTests.java	(revision 0)
+++ distribution-test/cluster-tests/src/test/it/com/xpn/xwiki/it/AllTests.java	(revision 0)
@@ -0,0 +1,86 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * 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 com.xpn.xwiki.it;
+
+import java.lang.reflect.Method;
+
+import com.xpn.xwiki.it.framework.XWikiClusterTestSetup;
+import com.xpn.xwiki.it.selenium.framework.XWikiSeleniumTestSetup;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * A class listing all the Functional tests to execute. We need such a class (rather than letting the JUnit Runner
+ * discover the different TestCases classes by itself) because we want to start/stop XWiki before and after the tests
+ * start (but only once).
+ * 
+ * @version $Id: AllTests.java 18858 2009-04-20 15:32:56Z tmortagne $
+ */
+public class AllTests extends TestCase
+{
+    /**
+     * The pattern to filter the tests to launch.
+     */
+    private static final String PATTERN = ".*" + System.getProperty("pattern", "");
+
+    /**
+     * @return the test suite.
+     * @throws Exception error when creation the tests suite.
+     */
+    public static Test suite() throws Exception
+    {
+        TestSuite suite = new TestSuite();
+
+        // TODO: I don't like listing tests here as it means we can add a new TestCase class and
+        // forget to add it here and the tests won't be run but we'll not know about it and we'll
+        // think the tests are all running fine. I haven't found a simple solution to this yet
+        // (there are complex solutions like searching for all tests by parsing the source tree).
+        // I think there are TestSuite that do this out there but I haven't looked for them yet.
+
+        // Unit tests
+        // TODO
+
+        // Selenium tests
+        TestSuite seleniumSuite = new TestSuite();
+
+        addTestCaseSuite(seleniumSuite, DocumentCacheTest.class);
+
+        suite.addTest(new XWikiSeleniumTestSetup(new XWikiClusterTestSetup(seleniumSuite)));
+
+        return suite;
+    }
+
+    private static void addTestCase(TestSuite suite, Class< ? > testClass) throws Exception
+    {
+        if (testClass.getName().matches(PATTERN)) {
+            suite.addTest(new TestSuite(testClass));
+        }
+    }
+
+    private static void addTestCaseSuite(TestSuite suite, Class< ? > testClass) throws Exception
+    {
+        if (testClass.getName().matches(PATTERN)) {
+            Method method = testClass.getMethod("suite");
+            suite.addTest((Test) method.invoke(null));
+        }
+    }
+}
Index: distribution-test/cluster-tests/src/test/it/com/xpn/xwiki/it/DocumentCacheTest.java
===================================================================
--- distribution-test/cluster-tests/src/test/it/com/xpn/xwiki/it/DocumentCacheTest.java	(revision 0)
+++ distribution-test/cluster-tests/src/test/it/com/xpn/xwiki/it/DocumentCacheTest.java	(revision 0)
@@ -0,0 +1,79 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * 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 com.xpn.xwiki.it;
+
+import junit.framework.Test;
+
+import com.xpn.xwiki.it.framework.AbstractClusterXWikiTestCase;
+import com.xpn.xwiki.it.selenium.framework.AlbatrossSkinExecutor;
+import com.xpn.xwiki.it.selenium.framework.XWikiTestSuite;
+
+/**
+ * Verify the LDAP login and logout features.
+ * 
+ * @version $Id: LDAPAuthTest.java 16017 2009-02-02 08:56:46Z tmortagne $
+ */
+public class DocumentCacheTest extends AbstractClusterXWikiTestCase
+{
+    public static Test suite()
+    {
+        XWikiTestSuite suite = new XWikiTestSuite("Verify the document cache synch in a cluster");
+        suite.addTestSuite(DocumentCacheTest.class, AlbatrossSkinExecutor.class);
+        return suite;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see com.xpn.xwiki.it.selenium.framework.AbstractXWikiTestCase#setUp()
+     */
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        loginAsAdmin();
+    }
+
+    public void testDocumentCacheSync()
+    {
+        // 1) edit a page on XWiki 0
+
+        switchXWiki(1);
+        //createPage("Test", "CacheSync", "content");
+
+        // 2) modify content of the page on XWiki 1
+
+        //switchXWiki(1);
+        //editInWikiEditor("Test", "CacheSync");
+        //setFieldValue("content", "modified content");
+        //clickEditSaveAndView();
+
+        // TODO: give some time to JGroups to send the message
+
+        // 3) view the page on XWiki 0
+
+        //switchXWiki(0);
+        //open("Test", "CacheSync");
+
+        // ASSERT) the content should be the one set in XWiki 1
+
+        //assertTextPresent("modified content");
+    }
+}
