[appengine-java] Re: how to persist a list of bytearray?

2011-03-17 Thread Khanh Dao Minh
Dear Tao,

As I understand, you should not use byte[] in GAE store. GAE only support 
some core value type here: 
http://code.google.com/appengine/docs/java/datastore/entities.html#Properties_and_Value_Types

So I think you may change to ShortBlob:
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/ShortBlob.html

Here I go:

private List attachments = new ArrayList();
ShortBlob foo = new ShortBlob(new byte[]...);
attachments.add(foo);

Hope this help.
KhanhDM.

-- 
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-java@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: jetty java.lang.IllegalStateException: STREAM

2011-03-17 Thread Ian Marshall
Hello Mark,

I get this sometimes too on the GAE/J developmenr web server after the
next web page has been served. I do not find this exception to be
reliably reproducible: sometimes it happens, usually is doesn't.

I am running GAE/J 1.4.2 with the JDK 1.6.0_24 for Microsoft Windows
XP.

An example of my errors are:

  org.apache.wicket.WicketRuntimeException: Unable to write the
response
at org.apache.wicket.Response.handleException(Response.java:286)
at org.apache.wicket.Response.write(Response.java:310)
...
  Caused by: java.io.IOException: Closed
at org.mortbay.jetty.AbstractGenerator
$Output.write(AbstractGenerator.java:629)
at org.mortbay.jetty.AbstractGenerator
$Output.write(AbstractGenerator.java:579)
at org.apache.wicket.util.io.Streams.copy(Streams.java:159)
at org.apache.wicket.util.io.Streams.copy(Streams.java:126)
at org.apache.wicket.Response.write(Response.java:306)
... 32 more

This is followed immediately by what you get:

  java.lang.IllegalStateException: STREAM
at org.mortbay.jetty.Response.getWriter(Response.java:616)
...

Ian


On Mar 16, 10:35 am, Mark Harrison 
wrote:
> Hi, can you explain why jetty is returning a
> java.lang.IllegalStateException: STREAM?
>
> Is this a known issue?
> Is there something wrong with my code that is causing the issue?
> Does this happen on other implementations of Jetty
>
> I am using the Java Environment with Google App Engine 1.4.2 with JRE 1.7
> (x64) for Mac OSX. No exception is caught from try..catch block. The
> exception seems to occur after the page has finished execution. I am calling
> the JSP page directly (i.e. entering name into browser window).
>
> Note: I cannot see this exception on GAE server it only happens when running
> the local jetty on my Dev Machine.
>
> JSP
> ==
>
> 
> 
> <%
> try
> {
>         response.sendError(401,"This will generate IllegalStateException");
>         // response.setStatus(401);}
>
> catch (Exception e)
> {
>         %>
>         Caught exception with response.sendError(401)
>         <%
>
> }
>
> %>
> 
> 
>
> EXCEPTION
> ==
>
> Mar 16, 2011 12:19:32 PM com.google.apphosting.utils.jetty.JettyLogger warn
> WARNING: /Test.jsp
> java.lang.IllegalStateException: STREAM
>         at org.mortbay.jetty.Response.getWriter(Response.java:616)
>         at
> javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:112)
>         at
> org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)
>         at
> org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118)
>         at
> org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:188)
>         at
> org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:118)
>         at
> org.apache.jasper.runtime.JspFactoryImpl.access$100(JspFactoryImpl.java:40)
>         at
> org.apache.jasper.runtime.JspFactoryImpl$PrivilegedReleasePageContext.run(JspFactoryImpl.java:166)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at
> org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
>         at org.apache.jsp.Test_jsp._jspService(Test_jsp.java:83)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>         at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>         at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>         at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>         at
> com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
>         at
> com.google.appengine.tools.development.PrivilegedJspServlet$2.run(PrivilegedJspServlet.java:59)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at
> com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:57)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>         at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>         at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
>         at
> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
>         at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>         at
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
>         at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>         at
> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
>         at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>         at
> org

[appengine-java] Design choices.

2011-03-17 Thread sledorze
Hi!

I am currently building an app that will be sell as a customized
service to few but big (in traffic) clients via some integrators.

This app is a backend for a model on which you can put cothes and
create outfits in the browser.
The stereotypical final client is an e-commerce selling company and
the integration is done in its web site and IPad, IPhone, etc..

Having several clients, I was wondering if I am allowed to make
several apps.
These are the reasons why:
- Each client integration requiers specific code and/or datastore
modifications and to host possibly specific datas.
- Each app can behave differently, has different load and I need to
track that down for evaluation of the costs.

