ApiProxy gives you access to the dev_appserver's internal interfaces for the
services that Google provides, such as mail, urlfetch, memcache, xmpp,
etc... ApiProxy is entirely unrelated to GWT RemoteServiceServlets, which is
what your code is trying to use it for.
You only need to use our internal dev_appserver interfaces if you
specifically need to do something with the services that isn't supported on
prod via the standard interfaces. For example, in the page you referenced,
the code clears all record of sent messages:

mailService.clearSentMessages();


That capability makes no sense in production, but it is very useful for
testing locally.


On Tue, Sep 22, 2009 at 10:35 AM, Pion <[email protected]> wrote:

>
> This line fails:
>
>   FooServiceImpl server =  (FooServiceImpl ) proxy.getService
> ("com.foo.server");
>
> The server is null.
>
> On Sep 21, 6:48 pm, Pion <[email protected]> wrote:
> > I have the following server side code:
> >
> >         package com.foo.server;
> >         // code deleted for brevity
> >         /**
> >          * The server side implementation of the RPC service.
> >          */
> >         @SuppressWarnings("serial")
> >         public class FooServiceImpl extends RemoteServiceServlet
> implements
> > FooService {
> >         // code deleted for brevity
> >                 @Override
> >                 public String barTest() {
> >                         return "unitTest";
> >                 }
> >         } // FooServiceImpl
> >
> > I copied/implemented the TestEnvironment and LocalServiceTestCase
> > classes as shown onhttp://
> code.google.com/appengine/docs/java/howto/unittesting.html.
> >
> > Then, I implemented the following:
> >         public class ServerTest extends LocalServiceTestCase {
> >
> >         ApiProxyLocalImpl proxy = (ApiProxyLocalImpl)
> > ApiProxy.getDelegate();
> >         FooServiceImpl server =  (FooServiceImpl ) proxy.getService
> > ("com.foo.server");
> >
> >         String result = barTest();                      // produces
> > java.lang.NullPointerException
> >         assertEquals("unitTest", result);
> >
> >         } // ServerTest
> >
> > I got the java.lang.NullPointerException on this line "String result =
> > barTest();"
> >
> > My environments: GAE 1.25, GWT 1.7, Eclipse-Galileo on Windows Vista.
> >
> > I am new on this. What did I do wrong?
> >
> > Thanks in advance for your help.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to