Index: filter/count/count_test.go |
diff --git a/filter/count/count_test.go b/filter/count/count_test.go |
index 08f2b2fa1bbea2c1fe1a7f20c706a9b2bad2adcb..a5205db46e60382a76636245639660146e7963e5 100644 |
--- a/filter/count/count_test.go |
+++ b/filter/count/count_test.go |
@@ -10,9 +10,9 @@ import ( |
"github.com/luci/gae/filter/featureBreaker" |
"github.com/luci/gae/impl/memory" |
+ "github.com/luci/gae/service/datastore" |
"github.com/luci/gae/service/info" |
"github.com/luci/gae/service/memcache" |
- "github.com/luci/gae/service/rawdatastore" |
"github.com/luci/gae/service/taskqueue" |
. "github.com/smartystreets/goconvey/convey" |
"golang.org/x/net/context" |
@@ -21,11 +21,11 @@ import ( |
func TestCount(t *testing.T) { |
t.Parallel() |
- pnil := func(_ rawdatastore.Key, err error) { |
+ pnil := func(_ datastore.Key, err error) { |
So(err, ShouldBeNil) |
} |
- gnil := func(_ rawdatastore.PropertyMap, err error) { |
+ gnil := func(_ datastore.PropertyMap, err error) { |
So(err, ShouldBeNil) |
} |
@@ -36,32 +36,32 @@ func TestCount(t *testing.T) { |
So(c, ShouldNotBeNil) |
So(ctr, ShouldNotBeNil) |
- rds := rawdatastore.Get(c) |
+ ds := datastore.Get(c) |
- Convey("Calling a rds function should reflect in counter", func() { |
- p := rawdatastore.Property{} |
+ Convey("Calling a ds function should reflect in counter", func() { |
+ p := datastore.Property{} |
p.SetValue(100, false) |
- keys := []rawdatastore.Key{rds.NewKey("Kind", "", 0, nil)} |
- vals := []rawdatastore.PropertyLoadSaver{&rawdatastore.PropertyMap{"Val": {p}}} |
+ keys := []datastore.Key{ds.NewKey("Kind", "", 0, nil)} |
+ vals := []datastore.PropertyLoadSaver{&datastore.PropertyMap{"Val": {p}}} |
- So(rds.PutMulti(keys, vals, pnil), ShouldBeNil) |
+ So(ds.PutMulti(keys, vals, pnil), ShouldBeNil) |
So(ctr.NewKey.Successes, ShouldEqual, 1) |
So(ctr.PutMulti.Successes, ShouldEqual, 1) |
Convey("effects are cumulative", func() { |
- So(rds.PutMulti(keys, vals, pnil), ShouldBeNil) |
+ So(ds.PutMulti(keys, vals, pnil), ShouldBeNil) |
So(ctr.PutMulti.Successes, ShouldEqual, 2) |
Convey("even within transactions", func() { |
- root := rds.NewKey("Root", "", 1, nil) |
- rds.RunInTransaction(func(c context.Context) error { |
- rds := rawdatastore.Get(c) |
- keys := []rawdatastore.Key{ |
- rds.NewKey("Kind", "hi", 0, root), |
- rds.NewKey("Kind", "there", 0, root), |
+ root := ds.NewKey("Root", "", 1, nil) |
+ ds.RunInTransaction(func(c context.Context) error { |
+ ds := datastore.Get(c) |
+ keys := []datastore.Key{ |
+ ds.NewKey("Kind", "hi", 0, root), |
+ ds.NewKey("Kind", "there", 0, root), |
} |
vals = append(vals, vals[0]) |
- So(rds.PutMulti(keys, vals, pnil), ShouldBeNil) |
+ So(ds.PutMulti(keys, vals, pnil), ShouldBeNil) |
return nil |
}, nil) |
}) |
@@ -69,23 +69,23 @@ func TestCount(t *testing.T) { |
}) |
Convey("errors count against errors", func() { |
- keys := []rawdatastore.Key{rds.NewKey("Kind", "", 1, nil)} |
- vals := []rawdatastore.PropertyLoadSaver{&rawdatastore.PropertyMap{"Val": {{}}}} |
+ keys := []datastore.Key{ds.NewKey("Kind", "", 1, nil)} |
+ vals := []datastore.PropertyLoadSaver{&datastore.PropertyMap{"Val": {{}}}} |
fb.BreakFeatures(nil, "GetMulti") |
- rds.GetMulti(keys, gnil) |
+ ds.GetMulti(keys, gnil) |
So(ctr.GetMulti.Errors, ShouldEqual, 1) |
fb.UnbreakFeatures("GetMulti") |
- err := rds.PutMulti(keys, vals, func(k rawdatastore.Key, err error) { |
+ err := ds.PutMulti(keys, vals, func(k datastore.Key, err error) { |
keys[0] = k |
So(err, ShouldBeNil) |
}) |
So(err, ShouldBeNil) |
- rds.GetMulti(keys, gnil) |
+ ds.GetMulti(keys, gnil) |
So(ctr.GetMulti.Errors, ShouldEqual, 1) |
So(ctr.GetMulti.Successes, ShouldEqual, 1) |
So(ctr.GetMulti.Total(), ShouldEqual, 2) |
@@ -142,17 +142,17 @@ func ExampleFilterRDS() { |
// Apply the counter.FilterRDS |
c, counter := FilterRDS(c) |
- // functions use RDS from the context like normal... they don't need to know |
+ // functions use ds from the context like normal... they don't need to know |
// that there are any filters at all. |
someCalledFunc := func(c context.Context) { |
- rds := rawdatastore.Get(c) |
- key := rds.NewKey("Kind", "", 1, nil) |
- prop := rawdatastore.Property{} |
+ ds := datastore.Get(c) |
+ key := ds.NewKey("Kind", "", 1, nil) |
+ prop := datastore.Property{} |
prop.SetValue(100, false) |
- val := rawdatastore.PropertyMap{ |
+ val := datastore.PropertyMap{ |
"FieldName": {prop}, |
} |
- rds.PutMulti([]rawdatastore.Key{key}, []rawdatastore.PropertyLoadSaver{&val}, nil) |
+ ds.PutMulti([]datastore.Key{key}, []datastore.PropertyLoadSaver{&val}, nil) |
} |
// Using the other function. |