Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxeo testing issues #114

Closed
mkalam-alami opened this issue Apr 27, 2012 · 4 comments
Closed

Nuxeo testing issues #114

mkalam-alami opened this issue Apr 27, 2012 · 4 comments
Assignees
Labels

Comments

@mkalam-alami
Copy link
Contributor

Please see the problems below to help up start with good practices for Nuxeo testing. Fixing easysoa-registry-core tests should be enough to let us fix the others.

Note: The 'scaImport' test not passing is not part of these issues.

1. Datasource stacktrace in most tests

Stacktraces about sata-source configuration issues are logged all over the tests (but don't refrain them from passing).

ERROR [SQLDirectory] dataSource lookup failed
javax.naming.NameNotFoundException; remaining name 'jdbc/nxsqldirectory'
    at org.mortbay.naming.NamingContext.lookup(NamingContext.java:634)
    at org.mortbay.naming.NamingContext.lookup(NamingContext.java:680)
    at org.mortbay.naming.local.localContextRoot.lookup(localContextRoot.java:164)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.nuxeo.runtime.api.DataSourceHelper.getDataSource(DataSourceHelper.java:125)
    at org.nuxeo.ecm.directory.sql.SQLDirectory.getDataSource(SQLDirectory.java:186)
    at org.nuxeo.ecm.directory.sql.SQLDirectory.getConnection(SQLDirectory.java:205)
    at org.nuxeo.ecm.directory.sql.SQLDirectory.<init>(SQLDirectory.java:87)
    at org.nuxeo.ecm.directory.sql.SQLDirectoryProxy.getDirectory(SQLDirectoryProxy.java:49)
    at org.nuxeo.ecm.directory.sql.SQLDirectoryProxy.getSession(SQLDirectoryProxy.java:84)
    at org.nuxeo.ecm.directory.DirectoryServiceImpl.open(DirectoryServiceImpl.java:270)
    at org.easysoa.services.VocabularyHelper.entryExists(VocabularyHelper.java:69)
    at org.easysoa.listeners.AppliImplListener.updateVocabulary(AppliImplListener.java:147)
    at org.easysoa.listeners.AppliImplListener.handleEvent(AppliImplListener.java:100)
    at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:195)
    at org.nuxeo.ecm.core.api.AbstractSession.fireEvent(AbstractSession.java:400)
    at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:452)
    at org.nuxeo.ecm.core.api.AbstractSession.createDocument(AbstractSession.java:896)
    at org.easysoa.services.DocumentServiceImpl.createAppliImpl(DocumentServiceImpl.java:77)
    at org.easysoa.services.DocumentServiceImpl.getDefaultAppliImpl(DocumentServiceImpl.java:259)
    at org.easysoa.services.DocumentServiceImpl.getDefaultAppliImpl(DocumentServiceImpl.java:233)
    at org.easysoa.services.DocumentServiceTest.testMerge(DocumentServiceTest.java:99)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.nuxeo.runtime.test.runner.FeaturesRunner$InvokeMethod.evaluate(FeaturesRunner.java:269)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.nuxeo.runtime.test.runner.FeaturesRunner.run(FeaturesRunner.java:220)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)

2. General use of RunnerFeatures

We would like a review of our use of the Nuxeo testing framework, as we're not sure we're using it right (we often face various classpath/deployment problems). We mainly need some feedback on our way to implement reusable RunnerFeatures (see easysoa-registry-core/...main.../org/easysoa/test/...) and our use of @Deploy and @LocalDeploy annotations.

@jcarsique
Copy link
Member

Hi,

  1. dataSource lookup failed

