From user-return-10446-apmail-geronimo-user-archive=geronimo.apache.org@geronimo.apache.org Wed Jun 04 11:25:51 2008 Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 24152 invoked from network); 4 Jun 2008 11:25:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jun 2008 11:25:51 -0000 Received: (qmail 59709 invoked by uid 500); 4 Jun 2008 11:25:50 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 59644 invoked by uid 500); 4 Jun 2008 11:25:50 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 59624 invoked by uid 99); 4 Jun 2008 11:25:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jun 2008 04:25:50 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [212.184.118.200] (HELO lnm4.bgs-ag.de) (212.184.118.200) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jun 2008 11:24:58 +0000 In-Reply-To: <9DD529E6-7582-4326-925A-07ACDD7290EC@visi.com> To: user@geronimo.apache.org Subject: Antwort: EJB unit testing available Message-ID: Date: Wed, 4 Jun 2008 13:25:06 +0200 From: Josef.Eisele@bgs-ag.de Content-Type: multipart/alternative; boundary="=_alternative 003EBAB7C125745E_=" MIME-Version: 1.0 X-KeepSent: C020F274:307C9830-C125745E:003C91D6; name=$KeepSent; type=4 X-Mailer: Lotus Notes Release 7.0.3 September 26, 2007 X-Disclaimed: 14623 X-Virus-Checked: Checked by ClamAV on apache.org --=_alternative 003EBAB7C125745E_= Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Hi David, great Idea to do unit-testing using the embedded functions of openejb. So=20 I tried...=20 I have a JavaEE-5 application on Geronimo 2.1.1 with Postgres-DB. (Driver=20 postgresql-8.2-508.jdbc3.jar). In Geronimo I defined a database pool with=20 Pool-Type "TranQL XA Resource Adapter for PostgreSQL". I use Local=20 Sesscion Beans in General. The Application works quite well. Thus I tried to do this with embedded openejb. After quite a few problems=20 to set up the system, my JUNIT-Test works up to a certain step. It seems=20 there is maybe an impact with the transaction - functionality. The=20 transaction could not be comitted. I could imagine not the XA-Datasource=20 is taken, but who knows?? openejb.conf: ... =20 JUNIT-Testcase: public void setUp() throws Exception { Properties properties =3D new Properties(); properties.setProperty(Context.INITIAL=5FCONTEXT=5FFACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); =20 properties.put("openejb.home",=20 "/home/user/workspace/VesuvUnit/openejb"); =20 properties.put("openejb.configuration",=20 "/home/user/workspace/VesuvUnit/openejb/openejb.conf"); .... =20 properties.put("Postgres.postgres.vesuv",=20 "new://Resource?type=3DDataSource"); properties.put("Postgres.postgres.vesuv.JdbcDriver",=20 "org.postgresql.Driver"); properties.put("Postgres.postgres.vesuv.JdbcUrl",=20 "jdbc:postgresql://localhost/bla"); properties.put("Postgres.postgres.vesuv.UserName", "bla"); properties.put("Postgres.postgres.vesuv.Password", "bla"); .... Lookup of the SessionBean works. Invoking the method is fine.=20 SQL-Statements are done. But=20 LOG: [DEBUG] [BenutzerManagerImpl] >> Mandant: Mandant:Vesuv Servicestelle Id:1 = Kurzname: SS PersonFK:0 Tstaend:null 13:18:31,644 INFO [Transaction] TX Required: Committing transaction=20 org.apache.geronimo.transaction.manager.TransactionImpl@1579371 13:18:31,693 DEBUG [SQL] executing prepstmnt 31310826 = UPDATE vesuv.v=5Forg=5Feinheit SET beziehung=5Forg=5Feinheit=5Ftyp =3D ?, k= urz=5Fname =3D=20 ?, name =3D ?, org=5Feinheit=5Ftyp =3D ?, person=5Ffk =3D ?, rechtsform =3D= ?, tstaend =3D=20 ?, beziehung=5Forg=5Feinheit=5Ffk =3D ?, uebergeordnete=5Forg=5Feinheit=5Ff= k =3D ? WHERE=20 id =3D ? [params=3D(null) null, (String) SS, (String) Vesuv Servicestelle, = (String) SS, (long) 1, (String) SS, (Timestamp) 2008-05-26 10:10:43.96,=20 (null) null, (null) null, (long) 1] 13:18:31,702 DEBUG [SQL] [9 ms] spent 13:18:31,717 DEBUG [SQL] executing prepstmnt 23410971 = UPDATE vesuv.benutzer SET anzahl=5Fanmeldeversuche =3D ?, anzahl=5Fanmeldun= gen =3D=20 ?, benutzer=5Fkennung =3D ?, datum=5Fletzte=5Fpasswort=5Faenderung =3D ?, e= mail=5Fanlage=20 =3D ?, historie=5Ffk =3D ?, ist=5Fgesperrt =3D ?, ist=5Fgesperrt=5Fseit =3D= ?,=20 kostenbefreiung=5Fonline=5Fauskunft =3D ?, letzte=5Fbenutzer=5Fgruppe=5Ffk = =3D ?,=20 letzter=5Fanmeldeversuch =3D ?, passwort=5Ffehlversuche=5Fzaehler =3D ?,=20 passwort=5Fhistorie =3D ?, passwort=5Fsha256hash =3D ?,=20 passwort=5Fwechsel=5Ferst=5Fanmeldung =3D ?, person=5Finfo=5Ffk =3D ?, sper= rgrund =3D ?,=20 verknuepft=5Fmit=5Ffk =3D ?, zuletzt=5Fangemeldet=5Fam =3D ? WHERE id =3D ?= =20 [params=3D(long) 0, (long) 0, (String) system, (Timestamp) 2008-05-26=20 10:10:49.2, (boolean) false, (long) 3, (boolean) false, (Timestamp)=20 2008-05-26 10:10:49.2, (boolean) false, (null) null, (Timestamp)=20 2008-05-26 10:10:49.2, (long) 0, (String) keine Historie, (String)=20 6ee4a469cd4e91053847f5d3fcb61dbcc91e8f0ef10be7748da4c4a1ba382d17,=20 (boolean) false, (long) 2, (String) keiner, (long) 0, (Timestamp)=20 2008-05-26 10:10:49.2, (long) 8] 13:18:31,718 DEBUG [SQL] [1 ms] spent 13:18:31,719 DEBUG [SQL] executing prepstmnt 8929602=20 UPDATE vesuv.v=5Fgruppe=5Forg=5Feinheit SET gruppe=5Fname =3D ?, kurz=5Fnam= e =3D ?, name=20 =3D ?, org=5Feinheit=5Fid =3D ?, org=5Feinheit=5Ftyp =3D ?, person=5Ffk =3D= ?, rechtsform =3D=20 ? WHERE gruppe=5Fid =3D ? [params=3D(String) SystemManager, (String) SS,=20 (String) Vesuv Servicestelle, (long) 1, (String) SS, (long) 1, (String)=20 SS, (long) 1] 13:18:31,721 DEBUG [SQL] [2 ms] spent 13:18:31,721 DEBUG [SQL] executing prepstmnt 24403605 = UPDATE vesuv.v=5Fbenutzer=5Fgruppe SET benutzer=5Fgruppe=5Fzuordnung=5Ffk = =3D ?,=20 benutzer=5Fkennung =3D ?, gruppe=5Fname =3D ? WHERE benutzer=5Fgruppe=5Fid = =3D ? AND=20 benutzer=5Fid =3D ? [params=3D(long) 1, (String) system, (String) SystemMan= ager,=20 (long) 1, (long) 8] 13:18:31,722 DEBUG [SQL] [1 ms] spent 13:18:31,737 DEBUG [Runtime] An exception occurred while ending the=20 transaction. This exception will be re-thrown. =20 org.apache.openjpa.util.StoreException: The transaction has been rolled=20 back. See the nested exceptions for details on the errors that occurred. ... Caused by: =20 org.apache.openjpa.util.StoreException: FEHLER: kann eine Sicht nicht=20 aktualisieren {prepstmnt 31310826 UPDATE vesuv.v=5Forg=5Feinheit SET=20 beziehung=5Forg=5Feinheit=5Ftyp =3D ?, kurz=5Fname =3D ?, name =3D ?, org= =5Feinheit=5Ftyp =3D=20 ?, person=5Ffk =3D ?, rechtsform =3D ?, tstaend =3D ?, beziehung=5Forg=5Fei= nheit=5Ffk =3D=20 ?, uebergeordnete=5Forg=5Feinheit=5Ffk =3D ? WHERE id =3D ? [params=3D(null= ) null,=20 (String) SS, (String) Vesuv Servicestelle, (String) SS, (long) 1, (String) = SS, (Timestamp) 2008-05-26 10:10:43.96, (null) null, (null) null, (long)=20 1]} [code=3D0, state=3D0A000] FailedObject:=20 org.apache.openjpa.enhance.de$nrw$hagen$ggrz$bv$orgeinheit$db$VOrgEinheitPA= O$pcsubclass-de.nrw.hagen.ggrz.bv.orgeinheit.db.VOrgEinheitPAO-1 ... The LOG-File is in German, therefore some translation: Sicht =3D View. The = Update of the View-PAO does not work. Any suggestions ???=20 Thanx Josef David Blevins =20 21.05.2008 05:12 Bitte antworten an user@geronimo.apache.org An user@geronimo.apache.org Kopie Thema EJB unit testing available I just wanted to put this on everyone's radar in case it wasn't=20 already known. Those of you writing EJB applications run on Geronimo=20 have an extra advantage that those applications can be easily unit=20 tested by embedding the Geronimo EJB container (OpenEJB) into your=20 test case. This sort of in-container unit testing technique is something we've=20 been innovating for a while and is likely to be a major addition to=20 the EJB 3.1 specifications. I strongly encourage anyone doing EJB=20 development to check this out. There are a number of examples=20 available here: http://openejb.apache.org/examples.html The net result of this is that you should be able to quickly unit test=20 your ejbs in your build as you would test a plain java application.=20 With good EJB unit tests you'll get much faster development, fewer=20 build/deploy cycles, and be able to quickly catch basic deployment=20 issues that stem from incorrect or non-compliant apps. -David BGS Beratungsgesellschaft=20 Software Systemplanung AG Niederlassung Rhein/Main=20 Robert-Koch-Stra=DFe 41=20 55129 Mainz=20 Fon: +49 (0) 6131 / 914-0=20 Fax: +49 (0) 6131 / 914-400=20 www.bgs-ag.de Gesch=E4ftssitz Mainz=20 Registergericht=20 Amtsgericht Mainz=20 HRB 62 50=20 Aufsichtsratsvorsitzender=20 Dr. Wolfgang Trommer=20 Vorstand=20 Hanspeter Gau=20 Hermann Kiefer=20 Nils Manegold=20 Heinz-J=F6rg Zimmermann=20 = --=_alternative 003EBAB7C125745E_= Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable
Hi David,

great Idea to do unit-testing using the embedded functions of openejb. So I tried...

I have a JavaEE-5 application on Geronimo 2.1.1 with Postgres-DB. (Driver postgresql-8.2-508.jdbc3.jar). In Geronimo I defined a database pool with Pool-Type "TranQL XA Resource Adapter for PostgreSQL". I use Local Sesscion Beans in General. The Application works quite well.

Thus I t= ried to do this with embedded openejb. After quite a few problems to set up the system, my JUNIT-Test works up to a certain step. It seems there is maybe an impact with the transaction - functionality. The transaction could not be comitted. I could imagine not the XA-Datasource is taken, but who knows??

openejb.conf:
...
 = ; <SecurityService id=3D"Default Security Service"/>
&n= bsp; <TransactionManager id=3D"Default Transaction Manager"/>  
</openejb>


JUNIT-Testcase:
&nbs= p;       public void setUp() throws Exception {
                Properties properties =3D new Properties();
=                 properties.setProperty(Context.INITIAL=5FCONTEXT=5FFAC= TORY,
      &nb= sp;                         "org.apache.openejb.client.LocalInitialContextFac= tory");
    &nb= sp;          
  &= nbsp;             properties.put("openejb.home", "/home/u= ser/workspace/VesuvUnit/openejb");
           
      &= nbsp;         properties.put("openejb.configuration",
        &= nbsp;         "/home/user/workspace/VesuvUnit/openejb/op= enejb.conf");

  =               ....
&nbs= p;              
  &= nbsp;             properties.put("Postgres.postgres.vesuv", "new://Resource?type=3DDataSource");
                properties.put("Postgres.postgres.vesuv.JdbcDrive= r", "org.postgresql.Driver");
                properties.put("Postgres.postgres.vesuv.JdbcUrl&q= uot;, "jdbc:postgresql://localhost/bla");
                properties.put("Postgres.postgres.vesuv.UserName&= quot;, "bla");
   = ;             properties.put("Postgres.postgres.vesuv.Password&= quot;, "bla");
   = ;....

Lookup of the Sessio= nBean works. Invoking the method is fine. SQL-Statements are done. But

LOG:
[DEBUG] [BenutzerManagerImpl] >> Mandant: Mandant:Vesuv Servicestelle Id:1 Kurzname: SS PersonFK:0 Tstaend:n= ull
13:18:31,644 INFO  [= Transaction] TX Required: Committing transaction org.apache.geronimo.transaction.manager= .TransactionImpl@1579371
13:1= 8:31,693 DEBUG [SQL] <t 15431769, conn 0> executing prepstmnt 31310826 UPDATE vesuv.v=5Forg=5Feinheit SET beziehung=5Forg=5Feinheit=5Ftyp =3D ?, kurz=5Fname =3D ?, name =3D ?, org= =5Feinheit=5Ftyp =3D ?, person=5Ffk =3D ?, rechtsform =3D ?, tstaend =3D ?, beziehung=5Forg= =5Feinheit=5Ffk =3D ?, uebergeordnete=5Forg=5Feinheit=5Ffk =3D ? WHERE id =3D ? [params=3D(= null) null, (String) SS, (String) Vesuv Servicestelle, (String) SS, (long) 1, (String) SS, (Timestamp) 2008-05-26 10:10:43.96, (null) null, (null) null, (long) 1]
13:18:31,702 DEBUG [SQL] &= lt;t 15431769, conn 0> [9 ms] spent
13:18= :31,717 DEBUG [SQL] <t 15431769, conn 0> executing prepstmnt 23410971 UPDATE vesuv.benutzer SET anzahl=5F= anmeldeversuche =3D ?, anzahl=5Fanmeldungen =3D ?, benutzer=5Fkennung =3D ?, datum=5Fletzte= =5Fpasswort=5Faenderung =3D ?, email=5Fanlage =3D ?, historie=5Ffk =3D ?, ist=5Fgesperrt =3D ?, ist= =5Fgesperrt=5Fseit =3D ?, kostenbefreiung=5Fonline=5Fauskunft =3D ?, letzte=5Fbenutzer=5Fgrupp= e=5Ffk =3D ?, letzter=5Fanmeldeversuch =3D ?, passwort=5Ffehlversuche=5Fzaehler =3D ?, pa= sswort=5Fhistorie =3D ?, passwort=5Fsha256hash =3D ?, passwort=5Fwechsel=5Ferst=5Fanmeldung = =3D ?, person=5Finfo=5Ffk =3D ?, sperrgrund =3D ?, verknuepft=5Fmit=5Ffk =3D ?, zuletzt=5Fangemeldet= =5Fam =3D ? WHERE id =3D ? [params=3D(long) 0, (long) 0, (String) system, (Timestamp) 2008-05= -26 10:10:49.2, (boolean) false, (long) 3, (boolean) false, (Timestamp) 2008-05= -26 10:10:49.2, (boolean) false, (null) null, (Timestamp) 2008-05-26 10:10:49.2, (long) 0, (String) keine Historie, (String) 6ee4a469cd4e91053847f5d3fcb61db= cc91e8f0ef10be7748da4c4a1ba382d17, (boolean) false, (long) 2, (String) keiner, (long) 0, (Timestamp) 2008-05-26 10:10:49.2, (long) 8]
13:18:3= 1,718 DEBUG [SQL] <t 15431769, conn 0> [1 ms] spent
13:18= :31,719 DEBUG [SQL] <t 15431769, conn 0> executing prepstmnt 8929602 UPDATE vesuv.v=5Fgruppe=5Forg=5Feinh= eit SET gruppe=5Fname =3D ?, kurz=5Fname =3D ?, name =3D ?, org=5Feinheit=5Fid = =3D ?, org=5Feinheit=5Ftyp =3D ?, person=5Ffk =3D ?, rechtsform =3D ? WHERE gruppe=5Fid =3D ? [params= =3D(String) SystemManager, (String) SS, (String) Vesuv Servicestelle, (long) 1, (String) SS, (long) 1, (String) SS, (long) 1]
13:18:31,721 DEBUG [SQL] <t 15431769, conn 0> [2 ms] spent
13:18= :31,721 DEBUG [SQL] <t 15431769, conn 0> executing prepstmnt 24403605 UPDATE vesuv.v=5Fbenutzer=5Fgruppe SET benutzer=5Fgruppe=5Fzuordnung=5Ffk =3D ?, benutzer=5Fkennung =3D ?, gru= ppe=5Fname =3D ? WHERE benutzer=5Fgruppe=5Fid =3D ? AND benutzer=5Fid =3D ? [params=3D= (long) 1, (String) system, (String) SystemManager, (long) 1, (long) 8]
13:18:31,722 DEBUG [SQL] <t 15431769, conn 0> [1 ms] spent
13:18= :31,737 DEBUG [Runtime] An exception occurred while ending the transaction.  This exception will be re-thro= wn.
<openjpa-1.0.1-r420667= :592145 fatal store error> org.apache.openjpa.util.StoreException: The transact= ion has been rolled back.  See the nested exceptions for details on the errors that occurred.
...
Caused by: <openjpa-1.0.1-r42= 0667:592145 nonfatal store error> org.apache.openjpa.util.StoreException: FEHLER: kann eine Sicht nicht aktualisieren {prepstmnt 31310826 UPDATE vesuv.v= =5Forg=5Feinheit SET beziehung=5Forg=5Feinheit=5Ftyp =3D ?, kurz=5Fname =3D ?, name =3D ?, o= rg=5Feinheit=5Ftyp =3D ?, person=5Ffk =3D ?, rechtsform =3D ?, tstaend =3D ?, beziehung=5Forg= =5Feinheit=5Ffk =3D ?, uebergeordnete=5Forg=5Feinheit=5Ffk =3D ? WHERE id =3D ? [params=3D(= null) null, (String) SS, (String) Vesuv Servicestelle, (String) SS, (long) 1, (String) SS, (Timestamp) 2008-05-26 10:10:43.96, (null) null, (null) null, (long) 1]} [code=3D0, state=3D0A000]
FailedObject: org.apache.openjpa.enhance.de$nrw$hagen$ggrz$bv$orgeinheit$d= b$VOrgEinheitPAO$pcsubclass-de.nrw.hagen.ggrz.bv.orgeinheit.db.VOrgEinheitP= AO-1
...

The LOG-File is in German, therefore some tran= slation: Sicht =3D View. The Update of the View-PAO does not work. Any suggestions ???


Thanx Josef





David Blevins <david.blevin= s@visi.com>

21.05.2008 0= 5:12
Bitte antworten an
user@geroni= mo.apache.org

<= tr valign=3Dtop>
A= n
user@geronimo.apache.o= rg
Kopie
Thema
EJB unit testing available





I just wa= nted to put this on everyone's radar in case it wasn't  
already known.  Those of you writing EJB applicati= ons run on Geronimo  
have an extra advantage that those applications can be easily uni= t  
tested by embedding the Geronimo EJB container (OpenEJB) into y= our  
test case.

This sort of in-container unit testing tech= nique is something we've  
been innovating for a while and is likel= y to be a major addition to  
the EJB 3.1 specifications.  I s= trongly encourage anyone doing EJB  
development to check this out.  There are a number of exampl= es  
available here:
http://openejb.apache.org/examples.html<= br>
The net result of this is that you should be able to quickly unit te= st  
your ejbs in your build as you would test a plain java applicatio= n.  
With good EJB unit tests you'll get much faster development, fewer &nbs= p;
build/deploy cycles, and be able to quickly catch basic deployment &n= bsp;
issues that stem from incorrect or non-compliant apps.

-Davi= d





BGS Bera= tungsgesellschaft
Software Systemplanung AG
     
  Ni= ederlassung Rhein/Main
Robert-Koch-Stra=DFe 41
55129 MainzFon: +49 (0) 6131 / 914-0
Fax: +49 (0) 6131 / 914-400
www.bgs-ag.de=
Ge= sch=E4ftssitz Mainz
Registergericht
Amtsger= icht Mainz
HRB 62 50
 
Au= fsichtsratsvorsitzender
Dr. Wolfgang Trommer
Vorstan= d
Hanspeter Gau
Hermann Kiefer
Nils Manegold
Heinz-J= =F6rg Zimmermann


 3D"Ein
--=_alternative 003EBAB7C125745E_=--