[google-appengine] Issue About encode/decode in webapp2 on GAE

2012-08-19 Thread forNightmare TF
Hello, everyone : )
I have a output list like [u'\u7acb\u5f0f\u78e8\u7c89\u673a',
u'\u4e94\u8c37\u78e8\u7c89\u673a',
u'\u4e94\u8c37\u6742\u7cae\u78e8\u7c89\u673a',
u'\u5c0f\u578b\u78e8\u7c89\u673a', u'\u6a61\u80f6\u78e8\u7c89\u673a',]
Need to ouput Chinese charactor, and the resources json i parsed are
Chinese, so how can i ouput it not \u7acb like above ?

Thank you very much

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



Re: [google-appengine] Re: Hosting static files on GAE and using own domain.

2012-08-19 Thread Robert Fischer
Sorry, the logic to see if it's localhost isn't sound.

This is a bit more robust and works to redirect users to the custom domain (
www.dealscorcher.com in my case):

class HomepageHander(webapp2.RequestHandler):
def get(self):
if (self.request.url.lower().find('dealscorcher.com') is -1 and
self.request.url.lower().find('localhost') is -1):
self.redirect('http://www.dealscorcher.com')
return

-Robert Fischer
www.DealScorcher.com



On Sun, Aug 19, 2012 at 8:14 PM, Robert Fischer  wrote:

> Hi Omne,
>
> I was trying to say you can check the 
> url
>  of
> the 
> Requestobject
>  to generate a redirect from
> appid.appspot.com to whatever your domain is.
>
> Here's a quick snippet of code you can put at the beginning of your
> HomepageHandler's get method. It will redirect all *.appspot.com urls to
> your appid. I added my local address to my development server as well so I
> can still run the devserver.
>
> class HomepageHander(webapp2.RequestHandler):
> def get(self):
> if (self.request.url.lower() is not 'http://www.dealscorcher.com'
> or
> self.request.url.lower() is not 'http://localhost:'):
> self.redirect('http://www.dealscorcher.com')
> return
>
> -Robert Fischer
> www.DealScorcher.com
>
>
>
> On Sat, Aug 18, 2012 at 10:51 PM, Raghu Kiran wrote:
>
>> Small changes to the URL's below.
>>
>> Blog link :  http://blog.recurtrix.com/**2012/08/free-hosting-for-your-**
>> web-applications.html
>>
>>
>> Google App link: http://www.recurtrix.com
>>
>> On Saturday, 18 August 2012 18:05:52 UTC+5:30, Raghu Kiran wrote:
>>>
>>> Hi Omne,
>>>
>>> Please find my answers to your questions below.
>>>
>>> Do you I have to do anything special for hosting static HTML pages?
>>> >>Nope, its far more easier, simpler and less resource consuming than
>>> servlets and JSP's.
>>>
>>> I read on the internet that with Python we should configure a file for
>>> static files, what about Eclipse?
>>> >>Yes, python does. I wrote a blog on how to do this in eclipse, the
>>> link is still under construction, I tried to make the stuff in it as simple
>>> as possible. Let me know in case you need any support.
>>> http://blog.recurtrix.com/**2012/08/host-your-static-**
>>> website-in-google-for.html
>>>
>>>
>>> I'm going to remove all unwanted files from project folders and add my
>>> website files and folders to the project and then deploy it. is this what
>>> should do?
>>> >>Yes, Thats what you have to do the blog link above should guide
>>> you with the process in detail.
>>>
>>> If I want to point my own domain to my project, should I do it before
>>> uploading the project or after it? because I noticed GAE has its own domain
>>> (appspot.com) what if I don't want that my website be available at this
>>> address too?
>>> >>You can point to your own domain. http://www.recutrix.com is one such
>>> hosted app.
>>> >>You can point it to your own domain after hosting your app.
>>> >> for the last part, I do not have a answer, please post another
>>> question for it.
>>>
>>> Best regards,
>>> Raghu
>>>
>>> On Wednesday, 15 August 2012 12:24:15 UTC+5:30, Omne wrote:

 Hi, I'm trying to host my website on GAE, it's just a few  HTML page
 and images. I downloaded the Eclipse and all its required plugins and GAE
 SDK, I think I were able to upload (deploy) a project successfully, now I
 can see an index page on myapp.appspot.com wiich says "Hello App
 Engine!".

 Now I have a few questions:
 Do you I have to do anything special for hosting static HTML pages?
 I read on the internet that with Python we should configure a file for
 static files, what about Eclipse?
 I'm going to remove all unwanted files from project folders and add my
 website files and folders to the project and then deploy it. is this what
 should do?
 If I want to point my own domain to my project, should I do it before
 uploading the project or after it? because I noticed GAE has its own domain
 (appspot.com) what if I don't want that my website be available at
 this address too?

 Thank you for your help.

