Upgrade jUnit to 4.x
--------------------

                 Key: NXP-4322
                 URL: http://jira.nuxeo.org/browse/NXP-4322
             Project: Nuxeo Enterprise Platform
          Issue Type: Improvement
            Reporter: Damien Metzler
            Assignee: Thierry Delprat


Upgrade jUnit to 4.x
===============

Integrate the integration test framework developped by LM for OpenSocial

Nuxeo-Runtime-test
---------------------------

Add a NuxeoRunner class based on jUnit4. It provides a RuntimeHarness that can 
be injected in the constructor of a jUnit POJO test class. Injection is lazy 
and makes use of Guice providers. 
This way, test class are lighter and all deployment is done by provider, hiding 
the complexity of various deployment.

For instance :

@RunWith(NuxeoPlatformRunner.class)
public class UserManagerTest {
    @Inject UserManager um;

    @Test
    public void userManagerIsInjected() throws Exception {
        assertNotNull(um);
        assertEquals(UserManagerImpl.class, um.getClass());
    }

    @Test
    public void testUsersAreHere() throws Exception {
        assertNotNull(um.getPrincipal("Administrator"));
    }

}


The goal is to hide all the basic setup of basic nuxeo services in 

Nuxeo-Core-test
----------------------
Give another jUnit runner class that knows how to inject a CoreSession. A 
RepoFactory can be specified, applied at class or method level to populate the 
repo. The RepoType can be specified by an annontation.

@RunWith(NuxeoCoreRunner.class)
@CleanupLevel(Level.METHOD)
@RepositoryFactory(DefaultRepoFactory.class)
public class CleanUpWithFactoryTest {
    @Inject CoreSession session;

    @Test
    public void iCreateADoc() throws Exception {
        DocumentModel doc = 
session.createDocumentModel("/default-domain/workspaces/", "myWorkspace", 
"Workspace");
        doc.setProperty("dublincore", "title", "My Workspace");
        doc = session.createDocument(doc);
        session.saveDocument(doc);
        session.save();
        assertTrue(session.exists(new 
PathRef("/default-domain/workspaces/myWorkspace")));
    }

    @Test
    public void myWorkspaceIsNotHereAnymore() throws Exception {
        assertTrue(session.exists(new PathRef("/default-domain/workspaces/")));
        assertFalse(session.exists(new 
PathRef("/default-domain/workspaces/myWorkspace")));
    }
}


Nuxeo-platform-test
---------------------------
Add the same mecanism at platform level to be able to inject DirectoryService 
and UserManager in tests. 

nuxeo-webengine-test
------------------------------
Add the ability to deploy webengine only by injecting the webengine service.




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets

Reply via email to