You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by GESCONSULTOR - Óscar Bou <o....@gesconsultor.com> on 2015/05/28 14:00:20 UTC

Re: FixtureScripts - method to initiate a new transaction

Related with this, I’m trying to test the following:

   @Test
    public void totalOrRatio() {

        // given
        kit.assignToPerson(account.getAccountOwner());

        this.nextRequest();

        kit.getRegisteredForPerson().setSex(Sex.Man);

….
}

Where the Kit.getRegisteredForPerson() is cached:

    // {{ RegisteredForPerson (property)
    @Property(editing = Editing.DISABLED, notPersisted = true)
    @MemberOrder(sequence = "1")
    public Person getRegisteredForPerson() {
        return this.queryResultsCache.execute(new Callable<Person>() {
            @Override
            public Person call() throws Exception {
                return Kit.this.findRegisteredToPerson();
            }
        }, this.getClass(), "findRegisteredToPerson");
    }

    // }}


Despite invoking “this.nextRequest()” on the integtest, seems that the cache is still alive (being it a @RequestScoped service).

Would this also need to be improved for testing @RequestScoped services? 


Thanks!





> El 28/5/2015, a las 13:39, GESCONSULTOR - Óscar Bou <o....@gesconsultor.com> escribió:
> 
> Hi all.
> 
> When using FixtureScripts, there can be many actions that, on the real world, are execute in different time contexts.
> 
> For example, a user creates an Account on the webapp and after that executes different actions.
> 
> That’s relevant if using the queryResultsCache service (or the new planned “@Action” annotation extension) because the results previously created (i.e., the Account) might be available on the cache.
> 
> So perhaps some mechanism like the nextTransation() method might be also introduced on FixtureScripts.
> 
> What do you think?
> 
> Regards,
> 
> Oscar
> 
> 
> 
> 


Óscar Bou Bou
Responsable de Producto
Auditor Jefe de Certificación ISO 27001 en BSI
CISA, CRISC, APMG ISO 20000, ITIL-F

   902 900 231 / 620 267 520
   http://www.twitter.com/oscarbou <http://www.twitter.com/oscarbou>

   http://es.linkedin.com/in/oscarbou <http://es.linkedin.com/in/oscarbou>

   http://www.GesConsultor.com <http://www.gesconsultor.com/> 




Este mensaje y los ficheros anexos son confidenciales. Los mismos contienen información reservada que no puede ser difundida. Si usted ha recibido este correo por error, tenga la amabilidad de eliminarlo de su sistema y avisar al remitente mediante reenvío a su dirección electrónica; no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
Su dirección de correo electrónico junto a sus datos personales constan en un fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de mantener el contacto con Ud. Si quiere saber de qué información disponemos de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente dirección: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo - 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia). Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso que los tuvieran eliminarlos.






Re: FixtureScripts - method to initiate a new transaction

Posted by GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>.
The concrete exception thrown is:

java.lang.AssertionError: Transaction is in state of 'COMMITTED'
	at org.junit.Assert.fail(Assert.java:88)
	at org.apache.isis.core.integtestsupport.IsisSystemForTest.commitTran(IsisSystemForTest.java:744)
	at org.apache.isis.core.integtestsupport.scenarios.ScenarioExecutionForIntegration.endTran(ScenarioExecutionForIntegration.java:76)
	at org.apache.isis.core.integtestsupport.IntegrationTestAbstract.nextTransaction(IntegrationTestAbstract.java:80)
	at org.apache.isis.core.integtestsupport.IntegrationTestAbstract.nextRequest(IntegrationTestAbstract.java:91)
	at com.tellmegen.integtests.domain.model.algorithms.complexdiseases.ComplexDiseaseAlgorithmImplementationTests.totalOrRatio(ComplexDiseaseAlgorithmImplementationTests.java:94)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2$1.evaluate(JUnitRuleMockery2.java:146)
	at org.apache.isis.core.integtestsupport.ExceptionRecognizerTranslate$TranslationStatement.evaluate(ExceptionRecognizerTranslate.java:32)
	at org.apache.isis.core.integtestsupport.IntegrationTestAbstract$IsisTransactionRule$1.evaluate(IntegrationTestAbstract.java:214)
	at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)





