persistence@glassfish.java.net

Re: DDL generation failures in entity-persistence-tests

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Thu, 26 Oct 2006 19:16:23 -0700

Wonseok, Markus,

I'm not sure whose changes affect this, but I got very strange runs with
applying Wonseok's changes on top of the latest code base. Yes, I did
run 'maven -o clean build' in both, the sources and the tests.

The 1st run didn't even report the number of failures, though there was
actually only 1 error - see [1].

The second run reported it correctly, but nothing about releasing the client
(was it wrong before?) - see [2].

The error is the same in both cases ([3]).

thanks,
-marina

[1]
     [junit] BeerListener.POST_PERSIST_COUNT=4
     [junit] [TopLink Finer]: 2006.10.26
07:00:49.707--ServerSession(13446707)--Thread(Thread[main,5,main])--initialize
all identitymaps
     [junit] Tests run: 552, Failures: 0, Errors: 1, Time elapsed: 224.887 sec
     [junit] [TopLink Finer]: 2006.10.26
07:00:49.727--ClientSession(28181611)--Thread(Thread[Finalizer,8,system])--client
released
     [junit] [TopLink Finer]: 2006.10.26
07:00:49.728--ClientSession(13428375)--Thread(Thread[Finalizer,8,system])--client
released
     [junit] Test
oracle.toplink.essentials.testing.tests.FullRegressionTestSuite FAILED


[2]
     [junit] BeerListener.POST_PERSIST_COUNT=4
     [junit] [TopLink Finer]: 2006.10.26
07:15:49.582--ServerSession(13446707)--Thread(Thread[main,5,main])--initialize
all identitymaps
     [junit] Tests run: 552, Failures: 0, Errors: 1, Time elapsed: 271.225 sec
     [junit] Test
oracle.toplink.essentials.testing.tests.FullRegressionTestSuite FAILED


[3]
Testcase: testJoinedInheritance took 0.02 sec
         Caused an ERROR
More than one result was returned from Query.getSingleResult()
javax.persistence.NonUniqueResultException: More than one result was returned
from Query.getSingleResult(
)
         at
oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.throwNonUniqueResultException(EJBQuer
yImpl.java:227)
         at
oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getSingleResult(EJBQueryImpl.jav
a:477)
         at
oracle.toplink.essentials.testing.tests.ejb.ejbqltesting.JUnitEJBQLInheritanceTestSuite.testJo
inedInheritance(JUnitEJBQLInheritanceTestSuite.java:267)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
         at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
         at junit.extensions.TestSetup.run(TestSetup.java:23)


