2014-10-17 16 views
-2

我已經下載了谷歌應用程序引擎的源代碼,我想改變的一些方法的行爲(例如,DatastoreService.put(Entity e))本example使用:如何構建Google App Enging Java SDK?

import com.google.appengine.api.datastore.DatastoreService; 
import com.google.appengine.api.datastore.DatastoreServiceFactory; 
import com.google.appengine.api.datastore.Entity; 
import static com.google.appengine.api.datastore.FetchOptions.Builder.withLimit; 
import com.google.appengine.api.datastore.Query; 
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig; 
import com.google.appengine.tools.development.testing.LocalServiceTestHelper; 

import org.junit.After; 
import org.junit.Before; 
import org.junit.Test; 
import static org.junit.Assert.*; 

public class LocalDatastoreTest { 

    private final LocalServiceTestHelper helper = 
     new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()); 

    @Before 
    public void setUp() { 
     helper.setUp(); 
    } 

    @After 
    public void tearDown() { 
     helper.tearDown(); 
    } 

    // run this test twice to prove we're not leaking any state across tests 
    private void doTest() { 
     DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); 
     assertEquals(0, ds.prepare(new Query("yam")).countEntities(withLimit(10))); 
     ds.put(new Entity("yam")); 
     ds.put(new Entity("yam")); 
     assertEquals(2, ds.prepare(new Query("yam")).countEntities(withLimit(10))); 
    } 

    @Test 
    public void testInsert1() { 
     doTest(); 
    } 

    @Test 
    public void testInsert2() { 
     doTest(); 
    } 
} 

的問題是,我沒有看到隨源代碼提供的build.xml文件對源文件進行編譯。例如,當我向其中一個源文件添加一些垃圾並嘗試使用ant dist構建SDK時,它將返回BUILD SUCCESSFUL而不是編譯時錯誤。

任何想法在哪裏可以找到put(Entity e)方法的源文件?以及如何編譯源代碼?

回答

0

您無法對App Engine SDK進行任何更改。 SDK公開了與App Engine及其數據存儲的內部操作直接相關並依賴於其的方法。您不應該從源代碼中單獨編譯SDK。

+0

但是,爲什麼他們首先共享源代碼? – Tato 2014-10-18 01:03:16

+0

在某些情況下,查看內部並瞭解正在發生的情況可能會有所幫助。社區還可以幫助修復錯誤或提出改進建議。 – 2014-10-18 14:51:41

相關問題