> El 28/5/2015, a las 14:00, GESCONSULTOR - Óscar Bou <o....@gesconsultor.com> escribió:
> 
> Related with this, I’m trying to test the following:
> 
>    @Test
>     public void totalOrRatio() {
> 
>         // given
>         kit.assignToPerson(account.getAccountOwner());
> 
>         this.nextRequest();
> 
>         kit.getRegisteredForPerson().setSex(Sex.Man);
> 
> ….
> }
> 
> Where the Kit.getRegisteredForPerson() is cached:
> 
>     // {{ RegisteredForPerson (property)
>     @Property(editing = Editing.DISABLED, notPersisted = true)
>     @MemberOrder(sequence = "1")
>     public Person getRegisteredForPerson() {
>         return this.queryResultsCache.execute(new Callable<Person>() {
>             @Override
>             public Person call() throws Exception {
>                 return Kit.this.findRegisteredToPerson();
>             }
>         }, this.getClass(), "findRegisteredToPerson");
>     }
> 
>     // }}
> 
> 
> Despite invoking “this.nextRequest()” on the integtest, seems that the cache is still alive (being it a @RequestScoped service).
> 
> Would this also need to be improved for testing @RequestScoped services? 
> 
> 
> Thanks!
> 
> 
> 
> 
> 
>> El 28/5/2015, a las 13:39, GESCONSULTOR - Óscar Bou <o.bou@gesconsultor.com <ma...@gesconsultor.com>> escribió:
>> 
>> Hi all.
>> 
>> When using FixtureScripts, there can be many actions that, on the real world, are execute in different time contexts.
>> 
>> For example, a user creates an Account on the webapp and after that executes different actions.
>> 
>> That’s relevant if using the queryResultsCache service (or the new planned “@Action” annotation extension) because the results previously created (i.e., the Account) might be available on the cache.
>> 
>> So perhaps some mechanism like the nextTransation() method might be also introduced on FixtureScripts.
>> 
>> What do you think?
>> 
>> Regards,
>> 
>> Oscar
>> 
>> 
>> 
>> 
> 
> 
> Óscar Bou Bou
> Responsable de Producto
> Auditor Jefe de Certificación ISO 27001 en BSI
> CISA, CRISC, APMG ISO 20000, ITIL-F
> 
> <contactenos.html.gif>   902 900 231 / 620 267 520
> <Pasted Graphic 1.tiff>   http://www.twitter.com/oscarbou <http://www.twitter.com/oscarbou>
> 
> <gesdatos-software.gif>   http://es.linkedin.com/in/oscarbou <http://es.linkedin.com/in/oscarbou>
> 
> <blog.png>   http://www.GesConsultor.com <http://www.gesconsultor.com/> 
> 
> <gesconsultor_logo_blue_email.png>
> 
> 
> Este mensaje y los ficheros anexos son confidenciales. Los mismos contienen información reservada que no puede ser difundida. Si usted ha recibido este correo por error, tenga la amabilidad de eliminarlo de su sistema y avisar al remitente mediante reenvío a su dirección electrónica; no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
> Su dirección de correo electrónico junto a sus datos personales constan en un fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de mantener el contacto con Ud. Si quiere saber de qué información disponemos de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente dirección: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo - 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia). Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso que los tuvieran eliminarlos.
> 
> 
> 
> 
> 


Óscar Bou Bou
Responsable de Producto
Auditor Jefe de Certificación ISO 27001 en BSI
CISA, CRISC, APMG ISO 20000, ITIL-F

   902 900 231 / 620 267 520
   http://www.twitter.com/oscarbou <http://www.twitter.com/oscarbou>

   http://es.linkedin.com/in/oscarbou <http://es.linkedin.com/in/oscarbou>

   http://www.GesConsultor.com <http://www.gesconsultor.com/> 




Este mensaje y los ficheros anexos son confidenciales. Los mismos contienen información reservada que no puede ser difundida. Si usted ha recibido este correo por error, tenga la amabilidad de eliminarlo de su sistema y avisar al remitente mediante reenvío a su dirección electrónica; no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
Su dirección de correo electrónico junto a sus datos personales constan en un fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de mantener el contacto con Ud. Si quiere saber de qué información disponemos de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente dirección: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo - 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia). Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso que los tuvieran eliminarlos.






Re: FixtureScripts - method to initiate a new transaction

Posted by GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>.
The concrete exception thrown is:

java.lang.AssertionError: Transaction is in state of 'COMMITTED'
	at org.junit.Assert.fail(Assert.java:88)
	at org.apache.isis.core.integtestsupport.IsisSystemForTest.commitTran(IsisSystemForTest.java:744)
	at org.apache.isis.core.integtestsupport.scenarios.ScenarioExecutionForIntegration.endTran(ScenarioExecutionForIntegration.java:76)
	at org.apache.isis.core.integtestsupport.IntegrationTestAbstract.nextTransaction(IntegrationTestAbstract.java:80)
	at org.apache.isis.core.integtestsupport.IntegrationTestAbstract.nextRequest(IntegrationTestAbstract.java:91)
	at com.tellmegen.integtests.domain.model.algorithms.complexdiseases.ComplexDiseaseAlgorithmImplementationTests.totalOrRatio(ComplexDiseaseAlgorithmImplementationTests.java:94)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2$1.evaluate(JUnitRuleMockery2.java:146)
	at org.apache.isis.core.integtestsupport.ExceptionRecognizerTranslate$TranslationStatement.evaluate(ExceptionRecognizerTranslate.java:32)
	at org.apache.isis.core.integtestsupport.IntegrationTestAbstract$IsisTransactionRule$1.evaluate(IntegrationTestAbstract.java:214)
	at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)





> El 28/5/2015, a las 14:00, GESCONSULTOR - Óscar Bou <o....@gesconsultor.com> escribió:
> 
> Related with this, I’m trying to test the following:
> 
>    @Test
>     public void totalOrRatio() {
> 
>         // given
>         kit.assignToPerson(account.getAccountOwner());
> 
>         this.nextRequest();
> 
>         kit.getRegisteredForPerson().setSex(Sex.Man);
> 
> ….
> }
> 
> Where the Kit.getRegisteredForPerson() is cached:
> 
>     // {{ RegisteredForPerson (property)
>     @Property(editing = Editing.DISABLED, notPersisted = true)
>     @MemberOrder(sequence = "1")
>     public Person getRegisteredForPerson() {
>         return this.queryResultsCache.execute(new Callable<Person>() {
>             @Override
>             public Person call() throws Exception {
>                 return Kit.this.findRegisteredToPerson();
>             }
>         }, this.getClass(), "findRegisteredToPerson");
>     }
> 
>     // }}
> 
> 
> Despite invoking “this.nextRequest()” on the integtest, seems that the cache is still alive (being it a @RequestScoped service).
> 
> Would this also need to be improved for testing @RequestScoped services? 
> 
> 
> Thanks!
> 
> 
> 
> 
> 
>> El 28/5/2015, a las 13:39, GESCONSULTOR - Óscar Bou <o.bou@gesconsultor.com <ma...@gesconsultor.com>> escribió:
>> 
>> Hi all.
>> 
>> When using FixtureScripts, there can be many actions that, on the real world, are execute in different time contexts.
>> 
>> For example, a user creates an Account on the webapp and after that executes different actions.
>> 
>> That’s relevant if using the queryResultsCache service (or the new planned “@Action” annotation extension) because the results previously created (i.e., the Account) might be available on the cache.
>> 
>> So perhaps some mechanism like the nextTransation() method might be also introduced on FixtureScripts.
>> 
>> What do you think?
>> 
>> Regards,
>> 
>> Oscar
>> 
>> 
>> 
>> 
> 
> 
> Óscar Bou Bou
> Responsable de Producto
> Auditor Jefe de Certificación ISO 27001 en BSI
> CISA, CRISC, APMG ISO 20000, ITIL-F
> 
> <contactenos.html.gif>   902 900 231 / 620 267 520
> <Pasted Graphic 1.tiff>   http://www.twitter.com/oscarbou <http://www.twitter.com/oscarbou>
> 
> <gesdatos-software.gif>   http://es.linkedin.com/in/oscarbou <http://es.linkedin.com/in/oscarbou>
> 
> <blog.png>   http://www.GesConsultor.com <http://www.gesconsultor.com/> 
> 
> <gesconsultor_logo_blue_email.png>
> 
> 
> Este mensaje y los ficheros anexos son confidenciales. Los mismos contienen información reservada que no puede ser difundida. Si usted ha recibido este correo por error, tenga la amabilidad de eliminarlo de su sistema y avisar al remitente mediante reenvío a su dirección electrónica; no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
> Su dirección de correo electrónico junto a sus datos personales constan en un fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de mantener el contacto con Ud. Si quiere saber de qué información disponemos de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente dirección: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo - 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia). Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso que los tuvieran eliminarlos.
> 
> 
> 
> 
> 


Óscar Bou Bou
Responsable de Producto
Auditor Jefe de Certificación ISO 27001 en BSI
CISA, CRISC, APMG ISO 20000, ITIL-F

   902 900 231 / 620 267 520
   http://www.twitter.com/oscarbou <http://www.twitter.com/oscarbou>

   http://es.linkedin.com/in/oscarbou <http://es.linkedin.com/in/oscarbou>

   http://www.GesConsultor.com <http://www.gesconsultor.com/> 




Este mensaje y los ficheros anexos son confidenciales. Los mismos contienen información reservada que no puede ser difundida. Si usted ha recibido este correo por error, tenga la amabilidad de eliminarlo de su sistema y avisar al remitente mediante reenvío a su dirección electrónica; no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
Su dirección de correo electrónico junto a sus datos personales constan en un fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de mantener el contacto con Ud. Si quiere saber de qué información disponemos de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente dirección: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo - 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia). Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso que los tuvieran eliminarlos.