Package net.kindleit.gae.example.server

Source Code of net.kindleit.gae.example.server.LocalServiceTest

package net.kindleit.gae.example.server;

import java.io.File;

import com.google.appengine.tools.development.ApiProxyLocalImpl;
import com.google.apphosting.api.ApiProxy;
import com.google.apphosting.api.MockEnvironment;

/**
* Performs basic {@link ApiProxy} setUp/tearDown, as described <a
* href="http://code.google.com/appengine/docs/java/howto/unittesting.html">here</a>.
*
* @author androns
*/
public abstract class LocalServiceTest {

  /**
   * Sets up {@link ApiProxy} with {@link MockEnvironment} and
   * {@link ApiProxyLocalImpl}.
   */
  public void setUp() {
    ApiProxy.setEnvironmentForCurrentThread(new MockEnvironment());
    ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")) {
      // nothing here
    });
  }

  /**
   * Tears down {@link ApiProxy}.
   */
  public void tearDown() {

    // not strictly necessary to null these out but there's no harm either
    ApiProxy.setDelegate(null);
    ApiProxy.setEnvironmentForCurrentThread(null);
  }

}
TOP

Related Classes of net.kindleit.gae.example.server.LocalServiceTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.