I've pushed a fix (commit fd3bda4).
I've replaced the use of jndi datasource (which was not initialized) with a direct binding on vcs DB. That method is
used in Nuxeo in order to ease unit testing against various real databases (we only have to run the unit tests with the
wanted nuxeo.test.vcs.* properties, which are set depending on the "customdb" Maven profile (see Nuxeo corporate POM).
I also had to remove the directory contributions coming from org.easysoa.core.contrib.vocabularies because of the merge
behavior which was keeping the inherited datasource definition.
See easysoa-registry/easysoa-registry-core/src/main/resources/test/vocabularies-contrib.xml

About the testing contributions which are currently located in easysoa-registry-core/src/main/resources/test/, they
should be movable to easysoa-registry-core/src/test/resources/ by adding an
easysoa-registry-core/src/test/resources/META-INF/MANIFEST.MF

  1. Deploy and LocalDeploy

See below the corresponding interfaces Javadoc.
The detailed explanation is LocalDeploy allows to deploy a resource which is not part of any bundle but available in the
current classloader (i.e. while testing).

public @interface Deploy {
/**
* The artifact ID (symbolic name or bundle resource URI).
*/

public @interface LocalDeploy {
/**
* The local resource URI.
* The resource uri is of the form bundleId:path/to/resource where resource is a test resource
* located in src/test/resources that should be resolved using current class loader and deployed as part of the
* given bundle.
*/

I'm looking in the EasySOA wiki if there's some page dedicated to tests with Nuxeo tests framework for copying the above
information, or if it's only referencing http://doc.nuxeo.com/display/CORG/Unit+Testing

Regards,

Le 27/04/12 12:22, Marwane Kalam-Alami a écrit :

Please see the problems below to help up start with good practices for Nuxeo testing. Fixing easysoa-registry-core tests should be enough to let us fix the others.

Note: The 'scaImport' test not passing is not part of these issues.

1. Datasource stacktrace in most tests

Stacktraces about sata-source configuration issues are logged all over the tests (but don't refrain them from passing).

ERROR [SQLDirectory] dataSource lookup failed
javax.naming.NameNotFoundException; remaining name 'jdbc/nxsqldirectory'
  at org.mortbay.naming.NamingContext.lookup(NamingContext.java:634)
  at org.mortbay.naming.NamingContext.lookup(NamingContext.java:680)
  at org.mortbay.naming.local.localContextRoot.lookup(localContextRoot.java:164)
  at javax.naming.InitialContext.lookup(InitialContext.java:392)
  at org.nuxeo.runtime.api.DataSourceHelper.getDataSource(DataSourceHelper.java:125)
  at org.nuxeo.ecm.directory.sql.SQLDirectory.getDataSource(SQLDirectory.java:186)
  at org.nuxeo.ecm.directory.sql.SQLDirectory.getConnection(SQLDirectory.java:205)
  at org.nuxeo.ecm.directory.sql.SQLDirectory.<init>(SQLDirectory.java:87)
  at org.nuxeo.ecm.directory.sql.SQLDirectoryProxy.getDirectory(SQLDirectoryProxy.java:49)
  at org.nuxeo.ecm.directory.sql.SQLDirectoryProxy.getSession(SQLDirectoryProxy.java:84)
  at org.nuxeo.ecm.directory.DirectoryServiceImpl.open(DirectoryServiceImpl.java:270)
  at org.easysoa.services.VocabularyHelper.entryExists(VocabularyHelper.java:69)
  at org.easysoa.listeners.AppliImplListener.updateVocabulary(AppliImplListener.java:147)
  at org.easysoa.listeners.AppliImplListener.handleEvent(AppliImplListener.java:100)
  at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:195)
  at org.nuxeo.ecm.core.api.AbstractSession.fireEvent(AbstractSession.java:400)
  at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:452)
  at org.nuxeo.ecm.core.api.AbstractSession.createDocument(AbstractSession.java:896)
  at org.easysoa.services.DocumentServiceImpl.createAppliImpl(DocumentServiceImpl.java:77)
  at org.easysoa.services.DocumentServiceImpl.getDefaultAppliImpl(DocumentServiceImpl.java:259)
  at org.easysoa.services.DocumentServiceImpl.getDefaultAppliImpl(DocumentServiceImpl.java:233)
  at org.easysoa.services.DocumentServiceTest.testMerge(DocumentServiceTest.java:99)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at org.nuxeo.runtime.test.runner.FeaturesRunner$InvokeMethod.evaluate(FeaturesRunner.java:269)
  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
  at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
  at org.nuxeo.runtime.test.runner.FeaturesRunner.run(FeaturesRunner.java:220)
  at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
  at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
  at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
  at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
  at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
  at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
  at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)

2. General use of RunnerFeatures

We would like a review of our use of the Nuxeo testing framework, as we're not sure we're using it right (we often face various classpath/deployment problems). We mainly need some feedback on our way to implement reusable RunnerFeatures (see easysoa-registry-core/...main.../org/easysoa/test/...) and our use of @Deploy and @LocalDeploy annotations.


Reply to this email directly or view it on GitHub:
#114

Julien Carsique, DevOps, Nuxeo (Paris, France)
www.nuxeo.com - The Open Source ECM Platform - www.nuxeo.org
Nuxeo ECM Stack - The Java EE, scalable, standard-based ECM Platform

@mkalam-alami
Copy link
Contributor Author

Hi Julien,

Thanks for your answer. In particular I didn't know we could provide a Manifest for the tests, it might explain a few things!

Now I still have the dataSource errors, but I think it's only because you forgot to commit the easysoa-registry/easysoa-registry-core/src/main/resources/test/vocabularies-contrib.xml file you mentioned.

jcarsique added a commit that referenced this issue Apr 30, 2012
@jcarsique
Copy link
Member

Ouch! Sorry, that's pushed.

Le 30/04/12 10:59, Marwane Kalam-Alami a écrit :

Hi Julien,

Thanks for your answer. In particular I didn't know we could provide a Manifest for the tests, it might explain a few things!

Now I still have the dataSource errors, but I think it's only because you forgot to commit the easysoa-registry/easysoa-registry-core/src/main/resources/test/vocabularies-contrib.xml file you mentioned.


Reply to this email directly or view it on GitHub:
#114 (comment)

Julien Carsique, DevOps, Nuxeo (Paris, France)
www.nuxeo.com - The Open Source ECM Platform - www.nuxeo.org
Nuxeo ECM Stack - The Java EE, scalable, standard-based ECM Platform

@mkalam-alami
Copy link
Contributor Author

Awesome, it works fine now. Thanks again

@ghost ghost assigned jcarsique May 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants