[xwiki-devs] [xwiki-notifications] r35749 - in enterprise/trunk/distribution-test: cluster-tests/src/test/it/org/xwiki/test/cluster cluster-tests/src/test/it/org/xwiki/test/cluster/framework escaping-tests/src/test/it/org/xwiki/test/escaping/framework ldap-tests/src/test/it/org/xwiki/test/ldap/framework rest-tests/src/test/it/org/xwiki/test/rest rest-tests/src/test/it/org/xwiki/test/rest/framework selenium-tests/src/test/it/org/xwiki/test/selenium ui-tests/src/test/it/org/xwiki/test/ui/framework webdav-tests/src/test/it/org/xwiki/test/webdav webstandards-tests/src/test/it/org/xwiki/test/webstandards wysiwyg-tests/src/test/it/org/xwiki/test/wysiwyg xmlrpc-tests/src/test/it/org/xwiki/test/xmlrpc/confluence

Caleb James DeLisle calebdelisle at lavabit.com
Mon Mar 21 13:46:35 UTC 2011



On 03/21/2011 05:20 AM, vmassol (SVN) wrote:
> Author: vmassol
> Date: 2011-03-21 10:20:45 +0100 (Mon, 21 Mar 2011)
> New Revision: 35749
> 
> Modified:
>    enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/DocumentCacheTest.java
>    enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/framework/AbstractClusterHttpTest.java
>    enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/framework/XWikiClusterTestSetup.java
>    enterprise/trunk/distribution-test/escaping-tests/src/test/it/org/xwiki/test/escaping/framework/SingleXWikiExecutor.java
>    enterprise/trunk/distribution-test/ldap-tests/src/test/it/org/xwiki/test/ldap/framework/XWikiLDAPTestSetup.java
>    enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/test/rest/AllTests.java
>    enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/test/rest/framework/AbstractHttpTest.java
>    enterprise/trunk/distribution-test/selenium-tests/src/test/it/org/xwiki/test/selenium/AllTests.java
>    enterprise/trunk/distribution-test/ui-tests/src/test/it/org/xwiki/test/ui/framework/PersistentTestContext.java
>    enterprise/trunk/distribution-test/webdav-tests/src/test/it/org/xwiki/test/webdav/AllTests.java
>    enterprise/trunk/distribution-test/webstandards-tests/src/test/it/org/xwiki/test/webstandards/AllTests.java
>    enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/org/xwiki/test/wysiwyg/AllTests.java
>    enterprise/trunk/distribution-test/xmlrpc-tests/src/test/it/org/xwiki/test/xmlrpc/confluence/AllTests.java
> Log:
> XCOMMONS-2: Add JUnit4 Suite for starting/stopping XE + Running all JUnit tests in the current classloader
> 
> Modified: enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/DocumentCacheTest.java
> ===================================================================
> --- enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/DocumentCacheTest.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/DocumentCacheTest.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -24,6 +24,7 @@
>  import org.apache.commons.httpclient.HttpStatus;
>  import org.apache.commons.httpclient.methods.GetMethod;
>  import org.apache.commons.httpclient.methods.PutMethod;
> +import org.junit.*;

I thought we didn't do that in tests, it will certainly make my life a lot easier.

Caleb


>  import org.xwiki.rest.model.jaxb.Attachment;
>  import org.xwiki.rest.model.jaxb.Attachments;
>  import org.xwiki.rest.resources.attachments.AttachmentResource;
> @@ -38,28 +39,30 @@
>   */
>  public class DocumentCacheTest extends AbstractClusterHttpTest
>  {
> +    @Test
>      public void testDocumentCacheSync() throws Exception
>      {
>          // 1) edit a page on XWiki 0
>  
>          switchXWiki(0);
>          setPageContent(getWiki(), "Test", "CacheSync", "content");
> -        assertEquals("content", getPageContent(getWiki(), "Test", "CacheSync"));
> +        Assert.assertEquals("content", getPageContent(getWiki(), "Test", "CacheSync"));
>  
>          // 2) modify content of the page on XWiki 1
>  
>          switchXWiki(1);
>          setPageContent(getWiki(), "Test", "CacheSync", "modified content");
> -        assertEquals("modified content", getPageContent(getWiki(), "Test", "CacheSync"));
> +        Assert.assertEquals("modified content", getPageContent(getWiki(), "Test", "CacheSync"));
>  
>          // TODO: give some time to JGroups to send the message
>  
>          // ASSERT) the content in XWiki 0 should be the one set than in XWiki 1
>  
>          switchXWiki(0);
> -        assertEquals("modified content", getPageContent(getWiki(), "Test", "CacheSync"));
> +        Assert.assertEquals("modified content", getPageContent(getWiki(), "Test", "CacheSync"));
>      }
>  
> +    @Test
>      public void testDocumentCacheSyncForAttachments() throws Exception
>      {
>          // 1) edit a page on XWiki 0
> @@ -73,7 +76,7 @@
>          String attachmentUri =
>                  getUriBuilder(AttachmentResource.class).build(getWiki(), "Test", "AttachementCacheSync", "file.ext").toString();
>          PutMethod putMethod = executePut(attachmentUri, "content", MediaType.TEXT_PLAIN, "Admin", "admin");
> -        assertEquals(getHttpMethodInfo(putMethod), HttpStatus.SC_CREATED, putMethod.getStatusCode());
> +        Assert.assertEquals(getHttpMethodInfo(putMethod), HttpStatus.SC_CREATED, putMethod.getStatusCode());
>  
>          // TODO: give some time to JGroups to send the message
>  
> @@ -84,7 +87,7 @@
>                  getUriBuilder(AttachmentsResource.class).build(getWiki(), "Test", "AttachementCacheSync").toString();
>  
>          GetMethod getMethod = executeGet(attachmentsUri);
> -        assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
> +        Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
>  
>          boolean found = false;
>  
> @@ -96,6 +99,6 @@
>              }
>          }
>  
> -        assertTrue("Failed to find attachment", found);
> +        Assert.assertTrue("Failed to find attachment", found);
>      }
>  }
> 
> Modified: enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/framework/AbstractClusterHttpTest.java
> ===================================================================
> --- enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/framework/AbstractClusterHttpTest.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/framework/AbstractClusterHttpTest.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -19,16 +19,19 @@
>   */
>  package org.xwiki.test.cluster.framework;
>  
> +import org.junit.*;
> +import org.xwiki.test.integration.XWikiExecutor;
>  import org.xwiki.test.rest.framework.AbstractHttpTest;
> -import org.xwiki.test.XWikiExecutor;
>  
>  /**
>   * Base class for REST based clustering integration test.
>   * 
>   * @version $Id$
>   */
> +// TODO: Fix this, it's wrong to reuse AbstractHttpTest from the REST Tests module
>  public abstract class AbstractClusterHttpTest extends AbstractHttpTest
>  {
> +    @Test
>      public void testRepresentation() throws Exception
>      {
>      }
> 
> Modified: enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/framework/XWikiClusterTestSetup.java
> ===================================================================
> --- enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/framework/XWikiClusterTestSetup.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/cluster-tests/src/test/it/org/xwiki/test/cluster/framework/XWikiClusterTestSetup.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -23,11 +23,11 @@
>  import java.io.InputStream;
>  import java.util.Properties;
>  
> +import org.xwiki.test.integration.XWikiExecutor;
> +import org.xwiki.test.integration.XWikiTestSetup;
> +
>  import junit.framework.Test;
>  
> -import org.xwiki.test.XWikiExecutor;
> -import org.xwiki.test.XWikiTestSetup;
> -
>  /**
>   * Set clustering configuration and start two instances of XWiki.
>   * <p>
> @@ -47,7 +47,7 @@
>      /**
>       * {@inheritDoc}
>       * 
> -     * @see org.xwiki.test.XWikiTestSetup#setUp()
> +     * @see XWikiTestSetup#setUp()
>       */
>      @Override
>      protected void setUp() throws Exception
> 
> Modified: enterprise/trunk/distribution-test/escaping-tests/src/test/it/org/xwiki/test/escaping/framework/SingleXWikiExecutor.java
> ===================================================================
> --- enterprise/trunk/distribution-test/escaping-tests/src/test/it/org/xwiki/test/escaping/framework/SingleXWikiExecutor.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/escaping-tests/src/test/it/org/xwiki/test/escaping/framework/SingleXWikiExecutor.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -19,9 +19,8 @@
>   */
>  package org.xwiki.test.escaping.framework;
>  
> -import org.xwiki.test.XWikiExecutor;
> +import org.xwiki.test.integration.XWikiExecutor;
>  
> -
>  /**
>   * Starts and stops exactly one XWiki instance. The methods {@link #start()} and {@link #stop()}
>   * allow to call them multiple times, starting and stopping the server only on the first and
> 
> Modified: enterprise/trunk/distribution-test/ldap-tests/src/test/it/org/xwiki/test/ldap/framework/XWikiLDAPTestSetup.java
> ===================================================================
> --- enterprise/trunk/distribution-test/ldap-tests/src/test/it/org/xwiki/test/ldap/framework/XWikiLDAPTestSetup.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/ldap-tests/src/test/it/org/xwiki/test/ldap/framework/XWikiLDAPTestSetup.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -21,10 +21,10 @@
>  
>  import java.util.Properties;
>  
> +import org.xwiki.test.integration.XWikiTestSetup;
> +
>  import junit.framework.Test;
>  
> -import org.xwiki.test.XWikiTestSetup;
> -
>  /**
>   * JUnit TestSetup extension that modify xwiki.cfg file to use LDAP as authentication system. This class is meant to
>   * wrap a JUnit TestSuite. For example:
> 
> Modified: enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/test/rest/AllTests.java
> ===================================================================
> --- enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/test/rest/AllTests.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/test/rest/AllTests.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -19,32 +19,15 @@
>   */
>  package org.xwiki.test.rest;
>  
> -import org.junit.AfterClass;
> -import org.junit.BeforeClass;
> -import org.junit.extensions.cpsuite.ClasspathSuite;
>  import org.junit.runner.RunWith;
> -import org.xwiki.test.XWikiExecutor;
> +import org.xwiki.test.integration.XWikiExecutorSuite;
>  
>  /**
>   * Runs all functional tests found in the classpath and start/stop XWiki before/after the tests (only once).
>   *
>   * @version $Id$
>   */
> - at RunWith(ClasspathSuite.class)
> + at RunWith(XWikiExecutorSuite.class)
>  public class AllTests
>  {
> -    /** This starts and stops the wiki engine. */
> -    private static final XWikiExecutor executor = new XWikiExecutor(0);
> -
> -    @BeforeClass
> -    public static void init() throws Exception
> -    {
> -        executor.start();
> -    }
> -
> -    @AfterClass
> -    public static void shutdown() throws Exception
> -    {
> -        executor.stop();
> -    }
>  }
> 
> Modified: enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/test/rest/framework/AbstractHttpTest.java
> ===================================================================
> --- enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/test/rest/framework/AbstractHttpTest.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/test/rest/framework/AbstractHttpTest.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -56,7 +56,7 @@
>  import org.xwiki.rest.resources.pages.PageResource;
>  import org.xwiki.rest.resources.wikis.WikisResource;
>  import org.xwiki.test.AbstractComponentTestCase;
> -import org.xwiki.test.XWikiExecutor;
> +import org.xwiki.test.integration.XWikiExecutor;
>  
>  public abstract class AbstractHttpTest extends AbstractComponentTestCase
>  {
> 
> Modified: enterprise/trunk/distribution-test/selenium-tests/src/test/it/org/xwiki/test/selenium/AllTests.java
> ===================================================================
> --- enterprise/trunk/distribution-test/selenium-tests/src/test/it/org/xwiki/test/selenium/AllTests.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/selenium-tests/src/test/it/org/xwiki/test/selenium/AllTests.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -25,8 +25,7 @@
>  import junit.framework.TestCase;
>  import junit.framework.TestSuite;
>  
> -import org.xwiki.test.XWikiTestSetup;
> -
> +import org.xwiki.test.integration.XWikiTestSetup;
>  import org.xwiki.test.selenium.framework.AbstractXWikiTestCase;
>  import org.xwiki.test.selenium.framework.XWikiSeleniumTestSetup;
>  
> 
> Modified: enterprise/trunk/distribution-test/ui-tests/src/test/it/org/xwiki/test/ui/framework/PersistentTestContext.java
> ===================================================================
> --- enterprise/trunk/distribution-test/ui-tests/src/test/it/org/xwiki/test/ui/framework/PersistentTestContext.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/ui-tests/src/test/it/org/xwiki/test/ui/framework/PersistentTestContext.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -21,7 +21,7 @@
>  
>  import org.openqa.selenium.WebDriver;
>  import org.openqa.selenium.firefox.FirefoxDriver;
> -import org.xwiki.test.XWikiExecutor;
> +import org.xwiki.test.integration.XWikiExecutor;
>  
>  /**
>   * This is a container for holding all of the information which should persist throughout all of the tests.
> 
> Modified: enterprise/trunk/distribution-test/webdav-tests/src/test/it/org/xwiki/test/webdav/AllTests.java
> ===================================================================
> --- enterprise/trunk/distribution-test/webdav-tests/src/test/it/org/xwiki/test/webdav/AllTests.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/webdav-tests/src/test/it/org/xwiki/test/webdav/AllTests.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -19,15 +19,12 @@
>   */
>  package org.xwiki.test.webdav;
>  
> +import org.xwiki.test.integration.XWikiTestSetup;
> +
>  import junit.framework.Test;
>  import junit.framework.TestCase;
>  import junit.framework.TestSuite;
>  
> -import org.xwiki.test.webdav.DefaultWebDAVTest;
> -import org.xwiki.test.XWikiTestSetup;
> -import org.xwiki.test.webdav.RootViewTest;
> -import org.xwiki.test.webdav.TempFileTest;
> -
>  /**
>   * 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
> 
> Modified: enterprise/trunk/distribution-test/webstandards-tests/src/test/it/org/xwiki/test/webstandards/AllTests.java
> ===================================================================
> --- enterprise/trunk/distribution-test/webstandards-tests/src/test/it/org/xwiki/test/webstandards/AllTests.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/webstandards-tests/src/test/it/org/xwiki/test/webstandards/AllTests.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -23,7 +23,7 @@
>  import junit.framework.TestCase;
>  import junit.framework.TestSuite;
>  
> -import org.xwiki.test.XWikiTestSetup;
> +import org.xwiki.test.integration.XWikiTestSetup;
>  import org.xwiki.validator.RSSValidator;
>  import org.xwiki.validator.XHTMLValidator;
>  import org.xwiki.validator.XWikiValidator;
> 
> Modified: enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/org/xwiki/test/wysiwyg/AllTests.java
> ===================================================================
> --- enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/org/xwiki/test/wysiwyg/AllTests.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/wysiwyg-tests/src/test/it/org/xwiki/test/wysiwyg/AllTests.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -22,7 +22,7 @@
>  import junit.framework.Test;
>  import junit.framework.TestCase;
>  
> -import org.xwiki.test.XWikiTestSetup;
> +import org.xwiki.test.integration.XWikiTestSetup;
>  import org.xwiki.test.selenium.framework.AbstractXWikiTestCase;
>  import org.xwiki.test.selenium.framework.ColibriSkinExecutor;
>  import org.xwiki.test.selenium.framework.XWikiSeleniumTestSetup;
> 
> Modified: enterprise/trunk/distribution-test/xmlrpc-tests/src/test/it/org/xwiki/test/xmlrpc/confluence/AllTests.java
> ===================================================================
> --- enterprise/trunk/distribution-test/xmlrpc-tests/src/test/it/org/xwiki/test/xmlrpc/confluence/AllTests.java	2011-03-21 09:19:16 UTC (rev 35748)
> +++ enterprise/trunk/distribution-test/xmlrpc-tests/src/test/it/org/xwiki/test/xmlrpc/confluence/AllTests.java	2011-03-21 09:20:45 UTC (rev 35749)
> @@ -22,7 +22,8 @@
>  import junit.framework.Test;
>  import junit.framework.TestCase;
>  import junit.framework.TestSuite;
> -import org.xwiki.test.XWikiTestSetup;
> +
> +import org.xwiki.test.integration.XWikiTestSetup;
>  import org.xwiki.test.xmlrpc.*;
>  import org.xwiki.test.xmlrpc.AttachmentsTest;
>  import org.xwiki.test.xmlrpc.PagesTest;
> 
> _______________________________________________
> notifications mailing list
> notifications at xwiki.org
> http://lists.xwiki.org/mailman/listinfo/notifications
> 




More information about the devs mailing list