[appengine-java] Re: How to use junit test in the newest SDK1.3.1

2010-03-02 Thread Ed Murphy
Thanks for starting this thread.  I have my Junit tests working,
including my datastore tests, but I have a question regarding project
setup.  I suppose this is more of an Eclipse question than anything
else, but perhaps you can help.  I've worked in NetBeans prior, and I
can setup a 'test' folder with my unit test source.  These classes are
excluded from the final war file. However, when I create a test folder
at the same level as my source folder:

Project
- src
- test

the only way I can make my tests work is to include test as a source
folder and add all the testing jars to my normal build path.  This
means my test classes end up in the deployment.

Can I have my tests in the same project as my source, or do I need to
have a separate project?

Thanks for you help.



On Feb 11, 10:43 am, Krishna Caldas  wrote:
> Yes, I missed that method.
> Maybe add this little trick on tutorial for now!?
>
> Krishna
>
> 2010/2/11 Max Ross (Google) :
>
>
>
> > Great, glad to hear it!  I forgot to add a method to LocalServiceTestHelper
> > to set a custom app id.  My mistake.  I'll make sure this gets added for the
> > next release so you don't need to provide your ownEnvironment
> > implementation.
>
> > Max
>
> > On Thu, Feb 11, 2010 at 10:30 AM, Krishna Caldas 
> > wrote:
>
> >> You're right!
> >> I refactored my code and forget to annotate the new setUp method with
> >> @Before.
> >> Sorry for taking your time! It works now.
>
> >> Thanks,
> >> Krishna
>
> >> 2010/2/11 Max Ross (Google) :
> >> > Your code looks fine.  Are you sure you're calling setUp() on the
> >> > LocalServiceTestHelper?
>
> >> > On Thu, Feb 11, 2010 at 10:11 AM, Krishna Caldas
> >> > 
> >> > wrote:
>
> >> >> Ooops.. missed your question!
> >> >> It's just:
> >> >>@Override
> >> >>protectedEnvironmentnewEnvironment() {
> >> >>return new TestEnvironment();
> >> >>}
>
> >> >> Thanks,
> >> >> Krishna
>
> >> >> 2010/2/11 Max Ross (Google) :
> >> >> > Subclassing LocalServiceTestHelper and overriding newEnvironment()
> >> >> > should
> >> >> > work fine.  What does your implementation of newEnvironment() look
> >> >> > like?
>
> >> >> > On Wed, Feb 10, 2010 at 7:35 PM, Krishna 
> >> >> > wrote:
>
> >> >> >> Ok!
>
> >> >> >> But when I'm using transactions I'm getting:
>
> >> >> >> java.lang.NullPointerException:NoAPIenvironmentisregisteredfor
> >> >> >> thisthread.
> >> >> >>at
>
> >> >> >> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(Datas
> >> >> >>  toreApiHelper.java:
> >> >> >> 67)
> >> >> >>at
>
> >> >> >> com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(Da
> >> >> >>  tastoreServiceImpl.java:
> >> >> >> 270)
>
> >> >> >> I've tried to extend LocalServiceTestHelper and overwrite
> >> >> >> newEnvironment()  with myEnvironment(who returns appId) but it
> >> >> >> didn't work...
>
> >> >> >> What's wrong?
>
> >> >> >> Thanks,
> >> >> >> Krishna
>
> >> >> >> On Feb 10, 10:25 pm, "Ikai L (Google)"  wrote:
> >> >> >> > We've got a more simple interface for you now. Take a look:
>
> >> >> >> >http://code.google.com/appengine/docs/java/tools/localunittesting.html
>
> >> >> >> > 2010/2/10 时空之蕊 
>
> >> >> >> > > I found the class
> >> >> >> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not
> >> >> >> > > public,but before 1.3.1 it's public!
> >> >> >> > > In the JUnit document:
>
> >> >> >> > > import java.io.File;
> >> >> >> > > import com.google.appengine.tools.development.ApiProxyLocalImpl;
> >> >> >> > > import com.google.apphosting.api.ApiProxy;
>
> >> >> >> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
>
> >> >> >> > > So I can't new a ApiProxyLocalImpl instance!
> >> >> >> > > Any body know how to use JUnit?
> >> >> >> > > Thanks :)
>
> >> >> >> > > --
> >> >> >> > > You received this message because you are subscribed to the
> >> >> >> > > Google
> >> >> >> > > Groups
> >> >> >> > > "Google App Engine for Java" group.
> >> >> >> > > To post to this group, send email to
> >> >> >> > > google-appengine-j...@googlegroups.com.
> >> >> >> > > To unsubscribe from this group, send email to
>
> >> >> >> > > google-appengine-java+unsubscr...@googlegroups.com >> >> >> > > unsubscr...@googlegroups.com>
> >> >> >> > > .
> >> >> >> > > For more options, visit this group at
> >> >> >> > >http://groups.google.com/group/google-appengine-java?hl=en.
>
> >> >> >> > --
> >> >> >> > Ikai Lan
> >> >> >> > Developer Programs Engineer, Google App
>
> >> >> >> > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine
>
> >> >> >> --
> >> >> >> You received this message because you are subscribed to the Google
> >> >> >> Groups
> >> >> >> "Google App Engine for Java" group.
> >> >> >> To post to this group, send email to
> >> >> >> google-appengine-j...@googlegroups.com.
> >> >> >> To unsubscribe from this group, send email to
> >> >> >> google-appengine-java+unsubscr...@googlegroups.com.
> >> >> >> For more optio

