java - 如何在本地检查或查看使用 gcloud 数据存储存储的数据?
问题描述
我有以下单元测试
public void testStoreGroceryList() {
Grocery beer = new Grocery("Beer", 10);
GroceryList groceryList = new GroceryList();
groceryList.addGrocery(beer);
Grocery bread = new Grocery("Bread", 1);
groceryList.addGrocery(bread);
assert(groceryList.getNumberOfGroceries() > 0);
ofy().save().entity(groceryList).now();
assert(groceryList.id != null);
}
我在执行测试时正在运行 glcoud 模拟器,一切正常,没有失败的测试。但是如何访问本地数据存储?我的模拟器在端口 8484 上运行,但http://localhost:8484/_ah/admin给了我Not Found
如果我运行 mvn appengine:run 我看到数据存储可供我使用,但是如何在运行单元测试时访问它以查看我存储的数据的样子?
我已经跑gcloud beta emulators datastore env-init
了,得到了
export DATASTORE_DATASET=grocery-monkey
export DATASTORE_EMULATOR_HOST=localhost:8484
export DATASTORE_EMULATOR_HOST_PATH=localhost:8484/datastore
export DATASTORE_HOST=http://localhost:8484
export DATASTORE_PROJECT_ID=grocery-monkey
但我仍然无法访问 _ah/admin
解决方案
推荐阅读
- ffmpeg - FFprobe 输出中的“has_b_frames”是什么意思?
- highcharts - Highmaps 钻取和不一致样式的工具提示?
- php - php发送的电子邮件标题中的特殊字符
- java - 配置 log4j2 为不同的包有不同的日志级别
- javascript - 我怎样才能在这里触发 popstate 事件?
- swift - 有人可以帮我阻止 arc4random 生成的数字再次出现吗?
- python - 您可以使用 Twitter API 查询的每个帐户的推文是否有时间限制?
- html - 如何使用引导 css 制作导航项?
- grafana - Grafana 中按天分组的 InfluxDB 数据移动了一天
- google-sheets - 根据输入在 Google 表格中创建动态列表