February 12, 2011  
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28

[00:34:05] *** michaelschuetz has quit IRC
[00:52:10] *** ldimaggi_ has joined #jbosstesting
[01:09:01] *** bleathem has quit IRC
[01:11:08] *** aslak has joined #jbosstesting
[01:11:08] *** aslak has joined #jbosstesting
[01:16:51] *** rruss has quit IRC
[01:22:21] *** aslak has quit IRC
[02:31:30] *** bobmcw has quit IRC
[04:29:48] *** jdlee has quit IRC
[04:42:24] *** jdlee has joined #jbosstesting
[04:42:25] *** jdlee has joined #jbosstesting
[04:55:54] *** jdlee has quit IRC
[05:00:04] *** ldimaggi_ has quit IRC
[05:02:41] *** jdlee has joined #jbosstesting
[05:02:42] *** jdlee has joined #jbosstesting
[05:12:54] *** jdlee has quit IRC
[05:17:20] *** tcunning has joined #jbosstesting
[05:23:01] *** jdlee has joined #jbosstesting
[05:33:59] *** tcunning has quit IRC
[05:40:45] *** tcunning has joined #jbosstesting
[05:50:04] *** tcunning has quit IRC
[05:55:14] *** jdlee has quit IRC
[06:01:59] *** jdlee has joined #jbosstesting
[06:01:59] *** jdlee has joined #jbosstesting
[06:11:18] *** jdlee has quit IRC
[06:15:52] *** jdlee has joined #jbosstesting
[06:15:52] *** jdlee has joined #jbosstesting
[06:15:55] *** rruss has joined #jbosstesting
[06:35:22] *** jdlee has quit IRC
[06:42:09] *** jdlee has joined #jbosstesting
[06:42:09] *** jdlee has joined #jbosstesting
[06:55:39] *** jdlee has quit IRC
[07:02:26] *** jdlee has joined #jbosstesting
[07:02:26] *** jdlee has joined #jbosstesting
[07:11:27] *** rruss has quit IRC
[07:12:56] *** bleathem has joined #jbosstesting
[07:15:56] *** jdlee has quit IRC
[07:22:45] *** jdlee has joined #jbosstesting
[07:23:44] *** bleathem has quit IRC
[07:57:17] *** jdlee has quit IRC
[08:13:04] *** jdlee has joined #jbosstesting
[08:13:05] *** jdlee has joined #jbosstesting
[08:35:19] *** jdlee has quit IRC
[08:42:06] *** jdlee has joined #jbosstesting
[08:42:06] *** jdlee has joined #jbosstesting
[08:55:36] *** jdlee has quit IRC
[09:02:23] *** jdlee has joined #jbosstesting
[09:02:23] *** jdlee has joined #jbosstesting
[09:15:53] *** jdlee has quit IRC
[09:22:40] *** jdlee has joined #jbosstesting
[09:22:40] *** jdlee has joined #jbosstesting
[09:24:57] *** Tashtego has joined #jbosstesting
[09:25:10] <Tashtego> hi
[09:51:14] *** ge0ffrey has joined #jbosstesting
[09:56:10] *** jdlee has quit IRC
[10:02:54] *** jdlee has joined #jbosstesting
[10:02:54] *** jdlee has joined #jbosstesting
[10:35:24] *** jdlee has quit IRC
[10:41:08] *** oskutka has joined #jbosstesting
[10:42:13] *** jdlee has joined #jbosstesting
[10:48:11] *** aslak has joined #jbosstesting
[10:48:11] *** aslak has quit IRC
[10:48:11] *** aslak has joined #jbosstesting
[10:55:42] *** jdlee has quit IRC
[11:02:30] *** jdlee has joined #jbosstesting
[11:02:31] *** jdlee has joined #jbosstesting
[11:16:00] *** jdlee has quit IRC
[11:21:36] *** mgoldmann has joined #jbosstesting
[11:22:49] *** jdlee has joined #jbosstesting
[11:23:47] *** oskutka has quit IRC
[11:34:52] *** kenglxn has joined #jbosstesting
[11:34:54] *** kenglxn has left #jbosstesting
[11:55:19] *** jdlee has quit IRC
[12:01:56] *** mgoldmann_ has joined #jbosstesting
[12:01:56] *** mgoldmann has quit IRC
[12:02:06] *** jdlee has joined #jbosstesting
[12:08:45] <Tashtego> hey guys ^^ i have a question about unit testing... i am testing my entitymanager.persist method... shouldnt the method do a rollback after the unit test finished? i dont do an explicit commit. ?
[12:17:14] <Tashtego> what i do is ->call session bean -> session bean persists and returns with success -> do assert statemets and end test
[12:17:28] <Tashtego> the complete call to session bean seems to do a autocommit
[12:19:36] <aslak> Tashtego, the session bean is default transacte
[12:19:37] <aslak> d
[12:20:34] <Tashtego> thats what i thought. what is a common way to handle this for unit tests?
[12:20:46] <Tashtego> do some annotation on the unit test to tell it the session is read only?
[12:21:02] <Tashtego> thought when a method is annotated with @Test this is done automaticallay :(
[12:24:15] <aslak> the default behavior of a SessionBean is TransactionAttribute.REQUIRED, which means it will join a transaction if there is one
[12:24:43] <Tashtego> my sessionbean does a entityManager.joinTransaction() anyways in code
[12:24:49] <Tashtego> maybe that is not neccessary?
[12:24:57] <aslak> Tashtego, shouldn't be
[12:25:04] <Tashtego> k i will remove that.
[12:25:12] <aslak> depend son how you create the EntityManager
[12:25:23] <Tashtego> but when i understand that right... then the transaction is not generated by unit test
[12:25:33] <Tashtego> but first generated with the ssb?
[12:25:36] <aslak> if you inject it via PersistenceContext or similar, it will auto join the ongoing transaction..
[12:25:40] <Tashtego> because else the transaction would be readonly i guess
[12:25:46] <Tashtego> i do
[12:26:18] <Tashtego> by the way i am using XA datasources. but that shouldnt matter, right
[12:26:20] <aslak> so if you start a transaction if your @Test method before doing the call, the session bean and entitymanger should be a part of that transaction, which you can rollback after the session bean call
[12:26:29] <aslak> be aware tho, that you are probably not testing what you think you are. .:)
[12:27:03] <Tashtego> i dont do anything with transactions in the unit test
[12:27:09] <Tashtego> only calling the session bean
[12:27:21] <Tashtego> so i guess the first time the transaction gets created happens in the ssb?
[12:27:36] <aslak> Tashtego, right, that's why a new transaction is created when you call the bean.. that transaction will be comitted if the call is successful
[12:28:25] <Tashtego> so how should i create the session in the unit test? with xa / jta no entitymanager.getTransaction().begin() is allowed
[12:28:51] <Tashtego> should i let the entity manager get injeced in the unit test and set it into the session bean??
[12:29:19] <aslak> http://arquillian.pastebin.com/edj9ybsE
[12:30:30] <aslak> at this point you won't be hitting the database at all, but.. depends on what you are testing
[12:33:50] <Tashtego> that works perfect
[12:33:52] <Tashtego> thanks !!!! ;)
[12:34:02] <Tashtego> and even makes sense ;) to get a transaction injected
[12:34:14] <Tashtego> thats how jta can work . i see. ;)
[12:34:21] <aslak> :)
[12:35:04] <aslak> Tashtego, but as i said, think before you write to much database related tests like this, becuase your not actaully hitting the database, so insert can still fail
[12:35:35] *** jdlee has quit IRC
[12:36:23] <Tashtego> aslka well my session beans all extend abstractDaoJpa which needs to be tested
[12:36:25] <Tashtego> http://pastebin.com/TEyRnuhK
[12:36:59] <Tashtego> thanks for your tips again! ;)
[12:38:04] <Tashtego> i am using this abstract class to do some historization and other logging stuff before doing the real update / persist...
[12:39:02] <aslak> yea, so if it's the behavior of AbstractDaoJpa your testing, this should work fine.
[12:39:48] <Tashtego> thx
[12:41:02] *** oskutka has joined #jbosstesting
[12:42:21] *** jdlee has joined #jbosstesting
[12:55:41] *** ge0ffrey has quit IRC
[12:55:50] *** jdlee has quit IRC
[13:00:14] <Tashtego> aslak what are you doing these days? what are you developing? ;)
[13:01:17] <aslak> Tashtego, conference in Danmark and Sweden atm.. but generally next arquillian v. :)
[13:02:39] *** jdlee has joined #jbosstesting
[13:03:30] <Tashtego> how did you start with arquillian? how comes you are working on it? ;)
[13:05:07] <Tashtego> http://home.javagruppen.dk/index.php/annualconferences/annualconference2011/188-ac2011-speakers <- that one ^^ its today? ok then i better not disturb *g
[13:05:51] <Tashtego> impressing ;)
[13:06:11] <aslak> Tashtego, Arquillian is the productifization of JBoss TestHarness, which was used for the CDI and BeanValidation TCKs. how i started, well, pure exedent
[13:07:24] <aslak> Tashtego, yea, javagruppen. had two talk yesterday. just observing today.. :)
[13:07:28] <Tashtego> ;)
[13:07:30] <aslak> then jfokus next week
[13:07:54] <aslak> gotta go
[13:08:33] <Tashtego> have fun
[13:08:36] <Tashtego> cu !!
[13:16:08] *** jdlee has quit IRC
[13:22:56] *** jdlee has joined #jbosstesting
[13:22:57] *** jdlee has joined #jbosstesting
[13:44:40] *** aslak has quit IRC
[13:57:51] *** jdlee has quit IRC
[13:59:06] *** aslak has joined #jbosstesting
[13:59:06] *** aslak has quit IRC
[13:59:06] *** aslak has joined #jbosstesting
[14:04:38] *** jdlee has joined #jbosstesting
[14:04:38] *** jdlee has joined #jbosstesting
[14:07:29] *** tcunning has joined #jbosstesting
[14:11:40] *** oskutka has quit IRC
[14:27:01] *** tcunning has quit IRC
[14:29:43] *** kpiwko has joined #jbosstesting
[14:36:07] *** jdlee has quit IRC
[14:36:53] *** oskutka has joined #jbosstesting
[14:42:55] *** jdlee has joined #jbosstesting
[14:42:55] *** jdlee has joined #jbosstesting
[14:49:59] *** jdlee has quit IRC
[14:54:37] *** aslak has quit IRC
[14:58:14] *** oskutka has quit IRC
[15:02:10] *** jdlee has joined #jbosstesting
[15:13:55] *** jdlee_ has joined #jbosstesting
[15:13:59] *** jdlee_ has joined #jbosstesting
[15:14:31] *** jdlee has quit IRC
[15:14:31] *** jdlee_ is now known as jdlee
[15:34:43] *** oskutka has joined #jbosstesting
[16:07:02] *** oskutka has quit IRC
[16:31:12] *** Tashtego has quit IRC
[16:54:08] *** jganoff has joined #jbosstesting
[17:20:09] *** tcunning has joined #jbosstesting
[17:20:25] *** kpiwko has quit IRC
[17:28:32] *** aslak has joined #jbosstesting
[17:28:33] *** aslak has quit IRC
[17:28:33] *** aslak has joined #jbosstesting
[17:56:12] *** bobmcw has joined #jbosstesting
[18:03:44] *** bobmcw has quit IRC
[18:31:26] *** johnament has joined #jbosstesting
[18:36:43] *** aslak has quit IRC
[20:09:21] *** jganoff has quit IRC
[20:20:05] *** Tashtego has joined #jbosstesting
[20:20:07] *** Tashtego has left #jbosstesting
[20:20:19] *** Tashtego has joined #jbosstesting
[20:59:03] *** mgoldmann_ has quit IRC
[21:13:56] *** johnament has quit IRC
[21:38:55] <nickarls> anyone around?
[21:54:34] *** alesj has joined #jbosstesting
[21:56:03] *** alesj has quit IRC
[22:00:05] *** alesj has joined #jbosstesting
[22:00:06] *** tcunning has quit IRC
[22:02:05] *** alesj has left #jbosstesting
[22:17:55] *** tcunning has joined #jbosstesting
[22:34:14] <Tashtego> hi nickarls
[22:37:11] *** tcunning has quit IRC
[23:07:15] *** tcunning has joined #jbosstesting
[23:14:05] *** bleathem has joined #jbosstesting
[23:16:47] *** tcunning has quit IRC
[23:26:00] *** tcunning has joined #jbosstesting
[23:30:11] *** Tashtego has quit IRC

top