Version upgrade: 5.0.3 - 5.1.1; JUnit Error - You have not started an Objectify context

2,004 views
Skip to first unread message

Roman Schönbichler

unread,
Oct 23, 2014, 6:04:48 AM10/23/14
to objectify...@googlegroups.com
After an upgrade from version 5.0.3 to 5.1.1 all my JUnit tests fail saying:

java.lang.IllegalStateException: You have not started an Objectify context. You are probably missing the ObjectifyFilter. If you are not running in the context of an http request, see the ObjectifyService.run() method.
 at com
.googlecode.objectify.ObjectifyService.ofy(ObjectifyService.java:44)
 at dao
.CreateTest.setUp(CreateTest.java:35)
 at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun
.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun
.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java
.lang.reflect.Method.invoke(Unknown Source)
 at org
.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
 at org
.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at org
.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
 at org
.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
 at org
.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
 at org
.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
 at org
.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
 at org
.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
 at org
.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
 at org
.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
 at org
.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
 at org
.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
 at org
.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
 at org
.junit.runners.ParentRunner.run(ParentRunner.java:300)
 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:459)
 at org
.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
 at org
.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
 at org
.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

I'm initializing the datastore like:

helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig().setDefaultHighRepJobPolicyUnappliedJobPercentage(100));
helper
.setUp();
ObjectifyService.register(MyClass.class);
DatastoreServiceFactory.getDatastoreService();


Before the upgrade, they ran just fine.

I'm using gae 1.9.14.

any ideas?

cheers.


Jeff Schnitzer

unread,
Oct 23, 2014, 3:28:51 PM10/23/14
to objectify...@googlegroups.com
Yes, this is one of the changes going to 5.1. There's mention of this in the release notes (mostly a pointer to the method you should look at, ObjectifiyService.run()), but this discussion should help you (read all the way through):

Feel free to ask further questions.

Jeff

--
You received this message because you are subscribed to the Google Groups "objectify-appengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objectify-appen...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roman Schönbichler

unread,
Oct 24, 2014, 1:04:48 AM10/24/14
to objectify...@googlegroups.com, je...@infohazard.org
Hey,

thanks for the link!...

I already figured it out, but what got mit confused first is, that the objectify JavaDoc which is stated in the release notes referes to the release 5.0.2.

I think this should be updated quickly.

cheers
To unsubscribe from this group and stop receiving emails from it, send an email to objectify-appengine+unsub...@googlegroups.com.

Jeff Schnitzer

unread,
Oct 24, 2014, 1:17:56 AM10/24/14
to objectify...@googlegroups.com
Where did you find a link to that git repo? I thought I squashed all of them.

The javadocs are now hosted by javadochub and automatically pulled from maven:


Jeff

To unsubscribe from this group and stop receiving emails from it, send an email to objectify-appen...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages