user1480330
user1480330

Reputation: 1

google app engine - running command prompt

I am Using GAE and java with JDO . I have the server side code and would like to run it from command prompt, rather than initiating from a browser (as its tedious to debug server side code by running the browser every time), but how do I do that ?, what would be the starting point (start a PersistenceManager, request thru port 8888 ) ?. I am looking for some guidance.

Following is my server side code, optimize is the method i would like to call from command line, where it needs to get data from the local app engine

@SuppressWarnings("serial")
public class OptimizerServiceImpl extends RemoteServiceServlet implements
    OptimizerService {


  public static void main(String args[])
  {
    System.out.println("comes in: ");
        optimize();

  }

  public String optimize(ModelRunDTO moDto)  
  {
        PersistenceManager pm = PMF.get().getPersistenceManager();
            Data data  = pm.getData(); // gets the data thru pm


     // all my logic goes here......

  }

Thanks alot.

Upvotes: 0

Views: 1471

Answers (2)

Dan Holevoet
Dan Holevoet

Reputation: 9183

To supplement Peter's answer above, if you're just trying to test and debug your code, you may want to use a unit test. This document explains local unit testing for Java App Engine. In particular, you'll be interested in writing datastore tests, which uses an in-memory implementation of the datastore (and flushes the contents between tests). Because these tests are based on JUnit, you can run them from the command line, or through the IDE of your choice.

Upvotes: 1

Peter Knego
Peter Knego

Reputation: 80340

The only way to invoke anything on GAE is via a HTTP request. You can make HTTP requets from command line (OS-specific), for example

wget http://yourapp.appspot.com/path

Upvotes: 0

Related Questions