OK. It does run correctly on a clean database. How would we document this?
I'm lucky to know a utility developed at some point for cmp testing that
is now checked in under <ws>/glassfish/appserv-tests/lib/isql.jar and which
can drop all tables on the cmp supported databases:
java -classpath <driver>:<ws>/glassfish/appserv-tests/lib/isql.jar
isql.DropTables <url> <user> <pwd> <driver-class-name>
But others might miss this discussion and not knowing the dependencies
between the tables, manual drop can be quite time consuming :(.
What should we do?
thanks,
-marina
Wonseok Kim wrote:
> Marina,
> I think, there is some misunderstanding.
>
> Tests don't need run on clean database always, but need to clean once
> with this modifications.
> This is because previously generated foreign key constraints by ddl
> generation can block drop some tables.
>
> Foreign key constraints generated by ddl generation were different from
> the ones by model table creators.
> Model table creators drop and create table/constraints always before
> tests, so you don't need to clean database, but in your case, I guess,
> dropping table by model table creators probably failed due to some
> existing foreign key constraints. You can check it by logging level FINEST.
>
> Thanks
> - Wonseok
>
> On 10/27/06, *Marina Vatkina* <Marina.Vatkina_at_sun.com
> <mailto:Marina.Vatkina_at_sun.com>> wrote:
>
> I ran on the existing database, but did a clean build. If the tests
> need a clean database, they must either remove all used tables at
> the end, or clean up all the tables at the beginning, right? I don't
> think that manual cleanup should be a pre-requisite for the run.
>
> I'm really not comfortable checking in the changes without an ability
> to have a clean run. Tom, do you have an idea?
>
> thanks,
> -marina
>
> Wonseok Kim wrote:
> > Did you run tests on clean database?
> > I've run tests several times, but there was no failure.
> >
> > I don't know what cause the situation, but DDL generation is
> disabled,
> > so it will not remove existing tables at deploy time (Instead, each
> > model table creator will recreate table before running tests).
> >
> > - Wonseok
> >
> > On 10/27/06, *Marina Vatkina* <Marina.Vatkina_at_sun.com
> <mailto:Marina.Vatkina_at_sun.com>
> > <mailto: Marina.Vatkina_at_sun.com <mailto:Marina.Vatkina_at_sun.com>>>
> wrote:
> >
> > 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>
> > <mailto: Marina.Vatkina_at_sun.com <mailto:Marina.Vatkina_at_sun.com>>
> > > <mailto:Marina.Vatkina_at_sun.com
> <mailto:Marina.Vatkina_at_sun.com> <mailto: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>>
> > > <mailto:guruwons_at_gmail.com <mailto:guruwons_at_gmail.com>
> <mailto:guruwons_at_gmail.com <mailto:guruwons_at_gmail.com>>>
> > > > <mailto: guruwons_at_gmail.com
> <mailto:guruwons_at_gmail.com> <mailto:guruwons_at_gmail.com
> <mailto:guruwons_at_gmail.com>>
> > <mailto: 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>>
> > > <mailto:tom.ware_at_oracle.com
> <mailto:tom.ware_at_oracle.com> <mailto:tom.ware_at_oracle.com
> <mailto:tom.ware_at_oracle.com>>>
> > > > <mailto:tom.ware_at_oracle.com
> <mailto:tom.ware_at_oracle.com>
> > <mailto: tom.ware_at_oracle.com <mailto:tom.ware_at_oracle.com>>
> <mailto: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
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>