Re: [appengine-java] Re: How to use junit test in the newest SDK1.3.1

2010-02-11 Thread Krishna Caldas
Yes, I missed that method.
Maybe add this little trick on tutorial for now!?

Krishna

2010/2/11 Max Ross (Google) :
> Great, glad to hear it!  I forgot to add a method to LocalServiceTestHelper
> to set a custom app id.  My mistake.  I'll make sure this gets added for the
> next release so you don't need to provide your own Environment
> implementation.
>
> Max
>
> On Thu, Feb 11, 2010 at 10:30 AM, Krishna Caldas 
> wrote:
>>
>> You're right!
>> I refactored my code and forget to annotate the new setUp method with
>> @Before.
>> Sorry for taking your time! It works now.
>>
>> Thanks,
>> Krishna
>>
>>
>> 2010/2/11 Max Ross (Google) :
>> > Your code looks fine.  Are you sure you're calling setUp() on the
>> > LocalServiceTestHelper?
>> >
>> > On Thu, Feb 11, 2010 at 10:11 AM, Krishna Caldas
>> > 
>> > wrote:
>> >>
>> >> Ooops.. missed your question!
>> >> It's just:
>> >>@Override
>> >>protected Environment newEnvironment() {
>> >>return new TestEnvironment();
>> >>}
>> >>
>> >> Thanks,
>> >> Krishna
>> >>
>> >> 2010/2/11 Max Ross (Google) :
>> >> > Subclassing LocalServiceTestHelper and overriding newEnvironment()
>> >> > should
>> >> > work fine.  What does your implementation of newEnvironment() look
>> >> > like?
>> >> >
>> >> > On Wed, Feb 10, 2010 at 7:35 PM, Krishna 
>> >> > wrote:
>> >> >>
>> >> >> Ok!
>> >> >>
>> >> >> But when I'm using transactions I'm getting:
>> >> >>
>> >> >> java.lang.NullPointerException: No API environment is registered for
>> >> >> this thread.
>> >> >>at
>> >> >>
>> >> >>
>> >> >>
>> >> >> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
>> >> >> 67)
>> >> >>at
>> >> >>
>> >> >>
>> >> >>
>> >> >> com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(DatastoreServiceImpl.java:
>> >> >> 270)
>> >> >>
>> >> >> I've tried to extend LocalServiceTestHelper and overwrite
>> >> >> newEnvironment()  with my Environment (who returns appId) but it
>> >> >> didn't work...
>> >> >>
>> >> >> What's wrong?
>> >> >>
>> >> >> Thanks,
>> >> >> Krishna
>> >> >>
>> >> >> On Feb 10, 10:25 pm, "Ikai L (Google)"  wrote:
>> >> >> > We've got a more simple interface for you now. Take a look:
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > http://code.google.com/appengine/docs/java/tools/localunittesting.html
>> >> >> >
>> >> >> > 2010/2/10 时空之蕊 
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > > I found the class
>> >> >> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not
>> >> >> > > public,but before 1.3.1 it's public!
>> >> >> > > In the JUnit document:
>> >> >> >
>> >> >> > > import java.io.File;
>> >> >> > > import com.google.appengine.tools.development.ApiProxyLocalImpl;
>> >> >> > > import com.google.apphosting.api.ApiProxy;
>> >> >> >
>> >> >> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
>> >> >> >
>> >> >> > > So I can't new a ApiProxyLocalImpl instance!
>> >> >> > > Any body know how to use JUnit?
>> >> >> > > Thanks :)
>> >> >> >
>> >> >> > > --
>> >> >> > > You received this message because you are subscribed to the
>> >> >> > > Google
>> >> >> > > Groups
>> >> >> > > "Google App Engine for Java" group.
>> >> >> > > To post to this group, send email to
>> >> >> > > google-appengine-j...@googlegroups.com.
>> >> >> > > To unsubscribe from this group, send email to
>> >> >> > >
>> >> >> > >
>> >> >> > >
>> >> >> > > google-appengine-java+unsubscr...@googlegroups.com> >> >> > > unsubscr...@googlegroups.com>
>> >> >> > > .
>> >> >> > > For more options, visit this group at
>> >> >> > >http://groups.google.com/group/google-appengine-java?hl=en.
>> >> >> >
>> >> >> > --
>> >> >> > Ikai Lan
>> >> >> > Developer Programs Engineer, Google App
>> >> >> >
>> >> >> >
>> >> >> > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine
>> >> >>
>> >> >> --
>> >> >> You received this message because you are subscribed to the Google
>> >> >> Groups
>> >> >> "Google App Engine for Java" group.
>> >> >> To post to this group, send email to
>> >> >> google-appengine-j...@googlegroups.com.
>> >> >> To unsubscribe from this group, send email to
>> >> >> google-appengine-java+unsubscr...@googlegroups.com.
>> >> >> For more options, visit this group at
>> >> >> http://groups.google.com/group/google-appengine-java?hl=en.
>> >> >>
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "Google App Engine for Java" group.
>> >> > To post to this group, send email to
>> >> > google-appengine-j...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to
>> >> > google-appengine-java+unsubscr...@googlegroups.com.
>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/google-appengine-java?hl=en.
>> >> >
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Google App Engine

