OLD | NEW |
| (Empty) |
1 library googleapis_beta.ml.v1beta1.test; | |
2 | |
3 import "dart:core" as core; | |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | |
6 import "dart:convert" as convert; | |
7 | |
8 import 'package:http/http.dart' as http; | |
9 import 'package:http/testing.dart' as http_testing; | |
10 import 'package:unittest/unittest.dart' as unittest; | |
11 | |
12 import 'package:googleapis_beta/ml/v1beta1.dart' as api; | |
13 | |
14 class HttpServerMock extends http.BaseClient { | |
15 core.Function _callback; | |
16 core.bool _expectJson; | |
17 | |
18 void register(core.Function callback, core.bool expectJson) { | |
19 _callback = callback; | |
20 _expectJson = expectJson; | |
21 } | |
22 | |
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | |
24 if (_expectJson) { | |
25 return request.finalize() | |
26 .transform(convert.UTF8.decoder) | |
27 .join('') | |
28 .then((core.String jsonString) { | |
29 if (jsonString.isEmpty) { | |
30 return _callback(request, null); | |
31 } else { | |
32 return _callback(request, convert.JSON.decode(jsonString)); | |
33 } | |
34 }); | |
35 } else { | |
36 var stream = request.finalize(); | |
37 if (stream == null) { | |
38 return _callback(request, []); | |
39 } else { | |
40 return stream.toBytes().then((data) { | |
41 return _callback(request, data); | |
42 }); | |
43 } | |
44 } | |
45 } | |
46 } | |
47 | |
48 http.StreamedResponse stringResponse( | |
49 core.int status, core.Map headers, core.String body) { | |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | |
51 return new http.StreamedResponse(stream, status, headers: headers); | |
52 } | |
53 | |
54 core.int buildCounterGoogleApiHttpBody = 0; | |
55 buildGoogleApiHttpBody() { | |
56 var o = new api.GoogleApiHttpBody(); | |
57 buildCounterGoogleApiHttpBody++; | |
58 if (buildCounterGoogleApiHttpBody < 3) { | |
59 o.contentType = "foo"; | |
60 o.data = "foo"; | |
61 } | |
62 buildCounterGoogleApiHttpBody--; | |
63 return o; | |
64 } | |
65 | |
66 checkGoogleApiHttpBody(api.GoogleApiHttpBody o) { | |
67 buildCounterGoogleApiHttpBody++; | |
68 if (buildCounterGoogleApiHttpBody < 3) { | |
69 unittest.expect(o.contentType, unittest.equals('foo')); | |
70 unittest.expect(o.data, unittest.equals('foo')); | |
71 } | |
72 buildCounterGoogleApiHttpBody--; | |
73 } | |
74 | |
75 core.int buildCounterGoogleCloudMlV1ManualScaling = 0; | |
76 buildGoogleCloudMlV1ManualScaling() { | |
77 var o = new api.GoogleCloudMlV1ManualScaling(); | |
78 buildCounterGoogleCloudMlV1ManualScaling++; | |
79 if (buildCounterGoogleCloudMlV1ManualScaling < 3) { | |
80 o.nodes = 42; | |
81 } | |
82 buildCounterGoogleCloudMlV1ManualScaling--; | |
83 return o; | |
84 } | |
85 | |
86 checkGoogleCloudMlV1ManualScaling(api.GoogleCloudMlV1ManualScaling o) { | |
87 buildCounterGoogleCloudMlV1ManualScaling++; | |
88 if (buildCounterGoogleCloudMlV1ManualScaling < 3) { | |
89 unittest.expect(o.nodes, unittest.equals(42)); | |
90 } | |
91 buildCounterGoogleCloudMlV1ManualScaling--; | |
92 } | |
93 | |
94 core.int buildCounterGoogleCloudMlV1OperationMetadata = 0; | |
95 buildGoogleCloudMlV1OperationMetadata() { | |
96 var o = new api.GoogleCloudMlV1OperationMetadata(); | |
97 buildCounterGoogleCloudMlV1OperationMetadata++; | |
98 if (buildCounterGoogleCloudMlV1OperationMetadata < 3) { | |
99 o.createTime = "foo"; | |
100 o.endTime = "foo"; | |
101 o.isCancellationRequested = true; | |
102 o.modelName = "foo"; | |
103 o.operationType = "foo"; | |
104 o.startTime = "foo"; | |
105 o.version = buildGoogleCloudMlV1Version(); | |
106 } | |
107 buildCounterGoogleCloudMlV1OperationMetadata--; | |
108 return o; | |
109 } | |
110 | |
111 checkGoogleCloudMlV1OperationMetadata(api.GoogleCloudMlV1OperationMetadata o) { | |
112 buildCounterGoogleCloudMlV1OperationMetadata++; | |
113 if (buildCounterGoogleCloudMlV1OperationMetadata < 3) { | |
114 unittest.expect(o.createTime, unittest.equals('foo')); | |
115 unittest.expect(o.endTime, unittest.equals('foo')); | |
116 unittest.expect(o.isCancellationRequested, unittest.isTrue); | |
117 unittest.expect(o.modelName, unittest.equals('foo')); | |
118 unittest.expect(o.operationType, unittest.equals('foo')); | |
119 unittest.expect(o.startTime, unittest.equals('foo')); | |
120 checkGoogleCloudMlV1Version(o.version); | |
121 } | |
122 buildCounterGoogleCloudMlV1OperationMetadata--; | |
123 } | |
124 | |
125 core.int buildCounterGoogleCloudMlV1Version = 0; | |
126 buildGoogleCloudMlV1Version() { | |
127 var o = new api.GoogleCloudMlV1Version(); | |
128 buildCounterGoogleCloudMlV1Version++; | |
129 if (buildCounterGoogleCloudMlV1Version < 3) { | |
130 o.createTime = "foo"; | |
131 o.deploymentUri = "foo"; | |
132 o.description = "foo"; | |
133 o.isDefault = true; | |
134 o.lastUseTime = "foo"; | |
135 o.manualScaling = buildGoogleCloudMlV1ManualScaling(); | |
136 o.name = "foo"; | |
137 o.runtimeVersion = "foo"; | |
138 } | |
139 buildCounterGoogleCloudMlV1Version--; | |
140 return o; | |
141 } | |
142 | |
143 checkGoogleCloudMlV1Version(api.GoogleCloudMlV1Version o) { | |
144 buildCounterGoogleCloudMlV1Version++; | |
145 if (buildCounterGoogleCloudMlV1Version < 3) { | |
146 unittest.expect(o.createTime, unittest.equals('foo')); | |
147 unittest.expect(o.deploymentUri, unittest.equals('foo')); | |
148 unittest.expect(o.description, unittest.equals('foo')); | |
149 unittest.expect(o.isDefault, unittest.isTrue); | |
150 unittest.expect(o.lastUseTime, unittest.equals('foo')); | |
151 checkGoogleCloudMlV1ManualScaling(o.manualScaling); | |
152 unittest.expect(o.name, unittest.equals('foo')); | |
153 unittest.expect(o.runtimeVersion, unittest.equals('foo')); | |
154 } | |
155 buildCounterGoogleCloudMlV1Version--; | |
156 } | |
157 | |
158 core.int buildCounterGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetri
c = 0; | |
159 buildGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric() { | |
160 var o = new api.GoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric()
; | |
161 buildCounterGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric++; | |
162 if (buildCounterGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric <
3) { | |
163 o.objectiveValue = 42.0; | |
164 o.trainingStep = "foo"; | |
165 } | |
166 buildCounterGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric--; | |
167 return o; | |
168 } | |
169 | |
170 checkGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric(api.GoogleClou
dMlV1beta1HyperparameterOutputHyperparameterMetric o) { | |
171 buildCounterGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric++; | |
172 if (buildCounterGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric <
3) { | |
173 unittest.expect(o.objectiveValue, unittest.equals(42.0)); | |
174 unittest.expect(o.trainingStep, unittest.equals('foo')); | |
175 } | |
176 buildCounterGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric--; | |
177 } | |
178 | |
179 core.int buildCounterGoogleCloudMlV1beta1CancelJobRequest = 0; | |
180 buildGoogleCloudMlV1beta1CancelJobRequest() { | |
181 var o = new api.GoogleCloudMlV1beta1CancelJobRequest(); | |
182 buildCounterGoogleCloudMlV1beta1CancelJobRequest++; | |
183 if (buildCounterGoogleCloudMlV1beta1CancelJobRequest < 3) { | |
184 } | |
185 buildCounterGoogleCloudMlV1beta1CancelJobRequest--; | |
186 return o; | |
187 } | |
188 | |
189 checkGoogleCloudMlV1beta1CancelJobRequest(api.GoogleCloudMlV1beta1CancelJobReque
st o) { | |
190 buildCounterGoogleCloudMlV1beta1CancelJobRequest++; | |
191 if (buildCounterGoogleCloudMlV1beta1CancelJobRequest < 3) { | |
192 } | |
193 buildCounterGoogleCloudMlV1beta1CancelJobRequest--; | |
194 } | |
195 | |
196 core.int buildCounterGoogleCloudMlV1beta1GetConfigResponse = 0; | |
197 buildGoogleCloudMlV1beta1GetConfigResponse() { | |
198 var o = new api.GoogleCloudMlV1beta1GetConfigResponse(); | |
199 buildCounterGoogleCloudMlV1beta1GetConfigResponse++; | |
200 if (buildCounterGoogleCloudMlV1beta1GetConfigResponse < 3) { | |
201 o.serviceAccount = "foo"; | |
202 o.serviceAccountProject = "foo"; | |
203 } | |
204 buildCounterGoogleCloudMlV1beta1GetConfigResponse--; | |
205 return o; | |
206 } | |
207 | |
208 checkGoogleCloudMlV1beta1GetConfigResponse(api.GoogleCloudMlV1beta1GetConfigResp
onse o) { | |
209 buildCounterGoogleCloudMlV1beta1GetConfigResponse++; | |
210 if (buildCounterGoogleCloudMlV1beta1GetConfigResponse < 3) { | |
211 unittest.expect(o.serviceAccount, unittest.equals('foo')); | |
212 unittest.expect(o.serviceAccountProject, unittest.equals('foo')); | |
213 } | |
214 buildCounterGoogleCloudMlV1beta1GetConfigResponse--; | |
215 } | |
216 | |
217 buildUnnamed3070() { | |
218 var o = new core.List<api.GoogleCloudMlV1beta1HyperparameterOutputHyperparamet
erMetric>(); | |
219 o.add(buildGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric()); | |
220 o.add(buildGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric()); | |
221 return o; | |
222 } | |
223 | |
224 checkUnnamed3070(core.List<api.GoogleCloudMlV1beta1HyperparameterOutputHyperpara
meterMetric> o) { | |
225 unittest.expect(o, unittest.hasLength(2)); | |
226 checkGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric(o[0]); | |
227 checkGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric(o[1]); | |
228 } | |
229 | |
230 buildUnnamed3071() { | |
231 var o = new core.Map<core.String, core.String>(); | |
232 o["x"] = "foo"; | |
233 o["y"] = "foo"; | |
234 return o; | |
235 } | |
236 | |
237 checkUnnamed3071(core.Map<core.String, core.String> o) { | |
238 unittest.expect(o, unittest.hasLength(2)); | |
239 unittest.expect(o["x"], unittest.equals('foo')); | |
240 unittest.expect(o["y"], unittest.equals('foo')); | |
241 } | |
242 | |
243 core.int buildCounterGoogleCloudMlV1beta1HyperparameterOutput = 0; | |
244 buildGoogleCloudMlV1beta1HyperparameterOutput() { | |
245 var o = new api.GoogleCloudMlV1beta1HyperparameterOutput(); | |
246 buildCounterGoogleCloudMlV1beta1HyperparameterOutput++; | |
247 if (buildCounterGoogleCloudMlV1beta1HyperparameterOutput < 3) { | |
248 o.allMetrics = buildUnnamed3070(); | |
249 o.finalMetric = buildGoogleCloudMlV1beta1HyperparameterOutputHyperparameterM
etric(); | |
250 o.hyperparameters = buildUnnamed3071(); | |
251 o.trialId = "foo"; | |
252 } | |
253 buildCounterGoogleCloudMlV1beta1HyperparameterOutput--; | |
254 return o; | |
255 } | |
256 | |
257 checkGoogleCloudMlV1beta1HyperparameterOutput(api.GoogleCloudMlV1beta1Hyperparam
eterOutput o) { | |
258 buildCounterGoogleCloudMlV1beta1HyperparameterOutput++; | |
259 if (buildCounterGoogleCloudMlV1beta1HyperparameterOutput < 3) { | |
260 checkUnnamed3070(o.allMetrics); | |
261 checkGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric(o.finalMet
ric); | |
262 checkUnnamed3071(o.hyperparameters); | |
263 unittest.expect(o.trialId, unittest.equals('foo')); | |
264 } | |
265 buildCounterGoogleCloudMlV1beta1HyperparameterOutput--; | |
266 } | |
267 | |
268 buildUnnamed3072() { | |
269 var o = new core.List<api.GoogleCloudMlV1beta1ParameterSpec>(); | |
270 o.add(buildGoogleCloudMlV1beta1ParameterSpec()); | |
271 o.add(buildGoogleCloudMlV1beta1ParameterSpec()); | |
272 return o; | |
273 } | |
274 | |
275 checkUnnamed3072(core.List<api.GoogleCloudMlV1beta1ParameterSpec> o) { | |
276 unittest.expect(o, unittest.hasLength(2)); | |
277 checkGoogleCloudMlV1beta1ParameterSpec(o[0]); | |
278 checkGoogleCloudMlV1beta1ParameterSpec(o[1]); | |
279 } | |
280 | |
281 core.int buildCounterGoogleCloudMlV1beta1HyperparameterSpec = 0; | |
282 buildGoogleCloudMlV1beta1HyperparameterSpec() { | |
283 var o = new api.GoogleCloudMlV1beta1HyperparameterSpec(); | |
284 buildCounterGoogleCloudMlV1beta1HyperparameterSpec++; | |
285 if (buildCounterGoogleCloudMlV1beta1HyperparameterSpec < 3) { | |
286 o.goal = "foo"; | |
287 o.hyperparameterMetricTag = "foo"; | |
288 o.maxParallelTrials = 42; | |
289 o.maxTrials = 42; | |
290 o.params = buildUnnamed3072(); | |
291 } | |
292 buildCounterGoogleCloudMlV1beta1HyperparameterSpec--; | |
293 return o; | |
294 } | |
295 | |
296 checkGoogleCloudMlV1beta1HyperparameterSpec(api.GoogleCloudMlV1beta1Hyperparamet
erSpec o) { | |
297 buildCounterGoogleCloudMlV1beta1HyperparameterSpec++; | |
298 if (buildCounterGoogleCloudMlV1beta1HyperparameterSpec < 3) { | |
299 unittest.expect(o.goal, unittest.equals('foo')); | |
300 unittest.expect(o.hyperparameterMetricTag, unittest.equals('foo')); | |
301 unittest.expect(o.maxParallelTrials, unittest.equals(42)); | |
302 unittest.expect(o.maxTrials, unittest.equals(42)); | |
303 checkUnnamed3072(o.params); | |
304 } | |
305 buildCounterGoogleCloudMlV1beta1HyperparameterSpec--; | |
306 } | |
307 | |
308 core.int buildCounterGoogleCloudMlV1beta1Job = 0; | |
309 buildGoogleCloudMlV1beta1Job() { | |
310 var o = new api.GoogleCloudMlV1beta1Job(); | |
311 buildCounterGoogleCloudMlV1beta1Job++; | |
312 if (buildCounterGoogleCloudMlV1beta1Job < 3) { | |
313 o.createTime = "foo"; | |
314 o.endTime = "foo"; | |
315 o.errorMessage = "foo"; | |
316 o.jobId = "foo"; | |
317 o.predictionInput = buildGoogleCloudMlV1beta1PredictionInput(); | |
318 o.predictionOutput = buildGoogleCloudMlV1beta1PredictionOutput(); | |
319 o.startTime = "foo"; | |
320 o.state = "foo"; | |
321 o.trainingInput = buildGoogleCloudMlV1beta1TrainingInput(); | |
322 o.trainingOutput = buildGoogleCloudMlV1beta1TrainingOutput(); | |
323 } | |
324 buildCounterGoogleCloudMlV1beta1Job--; | |
325 return o; | |
326 } | |
327 | |
328 checkGoogleCloudMlV1beta1Job(api.GoogleCloudMlV1beta1Job o) { | |
329 buildCounterGoogleCloudMlV1beta1Job++; | |
330 if (buildCounterGoogleCloudMlV1beta1Job < 3) { | |
331 unittest.expect(o.createTime, unittest.equals('foo')); | |
332 unittest.expect(o.endTime, unittest.equals('foo')); | |
333 unittest.expect(o.errorMessage, unittest.equals('foo')); | |
334 unittest.expect(o.jobId, unittest.equals('foo')); | |
335 checkGoogleCloudMlV1beta1PredictionInput(o.predictionInput); | |
336 checkGoogleCloudMlV1beta1PredictionOutput(o.predictionOutput); | |
337 unittest.expect(o.startTime, unittest.equals('foo')); | |
338 unittest.expect(o.state, unittest.equals('foo')); | |
339 checkGoogleCloudMlV1beta1TrainingInput(o.trainingInput); | |
340 checkGoogleCloudMlV1beta1TrainingOutput(o.trainingOutput); | |
341 } | |
342 buildCounterGoogleCloudMlV1beta1Job--; | |
343 } | |
344 | |
345 buildUnnamed3073() { | |
346 var o = new core.List<api.GoogleCloudMlV1beta1Job>(); | |
347 o.add(buildGoogleCloudMlV1beta1Job()); | |
348 o.add(buildGoogleCloudMlV1beta1Job()); | |
349 return o; | |
350 } | |
351 | |
352 checkUnnamed3073(core.List<api.GoogleCloudMlV1beta1Job> o) { | |
353 unittest.expect(o, unittest.hasLength(2)); | |
354 checkGoogleCloudMlV1beta1Job(o[0]); | |
355 checkGoogleCloudMlV1beta1Job(o[1]); | |
356 } | |
357 | |
358 core.int buildCounterGoogleCloudMlV1beta1ListJobsResponse = 0; | |
359 buildGoogleCloudMlV1beta1ListJobsResponse() { | |
360 var o = new api.GoogleCloudMlV1beta1ListJobsResponse(); | |
361 buildCounterGoogleCloudMlV1beta1ListJobsResponse++; | |
362 if (buildCounterGoogleCloudMlV1beta1ListJobsResponse < 3) { | |
363 o.jobs = buildUnnamed3073(); | |
364 o.nextPageToken = "foo"; | |
365 } | |
366 buildCounterGoogleCloudMlV1beta1ListJobsResponse--; | |
367 return o; | |
368 } | |
369 | |
370 checkGoogleCloudMlV1beta1ListJobsResponse(api.GoogleCloudMlV1beta1ListJobsRespon
se o) { | |
371 buildCounterGoogleCloudMlV1beta1ListJobsResponse++; | |
372 if (buildCounterGoogleCloudMlV1beta1ListJobsResponse < 3) { | |
373 checkUnnamed3073(o.jobs); | |
374 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
375 } | |
376 buildCounterGoogleCloudMlV1beta1ListJobsResponse--; | |
377 } | |
378 | |
379 buildUnnamed3074() { | |
380 var o = new core.List<api.GoogleCloudMlV1beta1Model>(); | |
381 o.add(buildGoogleCloudMlV1beta1Model()); | |
382 o.add(buildGoogleCloudMlV1beta1Model()); | |
383 return o; | |
384 } | |
385 | |
386 checkUnnamed3074(core.List<api.GoogleCloudMlV1beta1Model> o) { | |
387 unittest.expect(o, unittest.hasLength(2)); | |
388 checkGoogleCloudMlV1beta1Model(o[0]); | |
389 checkGoogleCloudMlV1beta1Model(o[1]); | |
390 } | |
391 | |
392 core.int buildCounterGoogleCloudMlV1beta1ListModelsResponse = 0; | |
393 buildGoogleCloudMlV1beta1ListModelsResponse() { | |
394 var o = new api.GoogleCloudMlV1beta1ListModelsResponse(); | |
395 buildCounterGoogleCloudMlV1beta1ListModelsResponse++; | |
396 if (buildCounterGoogleCloudMlV1beta1ListModelsResponse < 3) { | |
397 o.models = buildUnnamed3074(); | |
398 o.nextPageToken = "foo"; | |
399 } | |
400 buildCounterGoogleCloudMlV1beta1ListModelsResponse--; | |
401 return o; | |
402 } | |
403 | |
404 checkGoogleCloudMlV1beta1ListModelsResponse(api.GoogleCloudMlV1beta1ListModelsRe
sponse o) { | |
405 buildCounterGoogleCloudMlV1beta1ListModelsResponse++; | |
406 if (buildCounterGoogleCloudMlV1beta1ListModelsResponse < 3) { | |
407 checkUnnamed3074(o.models); | |
408 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
409 } | |
410 buildCounterGoogleCloudMlV1beta1ListModelsResponse--; | |
411 } | |
412 | |
413 buildUnnamed3075() { | |
414 var o = new core.List<api.GoogleCloudMlV1beta1Version>(); | |
415 o.add(buildGoogleCloudMlV1beta1Version()); | |
416 o.add(buildGoogleCloudMlV1beta1Version()); | |
417 return o; | |
418 } | |
419 | |
420 checkUnnamed3075(core.List<api.GoogleCloudMlV1beta1Version> o) { | |
421 unittest.expect(o, unittest.hasLength(2)); | |
422 checkGoogleCloudMlV1beta1Version(o[0]); | |
423 checkGoogleCloudMlV1beta1Version(o[1]); | |
424 } | |
425 | |
426 core.int buildCounterGoogleCloudMlV1beta1ListVersionsResponse = 0; | |
427 buildGoogleCloudMlV1beta1ListVersionsResponse() { | |
428 var o = new api.GoogleCloudMlV1beta1ListVersionsResponse(); | |
429 buildCounterGoogleCloudMlV1beta1ListVersionsResponse++; | |
430 if (buildCounterGoogleCloudMlV1beta1ListVersionsResponse < 3) { | |
431 o.nextPageToken = "foo"; | |
432 o.versions = buildUnnamed3075(); | |
433 } | |
434 buildCounterGoogleCloudMlV1beta1ListVersionsResponse--; | |
435 return o; | |
436 } | |
437 | |
438 checkGoogleCloudMlV1beta1ListVersionsResponse(api.GoogleCloudMlV1beta1ListVersio
nsResponse o) { | |
439 buildCounterGoogleCloudMlV1beta1ListVersionsResponse++; | |
440 if (buildCounterGoogleCloudMlV1beta1ListVersionsResponse < 3) { | |
441 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
442 checkUnnamed3075(o.versions); | |
443 } | |
444 buildCounterGoogleCloudMlV1beta1ListVersionsResponse--; | |
445 } | |
446 | |
447 core.int buildCounterGoogleCloudMlV1beta1ManualScaling = 0; | |
448 buildGoogleCloudMlV1beta1ManualScaling() { | |
449 var o = new api.GoogleCloudMlV1beta1ManualScaling(); | |
450 buildCounterGoogleCloudMlV1beta1ManualScaling++; | |
451 if (buildCounterGoogleCloudMlV1beta1ManualScaling < 3) { | |
452 o.nodes = 42; | |
453 } | |
454 buildCounterGoogleCloudMlV1beta1ManualScaling--; | |
455 return o; | |
456 } | |
457 | |
458 checkGoogleCloudMlV1beta1ManualScaling(api.GoogleCloudMlV1beta1ManualScaling o)
{ | |
459 buildCounterGoogleCloudMlV1beta1ManualScaling++; | |
460 if (buildCounterGoogleCloudMlV1beta1ManualScaling < 3) { | |
461 unittest.expect(o.nodes, unittest.equals(42)); | |
462 } | |
463 buildCounterGoogleCloudMlV1beta1ManualScaling--; | |
464 } | |
465 | |
466 buildUnnamed3076() { | |
467 var o = new core.List<core.String>(); | |
468 o.add("foo"); | |
469 o.add("foo"); | |
470 return o; | |
471 } | |
472 | |
473 checkUnnamed3076(core.List<core.String> o) { | |
474 unittest.expect(o, unittest.hasLength(2)); | |
475 unittest.expect(o[0], unittest.equals('foo')); | |
476 unittest.expect(o[1], unittest.equals('foo')); | |
477 } | |
478 | |
479 core.int buildCounterGoogleCloudMlV1beta1Model = 0; | |
480 buildGoogleCloudMlV1beta1Model() { | |
481 var o = new api.GoogleCloudMlV1beta1Model(); | |
482 buildCounterGoogleCloudMlV1beta1Model++; | |
483 if (buildCounterGoogleCloudMlV1beta1Model < 3) { | |
484 o.defaultVersion = buildGoogleCloudMlV1beta1Version(); | |
485 o.description = "foo"; | |
486 o.name = "foo"; | |
487 o.onlinePredictionLogging = true; | |
488 o.regions = buildUnnamed3076(); | |
489 } | |
490 buildCounterGoogleCloudMlV1beta1Model--; | |
491 return o; | |
492 } | |
493 | |
494 checkGoogleCloudMlV1beta1Model(api.GoogleCloudMlV1beta1Model o) { | |
495 buildCounterGoogleCloudMlV1beta1Model++; | |
496 if (buildCounterGoogleCloudMlV1beta1Model < 3) { | |
497 checkGoogleCloudMlV1beta1Version(o.defaultVersion); | |
498 unittest.expect(o.description, unittest.equals('foo')); | |
499 unittest.expect(o.name, unittest.equals('foo')); | |
500 unittest.expect(o.onlinePredictionLogging, unittest.isTrue); | |
501 checkUnnamed3076(o.regions); | |
502 } | |
503 buildCounterGoogleCloudMlV1beta1Model--; | |
504 } | |
505 | |
506 core.int buildCounterGoogleCloudMlV1beta1OperationMetadata = 0; | |
507 buildGoogleCloudMlV1beta1OperationMetadata() { | |
508 var o = new api.GoogleCloudMlV1beta1OperationMetadata(); | |
509 buildCounterGoogleCloudMlV1beta1OperationMetadata++; | |
510 if (buildCounterGoogleCloudMlV1beta1OperationMetadata < 3) { | |
511 o.createTime = "foo"; | |
512 o.endTime = "foo"; | |
513 o.isCancellationRequested = true; | |
514 o.modelName = "foo"; | |
515 o.operationType = "foo"; | |
516 o.startTime = "foo"; | |
517 o.version = buildGoogleCloudMlV1beta1Version(); | |
518 } | |
519 buildCounterGoogleCloudMlV1beta1OperationMetadata--; | |
520 return o; | |
521 } | |
522 | |
523 checkGoogleCloudMlV1beta1OperationMetadata(api.GoogleCloudMlV1beta1OperationMeta
data o) { | |
524 buildCounterGoogleCloudMlV1beta1OperationMetadata++; | |
525 if (buildCounterGoogleCloudMlV1beta1OperationMetadata < 3) { | |
526 unittest.expect(o.createTime, unittest.equals('foo')); | |
527 unittest.expect(o.endTime, unittest.equals('foo')); | |
528 unittest.expect(o.isCancellationRequested, unittest.isTrue); | |
529 unittest.expect(o.modelName, unittest.equals('foo')); | |
530 unittest.expect(o.operationType, unittest.equals('foo')); | |
531 unittest.expect(o.startTime, unittest.equals('foo')); | |
532 checkGoogleCloudMlV1beta1Version(o.version); | |
533 } | |
534 buildCounterGoogleCloudMlV1beta1OperationMetadata--; | |
535 } | |
536 | |
537 buildUnnamed3077() { | |
538 var o = new core.List<core.String>(); | |
539 o.add("foo"); | |
540 o.add("foo"); | |
541 return o; | |
542 } | |
543 | |
544 checkUnnamed3077(core.List<core.String> o) { | |
545 unittest.expect(o, unittest.hasLength(2)); | |
546 unittest.expect(o[0], unittest.equals('foo')); | |
547 unittest.expect(o[1], unittest.equals('foo')); | |
548 } | |
549 | |
550 buildUnnamed3078() { | |
551 var o = new core.List<core.double>(); | |
552 o.add(42.0); | |
553 o.add(42.0); | |
554 return o; | |
555 } | |
556 | |
557 checkUnnamed3078(core.List<core.double> o) { | |
558 unittest.expect(o, unittest.hasLength(2)); | |
559 unittest.expect(o[0], unittest.equals(42.0)); | |
560 unittest.expect(o[1], unittest.equals(42.0)); | |
561 } | |
562 | |
563 core.int buildCounterGoogleCloudMlV1beta1ParameterSpec = 0; | |
564 buildGoogleCloudMlV1beta1ParameterSpec() { | |
565 var o = new api.GoogleCloudMlV1beta1ParameterSpec(); | |
566 buildCounterGoogleCloudMlV1beta1ParameterSpec++; | |
567 if (buildCounterGoogleCloudMlV1beta1ParameterSpec < 3) { | |
568 o.categoricalValues = buildUnnamed3077(); | |
569 o.discreteValues = buildUnnamed3078(); | |
570 o.maxValue = 42.0; | |
571 o.minValue = 42.0; | |
572 o.parameterName = "foo"; | |
573 o.scaleType = "foo"; | |
574 o.type = "foo"; | |
575 } | |
576 buildCounterGoogleCloudMlV1beta1ParameterSpec--; | |
577 return o; | |
578 } | |
579 | |
580 checkGoogleCloudMlV1beta1ParameterSpec(api.GoogleCloudMlV1beta1ParameterSpec o)
{ | |
581 buildCounterGoogleCloudMlV1beta1ParameterSpec++; | |
582 if (buildCounterGoogleCloudMlV1beta1ParameterSpec < 3) { | |
583 checkUnnamed3077(o.categoricalValues); | |
584 checkUnnamed3078(o.discreteValues); | |
585 unittest.expect(o.maxValue, unittest.equals(42.0)); | |
586 unittest.expect(o.minValue, unittest.equals(42.0)); | |
587 unittest.expect(o.parameterName, unittest.equals('foo')); | |
588 unittest.expect(o.scaleType, unittest.equals('foo')); | |
589 unittest.expect(o.type, unittest.equals('foo')); | |
590 } | |
591 buildCounterGoogleCloudMlV1beta1ParameterSpec--; | |
592 } | |
593 | |
594 core.int buildCounterGoogleCloudMlV1beta1PredictRequest = 0; | |
595 buildGoogleCloudMlV1beta1PredictRequest() { | |
596 var o = new api.GoogleCloudMlV1beta1PredictRequest(); | |
597 buildCounterGoogleCloudMlV1beta1PredictRequest++; | |
598 if (buildCounterGoogleCloudMlV1beta1PredictRequest < 3) { | |
599 o.httpBody = buildGoogleApiHttpBody(); | |
600 } | |
601 buildCounterGoogleCloudMlV1beta1PredictRequest--; | |
602 return o; | |
603 } | |
604 | |
605 checkGoogleCloudMlV1beta1PredictRequest(api.GoogleCloudMlV1beta1PredictRequest o
) { | |
606 buildCounterGoogleCloudMlV1beta1PredictRequest++; | |
607 if (buildCounterGoogleCloudMlV1beta1PredictRequest < 3) { | |
608 checkGoogleApiHttpBody(o.httpBody); | |
609 } | |
610 buildCounterGoogleCloudMlV1beta1PredictRequest--; | |
611 } | |
612 | |
613 buildUnnamed3079() { | |
614 var o = new core.List<core.String>(); | |
615 o.add("foo"); | |
616 o.add("foo"); | |
617 return o; | |
618 } | |
619 | |
620 checkUnnamed3079(core.List<core.String> o) { | |
621 unittest.expect(o, unittest.hasLength(2)); | |
622 unittest.expect(o[0], unittest.equals('foo')); | |
623 unittest.expect(o[1], unittest.equals('foo')); | |
624 } | |
625 | |
626 core.int buildCounterGoogleCloudMlV1beta1PredictionInput = 0; | |
627 buildGoogleCloudMlV1beta1PredictionInput() { | |
628 var o = new api.GoogleCloudMlV1beta1PredictionInput(); | |
629 buildCounterGoogleCloudMlV1beta1PredictionInput++; | |
630 if (buildCounterGoogleCloudMlV1beta1PredictionInput < 3) { | |
631 o.dataFormat = "foo"; | |
632 o.inputPaths = buildUnnamed3079(); | |
633 o.maxWorkerCount = "foo"; | |
634 o.modelName = "foo"; | |
635 o.outputPath = "foo"; | |
636 o.region = "foo"; | |
637 o.runtimeVersion = "foo"; | |
638 o.uri = "foo"; | |
639 o.versionName = "foo"; | |
640 } | |
641 buildCounterGoogleCloudMlV1beta1PredictionInput--; | |
642 return o; | |
643 } | |
644 | |
645 checkGoogleCloudMlV1beta1PredictionInput(api.GoogleCloudMlV1beta1PredictionInput
o) { | |
646 buildCounterGoogleCloudMlV1beta1PredictionInput++; | |
647 if (buildCounterGoogleCloudMlV1beta1PredictionInput < 3) { | |
648 unittest.expect(o.dataFormat, unittest.equals('foo')); | |
649 checkUnnamed3079(o.inputPaths); | |
650 unittest.expect(o.maxWorkerCount, unittest.equals('foo')); | |
651 unittest.expect(o.modelName, unittest.equals('foo')); | |
652 unittest.expect(o.outputPath, unittest.equals('foo')); | |
653 unittest.expect(o.region, unittest.equals('foo')); | |
654 unittest.expect(o.runtimeVersion, unittest.equals('foo')); | |
655 unittest.expect(o.uri, unittest.equals('foo')); | |
656 unittest.expect(o.versionName, unittest.equals('foo')); | |
657 } | |
658 buildCounterGoogleCloudMlV1beta1PredictionInput--; | |
659 } | |
660 | |
661 core.int buildCounterGoogleCloudMlV1beta1PredictionOutput = 0; | |
662 buildGoogleCloudMlV1beta1PredictionOutput() { | |
663 var o = new api.GoogleCloudMlV1beta1PredictionOutput(); | |
664 buildCounterGoogleCloudMlV1beta1PredictionOutput++; | |
665 if (buildCounterGoogleCloudMlV1beta1PredictionOutput < 3) { | |
666 o.errorCount = "foo"; | |
667 o.nodeHours = 42.0; | |
668 o.outputPath = "foo"; | |
669 o.predictionCount = "foo"; | |
670 } | |
671 buildCounterGoogleCloudMlV1beta1PredictionOutput--; | |
672 return o; | |
673 } | |
674 | |
675 checkGoogleCloudMlV1beta1PredictionOutput(api.GoogleCloudMlV1beta1PredictionOutp
ut o) { | |
676 buildCounterGoogleCloudMlV1beta1PredictionOutput++; | |
677 if (buildCounterGoogleCloudMlV1beta1PredictionOutput < 3) { | |
678 unittest.expect(o.errorCount, unittest.equals('foo')); | |
679 unittest.expect(o.nodeHours, unittest.equals(42.0)); | |
680 unittest.expect(o.outputPath, unittest.equals('foo')); | |
681 unittest.expect(o.predictionCount, unittest.equals('foo')); | |
682 } | |
683 buildCounterGoogleCloudMlV1beta1PredictionOutput--; | |
684 } | |
685 | |
686 core.int buildCounterGoogleCloudMlV1beta1SetDefaultVersionRequest = 0; | |
687 buildGoogleCloudMlV1beta1SetDefaultVersionRequest() { | |
688 var o = new api.GoogleCloudMlV1beta1SetDefaultVersionRequest(); | |
689 buildCounterGoogleCloudMlV1beta1SetDefaultVersionRequest++; | |
690 if (buildCounterGoogleCloudMlV1beta1SetDefaultVersionRequest < 3) { | |
691 } | |
692 buildCounterGoogleCloudMlV1beta1SetDefaultVersionRequest--; | |
693 return o; | |
694 } | |
695 | |
696 checkGoogleCloudMlV1beta1SetDefaultVersionRequest(api.GoogleCloudMlV1beta1SetDef
aultVersionRequest o) { | |
697 buildCounterGoogleCloudMlV1beta1SetDefaultVersionRequest++; | |
698 if (buildCounterGoogleCloudMlV1beta1SetDefaultVersionRequest < 3) { | |
699 } | |
700 buildCounterGoogleCloudMlV1beta1SetDefaultVersionRequest--; | |
701 } | |
702 | |
703 buildUnnamed3080() { | |
704 var o = new core.List<core.String>(); | |
705 o.add("foo"); | |
706 o.add("foo"); | |
707 return o; | |
708 } | |
709 | |
710 checkUnnamed3080(core.List<core.String> o) { | |
711 unittest.expect(o, unittest.hasLength(2)); | |
712 unittest.expect(o[0], unittest.equals('foo')); | |
713 unittest.expect(o[1], unittest.equals('foo')); | |
714 } | |
715 | |
716 buildUnnamed3081() { | |
717 var o = new core.List<core.String>(); | |
718 o.add("foo"); | |
719 o.add("foo"); | |
720 return o; | |
721 } | |
722 | |
723 checkUnnamed3081(core.List<core.String> o) { | |
724 unittest.expect(o, unittest.hasLength(2)); | |
725 unittest.expect(o[0], unittest.equals('foo')); | |
726 unittest.expect(o[1], unittest.equals('foo')); | |
727 } | |
728 | |
729 core.int buildCounterGoogleCloudMlV1beta1TrainingInput = 0; | |
730 buildGoogleCloudMlV1beta1TrainingInput() { | |
731 var o = new api.GoogleCloudMlV1beta1TrainingInput(); | |
732 buildCounterGoogleCloudMlV1beta1TrainingInput++; | |
733 if (buildCounterGoogleCloudMlV1beta1TrainingInput < 3) { | |
734 o.args = buildUnnamed3080(); | |
735 o.hyperparameters = buildGoogleCloudMlV1beta1HyperparameterSpec(); | |
736 o.jobDir = "foo"; | |
737 o.masterType = "foo"; | |
738 o.packageUris = buildUnnamed3081(); | |
739 o.parameterServerCount = "foo"; | |
740 o.parameterServerType = "foo"; | |
741 o.pythonModule = "foo"; | |
742 o.region = "foo"; | |
743 o.runtimeVersion = "foo"; | |
744 o.scaleTier = "foo"; | |
745 o.workerCount = "foo"; | |
746 o.workerType = "foo"; | |
747 } | |
748 buildCounterGoogleCloudMlV1beta1TrainingInput--; | |
749 return o; | |
750 } | |
751 | |
752 checkGoogleCloudMlV1beta1TrainingInput(api.GoogleCloudMlV1beta1TrainingInput o)
{ | |
753 buildCounterGoogleCloudMlV1beta1TrainingInput++; | |
754 if (buildCounterGoogleCloudMlV1beta1TrainingInput < 3) { | |
755 checkUnnamed3080(o.args); | |
756 checkGoogleCloudMlV1beta1HyperparameterSpec(o.hyperparameters); | |
757 unittest.expect(o.jobDir, unittest.equals('foo')); | |
758 unittest.expect(o.masterType, unittest.equals('foo')); | |
759 checkUnnamed3081(o.packageUris); | |
760 unittest.expect(o.parameterServerCount, unittest.equals('foo')); | |
761 unittest.expect(o.parameterServerType, unittest.equals('foo')); | |
762 unittest.expect(o.pythonModule, unittest.equals('foo')); | |
763 unittest.expect(o.region, unittest.equals('foo')); | |
764 unittest.expect(o.runtimeVersion, unittest.equals('foo')); | |
765 unittest.expect(o.scaleTier, unittest.equals('foo')); | |
766 unittest.expect(o.workerCount, unittest.equals('foo')); | |
767 unittest.expect(o.workerType, unittest.equals('foo')); | |
768 } | |
769 buildCounterGoogleCloudMlV1beta1TrainingInput--; | |
770 } | |
771 | |
772 buildUnnamed3082() { | |
773 var o = new core.List<api.GoogleCloudMlV1beta1HyperparameterOutput>(); | |
774 o.add(buildGoogleCloudMlV1beta1HyperparameterOutput()); | |
775 o.add(buildGoogleCloudMlV1beta1HyperparameterOutput()); | |
776 return o; | |
777 } | |
778 | |
779 checkUnnamed3082(core.List<api.GoogleCloudMlV1beta1HyperparameterOutput> o) { | |
780 unittest.expect(o, unittest.hasLength(2)); | |
781 checkGoogleCloudMlV1beta1HyperparameterOutput(o[0]); | |
782 checkGoogleCloudMlV1beta1HyperparameterOutput(o[1]); | |
783 } | |
784 | |
785 core.int buildCounterGoogleCloudMlV1beta1TrainingOutput = 0; | |
786 buildGoogleCloudMlV1beta1TrainingOutput() { | |
787 var o = new api.GoogleCloudMlV1beta1TrainingOutput(); | |
788 buildCounterGoogleCloudMlV1beta1TrainingOutput++; | |
789 if (buildCounterGoogleCloudMlV1beta1TrainingOutput < 3) { | |
790 o.completedTrialCount = "foo"; | |
791 o.consumedMLUnits = 42.0; | |
792 o.isHyperparameterTuningJob = true; | |
793 o.trials = buildUnnamed3082(); | |
794 } | |
795 buildCounterGoogleCloudMlV1beta1TrainingOutput--; | |
796 return o; | |
797 } | |
798 | |
799 checkGoogleCloudMlV1beta1TrainingOutput(api.GoogleCloudMlV1beta1TrainingOutput o
) { | |
800 buildCounterGoogleCloudMlV1beta1TrainingOutput++; | |
801 if (buildCounterGoogleCloudMlV1beta1TrainingOutput < 3) { | |
802 unittest.expect(o.completedTrialCount, unittest.equals('foo')); | |
803 unittest.expect(o.consumedMLUnits, unittest.equals(42.0)); | |
804 unittest.expect(o.isHyperparameterTuningJob, unittest.isTrue); | |
805 checkUnnamed3082(o.trials); | |
806 } | |
807 buildCounterGoogleCloudMlV1beta1TrainingOutput--; | |
808 } | |
809 | |
810 core.int buildCounterGoogleCloudMlV1beta1Version = 0; | |
811 buildGoogleCloudMlV1beta1Version() { | |
812 var o = new api.GoogleCloudMlV1beta1Version(); | |
813 buildCounterGoogleCloudMlV1beta1Version++; | |
814 if (buildCounterGoogleCloudMlV1beta1Version < 3) { | |
815 o.createTime = "foo"; | |
816 o.deploymentUri = "foo"; | |
817 o.description = "foo"; | |
818 o.isDefault = true; | |
819 o.lastUseTime = "foo"; | |
820 o.manualScaling = buildGoogleCloudMlV1beta1ManualScaling(); | |
821 o.name = "foo"; | |
822 o.runtimeVersion = "foo"; | |
823 } | |
824 buildCounterGoogleCloudMlV1beta1Version--; | |
825 return o; | |
826 } | |
827 | |
828 checkGoogleCloudMlV1beta1Version(api.GoogleCloudMlV1beta1Version o) { | |
829 buildCounterGoogleCloudMlV1beta1Version++; | |
830 if (buildCounterGoogleCloudMlV1beta1Version < 3) { | |
831 unittest.expect(o.createTime, unittest.equals('foo')); | |
832 unittest.expect(o.deploymentUri, unittest.equals('foo')); | |
833 unittest.expect(o.description, unittest.equals('foo')); | |
834 unittest.expect(o.isDefault, unittest.isTrue); | |
835 unittest.expect(o.lastUseTime, unittest.equals('foo')); | |
836 checkGoogleCloudMlV1beta1ManualScaling(o.manualScaling); | |
837 unittest.expect(o.name, unittest.equals('foo')); | |
838 unittest.expect(o.runtimeVersion, unittest.equals('foo')); | |
839 } | |
840 buildCounterGoogleCloudMlV1beta1Version--; | |
841 } | |
842 | |
843 buildUnnamed3083() { | |
844 var o = new core.List<api.GoogleLongrunningOperation>(); | |
845 o.add(buildGoogleLongrunningOperation()); | |
846 o.add(buildGoogleLongrunningOperation()); | |
847 return o; | |
848 } | |
849 | |
850 checkUnnamed3083(core.List<api.GoogleLongrunningOperation> o) { | |
851 unittest.expect(o, unittest.hasLength(2)); | |
852 checkGoogleLongrunningOperation(o[0]); | |
853 checkGoogleLongrunningOperation(o[1]); | |
854 } | |
855 | |
856 core.int buildCounterGoogleLongrunningListOperationsResponse = 0; | |
857 buildGoogleLongrunningListOperationsResponse() { | |
858 var o = new api.GoogleLongrunningListOperationsResponse(); | |
859 buildCounterGoogleLongrunningListOperationsResponse++; | |
860 if (buildCounterGoogleLongrunningListOperationsResponse < 3) { | |
861 o.nextPageToken = "foo"; | |
862 o.operations = buildUnnamed3083(); | |
863 } | |
864 buildCounterGoogleLongrunningListOperationsResponse--; | |
865 return o; | |
866 } | |
867 | |
868 checkGoogleLongrunningListOperationsResponse(api.GoogleLongrunningListOperations
Response o) { | |
869 buildCounterGoogleLongrunningListOperationsResponse++; | |
870 if (buildCounterGoogleLongrunningListOperationsResponse < 3) { | |
871 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
872 checkUnnamed3083(o.operations); | |
873 } | |
874 buildCounterGoogleLongrunningListOperationsResponse--; | |
875 } | |
876 | |
877 buildUnnamed3084() { | |
878 var o = new core.Map<core.String, core.Object>(); | |
879 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | |
880 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | |
881 return o; | |
882 } | |
883 | |
884 checkUnnamed3084(core.Map<core.String, core.Object> o) { | |
885 unittest.expect(o, unittest.hasLength(2)); | |
886 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); | |
887 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); | |
888 } | |
889 | |
890 buildUnnamed3085() { | |
891 var o = new core.Map<core.String, core.Object>(); | |
892 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | |
893 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | |
894 return o; | |
895 } | |
896 | |
897 checkUnnamed3085(core.Map<core.String, core.Object> o) { | |
898 unittest.expect(o, unittest.hasLength(2)); | |
899 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); | |
900 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); | |
901 } | |
902 | |
903 core.int buildCounterGoogleLongrunningOperation = 0; | |
904 buildGoogleLongrunningOperation() { | |
905 var o = new api.GoogleLongrunningOperation(); | |
906 buildCounterGoogleLongrunningOperation++; | |
907 if (buildCounterGoogleLongrunningOperation < 3) { | |
908 o.done = true; | |
909 o.error = buildGoogleRpcStatus(); | |
910 o.metadata = buildUnnamed3084(); | |
911 o.name = "foo"; | |
912 o.response = buildUnnamed3085(); | |
913 } | |
914 buildCounterGoogleLongrunningOperation--; | |
915 return o; | |
916 } | |
917 | |
918 checkGoogleLongrunningOperation(api.GoogleLongrunningOperation o) { | |
919 buildCounterGoogleLongrunningOperation++; | |
920 if (buildCounterGoogleLongrunningOperation < 3) { | |
921 unittest.expect(o.done, unittest.isTrue); | |
922 checkGoogleRpcStatus(o.error); | |
923 checkUnnamed3084(o.metadata); | |
924 unittest.expect(o.name, unittest.equals('foo')); | |
925 checkUnnamed3085(o.response); | |
926 } | |
927 buildCounterGoogleLongrunningOperation--; | |
928 } | |
929 | |
930 core.int buildCounterGoogleProtobufEmpty = 0; | |
931 buildGoogleProtobufEmpty() { | |
932 var o = new api.GoogleProtobufEmpty(); | |
933 buildCounterGoogleProtobufEmpty++; | |
934 if (buildCounterGoogleProtobufEmpty < 3) { | |
935 } | |
936 buildCounterGoogleProtobufEmpty--; | |
937 return o; | |
938 } | |
939 | |
940 checkGoogleProtobufEmpty(api.GoogleProtobufEmpty o) { | |
941 buildCounterGoogleProtobufEmpty++; | |
942 if (buildCounterGoogleProtobufEmpty < 3) { | |
943 } | |
944 buildCounterGoogleProtobufEmpty--; | |
945 } | |
946 | |
947 buildUnnamed3086() { | |
948 var o = new core.Map<core.String, core.Object>(); | |
949 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | |
950 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | |
951 return o; | |
952 } | |
953 | |
954 checkUnnamed3086(core.Map<core.String, core.Object> o) { | |
955 unittest.expect(o, unittest.hasLength(2)); | |
956 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); | |
957 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); | |
958 } | |
959 | |
960 buildUnnamed3087() { | |
961 var o = new core.List<core.Map<core.String, core.Object>>(); | |
962 o.add(buildUnnamed3086()); | |
963 o.add(buildUnnamed3086()); | |
964 return o; | |
965 } | |
966 | |
967 checkUnnamed3087(core.List<core.Map<core.String, core.Object>> o) { | |
968 unittest.expect(o, unittest.hasLength(2)); | |
969 checkUnnamed3086(o[0]); | |
970 checkUnnamed3086(o[1]); | |
971 } | |
972 | |
973 core.int buildCounterGoogleRpcStatus = 0; | |
974 buildGoogleRpcStatus() { | |
975 var o = new api.GoogleRpcStatus(); | |
976 buildCounterGoogleRpcStatus++; | |
977 if (buildCounterGoogleRpcStatus < 3) { | |
978 o.code = 42; | |
979 o.details = buildUnnamed3087(); | |
980 o.message = "foo"; | |
981 } | |
982 buildCounterGoogleRpcStatus--; | |
983 return o; | |
984 } | |
985 | |
986 checkGoogleRpcStatus(api.GoogleRpcStatus o) { | |
987 buildCounterGoogleRpcStatus++; | |
988 if (buildCounterGoogleRpcStatus < 3) { | |
989 unittest.expect(o.code, unittest.equals(42)); | |
990 checkUnnamed3087(o.details); | |
991 unittest.expect(o.message, unittest.equals('foo')); | |
992 } | |
993 buildCounterGoogleRpcStatus--; | |
994 } | |
995 | |
996 | |
997 main() { | |
998 unittest.group("obj-schema-GoogleApiHttpBody", () { | |
999 unittest.test("to-json--from-json", () { | |
1000 var o = buildGoogleApiHttpBody(); | |
1001 var od = new api.GoogleApiHttpBody.fromJson(o.toJson()); | |
1002 checkGoogleApiHttpBody(od); | |
1003 }); | |
1004 }); | |
1005 | |
1006 | |
1007 unittest.group("obj-schema-GoogleCloudMlV1ManualScaling", () { | |
1008 unittest.test("to-json--from-json", () { | |
1009 var o = buildGoogleCloudMlV1ManualScaling(); | |
1010 var od = new api.GoogleCloudMlV1ManualScaling.fromJson(o.toJson()); | |
1011 checkGoogleCloudMlV1ManualScaling(od); | |
1012 }); | |
1013 }); | |
1014 | |
1015 | |
1016 unittest.group("obj-schema-GoogleCloudMlV1OperationMetadata", () { | |
1017 unittest.test("to-json--from-json", () { | |
1018 var o = buildGoogleCloudMlV1OperationMetadata(); | |
1019 var od = new api.GoogleCloudMlV1OperationMetadata.fromJson(o.toJson()); | |
1020 checkGoogleCloudMlV1OperationMetadata(od); | |
1021 }); | |
1022 }); | |
1023 | |
1024 | |
1025 unittest.group("obj-schema-GoogleCloudMlV1Version", () { | |
1026 unittest.test("to-json--from-json", () { | |
1027 var o = buildGoogleCloudMlV1Version(); | |
1028 var od = new api.GoogleCloudMlV1Version.fromJson(o.toJson()); | |
1029 checkGoogleCloudMlV1Version(od); | |
1030 }); | |
1031 }); | |
1032 | |
1033 | |
1034 unittest.group("obj-schema-GoogleCloudMlV1beta1HyperparameterOutputHyperparame
terMetric", () { | |
1035 unittest.test("to-json--from-json", () { | |
1036 var o = buildGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric(
); | |
1037 var od = new api.GoogleCloudMlV1beta1HyperparameterOutputHyperparameterMet
ric.fromJson(o.toJson()); | |
1038 checkGoogleCloudMlV1beta1HyperparameterOutputHyperparameterMetric(od); | |
1039 }); | |
1040 }); | |
1041 | |
1042 | |
1043 unittest.group("obj-schema-GoogleCloudMlV1beta1CancelJobRequest", () { | |
1044 unittest.test("to-json--from-json", () { | |
1045 var o = buildGoogleCloudMlV1beta1CancelJobRequest(); | |
1046 var od = new api.GoogleCloudMlV1beta1CancelJobRequest.fromJson(o.toJson())
; | |
1047 checkGoogleCloudMlV1beta1CancelJobRequest(od); | |
1048 }); | |
1049 }); | |
1050 | |
1051 | |
1052 unittest.group("obj-schema-GoogleCloudMlV1beta1GetConfigResponse", () { | |
1053 unittest.test("to-json--from-json", () { | |
1054 var o = buildGoogleCloudMlV1beta1GetConfigResponse(); | |
1055 var od = new api.GoogleCloudMlV1beta1GetConfigResponse.fromJson(o.toJson()
); | |
1056 checkGoogleCloudMlV1beta1GetConfigResponse(od); | |
1057 }); | |
1058 }); | |
1059 | |
1060 | |
1061 unittest.group("obj-schema-GoogleCloudMlV1beta1HyperparameterOutput", () { | |
1062 unittest.test("to-json--from-json", () { | |
1063 var o = buildGoogleCloudMlV1beta1HyperparameterOutput(); | |
1064 var od = new api.GoogleCloudMlV1beta1HyperparameterOutput.fromJson(o.toJso
n()); | |
1065 checkGoogleCloudMlV1beta1HyperparameterOutput(od); | |
1066 }); | |
1067 }); | |
1068 | |
1069 | |
1070 unittest.group("obj-schema-GoogleCloudMlV1beta1HyperparameterSpec", () { | |
1071 unittest.test("to-json--from-json", () { | |
1072 var o = buildGoogleCloudMlV1beta1HyperparameterSpec(); | |
1073 var od = new api.GoogleCloudMlV1beta1HyperparameterSpec.fromJson(o.toJson(
)); | |
1074 checkGoogleCloudMlV1beta1HyperparameterSpec(od); | |
1075 }); | |
1076 }); | |
1077 | |
1078 | |
1079 unittest.group("obj-schema-GoogleCloudMlV1beta1Job", () { | |
1080 unittest.test("to-json--from-json", () { | |
1081 var o = buildGoogleCloudMlV1beta1Job(); | |
1082 var od = new api.GoogleCloudMlV1beta1Job.fromJson(o.toJson()); | |
1083 checkGoogleCloudMlV1beta1Job(od); | |
1084 }); | |
1085 }); | |
1086 | |
1087 | |
1088 unittest.group("obj-schema-GoogleCloudMlV1beta1ListJobsResponse", () { | |
1089 unittest.test("to-json--from-json", () { | |
1090 var o = buildGoogleCloudMlV1beta1ListJobsResponse(); | |
1091 var od = new api.GoogleCloudMlV1beta1ListJobsResponse.fromJson(o.toJson())
; | |
1092 checkGoogleCloudMlV1beta1ListJobsResponse(od); | |
1093 }); | |
1094 }); | |
1095 | |
1096 | |
1097 unittest.group("obj-schema-GoogleCloudMlV1beta1ListModelsResponse", () { | |
1098 unittest.test("to-json--from-json", () { | |
1099 var o = buildGoogleCloudMlV1beta1ListModelsResponse(); | |
1100 var od = new api.GoogleCloudMlV1beta1ListModelsResponse.fromJson(o.toJson(
)); | |
1101 checkGoogleCloudMlV1beta1ListModelsResponse(od); | |
1102 }); | |
1103 }); | |
1104 | |
1105 | |
1106 unittest.group("obj-schema-GoogleCloudMlV1beta1ListVersionsResponse", () { | |
1107 unittest.test("to-json--from-json", () { | |
1108 var o = buildGoogleCloudMlV1beta1ListVersionsResponse(); | |
1109 var od = new api.GoogleCloudMlV1beta1ListVersionsResponse.fromJson(o.toJso
n()); | |
1110 checkGoogleCloudMlV1beta1ListVersionsResponse(od); | |
1111 }); | |
1112 }); | |
1113 | |
1114 | |
1115 unittest.group("obj-schema-GoogleCloudMlV1beta1ManualScaling", () { | |
1116 unittest.test("to-json--from-json", () { | |
1117 var o = buildGoogleCloudMlV1beta1ManualScaling(); | |
1118 var od = new api.GoogleCloudMlV1beta1ManualScaling.fromJson(o.toJson()); | |
1119 checkGoogleCloudMlV1beta1ManualScaling(od); | |
1120 }); | |
1121 }); | |
1122 | |
1123 | |
1124 unittest.group("obj-schema-GoogleCloudMlV1beta1Model", () { | |
1125 unittest.test("to-json--from-json", () { | |
1126 var o = buildGoogleCloudMlV1beta1Model(); | |
1127 var od = new api.GoogleCloudMlV1beta1Model.fromJson(o.toJson()); | |
1128 checkGoogleCloudMlV1beta1Model(od); | |
1129 }); | |
1130 }); | |
1131 | |
1132 | |
1133 unittest.group("obj-schema-GoogleCloudMlV1beta1OperationMetadata", () { | |
1134 unittest.test("to-json--from-json", () { | |
1135 var o = buildGoogleCloudMlV1beta1OperationMetadata(); | |
1136 var od = new api.GoogleCloudMlV1beta1OperationMetadata.fromJson(o.toJson()
); | |
1137 checkGoogleCloudMlV1beta1OperationMetadata(od); | |
1138 }); | |
1139 }); | |
1140 | |
1141 | |
1142 unittest.group("obj-schema-GoogleCloudMlV1beta1ParameterSpec", () { | |
1143 unittest.test("to-json--from-json", () { | |
1144 var o = buildGoogleCloudMlV1beta1ParameterSpec(); | |
1145 var od = new api.GoogleCloudMlV1beta1ParameterSpec.fromJson(o.toJson()); | |
1146 checkGoogleCloudMlV1beta1ParameterSpec(od); | |
1147 }); | |
1148 }); | |
1149 | |
1150 | |
1151 unittest.group("obj-schema-GoogleCloudMlV1beta1PredictRequest", () { | |
1152 unittest.test("to-json--from-json", () { | |
1153 var o = buildGoogleCloudMlV1beta1PredictRequest(); | |
1154 var od = new api.GoogleCloudMlV1beta1PredictRequest.fromJson(o.toJson()); | |
1155 checkGoogleCloudMlV1beta1PredictRequest(od); | |
1156 }); | |
1157 }); | |
1158 | |
1159 | |
1160 unittest.group("obj-schema-GoogleCloudMlV1beta1PredictionInput", () { | |
1161 unittest.test("to-json--from-json", () { | |
1162 var o = buildGoogleCloudMlV1beta1PredictionInput(); | |
1163 var od = new api.GoogleCloudMlV1beta1PredictionInput.fromJson(o.toJson()); | |
1164 checkGoogleCloudMlV1beta1PredictionInput(od); | |
1165 }); | |
1166 }); | |
1167 | |
1168 | |
1169 unittest.group("obj-schema-GoogleCloudMlV1beta1PredictionOutput", () { | |
1170 unittest.test("to-json--from-json", () { | |
1171 var o = buildGoogleCloudMlV1beta1PredictionOutput(); | |
1172 var od = new api.GoogleCloudMlV1beta1PredictionOutput.fromJson(o.toJson())
; | |
1173 checkGoogleCloudMlV1beta1PredictionOutput(od); | |
1174 }); | |
1175 }); | |
1176 | |
1177 | |
1178 unittest.group("obj-schema-GoogleCloudMlV1beta1SetDefaultVersionRequest", () { | |
1179 unittest.test("to-json--from-json", () { | |
1180 var o = buildGoogleCloudMlV1beta1SetDefaultVersionRequest(); | |
1181 var od = new api.GoogleCloudMlV1beta1SetDefaultVersionRequest.fromJson(o.t
oJson()); | |
1182 checkGoogleCloudMlV1beta1SetDefaultVersionRequest(od); | |
1183 }); | |
1184 }); | |
1185 | |
1186 | |
1187 unittest.group("obj-schema-GoogleCloudMlV1beta1TrainingInput", () { | |
1188 unittest.test("to-json--from-json", () { | |
1189 var o = buildGoogleCloudMlV1beta1TrainingInput(); | |
1190 var od = new api.GoogleCloudMlV1beta1TrainingInput.fromJson(o.toJson()); | |
1191 checkGoogleCloudMlV1beta1TrainingInput(od); | |
1192 }); | |
1193 }); | |
1194 | |
1195 | |
1196 unittest.group("obj-schema-GoogleCloudMlV1beta1TrainingOutput", () { | |
1197 unittest.test("to-json--from-json", () { | |
1198 var o = buildGoogleCloudMlV1beta1TrainingOutput(); | |
1199 var od = new api.GoogleCloudMlV1beta1TrainingOutput.fromJson(o.toJson()); | |
1200 checkGoogleCloudMlV1beta1TrainingOutput(od); | |
1201 }); | |
1202 }); | |
1203 | |
1204 | |
1205 unittest.group("obj-schema-GoogleCloudMlV1beta1Version", () { | |
1206 unittest.test("to-json--from-json", () { | |
1207 var o = buildGoogleCloudMlV1beta1Version(); | |
1208 var od = new api.GoogleCloudMlV1beta1Version.fromJson(o.toJson()); | |
1209 checkGoogleCloudMlV1beta1Version(od); | |
1210 }); | |
1211 }); | |
1212 | |
1213 | |
1214 unittest.group("obj-schema-GoogleLongrunningListOperationsResponse", () { | |
1215 unittest.test("to-json--from-json", () { | |
1216 var o = buildGoogleLongrunningListOperationsResponse(); | |
1217 var od = new api.GoogleLongrunningListOperationsResponse.fromJson(o.toJson
()); | |
1218 checkGoogleLongrunningListOperationsResponse(od); | |
1219 }); | |
1220 }); | |
1221 | |
1222 | |
1223 unittest.group("obj-schema-GoogleLongrunningOperation", () { | |
1224 unittest.test("to-json--from-json", () { | |
1225 var o = buildGoogleLongrunningOperation(); | |
1226 var od = new api.GoogleLongrunningOperation.fromJson(o.toJson()); | |
1227 checkGoogleLongrunningOperation(od); | |
1228 }); | |
1229 }); | |
1230 | |
1231 | |
1232 unittest.group("obj-schema-GoogleProtobufEmpty", () { | |
1233 unittest.test("to-json--from-json", () { | |
1234 var o = buildGoogleProtobufEmpty(); | |
1235 var od = new api.GoogleProtobufEmpty.fromJson(o.toJson()); | |
1236 checkGoogleProtobufEmpty(od); | |
1237 }); | |
1238 }); | |
1239 | |
1240 | |
1241 unittest.group("obj-schema-GoogleRpcStatus", () { | |
1242 unittest.test("to-json--from-json", () { | |
1243 var o = buildGoogleRpcStatus(); | |
1244 var od = new api.GoogleRpcStatus.fromJson(o.toJson()); | |
1245 checkGoogleRpcStatus(od); | |
1246 }); | |
1247 }); | |
1248 | |
1249 | |
1250 unittest.group("resource-ProjectsResourceApi", () { | |
1251 unittest.test("method--getConfig", () { | |
1252 | |
1253 var mock = new HttpServerMock(); | |
1254 api.ProjectsResourceApi res = new api.MlApi(mock).projects; | |
1255 var arg_name = "foo"; | |
1256 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1257 var path = (req.url).path; | |
1258 var pathOffset = 0; | |
1259 var index; | |
1260 var subPart; | |
1261 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1262 pathOffset += 1; | |
1263 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1264 pathOffset += 8; | |
1265 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1266 | |
1267 var query = (req.url).query; | |
1268 var queryOffset = 0; | |
1269 var queryMap = {}; | |
1270 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1271 parseBool(n) { | |
1272 if (n == "true") return true; | |
1273 if (n == "false") return false; | |
1274 if (n == null) return null; | |
1275 throw new core.ArgumentError("Invalid boolean: $n"); | |
1276 } | |
1277 if (query.length > 0) { | |
1278 for (var part in query.split("&")) { | |
1279 var keyvalue = part.split("="); | |
1280 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1281 } | |
1282 } | |
1283 | |
1284 | |
1285 var h = { | |
1286 "content-type" : "application/json; charset=utf-8", | |
1287 }; | |
1288 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1GetConfigRespons
e()); | |
1289 return new async.Future.value(stringResponse(200, h, resp)); | |
1290 }), true); | |
1291 res.getConfig(arg_name).then(unittest.expectAsync(((api.GoogleCloudMlV1bet
a1GetConfigResponse response) { | |
1292 checkGoogleCloudMlV1beta1GetConfigResponse(response); | |
1293 }))); | |
1294 }); | |
1295 | |
1296 unittest.test("method--predict", () { | |
1297 | |
1298 var mock = new HttpServerMock(); | |
1299 api.ProjectsResourceApi res = new api.MlApi(mock).projects; | |
1300 var arg_request = buildGoogleCloudMlV1beta1PredictRequest(); | |
1301 var arg_name = "foo"; | |
1302 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1303 var obj = new api.GoogleCloudMlV1beta1PredictRequest.fromJson(json); | |
1304 checkGoogleCloudMlV1beta1PredictRequest(obj); | |
1305 | |
1306 var path = (req.url).path; | |
1307 var pathOffset = 0; | |
1308 var index; | |
1309 var subPart; | |
1310 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1311 pathOffset += 1; | |
1312 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1313 pathOffset += 8; | |
1314 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1315 | |
1316 var query = (req.url).query; | |
1317 var queryOffset = 0; | |
1318 var queryMap = {}; | |
1319 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1320 parseBool(n) { | |
1321 if (n == "true") return true; | |
1322 if (n == "false") return false; | |
1323 if (n == null) return null; | |
1324 throw new core.ArgumentError("Invalid boolean: $n"); | |
1325 } | |
1326 if (query.length > 0) { | |
1327 for (var part in query.split("&")) { | |
1328 var keyvalue = part.split("="); | |
1329 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1330 } | |
1331 } | |
1332 | |
1333 | |
1334 var h = { | |
1335 "content-type" : "application/json; charset=utf-8", | |
1336 }; | |
1337 var resp = convert.JSON.encode(buildGoogleApiHttpBody()); | |
1338 return new async.Future.value(stringResponse(200, h, resp)); | |
1339 }), true); | |
1340 res.predict(arg_request, arg_name).then(unittest.expectAsync(((api.GoogleA
piHttpBody response) { | |
1341 checkGoogleApiHttpBody(response); | |
1342 }))); | |
1343 }); | |
1344 | |
1345 }); | |
1346 | |
1347 | |
1348 unittest.group("resource-ProjectsJobsResourceApi", () { | |
1349 unittest.test("method--cancel", () { | |
1350 | |
1351 var mock = new HttpServerMock(); | |
1352 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs; | |
1353 var arg_request = buildGoogleCloudMlV1beta1CancelJobRequest(); | |
1354 var arg_name = "foo"; | |
1355 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1356 var obj = new api.GoogleCloudMlV1beta1CancelJobRequest.fromJson(json); | |
1357 checkGoogleCloudMlV1beta1CancelJobRequest(obj); | |
1358 | |
1359 var path = (req.url).path; | |
1360 var pathOffset = 0; | |
1361 var index; | |
1362 var subPart; | |
1363 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1364 pathOffset += 1; | |
1365 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1366 pathOffset += 8; | |
1367 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1368 | |
1369 var query = (req.url).query; | |
1370 var queryOffset = 0; | |
1371 var queryMap = {}; | |
1372 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1373 parseBool(n) { | |
1374 if (n == "true") return true; | |
1375 if (n == "false") return false; | |
1376 if (n == null) return null; | |
1377 throw new core.ArgumentError("Invalid boolean: $n"); | |
1378 } | |
1379 if (query.length > 0) { | |
1380 for (var part in query.split("&")) { | |
1381 var keyvalue = part.split("="); | |
1382 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1383 } | |
1384 } | |
1385 | |
1386 | |
1387 var h = { | |
1388 "content-type" : "application/json; charset=utf-8", | |
1389 }; | |
1390 var resp = convert.JSON.encode(buildGoogleProtobufEmpty()); | |
1391 return new async.Future.value(stringResponse(200, h, resp)); | |
1392 }), true); | |
1393 res.cancel(arg_request, arg_name).then(unittest.expectAsync(((api.GooglePr
otobufEmpty response) { | |
1394 checkGoogleProtobufEmpty(response); | |
1395 }))); | |
1396 }); | |
1397 | |
1398 unittest.test("method--create", () { | |
1399 | |
1400 var mock = new HttpServerMock(); | |
1401 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs; | |
1402 var arg_request = buildGoogleCloudMlV1beta1Job(); | |
1403 var arg_parent = "foo"; | |
1404 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1405 var obj = new api.GoogleCloudMlV1beta1Job.fromJson(json); | |
1406 checkGoogleCloudMlV1beta1Job(obj); | |
1407 | |
1408 var path = (req.url).path; | |
1409 var pathOffset = 0; | |
1410 var index; | |
1411 var subPart; | |
1412 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1413 pathOffset += 1; | |
1414 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1415 pathOffset += 8; | |
1416 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1417 | |
1418 var query = (req.url).query; | |
1419 var queryOffset = 0; | |
1420 var queryMap = {}; | |
1421 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1422 parseBool(n) { | |
1423 if (n == "true") return true; | |
1424 if (n == "false") return false; | |
1425 if (n == null) return null; | |
1426 throw new core.ArgumentError("Invalid boolean: $n"); | |
1427 } | |
1428 if (query.length > 0) { | |
1429 for (var part in query.split("&")) { | |
1430 var keyvalue = part.split("="); | |
1431 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1432 } | |
1433 } | |
1434 | |
1435 | |
1436 var h = { | |
1437 "content-type" : "application/json; charset=utf-8", | |
1438 }; | |
1439 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1Job()); | |
1440 return new async.Future.value(stringResponse(200, h, resp)); | |
1441 }), true); | |
1442 res.create(arg_request, arg_parent).then(unittest.expectAsync(((api.Google
CloudMlV1beta1Job response) { | |
1443 checkGoogleCloudMlV1beta1Job(response); | |
1444 }))); | |
1445 }); | |
1446 | |
1447 unittest.test("method--get", () { | |
1448 | |
1449 var mock = new HttpServerMock(); | |
1450 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs; | |
1451 var arg_name = "foo"; | |
1452 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1453 var path = (req.url).path; | |
1454 var pathOffset = 0; | |
1455 var index; | |
1456 var subPart; | |
1457 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1458 pathOffset += 1; | |
1459 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1460 pathOffset += 8; | |
1461 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1462 | |
1463 var query = (req.url).query; | |
1464 var queryOffset = 0; | |
1465 var queryMap = {}; | |
1466 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1467 parseBool(n) { | |
1468 if (n == "true") return true; | |
1469 if (n == "false") return false; | |
1470 if (n == null) return null; | |
1471 throw new core.ArgumentError("Invalid boolean: $n"); | |
1472 } | |
1473 if (query.length > 0) { | |
1474 for (var part in query.split("&")) { | |
1475 var keyvalue = part.split("="); | |
1476 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1477 } | |
1478 } | |
1479 | |
1480 | |
1481 var h = { | |
1482 "content-type" : "application/json; charset=utf-8", | |
1483 }; | |
1484 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1Job()); | |
1485 return new async.Future.value(stringResponse(200, h, resp)); | |
1486 }), true); | |
1487 res.get(arg_name).then(unittest.expectAsync(((api.GoogleCloudMlV1beta1Job
response) { | |
1488 checkGoogleCloudMlV1beta1Job(response); | |
1489 }))); | |
1490 }); | |
1491 | |
1492 unittest.test("method--list", () { | |
1493 | |
1494 var mock = new HttpServerMock(); | |
1495 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs; | |
1496 var arg_parent = "foo"; | |
1497 var arg_pageToken = "foo"; | |
1498 var arg_pageSize = 42; | |
1499 var arg_filter = "foo"; | |
1500 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1501 var path = (req.url).path; | |
1502 var pathOffset = 0; | |
1503 var index; | |
1504 var subPart; | |
1505 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1506 pathOffset += 1; | |
1507 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1508 pathOffset += 8; | |
1509 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1510 | |
1511 var query = (req.url).query; | |
1512 var queryOffset = 0; | |
1513 var queryMap = {}; | |
1514 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1515 parseBool(n) { | |
1516 if (n == "true") return true; | |
1517 if (n == "false") return false; | |
1518 if (n == null) return null; | |
1519 throw new core.ArgumentError("Invalid boolean: $n"); | |
1520 } | |
1521 if (query.length > 0) { | |
1522 for (var part in query.split("&")) { | |
1523 var keyvalue = part.split("="); | |
1524 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1525 } | |
1526 } | |
1527 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1528 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
1529 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | |
1530 | |
1531 | |
1532 var h = { | |
1533 "content-type" : "application/json; charset=utf-8", | |
1534 }; | |
1535 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1ListJobsResponse
()); | |
1536 return new async.Future.value(stringResponse(200, h, resp)); | |
1537 }), true); | |
1538 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize, fil
ter: arg_filter).then(unittest.expectAsync(((api.GoogleCloudMlV1beta1ListJobsRes
ponse response) { | |
1539 checkGoogleCloudMlV1beta1ListJobsResponse(response); | |
1540 }))); | |
1541 }); | |
1542 | |
1543 }); | |
1544 | |
1545 | |
1546 unittest.group("resource-ProjectsModelsResourceApi", () { | |
1547 unittest.test("method--create", () { | |
1548 | |
1549 var mock = new HttpServerMock(); | |
1550 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models; | |
1551 var arg_request = buildGoogleCloudMlV1beta1Model(); | |
1552 var arg_parent = "foo"; | |
1553 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1554 var obj = new api.GoogleCloudMlV1beta1Model.fromJson(json); | |
1555 checkGoogleCloudMlV1beta1Model(obj); | |
1556 | |
1557 var path = (req.url).path; | |
1558 var pathOffset = 0; | |
1559 var index; | |
1560 var subPart; | |
1561 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1562 pathOffset += 1; | |
1563 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1564 pathOffset += 8; | |
1565 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1566 | |
1567 var query = (req.url).query; | |
1568 var queryOffset = 0; | |
1569 var queryMap = {}; | |
1570 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1571 parseBool(n) { | |
1572 if (n == "true") return true; | |
1573 if (n == "false") return false; | |
1574 if (n == null) return null; | |
1575 throw new core.ArgumentError("Invalid boolean: $n"); | |
1576 } | |
1577 if (query.length > 0) { | |
1578 for (var part in query.split("&")) { | |
1579 var keyvalue = part.split("="); | |
1580 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1581 } | |
1582 } | |
1583 | |
1584 | |
1585 var h = { | |
1586 "content-type" : "application/json; charset=utf-8", | |
1587 }; | |
1588 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1Model()); | |
1589 return new async.Future.value(stringResponse(200, h, resp)); | |
1590 }), true); | |
1591 res.create(arg_request, arg_parent).then(unittest.expectAsync(((api.Google
CloudMlV1beta1Model response) { | |
1592 checkGoogleCloudMlV1beta1Model(response); | |
1593 }))); | |
1594 }); | |
1595 | |
1596 unittest.test("method--delete", () { | |
1597 | |
1598 var mock = new HttpServerMock(); | |
1599 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models; | |
1600 var arg_name = "foo"; | |
1601 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1602 var path = (req.url).path; | |
1603 var pathOffset = 0; | |
1604 var index; | |
1605 var subPart; | |
1606 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1607 pathOffset += 1; | |
1608 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1609 pathOffset += 8; | |
1610 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1611 | |
1612 var query = (req.url).query; | |
1613 var queryOffset = 0; | |
1614 var queryMap = {}; | |
1615 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1616 parseBool(n) { | |
1617 if (n == "true") return true; | |
1618 if (n == "false") return false; | |
1619 if (n == null) return null; | |
1620 throw new core.ArgumentError("Invalid boolean: $n"); | |
1621 } | |
1622 if (query.length > 0) { | |
1623 for (var part in query.split("&")) { | |
1624 var keyvalue = part.split("="); | |
1625 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1626 } | |
1627 } | |
1628 | |
1629 | |
1630 var h = { | |
1631 "content-type" : "application/json; charset=utf-8", | |
1632 }; | |
1633 var resp = convert.JSON.encode(buildGoogleLongrunningOperation()); | |
1634 return new async.Future.value(stringResponse(200, h, resp)); | |
1635 }), true); | |
1636 res.delete(arg_name).then(unittest.expectAsync(((api.GoogleLongrunningOper
ation response) { | |
1637 checkGoogleLongrunningOperation(response); | |
1638 }))); | |
1639 }); | |
1640 | |
1641 unittest.test("method--get", () { | |
1642 | |
1643 var mock = new HttpServerMock(); | |
1644 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models; | |
1645 var arg_name = "foo"; | |
1646 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1647 var path = (req.url).path; | |
1648 var pathOffset = 0; | |
1649 var index; | |
1650 var subPart; | |
1651 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1652 pathOffset += 1; | |
1653 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1654 pathOffset += 8; | |
1655 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1656 | |
1657 var query = (req.url).query; | |
1658 var queryOffset = 0; | |
1659 var queryMap = {}; | |
1660 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1661 parseBool(n) { | |
1662 if (n == "true") return true; | |
1663 if (n == "false") return false; | |
1664 if (n == null) return null; | |
1665 throw new core.ArgumentError("Invalid boolean: $n"); | |
1666 } | |
1667 if (query.length > 0) { | |
1668 for (var part in query.split("&")) { | |
1669 var keyvalue = part.split("="); | |
1670 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1671 } | |
1672 } | |
1673 | |
1674 | |
1675 var h = { | |
1676 "content-type" : "application/json; charset=utf-8", | |
1677 }; | |
1678 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1Model()); | |
1679 return new async.Future.value(stringResponse(200, h, resp)); | |
1680 }), true); | |
1681 res.get(arg_name).then(unittest.expectAsync(((api.GoogleCloudMlV1beta1Mode
l response) { | |
1682 checkGoogleCloudMlV1beta1Model(response); | |
1683 }))); | |
1684 }); | |
1685 | |
1686 unittest.test("method--list", () { | |
1687 | |
1688 var mock = new HttpServerMock(); | |
1689 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models; | |
1690 var arg_parent = "foo"; | |
1691 var arg_pageToken = "foo"; | |
1692 var arg_pageSize = 42; | |
1693 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1694 var path = (req.url).path; | |
1695 var pathOffset = 0; | |
1696 var index; | |
1697 var subPart; | |
1698 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1699 pathOffset += 1; | |
1700 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1701 pathOffset += 8; | |
1702 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1703 | |
1704 var query = (req.url).query; | |
1705 var queryOffset = 0; | |
1706 var queryMap = {}; | |
1707 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1708 parseBool(n) { | |
1709 if (n == "true") return true; | |
1710 if (n == "false") return false; | |
1711 if (n == null) return null; | |
1712 throw new core.ArgumentError("Invalid boolean: $n"); | |
1713 } | |
1714 if (query.length > 0) { | |
1715 for (var part in query.split("&")) { | |
1716 var keyvalue = part.split("="); | |
1717 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1718 } | |
1719 } | |
1720 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1721 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
1722 | |
1723 | |
1724 var h = { | |
1725 "content-type" : "application/json; charset=utf-8", | |
1726 }; | |
1727 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1ListModelsRespon
se()); | |
1728 return new async.Future.value(stringResponse(200, h, resp)); | |
1729 }), true); | |
1730 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).the
n(unittest.expectAsync(((api.GoogleCloudMlV1beta1ListModelsResponse response) { | |
1731 checkGoogleCloudMlV1beta1ListModelsResponse(response); | |
1732 }))); | |
1733 }); | |
1734 | |
1735 }); | |
1736 | |
1737 | |
1738 unittest.group("resource-ProjectsModelsVersionsResourceApi", () { | |
1739 unittest.test("method--create", () { | |
1740 | |
1741 var mock = new HttpServerMock(); | |
1742 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; | |
1743 var arg_request = buildGoogleCloudMlV1beta1Version(); | |
1744 var arg_parent = "foo"; | |
1745 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1746 var obj = new api.GoogleCloudMlV1beta1Version.fromJson(json); | |
1747 checkGoogleCloudMlV1beta1Version(obj); | |
1748 | |
1749 var path = (req.url).path; | |
1750 var pathOffset = 0; | |
1751 var index; | |
1752 var subPart; | |
1753 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1754 pathOffset += 1; | |
1755 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1756 pathOffset += 8; | |
1757 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1758 | |
1759 var query = (req.url).query; | |
1760 var queryOffset = 0; | |
1761 var queryMap = {}; | |
1762 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1763 parseBool(n) { | |
1764 if (n == "true") return true; | |
1765 if (n == "false") return false; | |
1766 if (n == null) return null; | |
1767 throw new core.ArgumentError("Invalid boolean: $n"); | |
1768 } | |
1769 if (query.length > 0) { | |
1770 for (var part in query.split("&")) { | |
1771 var keyvalue = part.split("="); | |
1772 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1773 } | |
1774 } | |
1775 | |
1776 | |
1777 var h = { | |
1778 "content-type" : "application/json; charset=utf-8", | |
1779 }; | |
1780 var resp = convert.JSON.encode(buildGoogleLongrunningOperation()); | |
1781 return new async.Future.value(stringResponse(200, h, resp)); | |
1782 }), true); | |
1783 res.create(arg_request, arg_parent).then(unittest.expectAsync(((api.Google
LongrunningOperation response) { | |
1784 checkGoogleLongrunningOperation(response); | |
1785 }))); | |
1786 }); | |
1787 | |
1788 unittest.test("method--delete", () { | |
1789 | |
1790 var mock = new HttpServerMock(); | |
1791 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; | |
1792 var arg_name = "foo"; | |
1793 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1794 var path = (req.url).path; | |
1795 var pathOffset = 0; | |
1796 var index; | |
1797 var subPart; | |
1798 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1799 pathOffset += 1; | |
1800 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1801 pathOffset += 8; | |
1802 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1803 | |
1804 var query = (req.url).query; | |
1805 var queryOffset = 0; | |
1806 var queryMap = {}; | |
1807 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1808 parseBool(n) { | |
1809 if (n == "true") return true; | |
1810 if (n == "false") return false; | |
1811 if (n == null) return null; | |
1812 throw new core.ArgumentError("Invalid boolean: $n"); | |
1813 } | |
1814 if (query.length > 0) { | |
1815 for (var part in query.split("&")) { | |
1816 var keyvalue = part.split("="); | |
1817 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1818 } | |
1819 } | |
1820 | |
1821 | |
1822 var h = { | |
1823 "content-type" : "application/json; charset=utf-8", | |
1824 }; | |
1825 var resp = convert.JSON.encode(buildGoogleLongrunningOperation()); | |
1826 return new async.Future.value(stringResponse(200, h, resp)); | |
1827 }), true); | |
1828 res.delete(arg_name).then(unittest.expectAsync(((api.GoogleLongrunningOper
ation response) { | |
1829 checkGoogleLongrunningOperation(response); | |
1830 }))); | |
1831 }); | |
1832 | |
1833 unittest.test("method--get", () { | |
1834 | |
1835 var mock = new HttpServerMock(); | |
1836 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; | |
1837 var arg_name = "foo"; | |
1838 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1839 var path = (req.url).path; | |
1840 var pathOffset = 0; | |
1841 var index; | |
1842 var subPart; | |
1843 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1844 pathOffset += 1; | |
1845 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1846 pathOffset += 8; | |
1847 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1848 | |
1849 var query = (req.url).query; | |
1850 var queryOffset = 0; | |
1851 var queryMap = {}; | |
1852 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1853 parseBool(n) { | |
1854 if (n == "true") return true; | |
1855 if (n == "false") return false; | |
1856 if (n == null) return null; | |
1857 throw new core.ArgumentError("Invalid boolean: $n"); | |
1858 } | |
1859 if (query.length > 0) { | |
1860 for (var part in query.split("&")) { | |
1861 var keyvalue = part.split("="); | |
1862 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1863 } | |
1864 } | |
1865 | |
1866 | |
1867 var h = { | |
1868 "content-type" : "application/json; charset=utf-8", | |
1869 }; | |
1870 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1Version()); | |
1871 return new async.Future.value(stringResponse(200, h, resp)); | |
1872 }), true); | |
1873 res.get(arg_name).then(unittest.expectAsync(((api.GoogleCloudMlV1beta1Vers
ion response) { | |
1874 checkGoogleCloudMlV1beta1Version(response); | |
1875 }))); | |
1876 }); | |
1877 | |
1878 unittest.test("method--list", () { | |
1879 | |
1880 var mock = new HttpServerMock(); | |
1881 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; | |
1882 var arg_parent = "foo"; | |
1883 var arg_pageToken = "foo"; | |
1884 var arg_pageSize = 42; | |
1885 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1886 var path = (req.url).path; | |
1887 var pathOffset = 0; | |
1888 var index; | |
1889 var subPart; | |
1890 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1891 pathOffset += 1; | |
1892 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1893 pathOffset += 8; | |
1894 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1895 | |
1896 var query = (req.url).query; | |
1897 var queryOffset = 0; | |
1898 var queryMap = {}; | |
1899 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1900 parseBool(n) { | |
1901 if (n == "true") return true; | |
1902 if (n == "false") return false; | |
1903 if (n == null) return null; | |
1904 throw new core.ArgumentError("Invalid boolean: $n"); | |
1905 } | |
1906 if (query.length > 0) { | |
1907 for (var part in query.split("&")) { | |
1908 var keyvalue = part.split("="); | |
1909 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1910 } | |
1911 } | |
1912 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1913 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
1914 | |
1915 | |
1916 var h = { | |
1917 "content-type" : "application/json; charset=utf-8", | |
1918 }; | |
1919 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1ListVersionsResp
onse()); | |
1920 return new async.Future.value(stringResponse(200, h, resp)); | |
1921 }), true); | |
1922 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).the
n(unittest.expectAsync(((api.GoogleCloudMlV1beta1ListVersionsResponse response)
{ | |
1923 checkGoogleCloudMlV1beta1ListVersionsResponse(response); | |
1924 }))); | |
1925 }); | |
1926 | |
1927 unittest.test("method--setDefault", () { | |
1928 | |
1929 var mock = new HttpServerMock(); | |
1930 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; | |
1931 var arg_request = buildGoogleCloudMlV1beta1SetDefaultVersionRequest(); | |
1932 var arg_name = "foo"; | |
1933 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1934 var obj = new api.GoogleCloudMlV1beta1SetDefaultVersionRequest.fromJson(
json); | |
1935 checkGoogleCloudMlV1beta1SetDefaultVersionRequest(obj); | |
1936 | |
1937 var path = (req.url).path; | |
1938 var pathOffset = 0; | |
1939 var index; | |
1940 var subPart; | |
1941 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1942 pathOffset += 1; | |
1943 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1944 pathOffset += 8; | |
1945 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1946 | |
1947 var query = (req.url).query; | |
1948 var queryOffset = 0; | |
1949 var queryMap = {}; | |
1950 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1951 parseBool(n) { | |
1952 if (n == "true") return true; | |
1953 if (n == "false") return false; | |
1954 if (n == null) return null; | |
1955 throw new core.ArgumentError("Invalid boolean: $n"); | |
1956 } | |
1957 if (query.length > 0) { | |
1958 for (var part in query.split("&")) { | |
1959 var keyvalue = part.split("="); | |
1960 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1961 } | |
1962 } | |
1963 | |
1964 | |
1965 var h = { | |
1966 "content-type" : "application/json; charset=utf-8", | |
1967 }; | |
1968 var resp = convert.JSON.encode(buildGoogleCloudMlV1beta1Version()); | |
1969 return new async.Future.value(stringResponse(200, h, resp)); | |
1970 }), true); | |
1971 res.setDefault(arg_request, arg_name).then(unittest.expectAsync(((api.Goog
leCloudMlV1beta1Version response) { | |
1972 checkGoogleCloudMlV1beta1Version(response); | |
1973 }))); | |
1974 }); | |
1975 | |
1976 }); | |
1977 | |
1978 | |
1979 unittest.group("resource-ProjectsOperationsResourceApi", () { | |
1980 unittest.test("method--cancel", () { | |
1981 | |
1982 var mock = new HttpServerMock(); | |
1983 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera
tions; | |
1984 var arg_name = "foo"; | |
1985 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1986 var path = (req.url).path; | |
1987 var pathOffset = 0; | |
1988 var index; | |
1989 var subPart; | |
1990 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1991 pathOffset += 1; | |
1992 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
1993 pathOffset += 8; | |
1994 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
1995 | |
1996 var query = (req.url).query; | |
1997 var queryOffset = 0; | |
1998 var queryMap = {}; | |
1999 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2000 parseBool(n) { | |
2001 if (n == "true") return true; | |
2002 if (n == "false") return false; | |
2003 if (n == null) return null; | |
2004 throw new core.ArgumentError("Invalid boolean: $n"); | |
2005 } | |
2006 if (query.length > 0) { | |
2007 for (var part in query.split("&")) { | |
2008 var keyvalue = part.split("="); | |
2009 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2010 } | |
2011 } | |
2012 | |
2013 | |
2014 var h = { | |
2015 "content-type" : "application/json; charset=utf-8", | |
2016 }; | |
2017 var resp = convert.JSON.encode(buildGoogleProtobufEmpty()); | |
2018 return new async.Future.value(stringResponse(200, h, resp)); | |
2019 }), true); | |
2020 res.cancel(arg_name).then(unittest.expectAsync(((api.GoogleProtobufEmpty r
esponse) { | |
2021 checkGoogleProtobufEmpty(response); | |
2022 }))); | |
2023 }); | |
2024 | |
2025 unittest.test("method--delete", () { | |
2026 | |
2027 var mock = new HttpServerMock(); | |
2028 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera
tions; | |
2029 var arg_name = "foo"; | |
2030 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2031 var path = (req.url).path; | |
2032 var pathOffset = 0; | |
2033 var index; | |
2034 var subPart; | |
2035 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2036 pathOffset += 1; | |
2037 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
2038 pathOffset += 8; | |
2039 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
2040 | |
2041 var query = (req.url).query; | |
2042 var queryOffset = 0; | |
2043 var queryMap = {}; | |
2044 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2045 parseBool(n) { | |
2046 if (n == "true") return true; | |
2047 if (n == "false") return false; | |
2048 if (n == null) return null; | |
2049 throw new core.ArgumentError("Invalid boolean: $n"); | |
2050 } | |
2051 if (query.length > 0) { | |
2052 for (var part in query.split("&")) { | |
2053 var keyvalue = part.split("="); | |
2054 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2055 } | |
2056 } | |
2057 | |
2058 | |
2059 var h = { | |
2060 "content-type" : "application/json; charset=utf-8", | |
2061 }; | |
2062 var resp = convert.JSON.encode(buildGoogleProtobufEmpty()); | |
2063 return new async.Future.value(stringResponse(200, h, resp)); | |
2064 }), true); | |
2065 res.delete(arg_name).then(unittest.expectAsync(((api.GoogleProtobufEmpty r
esponse) { | |
2066 checkGoogleProtobufEmpty(response); | |
2067 }))); | |
2068 }); | |
2069 | |
2070 unittest.test("method--get", () { | |
2071 | |
2072 var mock = new HttpServerMock(); | |
2073 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera
tions; | |
2074 var arg_name = "foo"; | |
2075 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2076 var path = (req.url).path; | |
2077 var pathOffset = 0; | |
2078 var index; | |
2079 var subPart; | |
2080 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2081 pathOffset += 1; | |
2082 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
2083 pathOffset += 8; | |
2084 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
2085 | |
2086 var query = (req.url).query; | |
2087 var queryOffset = 0; | |
2088 var queryMap = {}; | |
2089 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2090 parseBool(n) { | |
2091 if (n == "true") return true; | |
2092 if (n == "false") return false; | |
2093 if (n == null) return null; | |
2094 throw new core.ArgumentError("Invalid boolean: $n"); | |
2095 } | |
2096 if (query.length > 0) { | |
2097 for (var part in query.split("&")) { | |
2098 var keyvalue = part.split("="); | |
2099 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2100 } | |
2101 } | |
2102 | |
2103 | |
2104 var h = { | |
2105 "content-type" : "application/json; charset=utf-8", | |
2106 }; | |
2107 var resp = convert.JSON.encode(buildGoogleLongrunningOperation()); | |
2108 return new async.Future.value(stringResponse(200, h, resp)); | |
2109 }), true); | |
2110 res.get(arg_name).then(unittest.expectAsync(((api.GoogleLongrunningOperati
on response) { | |
2111 checkGoogleLongrunningOperation(response); | |
2112 }))); | |
2113 }); | |
2114 | |
2115 unittest.test("method--list", () { | |
2116 | |
2117 var mock = new HttpServerMock(); | |
2118 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera
tions; | |
2119 var arg_name = "foo"; | |
2120 var arg_pageToken = "foo"; | |
2121 var arg_pageSize = 42; | |
2122 var arg_filter = "foo"; | |
2123 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
2124 var path = (req.url).path; | |
2125 var pathOffset = 0; | |
2126 var index; | |
2127 var subPart; | |
2128 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
2129 pathOffset += 1; | |
2130 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | |
2131 pathOffset += 8; | |
2132 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | |
2133 | |
2134 var query = (req.url).query; | |
2135 var queryOffset = 0; | |
2136 var queryMap = {}; | |
2137 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
2138 parseBool(n) { | |
2139 if (n == "true") return true; | |
2140 if (n == "false") return false; | |
2141 if (n == null) return null; | |
2142 throw new core.ArgumentError("Invalid boolean: $n"); | |
2143 } | |
2144 if (query.length > 0) { | |
2145 for (var part in query.split("&")) { | |
2146 var keyvalue = part.split("="); | |
2147 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
2148 } | |
2149 } | |
2150 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
2151 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
2152 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | |
2153 | |
2154 | |
2155 var h = { | |
2156 "content-type" : "application/json; charset=utf-8", | |
2157 }; | |
2158 var resp = convert.JSON.encode(buildGoogleLongrunningListOperationsRespo
nse()); | |
2159 return new async.Future.value(stringResponse(200, h, resp)); | |
2160 }), true); | |
2161 res.list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize, filte
r: arg_filter).then(unittest.expectAsync(((api.GoogleLongrunningListOperationsRe
sponse response) { | |
2162 checkGoogleLongrunningListOperationsResponse(response); | |
2163 }))); | |
2164 }); | |
2165 | |
2166 }); | |
2167 | |
2168 | |
2169 } | |
2170 | |
OLD | NEW |