[
http://jira.nuxeo.org/browse/NXP-4322?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=64544#action_64544
]
Damien Metzler commented on NXP-4322:
-------------------------------------
I looked at Weld and JSR-299. What i saw in a interview of Gavin King in InfoQ
is that JSR-330 is a subset of JSR-299. It only deals with DI. This JSR is lead
by one of the core Google Guice dev (Bob Lee)... so it could lead to the same
APIs....
http://www.infoq.com/news/2009/11/weld10
I rapidly walked thru Weld : @Inject annotation is the same as Guice, but the
Provider classes in Guice seems to be replaced by a @Produces annotation. If
@Produces is called lazy, it could replace Guice in our test Framework.
But I don't see something like Modules in Weld. In Guice it is the binding
part. I don't know if it can be replaced by a bunch of annotations in Weld.
Moreover, runners don't always use all available Modules, if it is replaces by
annotation resolution, I don't know how we could limit dependencies resolutions
(but this feature is perhaps not necessary).
Last thing, it seems that Weld is in a certain manner really tied to JEE. I did
not look at the bootstrap code, but with Guice, it only takes 1 line of code
to setup your injector.
I'll look at it if i have time but it's very time consuming as for now, you
have a working test framework ready to work with Guice.
> 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