Re: [appengine-java] Re: How to use junit test in the newest SDK1.3.1

2010-02-11 Thread Max Ross (Google)
Great, glad to hear it!  I forgot to add a method to LocalServiceTestHelper
to set a custom app id.  My mistake.  I'll make sure this gets added for the
next release so you don't need to provide your own Environment
implementation.

Max

On Thu, Feb 11, 2010 at 10:30 AM, Krishna Caldas wrote:

> You're right!
> I refactored my code and forget to annotate the new setUp method with
> @Before.
> Sorry for taking your time! It works now.
>
> Thanks,
> Krishna
>
>
> 2010/2/11 Max Ross (Google) 
> 
> >:
> > Your code looks fine.  Are you sure you're calling setUp() on the
> > LocalServiceTestHelper?
> >
> > On Thu, Feb 11, 2010 at 10:11 AM, Krishna Caldas <
> krishnacal...@gmail.com>
> > wrote:
> >>
> >> Ooops.. missed your question!
> >> It's just:
> >>@Override
> >>protected Environment newEnvironment() {
> >>return new TestEnvironment();
> >>}
> >>
> >> Thanks,
> >> Krishna
> >>
> >> 2010/2/11 Max Ross (Google) 
> >> 
> >:
> >> > Subclassing LocalServiceTestHelper and overriding newEnvironment()
> >> > should
> >> > work fine.  What does your implementation of newEnvironment() look
> like?
> >> >
> >> > On Wed, Feb 10, 2010 at 7:35 PM, Krishna 
> >> > wrote:
> >> >>
> >> >> Ok!
> >> >>
> >> >> But when I'm using transactions I'm getting:
> >> >>
> >> >> java.lang.NullPointerException: No API environment is registered for
> >> >> this thread.
> >> >>at
> >> >>
> >> >>
> >> >>
> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
> >> >> 67)
> >> >>at
> >> >>
> >> >>
> >> >>
> com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(DatastoreServiceImpl.java:
> >> >> 270)
> >> >>
> >> >> I've tried to extend LocalServiceTestHelper and overwrite
> >> >> newEnvironment()  with my Environment (who returns appId) but it
> >> >> didn't work...
> >> >>
> >> >> What's wrong?
> >> >>
> >> >> Thanks,
> >> >> Krishna
> >> >>
> >> >> On Feb 10, 10:25 pm, "Ikai L (Google)"  wrote:
> >> >> > We've got a more simple interface for you now. Take a look:
> >> >> >
> >> >> >
> >> >> >
> http://code.google.com/appengine/docs/java/tools/localunittesting.html
> >> >> >
> >> >> > 2010/2/10 时空之蕊 
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > > I found the class
> >> >> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not
> >> >> > > public,but before 1.3.1 it's public!
> >> >> > > In the JUnit document:
> >> >> >
> >> >> > > import java.io.File;
> >> >> > > import com.google.appengine.tools.development.ApiProxyLocalImpl;
> >> >> > > import com.google.apphosting.api.ApiProxy;
> >> >> >
> >> >> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
> >> >> >
> >> >> > > So I can't new a ApiProxyLocalImpl instance!
> >> >> > > Any body know how to use JUnit?
> >> >> > > Thanks :)
> >> >> >
> >> >> > > --
> >> >> > > You received this message because you are subscribed to the
> Google
> >> >> > > Groups
> >> >> > > "Google App Engine for Java" group.
> >> >> > > To post to this group, send email to
> >> >> > > google-appengine-j...@googlegroups.com.
> >> >> > > To unsubscribe from this group, send email to
> >> >> > >
> >> >> > >
> >> >> > > google-appengine-java+unsubscr...@googlegroups.com
>  >> >> > > unsubscr...@googlegroups.com>
> >> >> > > .
> >> >> > > For more options, visit this group at
> >> >> > >http://groups.google.com/group/google-appengine-java?hl=en.
> >> >> >
> >> >> > --
> >> >> > Ikai Lan
> >> >> > Developer Programs Engineer, Google App
> >> >> >
> >> >> > Enginehttp://googleappengine.blogspot.com|
> http://twitter.com/app_engine
> >> >>
> >> >> --
> >> >> You received this message because you are subscribed to the Google
> >> >> Groups
> >> >> "Google App Engine for Java" group.
> >> >> To post to this group, send email to
> >> >> google-appengine-j...@googlegroups.com.
> >> >> To unsubscribe from this group, send email to
> >> >> google-appengine-java+unsubscr...@googlegroups.com
> .
> >> >> For more options, visit this group at
> >> >> http://groups.google.com/group/google-appengine-java?hl=en.
> >> >>
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups
> >> > "Google App Engine for Java" group.
> >> > To post to this group, send email to
> >> > google-appengine-j...@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > google-appengine-java+unsubscr...@googlegroups.com
> .
> >> > For more options, visit this group at
> >> > http://groups.google.com/group/google-appengine-java?hl=en.
> >> >
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Google App Engine for Java" group.
> >> To post to this group, send email to
> >> google-appengine-j...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> google-appengine-java+unsubscr...@googlegroups.com
> .
> >> For more options, visit this group at
> >> http://groups.google.co

Re: [appengine-java] Re: How to use junit test in the newest SDK1.3.1

2010-02-11 Thread Krishna Caldas
You're right!
I refactored my code and forget to annotate the new setUp method with @Before.
Sorry for taking your time! It works now.

Thanks,
Krishna


2010/2/11 Max Ross (Google) :
> Your code looks fine.  Are you sure you're calling setUp() on the
> LocalServiceTestHelper?
>
> On Thu, Feb 11, 2010 at 10:11 AM, Krishna Caldas 
> wrote:
>>
>> Ooops.. missed your question!
>> It's just:
>>@Override
>>protected Environment newEnvironment() {
>>return new TestEnvironment();
>>}
>>
>> Thanks,
>> Krishna
>>
>> 2010/2/11 Max Ross (Google) :
>> > Subclassing LocalServiceTestHelper and overriding newEnvironment()
>> > should
>> > work fine.  What does your implementation of newEnvironment() look like?
>> >
>> > On Wed, Feb 10, 2010 at 7:35 PM, Krishna 
>> > wrote:
>> >>
>> >> Ok!
>> >>
>> >> But when I'm using transactions I'm getting:
>> >>
>> >> java.lang.NullPointerException: No API environment is registered for
>> >> this thread.
>> >>at
>> >>
>> >>
>> >> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
>> >> 67)
>> >>at
>> >>
>> >>
>> >> com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(DatastoreServiceImpl.java:
>> >> 270)
>> >>
>> >> I've tried to extend LocalServiceTestHelper and overwrite
>> >> newEnvironment()  with my Environment (who returns appId) but it
>> >> didn't work...
>> >>
>> >> What's wrong?
>> >>
>> >> Thanks,
>> >> Krishna
>> >>
>> >> On Feb 10, 10:25 pm, "Ikai L (Google)"  wrote:
>> >> > We've got a more simple interface for you now. Take a look:
>> >> >
>> >> >
>> >> > http://code.google.com/appengine/docs/java/tools/localunittesting.html
>> >> >
>> >> > 2010/2/10 时空之蕊 
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > > I found the class
>> >> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not
>> >> > > public,but before 1.3.1 it's public!
>> >> > > In the JUnit document:
>> >> >
>> >> > > import java.io.File;
>> >> > > import com.google.appengine.tools.development.ApiProxyLocalImpl;
>> >> > > import com.google.apphosting.api.ApiProxy;
>> >> >
>> >> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
>> >> >
>> >> > > So I can't new a ApiProxyLocalImpl instance!
>> >> > > Any body know how to use JUnit?
>> >> > > Thanks :)
>> >> >
>> >> > > --
>> >> > > You received this message because you are subscribed to the Google
>> >> > > Groups
>> >> > > "Google App Engine for Java" group.
>> >> > > To post to this group, send email to
>> >> > > google-appengine-j...@googlegroups.com.
>> >> > > To unsubscribe from this group, send email to
>> >> > >
>> >> > >
>> >> > > google-appengine-java+unsubscr...@googlegroups.com> >> > > unsubscr...@googlegroups.com>
>> >> > > .
>> >> > > For more options, visit this group at
>> >> > >http://groups.google.com/group/google-appengine-java?hl=en.
>> >> >
>> >> > --
>> >> > Ikai Lan
>> >> > Developer Programs Engineer, Google App
>> >> >
>> >> > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Google App Engine for Java" group.
>> >> To post to this group, send email to
>> >> google-appengine-j...@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> google-appengine-java+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/google-appengine-java?hl=en.
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Google App Engine for Java" group.
>> > To post to this group, send email to
>> > google-appengine-j...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > google-appengine-java+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/google-appengine-java?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> google-appengine-j...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsu

Re: [appengine-java] Re: How to use junit test in the newest SDK1.3.1

2010-02-11 Thread Max Ross (Google)
Your code looks fine.  Are you sure you're calling setUp() on the
LocalServiceTestHelper?

On Thu, Feb 11, 2010 at 10:11 AM, Krishna Caldas wrote:

> Ooops.. missed your question!
> It's just:
>@Override
>protected Environment newEnvironment() {
>return new TestEnvironment();
> }
>
> Thanks,
> Krishna
>
> 2010/2/11 Max Ross (Google) 
> 
> >:
> > Subclassing LocalServiceTestHelper and overriding newEnvironment() should
> > work fine.  What does your implementation of newEnvironment() look like?
> >
> > On Wed, Feb 10, 2010 at 7:35 PM, Krishna 
> wrote:
> >>
> >> Ok!
> >>
> >> But when I'm using transactions I'm getting:
> >>
> >> java.lang.NullPointerException: No API environment is registered for
> >> this thread.
> >>at
> >>
> >>
> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
> >> 67)
> >>at
> >>
> >>
> com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(DatastoreServiceImpl.java:
> >> 270)
> >>
> >> I've tried to extend LocalServiceTestHelper and overwrite
> >> newEnvironment()  with my Environment (who returns appId) but it
> >> didn't work...
> >>
> >> What's wrong?
> >>
> >> Thanks,
> >> Krishna
> >>
> >> On Feb 10, 10:25 pm, "Ikai L (Google)"  wrote:
> >> > We've got a more simple interface for you now. Take a look:
> >> >
> >> >
> http://code.google.com/appengine/docs/java/tools/localunittesting.html
> >> >
> >> > 2010/2/10 时空之蕊 
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > > I found the class
> >> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not
> >> > > public,but before 1.3.1 it's public!
> >> > > In the JUnit document:
> >> >
> >> > > import java.io.File;
> >> > > import com.google.appengine.tools.development.ApiProxyLocalImpl;
> >> > > import com.google.apphosting.api.ApiProxy;
> >> >
> >> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
> >> >
> >> > > So I can't new a ApiProxyLocalImpl instance!
> >> > > Any body know how to use JUnit?
> >> > > Thanks :)
> >> >
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> > > Groups
> >> > > "Google App Engine for Java" group.
> >> > > To post to this group, send email to
> >> > > google-appengine-j...@googlegroups.com.
> >> > > To unsubscribe from this group, send email to
> >> > >
> >> > > google-appengine-java+unsubscr...@googlegroups.com
>  >> > > unsubscr...@googlegroups.com>
> >> > > .
> >> > > For more options, visit this group at
> >> > >http://groups.google.com/group/google-appengine-java?hl=en.
> >> >
> >> > --
> >> > Ikai Lan
> >> > Developer Programs Engineer, Google App
> >> > Enginehttp://googleappengine.blogspot.com|
> http://twitter.com/app_engine
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Google App Engine for Java" group.
> >> To post to this group, send email to
> >> google-appengine-j...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> google-appengine-java+unsubscr...@googlegroups.com
> .
> >> For more options, visit this group at
> >> http://groups.google.com/group/google-appengine-java?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> > http://groups.google.com/group/google-appengine-java?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Re: How to use junit test in the newest SDK1.3.1

2010-02-11 Thread Krishna Caldas
Ooops.. missed your question!
It's just:
@Override
protected Environment newEnvironment() {
return new TestEnvironment();
}

Thanks,
Krishna

2010/2/11 Max Ross (Google) :
> Subclassing LocalServiceTestHelper and overriding newEnvironment() should
> work fine.  What does your implementation of newEnvironment() look like?
>
> On Wed, Feb 10, 2010 at 7:35 PM, Krishna  wrote:
>>
>> Ok!
>>
>> But when I'm using transactions I'm getting:
>>
>> java.lang.NullPointerException: No API environment is registered for
>> this thread.
>>at
>>
>> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
>> 67)
>>at
>>
>> com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(DatastoreServiceImpl.java:
>> 270)
>>
>> I've tried to extend LocalServiceTestHelper and overwrite
>> newEnvironment()  with my Environment (who returns appId) but it
>> didn't work...
>>
>> What's wrong?
>>
>> Thanks,
>> Krishna
>>
>> On Feb 10, 10:25 pm, "Ikai L (Google)"  wrote:
>> > We've got a more simple interface for you now. Take a look:
>> >
>> > http://code.google.com/appengine/docs/java/tools/localunittesting.html
>> >
>> > 2010/2/10 时空之蕊 
>> >
>> >
>> >
>> >
>> >
>> > > I found the class
>> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not
>> > > public,but before 1.3.1 it's public!
>> > > In the JUnit document:
>> >
>> > > import java.io.File;
>> > > import com.google.appengine.tools.development.ApiProxyLocalImpl;
>> > > import com.google.apphosting.api.ApiProxy;
>> >
>> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
>> >
>> > > So I can't new a ApiProxyLocalImpl instance!
>> > > Any body know how to use JUnit?
>> > > Thanks :)
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> > > Groups
>> > > "Google App Engine for Java" group.
>> > > To post to this group, send email to
>> > > google-appengine-j...@googlegroups.com.
>> > > To unsubscribe from this group, send email to
>> > >
>> > > google-appengine-java+unsubscr...@googlegroups.com> > > unsubscr...@googlegroups.com>
>> > > .
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/google-appengine-java?hl=en.
>> >
>> > --
>> > Ikai Lan
>> > Developer Programs Engineer, Google App
>> > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> google-appengine-j...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Re: How to use junit test in the newest SDK1.3.1

2010-02-11 Thread Krishna Caldas
It's the same (attached) I used before update to 1.3.1.

Thanks,
Krishna

