Re: jpa provider

From: Gilberto C Andrade (gilbertoc..ecad.to.gov.br)
Date: Tue Dec 18 2007 - 12:27:01 EST

  • Next message: Adam Yocum: "Example Project for ROP on Glassfish using Netbeans 6.0"

    > Hi Gilberto,
    >
    > The test case that you sent before did not have any annotations on
    > Produto class, so I can't say what's wrong... So I need to get more info.

    Ok, you can checkout it from here:
    svn checkout http://construtor.googlecode.com/svn/trunk/gfi gfi

    gilbert..i-des05:~/dev/netbeans-config/workspace/gfi> sh ~/bin/util/tree.sh

    /home/gilberto/dev/netbeans-config/workspace/gfi
       .
       |-core
       |---src
       |-----main
       |-------java
       |-------resources
       |---------META-INF
       |-----test
       |-------java
       |-src
       |---main
       |-----resources
       |---site
       |-web
       |---src
       |-----main
       |-------java
       |-------resources
       |-------webapp
       |---------images
       |---------META-INF
       |---------styles
       |---------WEB-INF

    > Also I suggest to switch to Jira and/or the dev list for this
    > discussion, as JPA testing discussion can get boring quickly for the
    > rest of the user list subscribers. Jira is also a good option as it has
    > much more reliable attachments support.
    Done! But for jira we need a real problem, right?

    Other thing, more precisely a favor. I know you are busy, but it costs
    nothing to try, right?

    Would you mind to take a look at the InventarioServiceTest? That's my
    first try on TDD and almost always I don't know to make a test(the
    correct one, I must say!) for a specific function.

    Thanks,

    Gilberto
    www.secad.to.gov.br

    >
    > Thanks
    > Andrus
    >
    >
    > On Dec 18, 2007, at 3:32 PM, Gilberto C Andrade wrote:
    >>> Ok, switching Surefire to 2.2 and the unit test to JUnit 3 actually
    >>> resulted in a successful run. So I went back to that old thread and
    >>> actually read it :-)
    >>>
    >>> http://objectstyle.org/cayenne/lists/cayenne-devel/2007/03/0065.html
    >>>
    >>> and it turns out that we need this for the surefire plugin:
    >>>
    >>> <useSystemClassLoader>true</useSystemClassLoader>
    >>>
    >>
    >> Fine, the enhancer now works, but ...
    >>
    >>> -------------------------------------------------------
    >>> T E S T S
    >>> -------------------------------------------------------
    >>> Running com.gilbertoca.gfi.service.PessoaServiceTest
    >>> [INFO] Provider - Extra PersistenceUnitInfo properties: null
    >>> [DEBUG] Configuration - added domain: gfi-corePU
    >>> [INFO] InstrumentingUnit - *** Adding transformer:
    >>> org.apache.cayenne.jpa.instrument.UnitClassTransforme..f3ce5c
    >>> [INFO] UnitClassTransformer - Will transform managed class:
    >>> com/gilbertoca/gfi/model/inventario/Item
    >>> [INFO] Enhancer - enhancing class
    >>> com/gilbertoca/gfi/model/inventario/Item
    >>> [INFO] UnitClassTransformer - Will transform managed class:
    >>> com/gilbertoca/gfi/model/inventario/UnidadeMedida
    >>> [INFO] Enhancer - enhancing class
    >>> com/gilbertoca/gfi/model/inventario/UnidadeMedida
    >>> [INFO] UnitClassTransformer - Will transform managed class:
    >>> com/gilbertoca/gfi/model/inventario/Produto
    >>> [INFO] Enhancer - enhancing class
    >>> com/gilbertoca/gfi/model/inventario/Produto
    >>> Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.048
    >>> sec <<< FAILURE!
    >>> Running com.gilbertoca.gfi.service.InventarioServiceTest
    >>> [INFO] Provider - Extra PersistenceUnitInfo properties: null
    >>> [DEBUG] DataRowStore - DataRowStore property
    >>> cayenne.DataRowStore.snapshot.expiration = 7200
    >>> [DEBUG] DataRowStore - DataRowStore property
    >>> cayenne.DataRowStore.snapshot.size = 10000
    >>> [DEBUG] DataRowStore - DataRowStore property
    >>> cayenne.DataRowStore.remote.notify = false
    >>> [DEBUG] DataRowStore - DataRowStore property
    >>> cayenne.DataRowStore.EventBridge.factory =
    >>> org.apache.cayenne.event.JavaGroupsBridgeFactory
    >>> [INFO] QueryLogger - --- transaction started.
    >>> [INFO] Provider - Extra PersistenceUnitInfo properties: null
    >>> [INFO] QueryLogger - --- transaction started.
    >>> [INFO] Provider - Extra PersistenceUnitInfo properties: null
    >>> [INFO] QueryLogger - --- transaction started.
    >>> [INFO] Provider - Extra PersistenceUnitInfo properties: null
    >>> [INFO] QueryLogger - --- transaction started.
    >>> Tests run: 8, Failures: 0, Errors: 8, Skipped: 0, Time elapsed: 0.167
    >>> sec <<< FAILURE!
    >>>
    >>> Results :
    >>>
    >>> Tests in error:
    >>> hello(com.gilbertoca.gfi.service.PessoaServiceTest)
    >>> hello(com.gilbertoca.gfi.service.PessoaServiceTest)
    >>> persistRemoveUnidadeMedidaTest(com.gilbertoca.gfi.service.InventarioServiceTest)
    >>>
    >>> persistRemoveUnidadeMedidaTest(com.gilbertoca.gfi.service.InventarioServiceTest)
    >>>
    >>> persistRemoveCategoriaTest(com.gilbertoca.gfi.service.InventarioServiceTest)
    >>>
    >>> persistRemoveCategoriaTest(com.gilbertoca.gfi.service.InventarioServiceTest)
    >>>
    >>> persistRemoveProdutoTest(com.gilbertoca.gfi.service.InventarioServiceTest)
    >>>
    >>> persistRemoveProdutoTest(com.gilbertoca.gfi.service.InventarioServiceTest)
    >>>
    >>> persistRemoveItemTest(com.gilbertoca.gfi.service.InventarioServiceTest)
    >>> persistRemoveItemTest(com.gilbertoca.gfi.service.InventarioServiceTest)
    >>>
    >>> Tests run: 10, Failures: 0, Errors: 10, Skipped: 0
    >>>
    >>> [INFO]
    >>> ------------------------------------------------------------------------
    >>> [ERROR] BUILD FAILURE
    >>> [INFO]
    >>> ------------------------------------------------------------------------
    >>> [INFO] There are test failures.
    >>> [INFO]
    >>> ------------------------------------------------------------------------
    >>
    >> and the error:
    >>
    >>> gilbert..i-des05:~/dev/netbeans-config/workspace/gfi/core> cat
    >>> target/surefire-reports/com.gilbertoca.gfi.service.PessoaServiceTest.txt
    >>> -------------------------------------------------------------------------------
    >>>
    >>> Test set: com.gilbertoca.gfi.service.PessoaServiceTest
    >>> -------------------------------------------------------------------------------
    >>>
    >>> Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.048
    >>> sec <<< FAILURE!
    >>> hello(com.gilbertoca.gfi.service.PessoaServiceTest) Time elapsed:
    >>> 0.971 sec <<< ERROR!
    >>> java.lang.IllegalArgumentException: Null id Produto.cd_produto
    >>> at
    >>> org.apache.cayenne.jpa.bridge.DataMapConverter$JpaJoinColumnVisitor.onStartNode(DataMapConverter.java:454)
    >>>
    >>> at
    >>> org.apache.cayenne.util.TraversalUtil.traverse(TraversalUtil.java:92)
    >>> at
    >>> org.apache.cayenne.util.TraversalUtil.traverse(TraversalUtil.java:113)
    >>> at
    >>> org.apache.cayenne.util.TraversalUtil.traverse(TraversalUtil.java:113)
    >>> at
    >>> org.apache.cayenne.util.TraversalUtil.traverse(TraversalUtil.java:118)
    >>> at
    >>> org.apache.cayenne.util.TraversalUtil.traverse(TraversalUtil.java:113)
    >>> at
    >>> org.apache.cayenne.util.TraversalUtil.traverse(TraversalUtil.java:80)
    >>> at
    >>> org.apache.cayenne.jpa.bridge.DataMapConverter.toDataMap(DataMapConverter.java:95)
    >>>
    >>> at
    >>> org.apache.cayenne.jpa.Provider.createContainerEntityManagerFactory(Provider.java:248)
    >>>
    >>> at
    >>> org.apache.cayenne.jpa.Provider.createEntityManagerFactory(Provider.java:194)
    >>>
    >>> at
    >>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
    >>>
    >>> at
    >>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
    >>>
    >>> at
    >>> com.gilbertoca.gfi.service.PessoaServiceTest.setUp(PessoaServiceTest.java:32)
    >>>
    >>> 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:585)
    >>> at
    >>> org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:122)
    >>>
    >>> at
    >>> org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:86)
    >>>
    >>> at
    >>> org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
    >>> at
    >>> org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
    >>> at
    >>> org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
    >>>
    >>> at
    >>> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
    >>>
    >>> at
    >>> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
    >>>
    >>> at
    >>> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
    >>>
    >>> at
    >>> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
    >>> at
    >>> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    >>>
    >>> at
    >>> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
    >>>
    >>> at
    >>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
    >>>
    >>> at
    >>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
    >>>
    >>> at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
    >>> 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:585)
    >>> at
    >>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
    >>>
    >>> at
    >>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
    >>>
    >>>
    >>> hello(com.gilbertoca.gfi.service.PessoaServiceTest) Time elapsed:
    >>> 0.975 sec <<< ERROR!
    >>> java.lang.NullPointerException
    >>> at
    >>> com.gilbertoca.gfi.service.PessoaServiceTest.tearDown(PessoaServiceTest.java:38)
    >>>
    >>> 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:585)
    >>> at
    >>> org.junit.internal.runners.MethodRoadie.runAfters(MethodRoadie.java:138)
    >>> at
    >>> org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:92)
    >>>
    >>> at
    >>> org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
    >>> at
    >>> org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
    >>> at
    >>> org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
    >>>
    >>> at
    >>> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
    >>>
    >>> at
    >>> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
    >>>
    >>> at
    >>> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
    >>>
    >>> at
    >>> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
    >>> at
    >>> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    >>>
    >>> at
    >>> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
    >>>
    >>> at
    >>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
    >>>
    >>> at
    >>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
    >>>
    >>> at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
    >>> 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:585)
    >>> at
    >>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
    >>>
    >>> at
    >>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
    >>>
    >>
    >> Gilberto
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Dec 18 2007 - 12:23:10 EST