However; I've read that Google prevents doing one App diguised into
several App.
I really don't know if my use case apply.

Today, I've start to build everything as a single app but I am not
very confortable as I could have a lot of struggle on the whole
service due to the number of maintenance scenario and the explosion of
schema models and View / Controllers for each client in the same App
(even if there's no schema in the datastore, I must have one in my
mind).
But one have to realize that the first versions will be identical.

I would need an answer, and would like to have it for granted if my
use case applies or not to the formentionned restriction.
What's your advice?
Whould should I contact?

Thanks for your answers,
Stephane

-- 
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-java@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: Design choices.

2011-03-17 Thread Khanh Dao Minh
Hi Stephane,

You can manage multitenancy using Namespaces:
http://code.google.com/appengine/docs/java/multitenancy/multitenancy.html

With each client (tenant), you can have difference setting in their 
namespace, then apply difference business logic within a single application.

Regards,
KhanhDM.

-- 
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-java@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: suggestions on template engine for GAE-java

2011-03-17 Thread Daniel Florey
You can check out 

http://code.google.com/p/jmte/


-- 
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-java@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: Design choices.

2011-03-17 Thread sledorze
Very interesting indeed!
Got to test that.
I am wondering if this this feature makes all datas part of an group
or not in the datastore? (i.e. implemented using parent keys)
I am asking this in order to know if there some possible performance
loss (like write contention) that could arise from using it.
Thanks!
Stephane

On 17 mar, 10:38, Khanh Dao Minh  wrote:
> Hi Stephane,
>
> You can manage multitenancy using 
> Namespaces:http://code.google.com/appengine/docs/java/multitenancy/multitenancy
>
> With each client (tenant), you can have difference setting in their
> namespace, then apply difference business logic within a single application.
>
> Regards,
> KhanhDM.

-- 
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-java@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: Design choices.

2011-03-17 Thread Khanh Dao Minh
I think there is no problems with performance, but security vulnerabilities 
and data leak.
Just give it a try :)

Regards,
KhanhDM.

-- 
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-java@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: 1.4.2: Can't make https call from dev server

2011-03-17 Thread Chris Wren
If you are seeing this problem:
http://permalink.gmane.org/gmane.comp.systems.google-appengine.jre/18014

This is fixed in "1.4.2 - 2011-02-16", look closely at the Location of
the App Engine SDK under Preferences -> Google -> App Engine and make
sure you don't have v201102111811.

Chris


On Feb 15, 12:57 pm, Lior Harsat  wrote:
> HI All,
>
> I found a very dirty workaround but at least it works for me.
> I was not aware of the doNotValidateCertificate() API that Fred
> mentioned.
> I made a very small change (one line of code) to the SDK appengine-
> api.jar.
> I have decompiled com.google.appengine.api.urlfetch.HTTPRequest and
> added the call to doNotValidateCertificate() on the FetchOptions in
> the constructor:
>
>         public HTTPRequest(URL url, HTTPMethod method, FetchOptions
> fetchOptions) {
>                 payload = null;
>                 this.url = url;
>                 this.method = method;
>                 this.fetchOptions = fetchOptions;
>                 this.fetchOptions.doNotValidateCertificate(); \\ADDED BY ME
>                 headers = new LinkedHashMap();
>         }
>
> Then I repackaged the jar with my change and that solved the issue for
> me - No certificate validation by default (Only on Dev server).
> This way I don't have to change every piece of code that uses
> URLFetchService with https and more important the production env still
> makes sure the validation occurs.
> Note that this solution will fix only flows where the URLFetchService
> is used.
> I do hope a better fix is provided by the App Engine team soon.
>
> Thanx, Lior
>
> On Feb 14, 11:22 pm, frew  wrote:> Hey everybody,
>
> > In order to help me diagnose the problems, could you respond with what
> > JDK (Platform, JDK manufacturer (e.g. Sun, OpenJDK), and version)
> > you're running? As a temporary stopgap, if you're using URLFetch
> > service, you can use the doNotValidateCertificate() method in
> > FetchOptions (http://code.google.com/appengine/docs/java/javadoc/com/
> > google/appengine/api/urlfetch/FetchOptions.html) to disable
> > validation.
>
> > -Fred
>
> > On Feb 13, 5:02 am, harri mauria  wrote:
>
> > > I am having similar problems with the recently released version
> > > com.google.appengine.eclipse.sdkbundle.1.4.2_1.4.2.v201102111811
> > > Problems happen with the development server, not in production. I am
> > > performing Facebook login credentials authentication in the callback
> > > url. Interrupt stack is below:
>
> > > HTTP ERROR 500
> > > Problem accessing /loginfacebookcallback. Reason:
>
> > >     Could not verify SSL certificate 
> > > for:https://graph.facebook.com/oauth/access_token?omitted
>
> > > Caused by:
> > > javax.net.ssl.SSLHandshakeException: Could not verify SSL certificate
> > > for:https://graph.facebook.com/oauth/access_token?omitted
> > >         at
> > > com.google.appengine.api.urlfetch.URLFetchServiceImpl.convertApplicationExc
> > >  eption(URLFetchServiceImpl.java:
> > > 114)
> > >         at
> > > com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchService
> > >  Impl.java:
> > > 41)
> > >         at
> > > com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler
> > > $Connection.fetchResponse(URLFetchServiceStreamHandler.java:418)
> > >         at
> > > com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler
> > > $Connection.getInputStream(URLFetchServiceStreamHandler.java:297)
> > >         atwww.superpass.de.server.UrlFetcher.get(UrlFetcher.java:60)
>
> > > Following message is printed to the console:
> > > I/O exception (javax.net.ssl.SSLPeerUnverifiedException) caught when
> > > processing request: HTTPS hostname invalid: expected
> > > 'graph.facebook.com', received '*.facebook.com'
> > > Retrying request
>
> > > Regards, Harri
>
> > > On Feb 13, 11:27 am, Lior Harsat  wrote:
>
> > > > I am having a similar problem with https:
>
> > > > I have been testing the SDK and I found one bug which seems critical.
> > > > When I call the URLFetchService.fetch API  with a https URL I get a
> > > > javax.net.ssl.SSLHandshakeException.
> > > > for example when I fetch "https://spreadsheets.google.com/feeds/
> > > > list/" I get
> > > > javax.net.ssl.SSLHandshakeException: Could not verify SSL certificate
> > > > for:https://spreadsheets.google.com/feeds/list/...
> > > > When I switch back to an older SDK this doesn't happen.
> > > > Is there a "Help us test Prerelease SDK 1.4.2" thread I can post this
> > > > to?
> > > > Can anyone confirm this bug reproduces?
> > > > Thanx, Lior
>
> > > > On Feb 12, 11:57 am, Peter Liu  wrote:
>
> > > > > We are using a custom remote delegate to route datastore rpc call to
> > > > > live production test site on appspot. We did this because sometimes we
> > > > > want to develop with live data.
>
> > > > > However after upgrading to 1.4.2, https outbound call starts failing
> > > > > (see below). If we change to http, then it works again.
>
> > > > > It seems like some class is 

[appengine-java] Re: Design choices.

2011-03-17 Thread Didier Durand
Hi,

namespaces are not related to entity groups: entity group is a notion
to group entities for transactional purposes. The aim is to limit a
transaction to update of objects in a single group (i.e on the same
server) to get a higher reliability and good scalability.

The namespace is a just a "prefix" on your data to separate it
virtually per namespace: it has nothing to do with entity groups. Of
course, you can't define entity groups across namespaces as data in
one namespace doesn't know of data in another.

regards

didier

On Mar 17, 4:00 pm, Khanh Dao Minh  wrote:
> I think there is no problems with performance, but security vulnerabilities
> and data leak.
> Just give it a try :)
>
> Regards,
> KhanhDM.

-- 
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-java@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] Strange MemcacheServiceException is thrown.

2011-03-17 Thread Miroslav Genov



Hello, before few minutes my app started to throw the following exception:

com.google.appengine.api.memcache.LogAndContinueErrorHandler 
handleServiceError: Service error in memcache
com.google.appengine.api.memcache.MemcacheServiceException: Memcache get: 
exception getting 1 key (sidkey_d415ddc17424ba8f4f98925270cf2054e729fe25)
at 
com.google.appengine.api.memcache.MemcacheServiceImpl.makeSyncCall(MemcacheServiceImpl.java:207)
at 
com.google.appengine.api.memcache.MemcacheServiceImpl.doGet(MemcacheServiceImpl.java:289)
at 
com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:322)
at com.google.appengine.api.memcache.stdimpl.GCache.get(GCache.java:158)


Any idea where this is an infrastructure issue or my mistake ? 


Thanks in advance.

-- 
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-java@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 persist a list of bytearray?

2011-03-17 Thread Tao
Thanks a lot, Khanh !

-- 
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-java@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: Unable to connect to repository http://dl.google.com/eclipse/plugin/3.6/content.xml

2011-03-17 Thread Ikai Lan (Google)
I talked to some folks, and Eclipse should never be trying to fetch
content.xml. Please follow the instructions step by step here:

http://code.google.com/eclipse/docs/install-eclipse-3.6.html

I just tried with a fresh install and Eclipse and this worked for me.

Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine



On Wed, Mar 16, 2011 at 3:30 AM, Sergey Kiselev  wrote:

> On 16 мар, 03:22, "Ikai Lan (Google)"  wrote:
> > I haven't reproduced this, but wget returns weird errors for that .xml
> URL.
> > I'm escalating this.
>
> don't work :(
>
> http://dl.google.com/eclipse/plugin/3.6/content.xml (open) ->
>
> http://commondatastorage.googleapis.com/eclipse_toolreleases/products/gpe/release/2.2/3.6/content.xml
> (redirect) -> Oops! This link appears to be broken. (google chrome)
>
> --
> 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-java@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-java@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] Datastore not responding intermittently

2011-03-17 Thread emurmur
We are testing a update to our app on a couple of qa instances 
(applications, not just JVMs) of AppEngine.  Both are getting 
DeadlineExceededException pretty often.  However, we have only a single user 
hitting the database and it has little data in it - basically, there is no 
contention for the database, but sometimes it simply does not respond. 
 Below is an example log.  You can see that we use JDO to emit a query for a 
single entity.  However, the datastore never responds.  We have the same 
exact code running on two different AppEngine applications.  One of them has 
instant-on enabled (so it has 3 instances running all the time) and the 
other does not (so it needs to spin up an instance relatively regularly). 
 We are using JDO and Restlet, but not Spring or Grooving or other packages 
that take a very long time to initialize (initializing a new instance takes 
our app about 7 seconds).  The very similar code on our live application 
seems to be fine - we are not seeing the same thing.  This makes me worry 
about deploying to live.  Is anyone else seeing this kind of behavior with 
the datastore?

Caused by: com.google.apphosting.api.DeadlineExceededException: This request 
(d5cf2cc1a60c6af7) started at 2011/03/17 22:49:48.468 UTC and was still 
executing at 2011/03/17 22:50:17.887 UTC.
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
at com.google.apphosting.runtime.AsyncFuture.get(AsyncFuture.java:54)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:67)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:67)
at 
com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.java:71)
at 
com.google.appengine.api.datastore.FutureHelper.quietGet(FutureHelper.java:32)
at 
com.google.appengine.api.datastore.QueryResultsSourceImpl.loadMoreEntities(QueryResultsSourceImpl.java:69)
at 
com.google.appengine.api.datastore.QueryResultsSourceImpl.loadMoreEntities(QueryResultsSourceImpl.java:56)
at 
com.google.appengine.api.datastore.QueryResultIteratorImpl.ensureLoaded(QueryResultIteratorImpl.java:156)
at 
com.google.appengine.api.datastore.QueryResultIteratorImpl.hasNext(QueryResultIteratorImpl.java:65)
at 
org.datanucleus.store.appengine.query.RuntimeExceptionWrappingIterator.hasNext(RuntimeExceptionWrappingIterator.java:44)
at 
org.datanucleus.store.appengine.query.LazyResult.resolveAll(LazyResult.java:115)
at 
org.datanucleus.store.appengine.query.LazyResult.size(LazyResult.java:110)
at 
org.datanucleus.store.appengine.query.StreamingQueryResult.size(StreamingQueryResult.java:124)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1508)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:266)
at 
com.conceptualcalculations.model.Group.GroupMembershipDAO.testSecondaryKey(GroupMembershipDAO.java:185)
at 
com.conceptualcalculations.model.Group.GroupMembershipDAO.testSecondaryKey(GroupMembershipDAO.java:1)
at 
com.conceptualcalculations.persistence.JDOTemplate.innerGetBySecondaryKey(JDOTemplate.java:403)

-- 
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-java@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: Dudas sobre Aplicaciones con JPA

2011-03-17 Thread Edixon Polanco

Donde puedo conseguir ejemplos de JPA con 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-java@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: JUnit Test of Code that uses GAE/J URLFetchServiceFactory.getURLFetchService()

2011-03-17 Thread Didier Durand
Hi,

Did you add the .jars specific to the local dev server in the
classpath of your IDE ?

regards

didier

On Mar 18, 12:27 am, James Andersen 
wrote:
> Apologize that this is a cross-post from a question I asked on 
> StackOverflowyesterday...
>  just didn't realize this forum was available...
>
> I've got some code I'm deploying to Google App Engine - Java (GAE/J) that
> makes use of theURLFetchService. I'd like to use JUnit to test this code.
> Per the testing 
> documentation,
>  it
> appears I should have a test that uses their LocalURLFetchServiceTestConfig 
> class
> ROUGHLY as follows:
>
> public class MyRemoteServiceTests {
>     private static final LocalURLFetchServiceTestConfig urlConfig = new 
> LocalURLFetchServiceTestConfig();
>     private static final LocalServiceTestHelper helper =
>         new LocalServiceTestHelper(urlConfig);
>
>     @Before
>     public void setUp() throws Exception {
>         service = new SampleService();
>         helper.setUp();
>     }
>
>     @After
>     public void tearDown() throws Exception {
>         service = null;
>         helper.tearDown();
>     }
>
>     @Test
>     public void testThatCallsCodeThatUsesUrlFetch() {
>             Object data = service.getRemoteDataUsingUrlFetch("foo", "bar");
>             Assert.assertNotNull(data);
>     }
>
> }
>
> I'm finding that this test continues to fail despite using the "helper" as 
> suggested in the GAE/J documentation on testing: "The API package 'urlfetch' 
> or call 'Fetch()' was not found.".
>
> I was assuming that using the "helper" would somehow setup the GAE 
> environment such that when I callURLFetchServiceFactory.getURLFetchService() 
> from within mygetRemoteDataUsingUrlFetch method, the interface returned would 
> be an instance ofLocalURLFetchService that would just "work" but that seems 
> NOT to be the case.
>
>    - How can I test this code?
>    - Am I missing something? (I'm pretty new to GAE...)
>    - Do I have to refactor my getRemoteDataUsingUrlFetch so that it doesn't 
> useURLFetchServiceFactory.getURLFetchService() because that makes it 
> untestable locally??? (That sounds like it would really suck...)
>
> Any help/suggestions much appreciated!

-- 
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-java@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: JUnit Test of Code that uses GAE/J URLFetchServiceFactory.getURLFetchService()

2011-03-17 Thread James Andersen
If by "jars specific to the local dev server" you mean 

   - appengine-local-runtime.jar
   - appengine-api-stubs.jar

Yes... I just barely figured out that these were needed (after much 
frustration and running across a post from two years ago that mentioned 
these jars).   That was all I needed!   Thanks for replying all the same!

P.S.  If anyone who manages the docs is watching... Would REALLY have 
appreciated some mention of that on the Local Unit 
Testingpage
 in the documentation.   Perhaps it went without saying for some but not 
for me.

-- 
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-java@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: JUnit Test of Code that uses GAE/J URLFetchServiceFactory.getURLFetchService()

2011-03-17 Thread James Andersen
If by "jars specific to the local dev server" you mean 

   - appengine-local-runtime.jar
   - appengine-api-stubs.jar

Yes... I just barely figured out that these were needed (after much 
frustration and running across a post from two years ago that mentioned 
these jars).   That was all I needed!   Thanks for replying all the same!

P.S.  I'm an idiot and did not read the Local Unit 
Testing 
page 
in the documentation carefully enough;  I missed this:
However, if your tests or code under test have these dependencies you'll 
need a few more JARs on your testing classpath:
${SDK_ROOT}/lib/impl/appengine-api.jar, 
${SDK_ROOT}/lib/impl/appengine-api-labs.jar, and 
${SDK_ROOT}/lib/impl/appengine-api-stubs.jar. These JARs make the runtime 
APIs and the local implementations of those APIs available to your tests.

-- 
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-java@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: JUnit Test of Code that uses GAE/J URLFetchServiceFactory.getURLFetchService()

2011-03-17 Thread James Andersen
Just for my own edification...  I was comparing the build path of my test 
project to my GAE project while trying to solve this... I didn't find these 
jars in either one.When I launch my GAE project locally is "works" of 
course...I'm using eclipse, does the "Google Web Application" launch 
configuration handle loading these jars for me before my project is actually 
loaded?   

Sorry still getting used to GAE and have been in the .NET world for several 
years now... 

-- 
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-java@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: JUnit Test of Code that uses GAE/J URLFetchServiceFactory.getURLFetchService()

2011-03-17 Thread James Andersen
Just for my own edification...  I was comparing the build path of my test 
project to my GAE project while trying to solve this... I didn't find these 
jars in either one.When I launch my GAE project locally is "works" of 
course...I'm using eclipse, does the "Google Web Application" launch 
configuration handle loading these jars for me before my project is actually 
loaded?   

Sorry still getting used to GAE and have been in the .NET world for several 
years now... 

-- 
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-java@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.