Re: [rules-users] Mocking Guvnor
I assume you have a service encapsulating your use of Drools? Why not mock this service to use an implementation that returns what you need? On 8 August 2014 03:13, san_hegde santhosh.he...@hp.com wrote: Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A -- View this message in context: Mocking Guvnor http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601.html Sent from the Drools: User forum mailing list archive http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Mocking Guvnor
Possibly also worth pointing out that inserting a fact and executing a session do not connect to Guvnor anyway? Although, as Mike mentions, the simplest approach tends to be to create a service which wraps knowledge base access and mock that. Although you could also mock the session. Although, I must admit I’m not sure what question is being asked... Steve On 8 Aug 2014, at 13:07, Michael Anstis michael.ans...@gmail.com wrote: I assume you have a service encapsulating your use of Drools? Why not mock this service to use an implementation that returns what you need? On 8 August 2014 03:13, san_hegde santhosh.he...@hp.com wrote: Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A View this message in context: Mocking Guvnor Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Mocking Guvnor
Actually during functional testing we want to test our service which in turn calls rules and we want to test the service with changing rules. But we do not want to change the rules in Guvnor rather we want to somehow mock it. Means depending on our tests we want to use different modified rules. For this if we can mock the session or guvnor or somehow so that we session can return the mocked fact depending on our test. Thank you Santhosh Hegde A From: Stephen Masters [via Drools] [mailto:ml-node+s46999n4030608...@n3.nabble.com] Sent: Friday, August 08, 2014 9:10 PM To: Ajekar, Santhosh Hegde (HP-IT) Subject: Re: [rules-users] Mocking Guvnor Possibly also worth pointing out that inserting a fact and executing a session do not connect to Guvnor anyway? Although, as Mike mentions, the simplest approach tends to be to create a service which wraps knowledge base access and mock that. Although you could also mock the session. Although, I must admit I’m not sure what question is being asked... Steve On 8 Aug 2014, at 13:07, Michael Anstis [hidden email]/user/SendEmail.jtp?type=nodenode=4030608i=0 wrote: I assume you have a service encapsulating your use of Drools? Why not mock this service to use an implementation that returns what you need? On 8 August 2014 03:13, san_hegde [hidden email]/user/SendEmail.jtp?type=nodenode=4030608i=1 wrote: Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A View this message in context: Mocking Guvnorhttp://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601.html Sent from the Drools: User forum mailing list archivehttp://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at Nabble.comhttp://Nabble.com. ___ rules-users mailing list [hidden email]/user/SendEmail.jtp?type=nodenode=4030608i=2 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email]/user/SendEmail.jtp?type=nodenode=4030608i=3 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email]/user/SendEmail.jtp?type=nodenode=4030608i=4 https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030608.html To start a new topic under Drools: User forum, email ml-node+s46999n4700...@n3.nabble.commailto:ml-node+s46999n4700...@n3.nabble.com To unsubscribe from Drools: User forum, click herehttp://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=47000code=c2FudGhvc2guaGVnZGVAaHAuY29tfDQ3MDAwfC00NDQzMTAxMzA=. NAMLhttp://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030609.html Sent from the Drools: User forum mailing list archive at Nabble.com.___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Mocking Guvnor
the updates just go through kie-ci, I’m assuming you are using this. I think you could mock this without Guvnor, by creating a temporary local m2_repo and add jars there. kie-ci will pick those up and try and apply them. Mark On 8 Aug 2014, at 18:02, san_hegde santhosh.he...@hp.com wrote: Actually during functional testing we want to test our service which in turn calls rules and we want to test the service with changing rules. But we do not want to change the rules in Guvnor rather we want to somehow mock it. Means depending on our tests we want to use different modified rules. For this if we can mock the session or guvnor or somehow so that we session can return the mocked fact depending on our test. Thank you Santhosh Hegde A From: Stephen Masters [via Drools] [mailto:ml-node+[hidden email]] Sent: Friday, August 08, 2014 9:10 PM To: Ajekar, Santhosh Hegde (HP-IT) Subject: Re: [rules-users] Mocking Guvnor Possibly also worth pointing out that inserting a fact and executing a session do not connect to Guvnor anyway? Although, as Mike mentions, the simplest approach tends to be to create a service which wraps knowledge base access and mock that. Although you could also mock the session. Although, I must admit I’m not sure what question is being asked... Steve On 8 Aug 2014, at 13:07, Michael Anstis [hidden email] wrote: I assume you have a service encapsulating your use of Drools? Why not mock this service to use an implementation that returns what you need? On 8 August 2014 03:13, san_hegde [hidden email] wrote: Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A View this message in context: Mocking Guvnor Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030608.html To start a new topic under Drools: User forum, email [hidden email] To unsubscribe from Drools: User forum, click here. NAML View this message in context: RE: [rules-users] Mocking Guvnor Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Mocking Guvnor
I should add that nothing on the client side of updates actually talks to Guvnor at all. It’s all just embedded Maven, interacting via local and remote m2 repositories. It just happens that Guvnor can build and install into a remote m2 repo. Mark On 8 Aug 2014, at 18:06, Mark Proctor mproc...@codehaus.org wrote: the updates just go through kie-ci, I’m assuming you are using this. I think you could mock this without Guvnor, by creating a temporary local m2_repo and add jars there. kie-ci will pick those up and try and apply them. Mark On 8 Aug 2014, at 18:02, san_hegde santhosh.he...@hp.com wrote: Actually during functional testing we want to test our service which in turn calls rules and we want to test the service with changing rules. But we do not want to change the rules in Guvnor rather we want to somehow mock it. Means depending on our tests we want to use different modified rules. For this if we can mock the session or guvnor or somehow so that we session can return the mocked fact depending on our test. Thank you Santhosh Hegde A From: Stephen Masters [via Drools] [mailto:ml-node+[hidden email]] Sent: Friday, August 08, 2014 9:10 PM To: Ajekar, Santhosh Hegde (HP-IT) Subject: Re: [rules-users] Mocking Guvnor Possibly also worth pointing out that inserting a fact and executing a session do not connect to Guvnor anyway? Although, as Mike mentions, the simplest approach tends to be to create a service which wraps knowledge base access and mock that. Although you could also mock the session. Although, I must admit I’m not sure what question is being asked... Steve On 8 Aug 2014, at 13:07, Michael Anstis [hidden email] wrote: I assume you have a service encapsulating your use of Drools? Why not mock this service to use an implementation that returns what you need? On 8 August 2014 03:13, san_hegde [hidden email] wrote: Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A View this message in context: Mocking Guvnor Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030608.html To start a new topic under Drools: User forum, email [hidden email] To unsubscribe from Drools: User forum, click here. NAML View this message in context: RE: [rules-users] Mocking Guvnor Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Mocking Guvnor
We are using drools-core 5.2 and Guvnor 5.2. We are not using kie-ci and not sure if this is available for 5.2 Also is it possible to mock StatelessKnowledgeSession, so that I then even need not connect to any repository and just return the output fact object as I need? Thank you Santhosh Hegde A From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Mark Proctor Sent: Friday, August 08, 2014 10:38 PM To: Rules Users List Subject: Re: [rules-users] Mocking Guvnor I should add that nothing on the client side of updates actually talks to Guvnor at all. It's all just embedded Maven, interacting via local and remote m2 repositories. It just happens that Guvnor can build and install into a remote m2 repo. Mark On 8 Aug 2014, at 18:06, Mark Proctor mproc...@codehaus.orgmailto:mproc...@codehaus.org wrote: the updates just go through kie-ci, I'm assuming you are using this. I think you could mock this without Guvnor, by creating a temporary local m2_repo and add jars there. kie-ci will pick those up and try and apply them. Mark On 8 Aug 2014, at 18:02, san_hegde santhosh.he...@hp.commailto:santhosh.he...@hp.com wrote: Actually during functional testing we want to test our service which in turn calls rules and we want to test the service with changing rules. But we do not want to change the rules in Guvnor rather we want to somehow mock it. Means depending on our tests we want to use different modified rules. For this if we can mock the session or guvnor or somehow so that we session can return the mocked fact depending on our test. Thank you Santhosh Hegde A From: Stephen Masters [via Drools] [mailto:ml-node+[hidden email]x-msg://119/user/SendEmail.jtp?type=nodenode=4030609i=0] Sent: Friday, August 08, 2014 9:10 PM To: Ajekar, Santhosh Hegde (HP-IT) Subject: Re: [rules-users] Mocking Guvnor Possibly also worth pointing out that inserting a fact and executing a session do not connect to Guvnor anyway? Although, as Mike mentions, the simplest approach tends to be to create a service which wraps knowledge base access and mock that. Although you could also mock the session. Although, I must admit I'm not sure what question is being asked... Steve On 8 Aug 2014, at 13:07, Michael Anstis [hidden email]x-msg://119/user/SendEmail.jtp?type=nodenode=4030608i=0 wrote: I assume you have a service encapsulating your use of Drools? Why not mock this service to use an implementation that returns what you need? On 8 August 2014 03:13, san_hegde [hidden email]x-msg://119/user/SendEmail.jtp?type=nodenode=4030608i=1 wrote: Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A View this message in context: Mocking Guvnorhttp://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601.html Sent from the Drools: User forum mailing list archivehttp://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at Nabble.comhttp://nabble.com/. ___ rules-users mailing list [hidden email]x-msg://119/user/SendEmail.jtp?type=nodenode=4030608i=2 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email]x-msg://119/user/SendEmail.jtp?type=nodenode=4030608i=3 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email]x-msg://119/user/SendEmail.jtp?type=nodenode=4030608i=4 https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030608.html To start a new topic under Drools: User forum, email [hidden email]x-msg://119/user/SendEmail.jtp?type=nodenode=4030609i=1 To unsubscribe from Drools: User forum, click here. NAMLhttp://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml View this message in context: RE: [rules-users] Mocking Guvnorhttp://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030609.html Sent from the Drools: User forum mailing list archivehttp
Re: [rules-users] Mocking Guvnor
Sounds like your service uses KnowledgeAgent that detects changes to rules in Guvnor based upon a changeset? Either way your requirement remains the same: *your* application architecture needs to support (at least) the ability to provide different changesets (for testing you can use a changeset that points to a local folder containing rules rather than Guvnor). You're not going to be able to avoid mocking some part of your application if you don't want to get rules from Guvnor (although I prefer the term pluggable - CDI use of @Specialises or @Alternative would be a good example, but IDK if you use CDI). Sent on the move On 8 Aug 2014 18:03, san_hegde santhosh.he...@hp.com wrote: Actually during functional testing we want to test our service which in turn calls rules and we want to test the service with changing rules. But we do not want to change the rules in Guvnor rather we want to somehow mock it. Means depending on our tests we want to use different modified rules. For this if we can mock the session or guvnor or somehow so that we session can return the mocked fact depending on our test. Thank you Santhosh Hegde A *From:* Stephen Masters [via Drools] [mailto:ml-node+[hidden email] http://user/SendEmail.jtp?type=nodenode=4030609i=0] *Sent:* Friday, August 08, 2014 9:10 PM *To:* Ajekar, Santhosh Hegde (HP-IT) *Subject:* Re: [rules-users] Mocking Guvnor Possibly also worth pointing out that inserting a fact and executing a session do not connect to Guvnor anyway? Although, as Mike mentions, the simplest approach tends to be to create a service which wraps knowledge base access and mock that. Although you could also mock the session. Although, I must admit I’m not sure what question is being asked... Steve On 8 Aug 2014, at 13:07, Michael Anstis [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=0 wrote: I assume you have a service encapsulating your use of Drools? Why not mock this service to use an implementation that returns what you need? On 8 August 2014 03:13, san_hegde [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=1 wrote: Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A -- View this message in context: Mocking Guvnor http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601.html Sent from the Drools: User forum mailing list archive http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at Nabble.com. ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=2 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=3 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=4 https://lists.jboss.org/mailman/listinfo/rules-users -- *If you reply to this email, your message will be added to the discussion below:* http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030608.html To start a new topic under Drools: User forum, email [hidden email] http://user/SendEmail.jtp?type=nodenode=4030609i=1 To unsubscribe from Drools: User forum, click here. NAML http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: RE: [rules-users] Mocking Guvnor http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030609.html Sent from the Drools: User forum mailing list archive http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Mocking Guvnor
Hi Michael, Yes, you are correct. We use the KnowledgeAgent that detects changes to rules in Guvnor based upon a changeset. One more question. Is there any way I can mock StatelessKnowledgeSession so that I can mock the output Fact object. Thank you Santhosh Hegde A From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michael Anstis Sent: Friday, August 08, 2014 11:28 PM To: Rules Users List Subject: Re: [rules-users] Mocking Guvnor Sounds like your service uses KnowledgeAgent that detects changes to rules in Guvnor based upon a changeset? Either way your requirement remains the same: *your* application architecture needs to support (at least) the ability to provide different changesets (for testing you can use a changeset that points to a local folder containing rules rather than Guvnor). You're not going to be able to avoid mocking some part of your application if you don't want to get rules from Guvnor (although I prefer the term pluggable - CDI use of @Specialises or @Alternative would be a good example, but IDK if you use CDI). Sent on the move On 8 Aug 2014 18:03, san_hegde santhosh.he...@hp.commailto:santhosh.he...@hp.com wrote: Actually during functional testing we want to test our service which in turn calls rules and we want to test the service with changing rules. But we do not want to change the rules in Guvnor rather we want to somehow mock it. Means depending on our tests we want to use different modified rules. For this if we can mock the session or guvnor or somehow so that we session can return the mocked fact depending on our test. Thank you Santhosh Hegde A From: Stephen Masters [via Drools] [mailto:ml-node+mailto:ml-node%2B[hidden email]http://user/SendEmail.jtp?type=nodenode=4030609i=0] Sent: Friday, August 08, 2014 9:10 PM To: Ajekar, Santhosh Hegde (HP-IT) Subject: Re: [rules-users] Mocking Guvnor Possibly also worth pointing out that inserting a fact and executing a session do not connect to Guvnor anyway? Although, as Mike mentions, the simplest approach tends to be to create a service which wraps knowledge base access and mock that. Although you could also mock the session. Although, I must admit I’m not sure what question is being asked... Steve On 8 Aug 2014, at 13:07, Michael Anstis [hidden email]http://user/SendEmail.jtp?type=nodenode=4030608i=0 wrote: I assume you have a service encapsulating your use of Drools? Why not mock this service to use an implementation that returns what you need? On 8 August 2014 03:13, san_hegde [hidden email]http://user/SendEmail.jtp?type=nodenode=4030608i=1 wrote: Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A View this message in context: Mocking Guvnorhttp://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601.html Sent from the Drools: User forum mailing list archivehttp://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at Nabble.comhttp://Nabble.com. ___ rules-users mailing list [hidden email]http://user/SendEmail.jtp?type=nodenode=4030608i=2 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email]http://user/SendEmail.jtp?type=nodenode=4030608i=3 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email]http://user/SendEmail.jtp?type=nodenode=4030608i=4 https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030608.html To start a new topic under Drools: User forum, email [hidden email]http://user/SendEmail.jtp?type=nodenode=4030609i=1 To unsubscribe from Drools: User forum, click here. NAMLhttp://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml View this message in context: RE: [rules-users] Mocking Guvnorhttp://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030609.html Sent from the Drools: User forum mailing list archivehttp
Re: [rules-users] Mocking Guvnor
My advice is still to mock the service. If the service is too fat (I.e. has alot of business functionality) split it into thinner layers until you isolate the Drools usage and then write a different implementation of this for your tests. Sent on the move On 8 Aug 2014 19:29, Ajekar, Santhosh Hegde (HP-IT) santhosh.he...@hp.com wrote: Hi Michael, Yes, you are correct. We use the KnowledgeAgent that detects changes to rules in Guvnor based upon a changeset. One more question. Is there any way I can mock StatelessKnowledgeSession so that I can mock the output Fact object. Thank you Santhosh Hegde A *From:* rules-users-boun...@lists.jboss.org [mailto: rules-users-boun...@lists.jboss.org] *On Behalf Of *Michael Anstis *Sent:* Friday, August 08, 2014 11:28 PM *To:* Rules Users List *Subject:* Re: [rules-users] Mocking Guvnor Sounds like your service uses KnowledgeAgent that detects changes to rules in Guvnor based upon a changeset? Either way your requirement remains the same: *your* application architecture needs to support (at least) the ability to provide different changesets (for testing you can use a changeset that points to a local folder containing rules rather than Guvnor). You're not going to be able to avoid mocking some part of your application if you don't want to get rules from Guvnor (although I prefer the term pluggable - CDI use of @Specialises or @Alternative would be a good example, but IDK if you use CDI). Sent on the move On 8 Aug 2014 18:03, san_hegde santhosh.he...@hp.com wrote: Actually during functional testing we want to test our service which in turn calls rules and we want to test the service with changing rules. But we do not want to change the rules in Guvnor rather we want to somehow mock it. Means depending on our tests we want to use different modified rules. For this if we can mock the session or guvnor or somehow so that we session can return the mocked fact depending on our test. Thank you Santhosh Hegde A *From:* Stephen Masters [via Drools] [mailto:ml-node+[hidden email] http://user/SendEmail.jtp?type=nodenode=4030609i=0] *Sent:* Friday, August 08, 2014 9:10 PM *To:* Ajekar, Santhosh Hegde (HP-IT) *Subject:* Re: [rules-users] Mocking Guvnor Possibly also worth pointing out that inserting a fact and executing a session do not connect to Guvnor anyway? Although, as Mike mentions, the simplest approach tends to be to create a service which wraps knowledge base access and mock that. Although you could also mock the session. Although, I must admit I’m not sure what question is being asked... Steve On 8 Aug 2014, at 13:07, Michael Anstis [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=0 wrote: I assume you have a service encapsulating your use of Drools? Why not mock this service to use an implementation that returns what you need? On 8 August 2014 03:13, san_hegde [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=1 wrote: Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A -- View this message in context: Mocking Guvnor http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601.html Sent from the Drools: User forum mailing list archive http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at Nabble.com. ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=2 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=3 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=4030608i=4 https://lists.jboss.org/mailman/listinfo/rules-users -- *If you reply to this email, your message will be added to the discussion below:* http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601p4030608.html To start a new topic under Drools: User forum, email [hidden email] http://user/SendEmail.jtp?type=nodenode=4030609i=1 To unsubscribe from Drools: User forum, click here. NAML http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace
[rules-users] Mocking Guvnor
Hi , We have requirement where in during functional testing we do not want to connect to Guvnor rather want to mock it. For example mocking could be like this. We send Fact object as input during calling knowledgeSession.execute() method and in rule we update the result in that fact object itself. So here can we mock the output fact object, so that during functional testing we no need to connect to Guvnor rather mocked result fact object is returned. Thank you Santhosh Hegde A -- View this message in context: http://drools.46999.n3.nabble.com/Mocking-Guvnor-tp4030601.html Sent from the Drools: User forum mailing list archive at Nabble.com.___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users