Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GAE+JUnit: Add a blob to the blobstore

I'm using Google App Engine for Java, and I'm trying to write JUnit tests for my code that deals with the blobstore. How can I put a blob in the blobstore to use during testing (after it has been configured to keep everything in-memory with the LocalBlobstoreServiceTestConfig)? It seems like the solution should be very simple and basic, but somehow I cannot find it.

I imagine it was possible using the Files API, but I have steered clear of it because it is being discontinued (next week).

The only way I know of to get blobs into the blobstore outside of tests is via a multi-part form upload. However, I don't know how I would do that in the context of a JUnit test.

One can also interact with Google Cloud Storage objects via the blobstore API, but I have chosen to use the vanilla blobstore so that I don't need to loop yet another service (and its client libraries) into my app.

So again I ask, how do I get a blob in there so I can test the code that uses it?

like image 743
Eric Simonton Avatar asked Jul 24 '15 01:07

Eric Simonton


1 Answers

It seems as though you're correct that this feature does not exist. You should open a Feature Request issue in the public issue tracker and any other users interested in this can star the issue. Once that's done, it will be triaged and logged Google-side for implementation over time.

like image 96
Nick Avatar answered Nov 03 '22 17:11

Nick