Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Side by Side Diff: impl/dummy/dummy.go

Issue 1285703002: Add testable interface for datastore. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fixes after Raw change Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « filter/count/rds.go ('k') | impl/memory/datastore.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package dummy 5 package dummy
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "runtime" 9 "runtime"
10 "strings" 10 "strings"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 func (ds) GetMulti([]datastore.Key, datastore.MultiMetaGetter, datastore.GetMult iCB) error { 74 func (ds) GetMulti([]datastore.Key, datastore.MultiMetaGetter, datastore.GetMult iCB) error {
75 panic(ni()) 75 panic(ni())
76 } 76 }
77 func (ds) DeleteMulti([]datastore.Key, datastore.DeleteMultiCB) error { panic(ni ()) } 77 func (ds) DeleteMulti([]datastore.Key, datastore.DeleteMultiCB) error { panic(ni ()) }
78 func (ds) NewQuery(string) datastore.Query { panic(ni ()) } 78 func (ds) NewQuery(string) datastore.Query { panic(ni ()) }
79 func (ds) Run(datastore.Query, datastore.RawRunCB) error { panic(ni ()) } 79 func (ds) Run(datastore.Query, datastore.RawRunCB) error { panic(ni ()) }
80 func (ds) RunInTransaction(func(context.Context) error, *datastore.TransactionOp tions) error { 80 func (ds) RunInTransaction(func(context.Context) error, *datastore.TransactionOp tions) error {
81 panic(ni()) 81 panic(ni())
82 } 82 }
83 func (ds) Testable() datastore.Testable { return nil }
83 84
84 var dummyDSInst = ds{} 85 var dummyDSInst = ds{}
85 86
86 // Datastore returns a dummy datastore.RawInterface implementation suitable 87 // Datastore returns a dummy datastore.RawInterface implementation suitable
87 // for embedding. Every method panics with a message containing the name of the 88 // for embedding. Every method panics with a message containing the name of the
88 // method which was unimplemented. 89 // method which was unimplemented.
89 func Datastore() datastore.RawInterface { return dummyDSInst } 90 func Datastore() datastore.RawInterface { return dummyDSInst }
90 91
91 /////////////////////////////////// mc //////////////////////////////////// 92 /////////////////////////////////// mc ////////////////////////////////////
92 93
(...skipping 17 matching lines...) Expand all
110 func Memcache() memcache.RawInterface { return dummyMCInst } 111 func Memcache() memcache.RawInterface { return dummyMCInst }
111 112
112 /////////////////////////////////// tq //////////////////////////////////// 113 /////////////////////////////////// tq ////////////////////////////////////
113 114
114 type tq struct{} 115 type tq struct{}
115 116
116 func (tq) AddMulti([]*taskqueue.Task, string, taskqueue.RawTaskCB) error { panic (ni()) } 117 func (tq) AddMulti([]*taskqueue.Task, string, taskqueue.RawTaskCB) error { panic (ni()) }
117 func (tq) DeleteMulti([]*taskqueue.Task, string, taskqueue.RawCB) error { panic (ni()) } 118 func (tq) DeleteMulti([]*taskqueue.Task, string, taskqueue.RawCB) error { panic (ni()) }
118 func (tq) Purge(string) error { panic (ni()) } 119 func (tq) Purge(string) error { panic (ni()) }
119 func (tq) Stats([]string, taskqueue.RawStatsCB) error { panic (ni()) } 120 func (tq) Stats([]string, taskqueue.RawStatsCB) error { panic (ni()) }
120 func (tq) Testable() taskqueue.Testable { panic (ni()) } 121 func (tq) Testable() taskqueue.Testable { retur n nil }
121 122
122 var dummyTQInst = tq{} 123 var dummyTQInst = tq{}
123 124
124 // TaskQueue returns a dummy taskqueue.RawInterface implementation suitable for 125 // TaskQueue returns a dummy taskqueue.RawInterface implementation suitable for
125 // embedding. Every method panics with a message containing the name of the 126 // embedding. Every method panics with a message containing the name of the
126 // method which was unimplemented. 127 // method which was unimplemented.
127 func TaskQueue() taskqueue.RawInterface { return dummyTQInst } 128 func TaskQueue() taskqueue.RawInterface { return dummyTQInst }
128 129
129 /////////////////////////////////// i //////////////////////////////////// 130 /////////////////////////////////// i ////////////////////////////////////
130 131
(...skipping 18 matching lines...) Expand all
149 func (i) IsCapabilityDisabled(err error) bool { panic(ni()) } 150 func (i) IsCapabilityDisabled(err error) bool { panic(ni()) }
150 func (i) IsOverQuota(err error) bool { panic(ni()) } 151 func (i) IsOverQuota(err error) bool { panic(ni()) }
151 func (i) IsTimeoutError(err error) bool { panic(ni()) } 152 func (i) IsTimeoutError(err error) bool { panic(ni()) }
152 153
153 var dummyInfoInst = i{} 154 var dummyInfoInst = i{}
154 155
155 // Info returns a dummy info.Interface implementation suitable for embedding. 156 // Info returns a dummy info.Interface implementation suitable for embedding.
156 // Every method panics with a message containing the name of the method which 157 // Every method panics with a message containing the name of the method which
157 // was unimplemented. 158 // was unimplemented.
158 func Info() info.Interface { return dummyInfoInst } 159 func Info() info.Interface { return dummyInfoInst }
OLDNEW
« no previous file with comments | « filter/count/rds.go ('k') | impl/memory/datastore.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698