>>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-appengine/-/oNEdPNjiiTIJ.
>>
>> To post to this group, send email to google-appengine@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google

Re: [google-appengine] Re: Hosting static files on GAE and using own domain.

2012-08-19 Thread Robert Fischer
Hi Omne,

I was trying to say you can check the
url
of
the 
Requestobject
to generate a redirect from
appid.appspot.com to whatever your domain is.

Here's a quick snippet of code you can put at the beginning of your
HomepageHandler's get method. It will redirect all *.appspot.com urls to
your appid. I added my local address to my development server as well so I
can still run the devserver.

class HomepageHander(webapp2.RequestHandler):
def get(self):
if (self.request.url.lower() is not 'http://www.dealscorcher.com' or
self.request.url.lower() is not 'http://localhost:'):
self.redirect('http://www.dealscorcher.com')
return

-Robert Fischer
www.DealScorcher.com



On Sat, Aug 18, 2012 at 10:51 PM, Raghu Kiran wrote:

> Small changes to the URL's below.
>
> Blog link :  http://blog.recurtrix.com/**2012/08/free-hosting-for-your-**
> web-applications.html
>
>
> Google App link: http://www.recurtrix.com
>
> On Saturday, 18 August 2012 18:05:52 UTC+5:30, Raghu Kiran wrote:
>>
>> Hi Omne,
>>
>> Please find my answers to your questions below.
>>
>> Do you I have to do anything special for hosting static HTML pages?
>> >>Nope, its far more easier, simpler and less resource consuming than
>> servlets and JSP's.
>>
>> I read on the internet that with Python we should configure a file for
>> static files, what about Eclipse?
>> >>Yes, python does. I wrote a blog on how to do this in eclipse, the link
>> is still under construction, I tried to make the stuff in it as simple as
>> possible. Let me know in case you need any support.
>> http://blog.recurtrix.com/**2012/08/host-your-static-**
>> website-in-google-for.html
>>
>>
>> I'm going to remove all unwanted files from project folders and add my
>> website files and folders to the project and then deploy it. is this what
>> should do?
>> >>Yes, Thats what you have to do the blog link above should guide you
>> with the process in detail.
>>
>> If I want to point my own domain to my project, should I do it before
>> uploading the project or after it? because I noticed GAE has its own domain
>> (appspot.com) what if I don't want that my website be available at this
>> address too?
>> >>You can point to your own domain. http://www.recutrix.com is one such
>> hosted app.
>> >>You can point it to your own domain after hosting your app.
>> >> for the last part, I do not have a answer, please post another
>> question for it.
>>
>> Best regards,
>> Raghu
>>
>> On Wednesday, 15 August 2012 12:24:15 UTC+5:30, Omne wrote:
>>>
>>> Hi, I'm trying to host my website on GAE, it's just a few  HTML page and
>>> images. I downloaded the Eclipse and all its required plugins and GAE SDK,
>>> I think I were able to upload (deploy) a project successfully, now I can
>>> see an index page on myapp.appspot.com wiich says "Hello App Engine!".
>>>
>>> Now I have a few questions:
>>> Do you I have to do anything special for hosting static HTML pages?
>>> I read on the internet that with Python we should configure a file for
>>> static files, what about Eclipse?
>>> I'm going to remove all unwanted files from project folders and add my
>>> website files and folders to the project and then deploy it. is this what
>>> should do?
>>> If I want to point my own domain to my project, should I do it before
>>> uploading the project or after it? because I noticed GAE has its own domain
>>> (appspot.com) what if I don't want that my website be available at this
>>> address too?
>>>
>>> Thank you for your help.
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/oNEdPNjiiTIJ.
>
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

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



