Open GoogleCodeExporter opened 8 years ago
[deleted comment]
I have the same problem. My exception is roughly the same:
WARN 07/Mar/2012 18:13:13,768 DatastoreUtils Cannot unbind session, it's not
registered in a SessionHolder
| Running 23 spock tests... 2 of 23
| Failure: description too long(com.spotmapping.domain.activity.ActivitySpec)
| java.lang.IllegalStateException: Already value
[org.grails.datastore.mapping.transactions.SessionHolder@3a38df00] for key
[org.grails.datastore.mapping.simple.SimpleMapDatastore@5472e884] bound to
thread [main]
at org.grails.datastore.mapping.core.DatastoreUtils.bindSession(DatastoreUtils.java:336)
at grails.test.mixin.domain.DomainClassUnitTestMixin.connectDatastore(DomainClassUnitTestMixin.groovy:110)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:176)
at org.spockframework.runtime.extension.builtin.JUnitFixtureMethodsExtension$FixtureType$FixtureMethodInterceptor.intercept(JUnitFixtureMethodsExtension.java:145)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:84)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:176)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:176)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:176)
This happened after upgrading from the SNAPSHOT release to 0.6. Before that I
"only" got the warning that the DatastoreUtils Cannot unbind the session, but
the test would still pass.
Original comment by n.wittst...@gmail.com
on 7 Mar 2012 at 7:20
Do you still see this problem (with latest Grails version)? Spock 0.6 changed
the initialization order a bit, but I can't see how this could cause problems.
Original comment by pnied...@gmail.com
on 12 May 2012 at 6:31
I am not seeing this problem any longer. I think it was somehow cache related,
because after deleting the plugin cache everything worked fine.
Original comment by n.wittst...@gmail.com
on 13 May 2012 at 12:09
[deleted comment]
Run grails clean. Then, when you select the test to run in Intellij, make sure
you choose "Grails test".
Original comment by fsa...@gmail.com
on 11 Mar 2014 at 10:12
This problem seems to be related to running tests in IntelliJ with the JUnit
runner - which used to work fine. but now seems broken.
JUnit Runner is approx 5x faster than the "Grails test" so was obviously
preferable.
Original comment by epg.team...@gmail.com
on 2 Apr 2014 at 7:43
It's nothing that we can do anything about, as it doesn't happen in our code.
Can you report this to the Grails and/or IntelliJ team?
Original comment by pnied...@gmail.com
on 2 Apr 2014 at 3:00
Facing this exact same issue on a very simple domain class test. Anyone been
able to find a root cause?
Original comment by dmitry.b...@gmail.com
on 3 Nov 2014 at 11:03
I am fairly certain this issue in IntelliJ happens when 2 grails test plugins
are referenced on the classpath by the IDE dependency resolver. For my
mavenized grails project there is a refernce to this plugin from Maven POM as
well as from the Grails SDK entry I made in IntelliJ that references the entire
grails directory.
Original comment by dmitry.b...@gmail.com
on 25 Mar 2015 at 4:46
I think this is caused by the
@TestFor(Company)
@Mock(Fleet)
bit - that causes DomainClassUnitTestMixin.connectDatastore() (an @Before
method) to be called twice for a test, the 2nd call triggering the exception.
Possibly the combination of Mock and TestFor is causing the mixin to be mixed
in twice sometimes in some way.
I'm seeing it a plain unit test that doesn't use spock, in grails 2.2.1. I
daresay it's fixed in more recent versions, where unit testing has been
somewhat overhauled. A workaround might be to manually do the mocking and
remove the @Mock(Fleet) bit, using a manual call to mockDomains in the test
setup() method instead.
Original comment by tom.wid...@gmail.com
on 17 Apr 2015 at 2:59
Original issue reported on code.google.com by
colin.we...@freedomit.co.za
on 29 Oct 2011 at 6:12