/** * Sets up the GAE simulation. */ public void setup() { synchronized (this) { System.out.println("Setting up GAE simulation"); LocalTaskQueueTestConfig localTasks = new LocalTaskQueueTestConfig(); localTasks.setQueueXmlPath(QUEUE_XML_PATH); LocalUserServiceTestConfig localUserServices = new LocalUserServiceTestConfig(); LocalDatastoreServiceTestConfig localDatastore = new LocalDatastoreServiceTestConfig(); LocalMailServiceTestConfig localMail = new LocalMailServiceTestConfig(); LocalSearchServiceTestConfig localSearch = new LocalSearchServiceTestConfig(); localSearch.setPersistent(false); LocalModulesServiceTestConfig localModules = new LocalModulesServiceTestConfig(); LocalLogServiceTestConfig localLog = new LocalLogServiceTestConfig(); helper = new LocalServiceTestHelper(localDatastore, localMail, localUserServices, localTasks, localSearch, localModules, localLog); helper.setEnvAttributes(getEnvironmentAttributesWithApplicationHostname()); helper.setUp(); sc = new ServletRunner().newClient(); } }
private UserInfo loginUser(String userId, boolean isAdmin) { helper.setEnvIsLoggedIn(true); helper.setEnvEmail(userId); helper.setEnvAuthDomain("gmail.com"); helper.setEnvIsAdmin(isAdmin); return gateKeeper.getCurrentUser(); }
/** * Logs the current user out of the GAE simulation environment. */ public void logoutUser() { helper.setEnvIsLoggedIn(false); helper.setEnvIsAdmin(false); }
@BeforeClass public void setUpGae() { helper.setEnvAttributes(GaeSimulation.getEnvironmentAttributesWithApplicationHostname()); helper.setUp(); }
public void toRunBeforeTest() { helper.setUp(); tearDownAccepter.addTearDown( new TearDown() { public void tearDown() throws Exception { helper.tearDown(); } } ); } };
@AfterClass public void tearDownGae() { helper.tearDown(); }
@BeforeMethod void setupApiProxy() { LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig()); helper.setUp(); }
public UserServiceEnvironment() { construct( new LocalServiceTestHelper( config ) ); } }
public void setUp() { helper = new LocalServiceTestHelper().setEnvAppId("exampleAppId"); helper.setUp(); service = DatastoreServiceFactory.getDatastoreService(); }
private void helperLoggout() { helper.setEnvIsLoggedIn(false); }
private static void testServerCallBack() { LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()); helper.setUp(); Contacts contacts = new Contacts("this is", "awesome"); greetingServiceImpl.saveContact(contacts);//line:14 }
/** * Tears down the GAE simulation. */ public void tearDown() { try { if (helper != null) { helper.tearDown(); } } catch (Exception e) { //TODO: eliminate this exception System.out.println("Ignoring exception during teardown..."); } }
@BeforeMethod public void setupApiProxy() { LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig()); helper.setUp(); }
public FileServiceEnvironment() { construct( new LocalServiceTestHelper( config ) ); } }
public void logout() { helper.setEnvIsLoggedIn(false); }
public class PersistenceTestHelper { private LocalServiceTestHelper appEngineHelper; @Before public void setUp() throws Exception { LocalDatastoreServiceTestConfig dsConfig = new LocalDatastoreServiceTestConfig(); dsConfig.setNoIndexAutoGen(false); appEngineHelper = new LocalServiceTestHelper(dsConfig); appEngineHelper.setUp(); ... } @After public void tearDown() throws Exception { // appEngineHelper.tearDown(); } }
@Override public void tearDown() { helper.tearDown(); }
protected void disableMemcache() { // See // http://www.ensor.cc/2010/11/unit-testing-named-queues-spring.html // NOTE: THE QUEUE XML PATH RELATIVE TO WEB APP ROOT, More info // below // http://stackoverflow.com/questions/11197058/testing-non-default-app-engine-task-queues final LocalTaskQueueTestConfig localTaskQueueConfig = new LocalTaskQueueTestConfig() .setDisableAutoTaskExecution(false).setQueueXmlPath("src/test/resources/queue.xml") .setTaskExecutionLatch(countdownLatch).setCallbackClass(DeleteShardedCounterDeferredCallback.class); Capability testOne = new Capability("memcache"); CapabilityStatus testStatus = CapabilityStatus.DISABLED; // Initialize LocalCapabilitiesServiceTestConfig capabilityStatusConfig = new LocalCapabilitiesServiceTestConfig() .setCapabilityStatus(testOne, testStatus); // Use a different queue.xml for testing purposes helper = new LocalServiceTestHelper( new LocalDatastoreServiceTestConfig().setDefaultHighRepJobPolicyUnappliedJobPercentage(0.01f), new LocalMemcacheServiceTestConfig(), localTaskQueueConfig, capabilityStatusConfig); helper.setUp(); }