Re: [google-appengine] may I use a wildcard certificate on level 2 domain ?

2012-08-19 Thread Cayden Meyer
Hi Mihal,

What the documentation means is you cannot get a wildcard certificate for
*.*.domain.com. In your case you could get a wildcard certificate for *.
api.example.com and that will allow you to serve
application1.api.example.com without issue. It will not however allow you
to serve path.app1.api.example.com without a certificate warning.

Hope that answers your question.

Cayden Meyer
Product Manager, Google App Engine

On 20 August 2012 10:20, Mihai  wrote:

> some of our apps (most of them ) are deployed as *
> application.api.example.com *. Will a wildcard certificate ( .*.
> api.example.com) work ? I'm asking because I find the documentation a bit
> confusing. "Wildcard certificates only support one level of subdomain."
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/JfKhP4VI1CkJ.
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

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



[google-appengine] JSTL classes in app engine

2012-08-19 Thread Gabriel Miro
According to GAE docs, jstl is provided by default, yet I'm getting the 
following error (locally):
The absolute uri: http://java.sun.com/jsp/jstl/core  cannot be resolved in 
either web.xml or the jar files deployed with this application

Looking at the App Engine SDK(1.6.5) jars in Eclipse I cannot find any 
reference to jstl classes like the if and forEach tags (IfTag and 
ForEachTag classes).
Where can I find the JSTL classes in the SDK?

Regards,
Gabriel MirĂ³

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/yWo6HSaIBUMJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] JSTL classes in 1.6.5 SDK

2012-08-19 Thread Gabriel Miro
I'm using SDK 1.6.5 and I'm currently unable to use JSTL tags because I get 
the following error:
The absolute uri: http://java.sun.com/jsp/jstl/core  cannot be resolved in 
either web.xml or the jar files deployed with this application

I took a look at the jars included in the SDK and I cannot find any 
reference to JSTL. In eclipse, If I look for the Type (Command+Shift+T) It 
cannot find any reference to IfTag and ForEachTag classes, which are part 
of the jstl jar.

According to the docs, jstl should be included by default in the SDK. Any 
idea where those classes are located?

Att,
Gabriel MirĂ³

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/wKpOzqJV1L0J.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] may I use a wildcard certificate on level 2 domain ?

2012-08-19 Thread Mihai
some of our apps (most of them ) are deployed as *application.api.example.com 
*. Will a wildcard certificate ( .*.api.example.com) work ? I'm asking 
because I find the documentation a bit confusing. "Wildcard certificates 
only support one level of subdomain." 

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/JfKhP4VI1CkJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Reminder: Cloud SQL App Engine G+ hangout on Mon., 20th Aug., at 9:30am PDT

2012-08-19 Thread Amy Unruh
Reminder - there's an App Engine G+ hangout coming up on Monday., 20th
Aug., at 9:30am Pacific time (16:30 UTC):

https://developers.google.com/live/shows/ahNzfmdvb2dsZS1kZXZlbG9wZXJzcg4LEgVFdmVudBipmLMDDA/

We'll review Cloud SQL and chat with members of the Cloud SQL team about
the newest features / tips & tricks. There will also be a Q&A session, so
please enter any questions you might have for the team in the moderator
list for this session at:
  https://www.google.com/moderator/#15/e=1faeac&t=1faeac.4a

 -Amy


On 15 August 2012 15:46, Amy Unruh  wrote:

>
> There will be an App Engine G+ hangout on Monday., 20th Aug., at 9:30am
> Pacific time (16:30 UTC).
>
> (This is not to be confused with the hangout happening tomorrow, 15th
> Aug., at 4pm PDT).
>
> The tentative topic for the upcoming Monday 20th hangout is Cloud SQL.
>
> Visit this Google Developers live event page to find the hangout when it
> starts up:
>
> https://developers.google.com/live/shows/ahNzfmdvb2dsZS1kZXZlbG9wZXJzcg4LEgVFdmVudBipmLMDDA/
> Submit questions via Google Moderator:
>   https://www.google.com/moderator/#15/e=1faeac&t=1faeac.4a
>
> Find out when the hangout starts in your time zone: http://goo.gl/3lp0d
> We hope you can join us!
>
> 
> For those tracking our hangout times, we're going to start holding them
> according to a more regular schedule -- either Wed. 4pm PDT or Monday
> 9:30am PDT, roughly alternating.  If you miss one, you can find it in the
> archives:
>   https://developers.google.com/live/cloud
>
> Track what's on each week by going to developers.google.com/live, or
> subscribing to calendar events for these hangouts here:
> http://goo.gl/GGkgx , http://goo.gl/PILq0 .
>

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



Re: [google-appengine] Is GAE good for database-heavy applications?

2012-08-19 Thread Emanuele Ziglioli

>
>
> Sounds like the blob will be in the 10s of megabytes.  I believe GAE 
> charges for bandwidth based on the pre-gzip-encoding size of requests. 
>  If you have a lot of downloads, you may wish to zip it on write and 
> deliver a zipfile download to your users, which should dramatically 
> reduce bandwidth costs. 
>
>
GAE doesn't gzip blobs > 1MB from the blobstore . To keep in mind...

https://groups.google.com/forum/?fromgroups#!topic/google-appengine/hv7QOd0ZlKM%5B1-25%5D

http://code.google.com/p/googleappengine/issues/detail?id=2820

http://code.google.com/p/googleappengine/issues/detail?id=5298

 

> The one 'gotcha' you may run into is that SSL on appengine costs $100/mo. 
>
> Jeff 
>
> On Thu, Aug 16, 2012 at 11:53 PM, Jordan Bakke 
> > 
> wrote: 
> > I'm writing a very limited-purpose web application that stores about 
> 10-20k 
> > user-submitted articles (typically 500-700 words). At any time, any user 
> > should be able to perform searches on tags and keywords, edit any part 
> of 
> > any article (metadata, text, or tags), or download a copy of the entire 
> > database that is recent up-to-the-hour. (It can be from a cache as long 
> as 
> > it is updated hourly.) Activity tends to happen in a few unpredictable 
> > spikes over a day (wherein many users download the entire database 
> > simultaneously requiring 100% availability and fast downloads) and 
> > itermittent weeks of low activity. This usage pattern is set in stone. 
> > 
> > Is GAE a wise choice for this application? It appeals to me for its low 
> cost 
> > (hopefully free), elasticity of scale, and professional management of 
> most 
> > of the stack. I like the idea of an app engine as an alternative to a 
> host. 
> > However, the excessive limitations and quotas on all manner of datastore 
> > usage concern me, as does the trade-off between strong and eventual 
> > consistency imposed by the datastore's distributed architecture. 
> > 
> > Is there a way to fit this application into GAE? Should I use the ndb 
> API 
> > instead of the plain datastore API? Or are the requirements so 
> > data-intensive that GAE is more expensive than hosts like Webfaction? 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Google App Engine" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/google-appengine/-/NZQnuJubU-sJ. 
> > To post to this group, send email to 
> > google-a...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > google-appengi...@googlegroups.com . 
> > For more options, visit this group at 
> > http://groups.google.com/group/google-appengine?hl=en. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/B6xlogJ3MmgJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: REST integration Tests with Java and Junit

2012-08-19 Thread Christopher Armstrong
Hi Alex,

Thanks for the example. This helps as I'm new to Mocking. Now I know what 
I'll be doing Monday evening :)

Kind regards,
Chris

