Hello Moony, Thank you for noticing this. I have fixed the issue and pushed the changes to git.
As bad as it sounds, I'm really busy at the moment but will make a very much official release shortly... :) Cheers, Henrik -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of MoonStorm Sent: den 16 mars 2010 15:57 To: Castle Project Users Subject: Problem with ATM in the ChildTransaction Hi Henrik, I spawned another discussion since this issue is not related to the one described in the other thread we used to talk in. I downloaded from the GIT the latest source of transactions and ATM and I was playing around with it. I found a problem in the implementation of the ChildTransaction that would always cause a rollback of the entire scope. The _CanCommit remains false throughout its lifecycle, making the IsRollbackOnlySet property on base to always return true for a transaction of this type. I have created a new test that would trap this problem but it could require some changes in the test project. First of all, I don't see any point in stubing the transaction manager in the ATM tests, basically hiding this type of problems. So I changed the MockTransactionManager to derive from the DefaultTransactionManager and, with a couple of event hookings from the constructor, to expose the same kind of information as the old one (so you don't need to change the tests). private void SetupStatistics() { base.TransactionCreated += (sender, ev) => { _transactions+ +;}; base.ChildTransactionCreated += (sender, ev) => { _transactions++; }; base.TransactionCompleted += (sender, ev) => { _committedCount++; }; base.TransactionRolledBack += (sender, ev) => { _rolledBackCount++; }; } After this change, the following test would trap this kind of problem: [Test] public void TestChildTransactions() { WindsorContainer container = new WindsorContainer(); container.AddFacility("transactionmanagement", new TransactionFacility()); container.AddComponent("transactionmanager", typeof(ITransactionManager), typeof(MockTransactionManager)); container.AddComponent("mycomp", typeof(CustomerService)); container.AddComponent("delegatecomp", typeof (ProxyService)); ProxyService serv = (ProxyService)container.Resolve("delegatecomp"); serv.DelegateInsert("John","Home Address"); MockTransactionManager transactionManager = (MockTransactionManager) container["transactionmanager"]; Assert.AreEqual(2, transactionManager.TransactionCount); Assert.AreEqual(0, transactionManager.RolledBackCount); } The test class I used has the following form: [Transactional] public class ProxyService { private readonly CustomerService customerService; public ProxyService(CustomerService customerService) { this.customerService = customerService; } [Transaction(TransactionMode.Requires)] public virtual void DelegateInsert(string name, string address) { this.customerService.Insert(name, address); } } -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