2010/2/11 Max Ross (Google) :
> Subclassing LocalServiceTestHelper and overriding newEnvironment() should
> work fine.  What does your implementation of newEnvironment() look like?
>
> On Wed, Feb 10, 2010 at 7:35 PM, Krishna  wrote:
>>
>> Ok!
>>
>> But when I'm using transactions I'm getting:
>>
>> java.lang.NullPointerException: No API environment is registered for
>> this thread.
>>at
>>
>> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
>> 67)
>>at
>>
>> com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(DatastoreServiceImpl.java:
>> 270)
>>
>> I've tried to extend LocalServiceTestHelper and overwrite
>> newEnvironment()  with my Environment (who returns appId) but it
>> didn't work...
>>
>> What's wrong?
>>
>> Thanks,
>> Krishna
>>
>> On Feb 10, 10:25 pm, "Ikai L (Google)"  wrote:
>> > We've got a more simple interface for you now. Take a look:
>> >
>> > http://code.google.com/appengine/docs/java/tools/localunittesting.html
>> >
>> > 2010/2/10 时空之蕊 
>> >
>> >
>> >
>> >
>> >
>> > > I found the class
>> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not
>> > > public,but before 1.3.1 it's public!
>> > > In the JUnit document:
>> >
>> > > import java.io.File;
>> > > import com.google.appengine.tools.development.ApiProxyLocalImpl;
>> > > import com.google.apphosting.api.ApiProxy;
>> >
>> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
>> >
>> > > So I can't new a ApiProxyLocalImpl instance!
>> > > Any body know how to use JUnit?
>> > > Thanks :)
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> > > Groups
>> > > "Google App Engine for Java" group.
>> > > To post to this group, send email to
>> > > google-appengine-j...@googlegroups.com.
>> > > To unsubscribe from this group, send email to
>> > >
>> > > google-appengine-java+unsubscr...@googlegroups.com> > > unsubscr...@googlegroups.com>
>> > > .
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/google-appengine-java?hl=en.
>> >
>> > --
>> > Ikai Lan
>> > Developer Programs Engineer, Google App
>> > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> google-appengine-j...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



TestEnvironment.java
Description: Binary data


Re: [appengine-java] Re: How to use junit test in the newest SDK1.3.1

2010-02-11 Thread Max Ross (Google)
Subclassing LocalServiceTestHelper and overriding newEnvironment() should
work fine.  What does your implementation of newEnvironment() look like?

On Wed, Feb 10, 2010 at 7:35 PM, Krishna  wrote:

> Ok!
>
> But when I'm using transactions I'm getting:
>
> java.lang.NullPointerException: No API environment is registered for
> this thread.
>at
>
> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
> 67)
>at
>
> com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(DatastoreServiceImpl.java:
> 270)
>
> I've tried to extend LocalServiceTestHelper and overwrite
> newEnvironment()  with my Environment (who returns appId) but it
> didn't work...
>
> What's wrong?
>
> Thanks,
> Krishna
>
> On Feb 10, 10:25 pm, "Ikai L (Google)"  wrote:
> > We've got a more simple interface for you now. Take a look:
> >
> > http://code.google.com/appengine/docs/java/tools/localunittesting.html
> >
> > 2010/2/10 时空之蕊 
> >
> >
> >
> >
> >
> > > I found the class
> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not
> > > public,but before 1.3.1 it's public!
> > > In the JUnit document:
> >
> > > import java.io.File;
> > > import com.google.appengine.tools.development.ApiProxyLocalImpl;
> > > import com.google.apphosting.api.ApiProxy;
> >
> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
> >
> > > So I can't new a ApiProxyLocalImpl instance!
> > > Any body know how to use JUnit?
> > > Thanks :)
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google App Engine for Java" group.
> > > To post to this group, send email to
> > > google-appengine-j...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-appengine-java+unsubscr...@googlegroups.com unsubscr...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine-java?hl=en.
> >
> > --
> > Ikai Lan
> > Developer Programs Engineer, Google App Enginehttp://
> googleappengine.blogspot.com|http://twitter.com/app_engine
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: How to use junit test in the newest SDK1.3.1

2010-02-10 Thread Krishna
Ok!

But when I'm using transactions I'm getting:

java.lang.NullPointerException: No API environment is registered for
this thread.
at
com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
67)
at
com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(DatastoreServiceImpl.java:
270)

I've tried to extend LocalServiceTestHelper and overwrite
newEnvironment()  with my Environment (who returns appId) but it
didn't work...

What's wrong?

Thanks,
Krishna

On Feb 10, 10:25 pm, "Ikai L (Google)"  wrote:
> We've got a more simple interface for you now. Take a look:
>
> http://code.google.com/appengine/docs/java/tools/localunittesting.html
>
> 2010/2/10 时空之蕊 
>
>
>
>
>
> > I found the class
> > com.google.appengine.tools.development.ApiProxyLocalImpl is not
> > public,but before 1.3.1 it's public!
> > In the JUnit document:
>
> > import java.io.File;
> > import com.google.appengine.tools.development.ApiProxyLocalImpl;
> > import com.google.apphosting.api.ApiProxy;
>
> > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
>
> > So I can't new a ApiProxyLocalImpl instance!
> > Any body know how to use JUnit?
> > Thanks :)
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App 
> Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.