On Sunday, August 19, 2012 10:10:34 PM UTC+2, alex wrote:
>
> I think you can do it with pretty much any mock framework, but to give you 
> an idea of what I mean in the prev. msg:
>
> ServletInputStream stream = new MockInputStream(some_bytes_or_string_data);
> request = mock(HttpServletRequest.class);
> when(request.getInputStream()).thenReturn(stream);
> when(request.getServletPath()).thenReturn(some_path);
> ...
>
> response = mock(HttpServletResponse.class);
> output = new StringWriter();
> when(response.getWriter()).thenReturn(new PrintWriter(output));
>
> - MockInputStream is really just a ServletInputStream only that it takes a 
> string (fake request data) as a constructor param.
> - mocking getWriter() is just an sample I've taken from one of our app 
> where I know it always uses getWriter(), otherwise I'd mock other methods.
>
> The above would be defined somewhere a BaseTest class, so our tests really 
> boil down to something like:
>
> public void testSomething() {
>   resp = get("/some/path?query=goes&here=too")
>   // or post(payload)
>
>   // do something with resp, 
>   // e.g. make assertions 
> }
>
> Maybe there's a better way but the idea above works pretty well for us.
>
>
> On Sunday, August 19, 2012 9:26:23 PM UTC+2, Christopher Armstrong wrote:
>>
>> Hi Alex,
>>
>> Thanks for your valuable input. I'll take a look at Mockito. 
>>
>> Kind regards,
>> Chris
>>
>> On Sunday, August 19, 2012 7:43:34 PM UTC+2, alex wrote:
>>>
>>> I never used Jersey but what we're doing in this kind of testing is 
>>> simply mocking (HttpServletRequest)request.getInputStream() and a couple 
>>> other methods  so that they would operate on payloads provided within the 
>>> unit tests or files on a disk, and (mocked) Response would write to a 
>>> string (instead of real HTTP communication). 
>>>
>>> Nice thing about this is the tests are run really fast as no external 
>>> processes (e.g. dev server) are launched during testing. Plus, Testbed is 
>>> always available  in case there's a need to check some internal states. 
>>> Also, the only external lib dependency (testing-wise) with which we mock 
>>> classes like HttpServletResponse is Mockito.
>>>
>>>
>>> On Sunday, August 19, 2012 2:54:40 PM UTC+2, Christopher Armstrong wrote:

 Hello,

 I'm currently developing an application in Java and want to use 
 AppEngine. My setup uses Jersey JSON/REST to exchange data between the 
 client and the server.

 I would like to do following in the development mode with JUnit:
 * Start AppEngine
 * Execute Tests
 * Stop AppEngine

 I have had two threads open on Stackoverflow. First thread was how I 
 can start AppEngine over Junit without spawning threads so that I can test 
 my REST resources. I have been told that this is an integration test and 
 Junit can't be used for that. I should try to test by executing the 
 methods 
 of the resource class directly. Ok, I was thinking but it is somehow funny 
 because when reading the Jersey docs they suggest exactly this. Starting a 
 webserver to test the REST resources with Junit.

 I tried then to execute the methods directly and this worked at least 
 for the getStatus() method from the Response class. But when I execute the 
 methods directly and want to use getEntity() method of the Response class 
 I 
 can't marshal the object back in to the entity class. So this isn't 
 working 
 either out of some reason and I'm unable get the created record back so 
 that I have the contents.

 Is there any best practice provided by Google to test REST interfaces 
 in an automated manner or does anybody know how to test jersey resource 
 classes properly (without curl on the command line)?

 Its nice that I'm doing it all wrong and that Junit has nothing to do 
 with Integration testing but somehow I need to test my classes. It would 
 be 
 great if somebody could give me a hint.

 Thanks,
 Chris



-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/buJYfYz-dfUJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: REST integration Tests with Java and Junit

2012-08-19 Thread alex
I think you can do it with pretty much any mock framework, but to give you 
an idea of what I mean in the prev. msg:

ServletInputStream stream = new MockInputStream(some_bytes_or_string_data);
request = mock(HttpServletRequest.class);
when(request.getInputStream()).thenReturn(stream);
when(request.getServletPath()).thenReturn(some_path);
...

response = mock(HttpServletResponse.class);
output = new StringWriter();
when(response.getWriter()).thenReturn(new PrintWriter(output));

- MockInputStream is really just a ServletInputStream only that it takes a 
string (fake request data) as a constructor param.
- mocking getWriter() is just an sample I've taken from one of our app 
where I know it always uses getWriter(), otherwise I'd mock other methods.

The above would be defined somewhere a BaseTest class, so our tests really 
boil down to something like:

public void testSomething() {
  resp = get("/some/path?query=goes&here=too")
  // or post(payload)

  // do something with resp, 
  // e.g. make assertions 
}

Maybe there's a better way but the idea above works pretty well for us.


On Sunday, August 19, 2012 9:26:23 PM UTC+2, Christopher Armstrong wrote:
>
> Hi Alex,
>
> Thanks for your valuable input. I'll take a look at Mockito. 
>
> Kind regards,
> Chris
>
> On Sunday, August 19, 2012 7:43:34 PM UTC+2, alex wrote:
>>
>> I never used Jersey but what we're doing in this kind of testing is 
>> simply mocking (HttpServletRequest)request.getInputStream() and a couple 
>> other methods  so that they would operate on payloads provided within the 
>> unit tests or files on a disk, and (mocked) Response would write to a 
>> string (instead of real HTTP communication). 
>>
>> Nice thing about this is the tests are run really fast as no external 
>> processes (e.g. dev server) are launched during testing. Plus, Testbed is 
>> always available  in case there's a need to check some internal states. 
>> Also, the only external lib dependency (testing-wise) with which we mock 
>> classes like HttpServletResponse is Mockito.
>>
>>
>> On Sunday, August 19, 2012 2:54:40 PM UTC+2, Christopher Armstrong wrote:
>>>
>>> Hello,
>>>
>>> I'm currently developing an application in Java and want to use 
>>> AppEngine. My setup uses Jersey JSON/REST to exchange data between the 
>>> client and the server.
>>>
>>> I would like to do following in the development mode with JUnit:
>>> * Start AppEngine
>>> * Execute Tests
>>> * Stop AppEngine
>>>
>>> I have had two threads open on Stackoverflow. First thread was how I can 
>>> start AppEngine over Junit without spawning threads so that I can test my 
>>> REST resources. I have been told that this is an integration test and Junit 
>>> can't be used for that. I should try to test by executing the methods of 
>>> the resource class directly. Ok, I was thinking but it is somehow funny 
>>> because when reading the Jersey docs they suggest exactly this. Starting a 
>>> webserver to test the REST resources with Junit.
>>>
>>> I tried then to execute the methods directly and this worked at least 
>>> for the getStatus() method from the Response class. But when I execute the 
>>> methods directly and want to use getEntity() method of the Response class I 
>>> can't marshal the object back in to the entity class. So this isn't working 
>>> either out of some reason and I'm unable get the created record back so 
>>> that I have the contents.
>>>
>>> Is there any best practice provided by Google to test REST interfaces in 
>>> an automated manner or does anybody know how to test jersey resource 
>>> classes properly (without curl on the command line)?
>>>
>>> Its nice that I'm doing it all wrong and that Junit has nothing to do 
>>> with Integration testing but somehow I need to test my classes. It would be 
>>> great if somebody could give me a hint.
>>>
>>> Thanks,
>>> Chris
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/RhQO5CW_G6sJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: REST integration Tests with Java and Junit

2012-08-19 Thread Christopher Armstrong
Hi Alex,

Thanks for your valuable input. I'll take a look at Mockito. 

Kind regards,
Chris

On Sunday, August 19, 2012 7:43:34 PM UTC+2, alex wrote:
>
> I never used Jersey but what we're doing in this kind of testing is simply 
> mocking (HttpServletRequest)request.getInputStream() and a couple other 
> methods  so that they would operate on payloads provided within the unit 
> tests or files on a disk, and (mocked) Response would write to a string 
> (instead of real HTTP communication). 
>
> Nice thing about this is the tests are run really fast as no external 
> processes (e.g. dev server) are launched during testing. Plus, Testbed is 
> always available  in case there's a need to check some internal states. 
> Also, the only external lib dependency (testing-wise) with which we mock 
> classes like HttpServletResponse is Mockito.
>
>
> On Sunday, August 19, 2012 2:54:40 PM UTC+2, Christopher Armstrong wrote:
>>
>> Hello,
>>
>> I'm currently developing an application in Java and want to use 
>> AppEngine. My setup uses Jersey JSON/REST to exchange data between the 
>> client and the server.
>>
>> I would like to do following in the development mode with JUnit:
>> * Start AppEngine
>> * Execute Tests
>> * Stop AppEngine
>>
>> I have had two threads open on Stackoverflow. First thread was how I can 
>> start AppEngine over Junit without spawning threads so that I can test my 
>> REST resources. I have been told that this is an integration test and Junit 
>> can't be used for that. I should try to test by executing the methods of 
>> the resource class directly. Ok, I was thinking but it is somehow funny 
>> because when reading the Jersey docs they suggest exactly this. Starting a 
>> webserver to test the REST resources with Junit.
>>
>> I tried then to execute the methods directly and this worked at least for 
>> the getStatus() method from the Response class. But when I execute the 
>> methods directly and want to use getEntity() method of the Response class I 
>> can't marshal the object back in to the entity class. So this isn't working 
>> either out of some reason and I'm unable get the created record back so 
>> that I have the contents.
>>
>> Is there any best practice provided by Google to test REST interfaces in 
>> an automated manner or does anybody know how to test jersey resource 
>> classes properly (without curl on the command line)?
>>
>> Its nice that I'm doing it all wrong and that Junit has nothing to do 
>> with Integration testing but somehow I need to test my classes. It would be 
>> great if somebody could give me a hint.
>>
>> Thanks,
>> Chris
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/QUSbaf8biHgJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: REST integration Tests with Java and Junit

2012-08-19 Thread alex
I never used Jersey but what we're doing in this kind of testing is simply 
mocking (HttpServletRequest)request.getInputStream() and a couple other 
methods  so that they would operate on payloads provided within the unit 
tests or files on a disk, and (mocked) Response would write to a string 
(instead of real HTTP communication). 

Nice thing about this is the tests are run really fast as no external 
processes (e.g. dev server) are launched during testing. Plus, Testbed is 
always available  in case there's a need to check some internal states. 
Also, the only external lib dependency (testing-wise) with which we mock 
classes like HttpServletResponse is Mockito.


On Sunday, August 19, 2012 2:54:40 PM UTC+2, Christopher Armstrong wrote:
>
> Hello,
>
> I'm currently developing an application in Java and want to use AppEngine. 
> My setup uses Jersey JSON/REST to exchange data between the client and the 
> server.
>
> I would like to do following in the development mode with JUnit:
> * Start AppEngine
> * Execute Tests
> * Stop AppEngine
>
> I have had two threads open on Stackoverflow. First thread was how I can 
> start AppEngine over Junit without spawning threads so that I can test my 
> REST resources. I have been told that this is an integration test and Junit 
> can't be used for that. I should try to test by executing the methods of 
> the resource class directly. Ok, I was thinking but it is somehow funny 
> because when reading the Jersey docs they suggest exactly this. Starting a 
> webserver to test the REST resources with Junit.
>
> I tried then to execute the methods directly and this worked at least for 
> the getStatus() method from the Response class. But when I execute the 
> methods directly and want to use getEntity() method of the Response class I 
> can't marshal the object back in to the entity class. So this isn't working 
> either out of some reason and I'm unable get the created record back so 
> that I have the contents.
>
> Is there any best practice provided by Google to test REST interfaces in 
> an automated manner or does anybody know how to test jersey resource 
> classes properly (without curl on the command line)?
>
> Its nice that I'm doing it all wrong and that Junit has nothing to do with 
> Integration testing but somehow I need to test my classes. It would be 
> great if somebody could give me a hint.
>
> Thanks,
> Chris
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/rKA7R40RZHoJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] Re: Instances/Java go crazy

2012-08-19 Thread Jeff Schnitzer
On Sun, Aug 19, 2012 at 4:47 AM, alex  wrote:
>
>> Nothing in the datastore can change faster than once per second;
>
> is true only in case of a single entity group. So, you're better off reading
> official docs.