Wonseok Kim wrote:
> Hi Marina,
> Oops, it is my mistake, those two files are nothing to do with this,
> please ignore them.
> Diff file has required changes only, please use it.
>
> Thanks,
> - Wonseok
>
> On 10/27/06, *Marina Vatkina* <Marina.Vatkina_at_sun.com
> <mailto:Marina.Vatkina_at_sun.com>> wrote:
>
> Hi Wonseok,
>
> What are the changes in
> src/java/oracle/toplink/essentials/testing/models/cmp3/xml/relationships/unidirectional/EmployeePopulator.java
>
> and
> src/java/oracle/toplink/essentials/testing/tests/ejb/ejbqltesting/JUnitEJBQLSimpleTestSuite.java
>
>
> thanks,
> -marina
>
> Wonseok Kim wrote:
> > I found another bug in JUnitTestCase, please see below diff.
> > I added following modification to the attached file.
> >
> > Thanks,
> > - Wonseok
> >
> > Index:
> >
> src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java
> >
> > ===================================================================
> > RCS file:
> >
> /cvs/glassfish/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java,v
>
> > retrieving revision 1.20
> > diff -c -r1.20 JUnitTestCase.java
> > ***
> >
> src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java
> > 19 Oct 2006 19:52:27 -0000 1.20
> > ---
> >
> src/java/oracle/toplink/essentials/testing/framework/junit/JUnitTestCase.java
> > 26 Oct 2006 15:23:09 -0000
> > ***************
> > *** 144,150 ****
> > }
> >
> > public static EntityManagerFactory
> getEntityManagerFactory(String
> > persistenceUnitName, Map properties){
> > ! EntityManagerFactory emfNamedPersistenceUnit =
> >
> (EntityManagerFactory)emfNamedPersistenceUnits.get("persistenceUnitName");
> > if (emfNamedPersistenceUnit == null){
> > emfNamedPersistenceUnit =
> > Persistence.createEntityManagerFactory(persistenceUnitName,
> properties);
> > emfNamedPersistenceUnits.put(persistenceUnitName,
> > emfNamedPersistenceUnit);
> > --- 144,150 ----
> > }
> >
> > public static EntityManagerFactory
> getEntityManagerFactory(String
> > persistenceUnitName, Map properties){
> > ! EntityManagerFactory emfNamedPersistenceUnit =
> >
> (EntityManagerFactory)emfNamedPersistenceUnits.get(persistenceUnitName);
> > if (emfNamedPersistenceUnit == null){
> > emfNamedPersistenceUnit =
> > Persistence.createEntityManagerFactory (persistenceUnitName,
> properties);
> > emfNamedPersistenceUnits.put(persistenceUnitName,
> > emfNamedPersistenceUnit);
> > ***************
> > *** 173,184 ****
> > }
> >
> > public static void
> > closeEntityManagerFactoryNamedPersistenceUnit(String
> persistenceUnitName) {
> > ! EntityManagerFactory emfNamedPersistenceUnit =
> >
> (EntityManagerFactory)emfNamedPersistenceUnits.get("persistenceUnitName");
>
> > if(emfNamedPersistenceUnit != null) {
> > if(emfNamedPersistenceUnit.isOpen()) {
> > emfNamedPersistenceUnit.close();
> > }
> > ! emfNamedPersistenceUnit = null;
> > }
> > }
> >
> > --- 173,184 ----
> > }
> >
> > public static void
> > closeEntityManagerFactoryNamedPersistenceUnit(String
> persistenceUnitName) {
> > ! EntityManagerFactory emfNamedPersistenceUnit =
> >
> (EntityManagerFactory)emfNamedPersistenceUnits.get(persistenceUnitName);
> > if(emfNamedPersistenceUnit != null) {
> > if(emfNamedPersistenceUnit.isOpen()) {
> > emfNamedPersistenceUnit.close();
> > }
> > ! emfNamedPersistenceUnits.remove (persistenceUnitName);
> > }
> > }
> >
> >
> > On 10/26/06, *Wonseok Kim* < guruwons_at_gmail.com
> <mailto:guruwons_at_gmail.com>
> > <mailto:guruwons_at_gmail.com <mailto:guruwons_at_gmail.com>>> wrote:
> >
> > Hi Tom, Marina
> > I filed an issue for this.
> > https://glassfish.dev.java.net/issues/show_bug.cgi?id=1380
> >
> > In addition to Tom's modification, I changed some other files
> > regarding to the problems shown in my first email.
> > * modified nullable column attributes of Buyer to follow the
> > specified unique constraints.
> > * modified some tests of EntityManagerJUnitTestSuite to show
> > occurred exceptions if test failed.
> > * added ddl file names to the persistence.xml of
> > ddl-generation-testmodel - because default ddl files are
> overwritten
> > by another pu's ddl generation.
> >
> > I confirmed that tests are running well on clean database.
> > Marina, could you check in this(attached) if there is no
> problem. I
> > don't have check-in permission -.-;
> >
> > Thanks
> > - Wonseok
> >
> >
> > On 10/26/06, *Tom Ware* < tom.ware_at_oracle.com
> <mailto:tom.ware_at_oracle.com>
> > <mailto:tom.ware_at_oracle.com <mailto:tom.ware_at_oracle.com> >>
> wrote:
> >
> > Hi Wonsoek,
> >
> > I fixed the problem by fixing two config files for the
> tests. I
> > tested with clean databases on both Derby and Oracle and
> on an
> > already
> > populated Oracle database.
> >
> > 1. I have removed DDL Generation from the base persistence
> > unit. We
> > initially added it to try to solve some issues we were
> having with
> > constraints. I think removing it should be fine since
> the DDL
> > Generation is tested in a specific model and all the other
> > models are
> > covered by TopLink table generation.
> >
> > 2. I have made a change to one xml file to workaround newly
> > added issue
> > 1376.
> >
> > I would like to check these files in, but will need to
> enter some
> > appropriate enhancement requests prior to removing DDL
> > generation from
> > the base persistence unit. I probably will not get a
> chance to
> > do that
> > until Monday. Feel free to check them in if it makes things
> > easier for you.
> >
> > The changes are attached.
> >
> > -Tom
> >
> >
> >
> >
>
>