OLD | NEW |
1 library googleapis.cloudtrace.v1.test; | 1 library googleapis.cloudtrace.v1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return o; | 61 return o; |
62 } | 62 } |
63 | 63 |
64 checkEmpty(api.Empty o) { | 64 checkEmpty(api.Empty o) { |
65 buildCounterEmpty++; | 65 buildCounterEmpty++; |
66 if (buildCounterEmpty < 3) { | 66 if (buildCounterEmpty < 3) { |
67 } | 67 } |
68 buildCounterEmpty--; | 68 buildCounterEmpty--; |
69 } | 69 } |
70 | 70 |
71 buildUnnamed132() { | 71 buildUnnamed134() { |
72 var o = new core.List<api.Trace>(); | 72 var o = new core.List<api.Trace>(); |
73 o.add(buildTrace()); | 73 o.add(buildTrace()); |
74 o.add(buildTrace()); | 74 o.add(buildTrace()); |
75 return o; | 75 return o; |
76 } | 76 } |
77 | 77 |
78 checkUnnamed132(core.List<api.Trace> o) { | 78 checkUnnamed134(core.List<api.Trace> o) { |
79 unittest.expect(o, unittest.hasLength(2)); | 79 unittest.expect(o, unittest.hasLength(2)); |
80 checkTrace(o[0]); | 80 checkTrace(o[0]); |
81 checkTrace(o[1]); | 81 checkTrace(o[1]); |
82 } | 82 } |
83 | 83 |
84 core.int buildCounterListTracesResponse = 0; | 84 core.int buildCounterListTracesResponse = 0; |
85 buildListTracesResponse() { | 85 buildListTracesResponse() { |
86 var o = new api.ListTracesResponse(); | 86 var o = new api.ListTracesResponse(); |
87 buildCounterListTracesResponse++; | 87 buildCounterListTracesResponse++; |
88 if (buildCounterListTracesResponse < 3) { | 88 if (buildCounterListTracesResponse < 3) { |
89 o.nextPageToken = "foo"; | 89 o.nextPageToken = "foo"; |
90 o.traces = buildUnnamed132(); | 90 o.traces = buildUnnamed134(); |
91 } | 91 } |
92 buildCounterListTracesResponse--; | 92 buildCounterListTracesResponse--; |
93 return o; | 93 return o; |
94 } | 94 } |
95 | 95 |
96 checkListTracesResponse(api.ListTracesResponse o) { | 96 checkListTracesResponse(api.ListTracesResponse o) { |
97 buildCounterListTracesResponse++; | 97 buildCounterListTracesResponse++; |
98 if (buildCounterListTracesResponse < 3) { | 98 if (buildCounterListTracesResponse < 3) { |
99 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 99 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
100 checkUnnamed132(o.traces); | 100 checkUnnamed134(o.traces); |
101 } | 101 } |
102 buildCounterListTracesResponse--; | 102 buildCounterListTracesResponse--; |
103 } | 103 } |
104 | 104 |
105 buildUnnamed133() { | 105 buildUnnamed135() { |
106 var o = new core.List<api.TraceSpan>(); | 106 var o = new core.List<api.TraceSpan>(); |
107 o.add(buildTraceSpan()); | 107 o.add(buildTraceSpan()); |
108 o.add(buildTraceSpan()); | 108 o.add(buildTraceSpan()); |
109 return o; | 109 return o; |
110 } | 110 } |
111 | 111 |
112 checkUnnamed133(core.List<api.TraceSpan> o) { | 112 checkUnnamed135(core.List<api.TraceSpan> o) { |
113 unittest.expect(o, unittest.hasLength(2)); | 113 unittest.expect(o, unittest.hasLength(2)); |
114 checkTraceSpan(o[0]); | 114 checkTraceSpan(o[0]); |
115 checkTraceSpan(o[1]); | 115 checkTraceSpan(o[1]); |
116 } | 116 } |
117 | 117 |
118 core.int buildCounterTrace = 0; | 118 core.int buildCounterTrace = 0; |
119 buildTrace() { | 119 buildTrace() { |
120 var o = new api.Trace(); | 120 var o = new api.Trace(); |
121 buildCounterTrace++; | 121 buildCounterTrace++; |
122 if (buildCounterTrace < 3) { | 122 if (buildCounterTrace < 3) { |
123 o.projectId = "foo"; | 123 o.projectId = "foo"; |
124 o.spans = buildUnnamed133(); | 124 o.spans = buildUnnamed135(); |
125 o.traceId = "foo"; | 125 o.traceId = "foo"; |
126 } | 126 } |
127 buildCounterTrace--; | 127 buildCounterTrace--; |
128 return o; | 128 return o; |
129 } | 129 } |
130 | 130 |
131 checkTrace(api.Trace o) { | 131 checkTrace(api.Trace o) { |
132 buildCounterTrace++; | 132 buildCounterTrace++; |
133 if (buildCounterTrace < 3) { | 133 if (buildCounterTrace < 3) { |
134 unittest.expect(o.projectId, unittest.equals('foo')); | 134 unittest.expect(o.projectId, unittest.equals('foo')); |
135 checkUnnamed133(o.spans); | 135 checkUnnamed135(o.spans); |
136 unittest.expect(o.traceId, unittest.equals('foo')); | 136 unittest.expect(o.traceId, unittest.equals('foo')); |
137 } | 137 } |
138 buildCounterTrace--; | 138 buildCounterTrace--; |
139 } | 139 } |
140 | 140 |
141 buildUnnamed134() { | 141 buildUnnamed136() { |
142 var o = new core.Map<core.String, core.String>(); | 142 var o = new core.Map<core.String, core.String>(); |
143 o["x"] = "foo"; | 143 o["x"] = "foo"; |
144 o["y"] = "foo"; | 144 o["y"] = "foo"; |
145 return o; | 145 return o; |
146 } | 146 } |
147 | 147 |
148 checkUnnamed134(core.Map<core.String, core.String> o) { | 148 checkUnnamed136(core.Map<core.String, core.String> o) { |
149 unittest.expect(o, unittest.hasLength(2)); | 149 unittest.expect(o, unittest.hasLength(2)); |
150 unittest.expect(o["x"], unittest.equals('foo')); | 150 unittest.expect(o["x"], unittest.equals('foo')); |
151 unittest.expect(o["y"], unittest.equals('foo')); | 151 unittest.expect(o["y"], unittest.equals('foo')); |
152 } | 152 } |
153 | 153 |
154 core.int buildCounterTraceSpan = 0; | 154 core.int buildCounterTraceSpan = 0; |
155 buildTraceSpan() { | 155 buildTraceSpan() { |
156 var o = new api.TraceSpan(); | 156 var o = new api.TraceSpan(); |
157 buildCounterTraceSpan++; | 157 buildCounterTraceSpan++; |
158 if (buildCounterTraceSpan < 3) { | 158 if (buildCounterTraceSpan < 3) { |
159 o.endTime = "foo"; | 159 o.endTime = "foo"; |
160 o.kind = "foo"; | 160 o.kind = "foo"; |
161 o.labels = buildUnnamed134(); | 161 o.labels = buildUnnamed136(); |
162 o.name = "foo"; | 162 o.name = "foo"; |
163 o.parentSpanId = "foo"; | 163 o.parentSpanId = "foo"; |
164 o.spanId = "foo"; | 164 o.spanId = "foo"; |
165 o.startTime = "foo"; | 165 o.startTime = "foo"; |
166 } | 166 } |
167 buildCounterTraceSpan--; | 167 buildCounterTraceSpan--; |
168 return o; | 168 return o; |
169 } | 169 } |
170 | 170 |
171 checkTraceSpan(api.TraceSpan o) { | 171 checkTraceSpan(api.TraceSpan o) { |
172 buildCounterTraceSpan++; | 172 buildCounterTraceSpan++; |
173 if (buildCounterTraceSpan < 3) { | 173 if (buildCounterTraceSpan < 3) { |
174 unittest.expect(o.endTime, unittest.equals('foo')); | 174 unittest.expect(o.endTime, unittest.equals('foo')); |
175 unittest.expect(o.kind, unittest.equals('foo')); | 175 unittest.expect(o.kind, unittest.equals('foo')); |
176 checkUnnamed134(o.labels); | 176 checkUnnamed136(o.labels); |
177 unittest.expect(o.name, unittest.equals('foo')); | 177 unittest.expect(o.name, unittest.equals('foo')); |
178 unittest.expect(o.parentSpanId, unittest.equals('foo')); | 178 unittest.expect(o.parentSpanId, unittest.equals('foo')); |
179 unittest.expect(o.spanId, unittest.equals('foo')); | 179 unittest.expect(o.spanId, unittest.equals('foo')); |
180 unittest.expect(o.startTime, unittest.equals('foo')); | 180 unittest.expect(o.startTime, unittest.equals('foo')); |
181 } | 181 } |
182 buildCounterTraceSpan--; | 182 buildCounterTraceSpan--; |
183 } | 183 } |
184 | 184 |
185 buildUnnamed135() { | 185 buildUnnamed137() { |
186 var o = new core.List<api.Trace>(); | 186 var o = new core.List<api.Trace>(); |
187 o.add(buildTrace()); | 187 o.add(buildTrace()); |
188 o.add(buildTrace()); | 188 o.add(buildTrace()); |
189 return o; | 189 return o; |
190 } | 190 } |
191 | 191 |
192 checkUnnamed135(core.List<api.Trace> o) { | 192 checkUnnamed137(core.List<api.Trace> o) { |
193 unittest.expect(o, unittest.hasLength(2)); | 193 unittest.expect(o, unittest.hasLength(2)); |
194 checkTrace(o[0]); | 194 checkTrace(o[0]); |
195 checkTrace(o[1]); | 195 checkTrace(o[1]); |
196 } | 196 } |
197 | 197 |
198 core.int buildCounterTraces = 0; | 198 core.int buildCounterTraces = 0; |
199 buildTraces() { | 199 buildTraces() { |
200 var o = new api.Traces(); | 200 var o = new api.Traces(); |
201 buildCounterTraces++; | 201 buildCounterTraces++; |
202 if (buildCounterTraces < 3) { | 202 if (buildCounterTraces < 3) { |
203 o.traces = buildUnnamed135(); | 203 o.traces = buildUnnamed137(); |
204 } | 204 } |
205 buildCounterTraces--; | 205 buildCounterTraces--; |
206 return o; | 206 return o; |
207 } | 207 } |
208 | 208 |
209 checkTraces(api.Traces o) { | 209 checkTraces(api.Traces o) { |
210 buildCounterTraces++; | 210 buildCounterTraces++; |
211 if (buildCounterTraces < 3) { | 211 if (buildCounterTraces < 3) { |
212 checkUnnamed135(o.traces); | 212 checkUnnamed137(o.traces); |
213 } | 213 } |
214 buildCounterTraces--; | 214 buildCounterTraces--; |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 main() { | 218 main() { |
219 unittest.group("obj-schema-Empty", () { | 219 unittest.group("obj-schema-Empty", () { |
220 unittest.test("to-json--from-json", () { | 220 unittest.test("to-json--from-json", () { |
221 var o = buildEmpty(); | 221 var o = buildEmpty(); |
222 var od = new api.Empty.fromJson(o.toJson()); | 222 var od = new api.Empty.fromJson(o.toJson()); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 res.get(arg_projectId, arg_traceId).then(unittest.expectAsync(((api.Trace
response) { | 374 res.get(arg_projectId, arg_traceId).then(unittest.expectAsync(((api.Trace
response) { |
375 checkTrace(response); | 375 checkTrace(response); |
376 }))); | 376 }))); |
377 }); | 377 }); |
378 | 378 |
379 unittest.test("method--list", () { | 379 unittest.test("method--list", () { |
380 | 380 |
381 var mock = new HttpServerMock(); | 381 var mock = new HttpServerMock(); |
382 api.ProjectsTracesResourceApi res = new api.CloudtraceApi(mock).projects.t
races; | 382 api.ProjectsTracesResourceApi res = new api.CloudtraceApi(mock).projects.t
races; |
383 var arg_projectId = "foo"; | 383 var arg_projectId = "foo"; |
| 384 var arg_orderBy = "foo"; |
| 385 var arg_filter = "foo"; |
| 386 var arg_endTime = "foo"; |
| 387 var arg_startTime = "foo"; |
| 388 var arg_pageToken = "foo"; |
| 389 var arg_pageSize = 42; |
384 var arg_view = "foo"; | 390 var arg_view = "foo"; |
385 var arg_pageSize = 42; | |
386 var arg_pageToken = "foo"; | |
387 var arg_startTime = "foo"; | |
388 var arg_endTime = "foo"; | |
389 var arg_filter = "foo"; | |
390 var arg_orderBy = "foo"; | |
391 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 391 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
392 var path = (req.url).path; | 392 var path = (req.url).path; |
393 var pathOffset = 0; | 393 var pathOffset = 0; |
394 var index; | 394 var index; |
395 var subPart; | 395 var subPart; |
396 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 396 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
397 pathOffset += 1; | 397 pathOffset += 1; |
398 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); | 398 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); |
399 pathOffset += 12; | 399 pathOffset += 12; |
400 index = path.indexOf("/traces", pathOffset); | 400 index = path.indexOf("/traces", pathOffset); |
(...skipping 13 matching lines...) Expand all Loading... |
414 if (n == "false") return false; | 414 if (n == "false") return false; |
415 if (n == null) return null; | 415 if (n == null) return null; |
416 throw new core.ArgumentError("Invalid boolean: $n"); | 416 throw new core.ArgumentError("Invalid boolean: $n"); |
417 } | 417 } |
418 if (query.length > 0) { | 418 if (query.length > 0) { |
419 for (var part in query.split("&")) { | 419 for (var part in query.split("&")) { |
420 var keyvalue = part.split("="); | 420 var keyvalue = part.split("="); |
421 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 421 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
422 } | 422 } |
423 } | 423 } |
| 424 unittest.expect(queryMap["orderBy"].first, unittest.equals(arg_orderBy))
; |
| 425 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| 426 unittest.expect(queryMap["endTime"].first, unittest.equals(arg_endTime))
; |
| 427 unittest.expect(queryMap["startTime"].first, unittest.equals(arg_startTi
me)); |
| 428 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 429 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
424 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); | 430 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); |
425 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
426 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
427 unittest.expect(queryMap["startTime"].first, unittest.equals(arg_startTi
me)); | |
428 unittest.expect(queryMap["endTime"].first, unittest.equals(arg_endTime))
; | |
429 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | |
430 unittest.expect(queryMap["orderBy"].first, unittest.equals(arg_orderBy))
; | |
431 | 431 |
432 | 432 |
433 var h = { | 433 var h = { |
434 "content-type" : "application/json; charset=utf-8", | 434 "content-type" : "application/json; charset=utf-8", |
435 }; | 435 }; |
436 var resp = convert.JSON.encode(buildListTracesResponse()); | 436 var resp = convert.JSON.encode(buildListTracesResponse()); |
437 return new async.Future.value(stringResponse(200, h, resp)); | 437 return new async.Future.value(stringResponse(200, h, resp)); |
438 }), true); | 438 }), true); |
439 res.list(arg_projectId, view: arg_view, pageSize: arg_pageSize, pageToken:
arg_pageToken, startTime: arg_startTime, endTime: arg_endTime, filter: arg_filt
er, orderBy: arg_orderBy).then(unittest.expectAsync(((api.ListTracesResponse res
ponse) { | 439 res.list(arg_projectId, orderBy: arg_orderBy, filter: arg_filter, endTime:
arg_endTime, startTime: arg_startTime, pageToken: arg_pageToken, pageSize: arg_
pageSize, view: arg_view).then(unittest.expectAsync(((api.ListTracesResponse res
ponse) { |
440 checkListTracesResponse(response); | 440 checkListTracesResponse(response); |
441 }))); | 441 }))); |
442 }); | 442 }); |
443 | 443 |
444 }); | 444 }); |
445 | 445 |
446 | 446 |
447 } | 447 } |
448 | 448 |
OLD | NEW |