Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 53573 invoked from network); 13 Sep 2009 11:14:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Sep 2009 11:14:36 -0000 Received: (qmail 79446 invoked by uid 500); 13 Sep 2009 11:14:36 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 79371 invoked by uid 500); 13 Sep 2009 11:14:36 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 79361 invoked by uid 99); 13 Sep 2009 11:14:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Sep 2009 11:14:36 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mtylenda@o2.pl designates 193.17.41.16 as permitted sender) Received: from [193.17.41.16] (HELO rekin23.go2.pl) (193.17.41.16) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Sep 2009 11:14:27 +0000 Received: from rekin23.go2.pl (rekin23 [127.0.0.1]) by rekin23.go2.pl (Postfix) with ESMTP id BCA8412885F for ; Sun, 13 Sep 2009 13:14:05 +0200 (CEST) Received: from o2.pl (unknown [10.0.0.17]) by rekin23.go2.pl (Postfix) with SMTP for ; Sun, 13 Sep 2009 13:14:05 +0200 (CEST) Subject: =?UTF-8?Q?Re:_New_o-p-j_TestCase_methods?= From: =?UTF-8?Q?Mi=C5=82osz_Tylenda?= To: dev@openjpa.apache.org In-Reply-To: <4AA93480.9030204@apache.org> References: <4AA93480.9030204@apache.org> Mime-Version: 1.0 Message-ID: <2e116005.65cf692b.4aacd3fb.c7546@o2.pl> Date: Sun, 13 Sep 2009 13:14:03 +0200 X-Originator: 79.186.160.142 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi=20Donald, I=20like=20your=20idea=20of=20specifying=20(un)supportedDatabases,=20was=20= also=20thinking=20about=20something=20like=20this. There=20is=20a=20small=20issue=20however.=20When=20you=20run=20TestMultip= leSchemaNames=20with=20PostgreSQL,=20it=20fails=20in=20setUp.=20This=20is= =20because=20the=20setUnsupportedDatabases=20creates=20an=20EntityManager= =20which=20in=20turn=20tries=20to=20create=20tables=20for=20a=20schema=20= not=20yet=20created.=20PostgreSQL=20requires=20a=20schema=20being=20creat= ed=20up-front=20and=20this=20is=20what=20createSchemas=20method=20does. I=20suggest=20we=20either: 1.=20Modify=20the=20set(Un)supportedDatabases=20methods=20to=20not=20crea= te=20EntityManager.=20It=20is=20possible=20to=20determine=20the=20instanc= e=20of=20DBDictionary=20just=20from=20OpenJPAEntityManagerFactory(SPI).=20= That=20would=20also=20have=20some=20minor=20positive=20performance=20impa= ct.=20An=20EntityManager=20would=20be=20needed=20if=20we=20wanted=20DBDic= tionary=20properties=20be=20initialized=20from=20a=20connection=20(see=20= TestXMLCustomerOrder=20for=20example). 2.=20If=20for=20some=20reason=20the=20above=20is=20wrong,=20let's=20just=20= try=20to=20move=20createSchemas=20call=20before=20setUnsupportedDatabases= =20call. Regards, Milosz >=20Some=20updates=20I=20just=20checked=20into=20trunk=20as=20r813506=20a= nd=20r813519=20under=20 >=20openjpa-persistence-jdbc=20which=20should=20make=20writing=20and=20ma= intaining=20 >=20testcases=20easier... >=20 >=20For=20setUp()=20code=20(all=20can=20be=20used=20before=20super.setUp(= )=20is=20called): >=20-=20Added=20new=20protected=20methods=20of=20setTestsDisabled()/isTes= tsDisabled()=20in=20 >=20AbstractPersistenceTestCase=20which=20is=20used=20by=20runTest()=20to= =20automatically=20 >=20skip=20all=20tests.=20=20This=20keeps=20us=20from=20having=20to=20put= =20our=20own=20if(skipTests)=20 >=20in=20each=20testXXX=20method=20for=20most=20cases=20(unless=20you=20n= eed=20granular=20per=20test=20 >=20exclusion=20capabilities). >=20 >=20=20=20=20=20=20setTestsDisabled(!dictionarySupportsXMLColumn()); >=20=20=20=20=20=20if=20(isTestsDisabled())=20{ >=20=20=20=20=20=20=20=20=20=20return; >=20=20=20=20=20=20} >=20 >=20-=20Added=20new=20setSupportedDatabases()/setUnsupportedDatabases()=20= methods=20in=20 >=20SingleEMFTestCase=20to=20set=20the=20testsDisabled=20flag=20in=20 >=20AbstractPersistenceTestCase,=20which=20allows=20you=20to=20exclude=20= all=20tests=20based=20 >=20on=20the=20DB=20platform=20being=20used=20- >=20 >=20=20=20=20=20=20setUnsupportedDatabases( >=20=20=20=20=20=20=20=20=20=20org.apache.openjpa.jdbc.sql.MySQLDictionar= y.class, >=20=20=20=20=20=20=20=20=20=20org.apache.openjpa.jdbc.sql.OracleDictiona= ry.class, >=20=20=20=20=20=20=20=20=20=20org.apache.openjpa.jdbc.sql.SQLServerDicti= onary.class); >=20=20=20=20=20=20if=20(isTestsDisabled())=20{ >=20=20=20=20=20=20=20=20=20=20return; >=20=20=20=20=20=20} >=20 >=20 >=20For=20general=20usage: >=20-=20Added=20a=20getLog()=20method=20in=20SingleEMFTestCase=20class=20= for=20everyone=20to=20 >=20use,=20instead=20of=20having=20a=20copy=20in=20your=20own=20tests.=20= =20Also,=20you=20can=20now=20use=20 >=20logging=20before=20calling=20super.setUp(),=20as=20the=20getLog()=20w= ill=20create=20a=20 >=20temporary=20EMF=20if=20needed. >=20 >=20 >=20 >=20-Donald >=20