My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
LocalServiceTestHelperConfig  
Example LocalServiceTestHelper config for using in tests.
Updated Jul 19, 2010 by 403...@gmail.com

Introduction

For correct testing you should use correctly created LocalServiceTestHelper. Here example.

Details

    private final LocalServiceTestHelper helper =
        (new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig(),
        			    new LocalTaskQueueTestConfig(),
        			    new LocalMemcacheServiceTestConfig())
        							{
          @Override
          protected LocalServerEnvironment newLocalServerEnvironment() {
            final LocalServerEnvironment lse =
super.newLocalServerEnvironment();
            return new LocalServerEnvironment() {

              public File getAppDir() {
                return new File("C:\\pathtoprojectfolder\\war\\");
              }

              public String getAddress() {
                return lse.getAddress();
              }

              public int getPort() {
                return lse.getPort();
              }

              public void waitForServerToStart() throws InterruptedException
              {
                lse.waitForServerToStart();
              }
            };
          }
        }).setEnvIsAdmin(true).setEnvIsLoggedIn(true); 	

Sign in to add a comment
Powered by Google Project Hosting