Perhaps I wasn't clear enough - that's my entire point.  No _single
thing_ in the datastore can change faster than once per second.  In
the case of rapidly mutating data, this is a problem. Aggregations in
particular, because if you aggregate 100 things mutating once per
second, the aggregation has to mutate 100 times per second.

Thus: "Apps with a lot of rapidly mutating aggregation are hard."

This is not to say that you should not read the official docs.  You
definitely should.  But some walls are not obvious until you slam your
head into them a few times.

Jeff

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



[google-appengine] REST integration Tests with Java and Junit

2012-08-19 Thread Christopher Armstrong
Hello,

I'm currently developing an application in Java and want to use AppEngine. 
My setup uses Jersey JSON/REST to exchange data between the client and the 
server.

I would like to do following in the development mode with JUnit:
* Start AppEngine
* Execute Tests
* Stop AppEngine

I have had two threads open on Stackoverflow. First thread was how I can 
start AppEngine over Junit without spawning threads so that I can test my 
REST resources. I have been told that this is an integration test and Junit 
can't be used for that. I should try to test by executing the methods of 
the resource class directly. Ok, I was thinking but it is somehow funny 
because when reading the Jersey docs they suggest exactly this. Starting a 
webserver to test the REST resources with Junit.

I tried then to execute the methods directly and this worked at least for 
the getStatus() method from the Response class. But when I execute the 
methods directly and want to use getEntity() method of the Response class I 
can't marshal the object back in to the entity class. So this isn't working 
either out of some reason and I'm unable get the created record back so 
that I have the contents.

Is there any best practice provided by Google to test REST interfaces in an 
automated manner or does anybody know how to test jersey resource classes 
properly (without curl on the command line)?

Its nice that I'm doing it all wrong and that Junit has nothing to do with 
Integration testing but somehow I need to test my classes. It would be 
great if somebody could give me a hint.

Thanks,
Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/ypx7-KgtrlkJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] Re: Instances/Java go crazy

2012-08-19 Thread alex
@pphalen just remember, you're reading replies from other developers, which 
are often biased (e.g. to a specific programming language) or coming from a 
different background; others wear mermaid costume; etc.

For instance,

> Nothing in the datastore can change faster than once per second;

is true *only* in case of a single entity group. So, you're better off 
reading official docs.

What I'm saying is, you'll find a lot of posts in this forum that are more 
like personal opinions of single developers (even when they scream "app 
engine is broken" sending you a bunch of charts that somehow are supposed 
to confirm that). So you should treat it as such, and not as an "absolute 
truth" unless you trust the guy or this is a google employee who really 
knows what she's talking about.


On Sunday, August 19, 2012 3:58:24 AM UTC+2, Jeff Schnitzer wrote:
>
> On Sat, Aug 18, 2012 at 8:59 PM, pphalen > 
> wrote: 
> >> Apps with a lot of rapidly mutating aggregation are hard. 
> > 
> > Hi, I'm new to app engine, so this is news to me. Could you please 
> > characterize a bit more? E.g., what is "a lot"? 
>
> Nothing in the datastore can change faster than once per second; 
> imagine trying to keep a count of products sold when you're selling 
> hundreds per second.  Sharding helps but it becomes tricky to get the 
> value in a timely manner when you get to hundreds of shards.  If you 
> need a transactionally accurate count (say, you are selling N units 
> and you must not sell N+1 units) this becomes even harder - you have 
> to go out of the datastore to another tool like memcache increment(). 
>
> There are other data storage technologies that are optimized for rapid 
> updates to atomic data.  Redis, Mongo, and of course traditional 
> RDBMSes solve this problem pretty easily for most typical scaling 
> needs.  There isn't an equivalent tool in the GAE toolbox.  This 
> doesn't mean you can't use GAE even if your app does some of this 
> aggregation... but if you do a lot of it, the platform works against 
> you rather than for you. 
>
> Jeff 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/nD2WS0E_Vo8J.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.