OLD | NEW |
(Empty) | |
| 1 library googleapis.clouddebugger.v2.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/clouddebugger/v2.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 buildUnnamed497() { |
| 55 var o = new core.List<api.Variable>(); |
| 56 o.add(buildVariable()); |
| 57 o.add(buildVariable()); |
| 58 return o; |
| 59 } |
| 60 |
| 61 checkUnnamed497(core.List<api.Variable> o) { |
| 62 unittest.expect(o, unittest.hasLength(2)); |
| 63 checkVariable(o[0]); |
| 64 checkVariable(o[1]); |
| 65 } |
| 66 |
| 67 buildUnnamed498() { |
| 68 var o = new core.List<core.String>(); |
| 69 o.add("foo"); |
| 70 o.add("foo"); |
| 71 return o; |
| 72 } |
| 73 |
| 74 checkUnnamed498(core.List<core.String> o) { |
| 75 unittest.expect(o, unittest.hasLength(2)); |
| 76 unittest.expect(o[0], unittest.equals('foo')); |
| 77 unittest.expect(o[1], unittest.equals('foo')); |
| 78 } |
| 79 |
| 80 buildUnnamed499() { |
| 81 var o = new core.List<api.StackFrame>(); |
| 82 o.add(buildStackFrame()); |
| 83 o.add(buildStackFrame()); |
| 84 return o; |
| 85 } |
| 86 |
| 87 checkUnnamed499(core.List<api.StackFrame> o) { |
| 88 unittest.expect(o, unittest.hasLength(2)); |
| 89 checkStackFrame(o[0]); |
| 90 checkStackFrame(o[1]); |
| 91 } |
| 92 |
| 93 buildUnnamed500() { |
| 94 var o = new core.List<api.Variable>(); |
| 95 o.add(buildVariable()); |
| 96 o.add(buildVariable()); |
| 97 return o; |
| 98 } |
| 99 |
| 100 checkUnnamed500(core.List<api.Variable> o) { |
| 101 unittest.expect(o, unittest.hasLength(2)); |
| 102 checkVariable(o[0]); |
| 103 checkVariable(o[1]); |
| 104 } |
| 105 |
| 106 core.int buildCounterBreakpoint = 0; |
| 107 buildBreakpoint() { |
| 108 var o = new api.Breakpoint(); |
| 109 buildCounterBreakpoint++; |
| 110 if (buildCounterBreakpoint < 3) { |
| 111 o.action = "foo"; |
| 112 o.condition = "foo"; |
| 113 o.createTime = "foo"; |
| 114 o.evaluatedExpressions = buildUnnamed497(); |
| 115 o.expressions = buildUnnamed498(); |
| 116 o.finalTime = "foo"; |
| 117 o.id = "foo"; |
| 118 o.isFinalState = true; |
| 119 o.location = buildSourceLocation(); |
| 120 o.logLevel = "foo"; |
| 121 o.logMessageFormat = "foo"; |
| 122 o.stackFrames = buildUnnamed499(); |
| 123 o.status = buildStatusMessage(); |
| 124 o.userEmail = "foo"; |
| 125 o.variableTable = buildUnnamed500(); |
| 126 } |
| 127 buildCounterBreakpoint--; |
| 128 return o; |
| 129 } |
| 130 |
| 131 checkBreakpoint(api.Breakpoint o) { |
| 132 buildCounterBreakpoint++; |
| 133 if (buildCounterBreakpoint < 3) { |
| 134 unittest.expect(o.action, unittest.equals('foo')); |
| 135 unittest.expect(o.condition, unittest.equals('foo')); |
| 136 unittest.expect(o.createTime, unittest.equals('foo')); |
| 137 checkUnnamed497(o.evaluatedExpressions); |
| 138 checkUnnamed498(o.expressions); |
| 139 unittest.expect(o.finalTime, unittest.equals('foo')); |
| 140 unittest.expect(o.id, unittest.equals('foo')); |
| 141 unittest.expect(o.isFinalState, unittest.isTrue); |
| 142 checkSourceLocation(o.location); |
| 143 unittest.expect(o.logLevel, unittest.equals('foo')); |
| 144 unittest.expect(o.logMessageFormat, unittest.equals('foo')); |
| 145 checkUnnamed499(o.stackFrames); |
| 146 checkStatusMessage(o.status); |
| 147 unittest.expect(o.userEmail, unittest.equals('foo')); |
| 148 checkUnnamed500(o.variableTable); |
| 149 } |
| 150 buildCounterBreakpoint--; |
| 151 } |
| 152 |
| 153 core.int buildCounterCloudRepoSourceContext = 0; |
| 154 buildCloudRepoSourceContext() { |
| 155 var o = new api.CloudRepoSourceContext(); |
| 156 buildCounterCloudRepoSourceContext++; |
| 157 if (buildCounterCloudRepoSourceContext < 3) { |
| 158 o.aliasName = "foo"; |
| 159 o.repoId = buildRepoId(); |
| 160 o.revisionId = "foo"; |
| 161 } |
| 162 buildCounterCloudRepoSourceContext--; |
| 163 return o; |
| 164 } |
| 165 |
| 166 checkCloudRepoSourceContext(api.CloudRepoSourceContext o) { |
| 167 buildCounterCloudRepoSourceContext++; |
| 168 if (buildCounterCloudRepoSourceContext < 3) { |
| 169 unittest.expect(o.aliasName, unittest.equals('foo')); |
| 170 checkRepoId(o.repoId); |
| 171 unittest.expect(o.revisionId, unittest.equals('foo')); |
| 172 } |
| 173 buildCounterCloudRepoSourceContext--; |
| 174 } |
| 175 |
| 176 core.int buildCounterCloudWorkspaceId = 0; |
| 177 buildCloudWorkspaceId() { |
| 178 var o = new api.CloudWorkspaceId(); |
| 179 buildCounterCloudWorkspaceId++; |
| 180 if (buildCounterCloudWorkspaceId < 3) { |
| 181 o.name = "foo"; |
| 182 o.repoId = buildRepoId(); |
| 183 } |
| 184 buildCounterCloudWorkspaceId--; |
| 185 return o; |
| 186 } |
| 187 |
| 188 checkCloudWorkspaceId(api.CloudWorkspaceId o) { |
| 189 buildCounterCloudWorkspaceId++; |
| 190 if (buildCounterCloudWorkspaceId < 3) { |
| 191 unittest.expect(o.name, unittest.equals('foo')); |
| 192 checkRepoId(o.repoId); |
| 193 } |
| 194 buildCounterCloudWorkspaceId--; |
| 195 } |
| 196 |
| 197 core.int buildCounterCloudWorkspaceSourceContext = 0; |
| 198 buildCloudWorkspaceSourceContext() { |
| 199 var o = new api.CloudWorkspaceSourceContext(); |
| 200 buildCounterCloudWorkspaceSourceContext++; |
| 201 if (buildCounterCloudWorkspaceSourceContext < 3) { |
| 202 o.snapshotId = "foo"; |
| 203 o.workspaceId = buildCloudWorkspaceId(); |
| 204 } |
| 205 buildCounterCloudWorkspaceSourceContext--; |
| 206 return o; |
| 207 } |
| 208 |
| 209 checkCloudWorkspaceSourceContext(api.CloudWorkspaceSourceContext o) { |
| 210 buildCounterCloudWorkspaceSourceContext++; |
| 211 if (buildCounterCloudWorkspaceSourceContext < 3) { |
| 212 unittest.expect(o.snapshotId, unittest.equals('foo')); |
| 213 checkCloudWorkspaceId(o.workspaceId); |
| 214 } |
| 215 buildCounterCloudWorkspaceSourceContext--; |
| 216 } |
| 217 |
| 218 buildUnnamed501() { |
| 219 var o = new core.Map<core.String, core.String>(); |
| 220 o["x"] = "foo"; |
| 221 o["y"] = "foo"; |
| 222 return o; |
| 223 } |
| 224 |
| 225 checkUnnamed501(core.Map<core.String, core.String> o) { |
| 226 unittest.expect(o, unittest.hasLength(2)); |
| 227 unittest.expect(o["x"], unittest.equals('foo')); |
| 228 unittest.expect(o["y"], unittest.equals('foo')); |
| 229 } |
| 230 |
| 231 buildUnnamed502() { |
| 232 var o = new core.List<api.SourceContext>(); |
| 233 o.add(buildSourceContext()); |
| 234 o.add(buildSourceContext()); |
| 235 return o; |
| 236 } |
| 237 |
| 238 checkUnnamed502(core.List<api.SourceContext> o) { |
| 239 unittest.expect(o, unittest.hasLength(2)); |
| 240 checkSourceContext(o[0]); |
| 241 checkSourceContext(o[1]); |
| 242 } |
| 243 |
| 244 core.int buildCounterDebuggee = 0; |
| 245 buildDebuggee() { |
| 246 var o = new api.Debuggee(); |
| 247 buildCounterDebuggee++; |
| 248 if (buildCounterDebuggee < 3) { |
| 249 o.agentVersion = "foo"; |
| 250 o.description = "foo"; |
| 251 o.id = "foo"; |
| 252 o.isDisabled = true; |
| 253 o.isInactive = true; |
| 254 o.labels = buildUnnamed501(); |
| 255 o.project = "foo"; |
| 256 o.sourceContexts = buildUnnamed502(); |
| 257 o.status = buildStatusMessage(); |
| 258 o.uniquifier = "foo"; |
| 259 } |
| 260 buildCounterDebuggee--; |
| 261 return o; |
| 262 } |
| 263 |
| 264 checkDebuggee(api.Debuggee o) { |
| 265 buildCounterDebuggee++; |
| 266 if (buildCounterDebuggee < 3) { |
| 267 unittest.expect(o.agentVersion, unittest.equals('foo')); |
| 268 unittest.expect(o.description, unittest.equals('foo')); |
| 269 unittest.expect(o.id, unittest.equals('foo')); |
| 270 unittest.expect(o.isDisabled, unittest.isTrue); |
| 271 unittest.expect(o.isInactive, unittest.isTrue); |
| 272 checkUnnamed501(o.labels); |
| 273 unittest.expect(o.project, unittest.equals('foo')); |
| 274 checkUnnamed502(o.sourceContexts); |
| 275 checkStatusMessage(o.status); |
| 276 unittest.expect(o.uniquifier, unittest.equals('foo')); |
| 277 } |
| 278 buildCounterDebuggee--; |
| 279 } |
| 280 |
| 281 core.int buildCounterEmpty = 0; |
| 282 buildEmpty() { |
| 283 var o = new api.Empty(); |
| 284 buildCounterEmpty++; |
| 285 if (buildCounterEmpty < 3) { |
| 286 } |
| 287 buildCounterEmpty--; |
| 288 return o; |
| 289 } |
| 290 |
| 291 checkEmpty(api.Empty o) { |
| 292 buildCounterEmpty++; |
| 293 if (buildCounterEmpty < 3) { |
| 294 } |
| 295 buildCounterEmpty--; |
| 296 } |
| 297 |
| 298 buildUnnamed503() { |
| 299 var o = new core.List<core.String>(); |
| 300 o.add("foo"); |
| 301 o.add("foo"); |
| 302 return o; |
| 303 } |
| 304 |
| 305 checkUnnamed503(core.List<core.String> o) { |
| 306 unittest.expect(o, unittest.hasLength(2)); |
| 307 unittest.expect(o[0], unittest.equals('foo')); |
| 308 unittest.expect(o[1], unittest.equals('foo')); |
| 309 } |
| 310 |
| 311 core.int buildCounterFormatMessage = 0; |
| 312 buildFormatMessage() { |
| 313 var o = new api.FormatMessage(); |
| 314 buildCounterFormatMessage++; |
| 315 if (buildCounterFormatMessage < 3) { |
| 316 o.format = "foo"; |
| 317 o.parameters = buildUnnamed503(); |
| 318 } |
| 319 buildCounterFormatMessage--; |
| 320 return o; |
| 321 } |
| 322 |
| 323 checkFormatMessage(api.FormatMessage o) { |
| 324 buildCounterFormatMessage++; |
| 325 if (buildCounterFormatMessage < 3) { |
| 326 unittest.expect(o.format, unittest.equals('foo')); |
| 327 checkUnnamed503(o.parameters); |
| 328 } |
| 329 buildCounterFormatMessage--; |
| 330 } |
| 331 |
| 332 core.int buildCounterGerritSourceContext = 0; |
| 333 buildGerritSourceContext() { |
| 334 var o = new api.GerritSourceContext(); |
| 335 buildCounterGerritSourceContext++; |
| 336 if (buildCounterGerritSourceContext < 3) { |
| 337 o.aliasName = "foo"; |
| 338 o.gerritProject = "foo"; |
| 339 o.hostUri = "foo"; |
| 340 o.revisionId = "foo"; |
| 341 } |
| 342 buildCounterGerritSourceContext--; |
| 343 return o; |
| 344 } |
| 345 |
| 346 checkGerritSourceContext(api.GerritSourceContext o) { |
| 347 buildCounterGerritSourceContext++; |
| 348 if (buildCounterGerritSourceContext < 3) { |
| 349 unittest.expect(o.aliasName, unittest.equals('foo')); |
| 350 unittest.expect(o.gerritProject, unittest.equals('foo')); |
| 351 unittest.expect(o.hostUri, unittest.equals('foo')); |
| 352 unittest.expect(o.revisionId, unittest.equals('foo')); |
| 353 } |
| 354 buildCounterGerritSourceContext--; |
| 355 } |
| 356 |
| 357 core.int buildCounterGetBreakpointResponse = 0; |
| 358 buildGetBreakpointResponse() { |
| 359 var o = new api.GetBreakpointResponse(); |
| 360 buildCounterGetBreakpointResponse++; |
| 361 if (buildCounterGetBreakpointResponse < 3) { |
| 362 o.breakpoint = buildBreakpoint(); |
| 363 } |
| 364 buildCounterGetBreakpointResponse--; |
| 365 return o; |
| 366 } |
| 367 |
| 368 checkGetBreakpointResponse(api.GetBreakpointResponse o) { |
| 369 buildCounterGetBreakpointResponse++; |
| 370 if (buildCounterGetBreakpointResponse < 3) { |
| 371 checkBreakpoint(o.breakpoint); |
| 372 } |
| 373 buildCounterGetBreakpointResponse--; |
| 374 } |
| 375 |
| 376 buildUnnamed504() { |
| 377 var o = new core.List<api.Breakpoint>(); |
| 378 o.add(buildBreakpoint()); |
| 379 o.add(buildBreakpoint()); |
| 380 return o; |
| 381 } |
| 382 |
| 383 checkUnnamed504(core.List<api.Breakpoint> o) { |
| 384 unittest.expect(o, unittest.hasLength(2)); |
| 385 checkBreakpoint(o[0]); |
| 386 checkBreakpoint(o[1]); |
| 387 } |
| 388 |
| 389 core.int buildCounterListActiveBreakpointsResponse = 0; |
| 390 buildListActiveBreakpointsResponse() { |
| 391 var o = new api.ListActiveBreakpointsResponse(); |
| 392 buildCounterListActiveBreakpointsResponse++; |
| 393 if (buildCounterListActiveBreakpointsResponse < 3) { |
| 394 o.breakpoints = buildUnnamed504(); |
| 395 o.nextWaitToken = "foo"; |
| 396 } |
| 397 buildCounterListActiveBreakpointsResponse--; |
| 398 return o; |
| 399 } |
| 400 |
| 401 checkListActiveBreakpointsResponse(api.ListActiveBreakpointsResponse o) { |
| 402 buildCounterListActiveBreakpointsResponse++; |
| 403 if (buildCounterListActiveBreakpointsResponse < 3) { |
| 404 checkUnnamed504(o.breakpoints); |
| 405 unittest.expect(o.nextWaitToken, unittest.equals('foo')); |
| 406 } |
| 407 buildCounterListActiveBreakpointsResponse--; |
| 408 } |
| 409 |
| 410 buildUnnamed505() { |
| 411 var o = new core.List<api.Breakpoint>(); |
| 412 o.add(buildBreakpoint()); |
| 413 o.add(buildBreakpoint()); |
| 414 return o; |
| 415 } |
| 416 |
| 417 checkUnnamed505(core.List<api.Breakpoint> o) { |
| 418 unittest.expect(o, unittest.hasLength(2)); |
| 419 checkBreakpoint(o[0]); |
| 420 checkBreakpoint(o[1]); |
| 421 } |
| 422 |
| 423 core.int buildCounterListBreakpointsResponse = 0; |
| 424 buildListBreakpointsResponse() { |
| 425 var o = new api.ListBreakpointsResponse(); |
| 426 buildCounterListBreakpointsResponse++; |
| 427 if (buildCounterListBreakpointsResponse < 3) { |
| 428 o.breakpoints = buildUnnamed505(); |
| 429 o.nextWaitToken = "foo"; |
| 430 } |
| 431 buildCounterListBreakpointsResponse--; |
| 432 return o; |
| 433 } |
| 434 |
| 435 checkListBreakpointsResponse(api.ListBreakpointsResponse o) { |
| 436 buildCounterListBreakpointsResponse++; |
| 437 if (buildCounterListBreakpointsResponse < 3) { |
| 438 checkUnnamed505(o.breakpoints); |
| 439 unittest.expect(o.nextWaitToken, unittest.equals('foo')); |
| 440 } |
| 441 buildCounterListBreakpointsResponse--; |
| 442 } |
| 443 |
| 444 buildUnnamed506() { |
| 445 var o = new core.List<api.Debuggee>(); |
| 446 o.add(buildDebuggee()); |
| 447 o.add(buildDebuggee()); |
| 448 return o; |
| 449 } |
| 450 |
| 451 checkUnnamed506(core.List<api.Debuggee> o) { |
| 452 unittest.expect(o, unittest.hasLength(2)); |
| 453 checkDebuggee(o[0]); |
| 454 checkDebuggee(o[1]); |
| 455 } |
| 456 |
| 457 core.int buildCounterListDebuggeesResponse = 0; |
| 458 buildListDebuggeesResponse() { |
| 459 var o = new api.ListDebuggeesResponse(); |
| 460 buildCounterListDebuggeesResponse++; |
| 461 if (buildCounterListDebuggeesResponse < 3) { |
| 462 o.debuggees = buildUnnamed506(); |
| 463 } |
| 464 buildCounterListDebuggeesResponse--; |
| 465 return o; |
| 466 } |
| 467 |
| 468 checkListDebuggeesResponse(api.ListDebuggeesResponse o) { |
| 469 buildCounterListDebuggeesResponse++; |
| 470 if (buildCounterListDebuggeesResponse < 3) { |
| 471 checkUnnamed506(o.debuggees); |
| 472 } |
| 473 buildCounterListDebuggeesResponse--; |
| 474 } |
| 475 |
| 476 core.int buildCounterProjectRepoId = 0; |
| 477 buildProjectRepoId() { |
| 478 var o = new api.ProjectRepoId(); |
| 479 buildCounterProjectRepoId++; |
| 480 if (buildCounterProjectRepoId < 3) { |
| 481 o.projectId = "foo"; |
| 482 o.repoName = "foo"; |
| 483 } |
| 484 buildCounterProjectRepoId--; |
| 485 return o; |
| 486 } |
| 487 |
| 488 checkProjectRepoId(api.ProjectRepoId o) { |
| 489 buildCounterProjectRepoId++; |
| 490 if (buildCounterProjectRepoId < 3) { |
| 491 unittest.expect(o.projectId, unittest.equals('foo')); |
| 492 unittest.expect(o.repoName, unittest.equals('foo')); |
| 493 } |
| 494 buildCounterProjectRepoId--; |
| 495 } |
| 496 |
| 497 core.int buildCounterRegisterDebuggeeRequest = 0; |
| 498 buildRegisterDebuggeeRequest() { |
| 499 var o = new api.RegisterDebuggeeRequest(); |
| 500 buildCounterRegisterDebuggeeRequest++; |
| 501 if (buildCounterRegisterDebuggeeRequest < 3) { |
| 502 o.debuggee = buildDebuggee(); |
| 503 } |
| 504 buildCounterRegisterDebuggeeRequest--; |
| 505 return o; |
| 506 } |
| 507 |
| 508 checkRegisterDebuggeeRequest(api.RegisterDebuggeeRequest o) { |
| 509 buildCounterRegisterDebuggeeRequest++; |
| 510 if (buildCounterRegisterDebuggeeRequest < 3) { |
| 511 checkDebuggee(o.debuggee); |
| 512 } |
| 513 buildCounterRegisterDebuggeeRequest--; |
| 514 } |
| 515 |
| 516 core.int buildCounterRegisterDebuggeeResponse = 0; |
| 517 buildRegisterDebuggeeResponse() { |
| 518 var o = new api.RegisterDebuggeeResponse(); |
| 519 buildCounterRegisterDebuggeeResponse++; |
| 520 if (buildCounterRegisterDebuggeeResponse < 3) { |
| 521 o.debuggee = buildDebuggee(); |
| 522 } |
| 523 buildCounterRegisterDebuggeeResponse--; |
| 524 return o; |
| 525 } |
| 526 |
| 527 checkRegisterDebuggeeResponse(api.RegisterDebuggeeResponse o) { |
| 528 buildCounterRegisterDebuggeeResponse++; |
| 529 if (buildCounterRegisterDebuggeeResponse < 3) { |
| 530 checkDebuggee(o.debuggee); |
| 531 } |
| 532 buildCounterRegisterDebuggeeResponse--; |
| 533 } |
| 534 |
| 535 core.int buildCounterRepoId = 0; |
| 536 buildRepoId() { |
| 537 var o = new api.RepoId(); |
| 538 buildCounterRepoId++; |
| 539 if (buildCounterRepoId < 3) { |
| 540 o.projectRepoId = buildProjectRepoId(); |
| 541 o.uid = "foo"; |
| 542 } |
| 543 buildCounterRepoId--; |
| 544 return o; |
| 545 } |
| 546 |
| 547 checkRepoId(api.RepoId o) { |
| 548 buildCounterRepoId++; |
| 549 if (buildCounterRepoId < 3) { |
| 550 checkProjectRepoId(o.projectRepoId); |
| 551 unittest.expect(o.uid, unittest.equals('foo')); |
| 552 } |
| 553 buildCounterRepoId--; |
| 554 } |
| 555 |
| 556 core.int buildCounterSetBreakpointResponse = 0; |
| 557 buildSetBreakpointResponse() { |
| 558 var o = new api.SetBreakpointResponse(); |
| 559 buildCounterSetBreakpointResponse++; |
| 560 if (buildCounterSetBreakpointResponse < 3) { |
| 561 o.breakpoint = buildBreakpoint(); |
| 562 } |
| 563 buildCounterSetBreakpointResponse--; |
| 564 return o; |
| 565 } |
| 566 |
| 567 checkSetBreakpointResponse(api.SetBreakpointResponse o) { |
| 568 buildCounterSetBreakpointResponse++; |
| 569 if (buildCounterSetBreakpointResponse < 3) { |
| 570 checkBreakpoint(o.breakpoint); |
| 571 } |
| 572 buildCounterSetBreakpointResponse--; |
| 573 } |
| 574 |
| 575 core.int buildCounterSourceContext = 0; |
| 576 buildSourceContext() { |
| 577 var o = new api.SourceContext(); |
| 578 buildCounterSourceContext++; |
| 579 if (buildCounterSourceContext < 3) { |
| 580 o.cloudRepo = buildCloudRepoSourceContext(); |
| 581 o.cloudWorkspace = buildCloudWorkspaceSourceContext(); |
| 582 o.gerrit = buildGerritSourceContext(); |
| 583 } |
| 584 buildCounterSourceContext--; |
| 585 return o; |
| 586 } |
| 587 |
| 588 checkSourceContext(api.SourceContext o) { |
| 589 buildCounterSourceContext++; |
| 590 if (buildCounterSourceContext < 3) { |
| 591 checkCloudRepoSourceContext(o.cloudRepo); |
| 592 checkCloudWorkspaceSourceContext(o.cloudWorkspace); |
| 593 checkGerritSourceContext(o.gerrit); |
| 594 } |
| 595 buildCounterSourceContext--; |
| 596 } |
| 597 |
| 598 core.int buildCounterSourceLocation = 0; |
| 599 buildSourceLocation() { |
| 600 var o = new api.SourceLocation(); |
| 601 buildCounterSourceLocation++; |
| 602 if (buildCounterSourceLocation < 3) { |
| 603 o.line = 42; |
| 604 o.path = "foo"; |
| 605 } |
| 606 buildCounterSourceLocation--; |
| 607 return o; |
| 608 } |
| 609 |
| 610 checkSourceLocation(api.SourceLocation o) { |
| 611 buildCounterSourceLocation++; |
| 612 if (buildCounterSourceLocation < 3) { |
| 613 unittest.expect(o.line, unittest.equals(42)); |
| 614 unittest.expect(o.path, unittest.equals('foo')); |
| 615 } |
| 616 buildCounterSourceLocation--; |
| 617 } |
| 618 |
| 619 buildUnnamed507() { |
| 620 var o = new core.List<api.Variable>(); |
| 621 o.add(buildVariable()); |
| 622 o.add(buildVariable()); |
| 623 return o; |
| 624 } |
| 625 |
| 626 checkUnnamed507(core.List<api.Variable> o) { |
| 627 unittest.expect(o, unittest.hasLength(2)); |
| 628 checkVariable(o[0]); |
| 629 checkVariable(o[1]); |
| 630 } |
| 631 |
| 632 buildUnnamed508() { |
| 633 var o = new core.List<api.Variable>(); |
| 634 o.add(buildVariable()); |
| 635 o.add(buildVariable()); |
| 636 return o; |
| 637 } |
| 638 |
| 639 checkUnnamed508(core.List<api.Variable> o) { |
| 640 unittest.expect(o, unittest.hasLength(2)); |
| 641 checkVariable(o[0]); |
| 642 checkVariable(o[1]); |
| 643 } |
| 644 |
| 645 core.int buildCounterStackFrame = 0; |
| 646 buildStackFrame() { |
| 647 var o = new api.StackFrame(); |
| 648 buildCounterStackFrame++; |
| 649 if (buildCounterStackFrame < 3) { |
| 650 o.arguments = buildUnnamed507(); |
| 651 o.function = "foo"; |
| 652 o.locals = buildUnnamed508(); |
| 653 o.location = buildSourceLocation(); |
| 654 } |
| 655 buildCounterStackFrame--; |
| 656 return o; |
| 657 } |
| 658 |
| 659 checkStackFrame(api.StackFrame o) { |
| 660 buildCounterStackFrame++; |
| 661 if (buildCounterStackFrame < 3) { |
| 662 checkUnnamed507(o.arguments); |
| 663 unittest.expect(o.function, unittest.equals('foo')); |
| 664 checkUnnamed508(o.locals); |
| 665 checkSourceLocation(o.location); |
| 666 } |
| 667 buildCounterStackFrame--; |
| 668 } |
| 669 |
| 670 core.int buildCounterStatusMessage = 0; |
| 671 buildStatusMessage() { |
| 672 var o = new api.StatusMessage(); |
| 673 buildCounterStatusMessage++; |
| 674 if (buildCounterStatusMessage < 3) { |
| 675 o.description = buildFormatMessage(); |
| 676 o.isError = true; |
| 677 o.refersTo = "foo"; |
| 678 } |
| 679 buildCounterStatusMessage--; |
| 680 return o; |
| 681 } |
| 682 |
| 683 checkStatusMessage(api.StatusMessage o) { |
| 684 buildCounterStatusMessage++; |
| 685 if (buildCounterStatusMessage < 3) { |
| 686 checkFormatMessage(o.description); |
| 687 unittest.expect(o.isError, unittest.isTrue); |
| 688 unittest.expect(o.refersTo, unittest.equals('foo')); |
| 689 } |
| 690 buildCounterStatusMessage--; |
| 691 } |
| 692 |
| 693 core.int buildCounterUpdateActiveBreakpointRequest = 0; |
| 694 buildUpdateActiveBreakpointRequest() { |
| 695 var o = new api.UpdateActiveBreakpointRequest(); |
| 696 buildCounterUpdateActiveBreakpointRequest++; |
| 697 if (buildCounterUpdateActiveBreakpointRequest < 3) { |
| 698 o.breakpoint = buildBreakpoint(); |
| 699 } |
| 700 buildCounterUpdateActiveBreakpointRequest--; |
| 701 return o; |
| 702 } |
| 703 |
| 704 checkUpdateActiveBreakpointRequest(api.UpdateActiveBreakpointRequest o) { |
| 705 buildCounterUpdateActiveBreakpointRequest++; |
| 706 if (buildCounterUpdateActiveBreakpointRequest < 3) { |
| 707 checkBreakpoint(o.breakpoint); |
| 708 } |
| 709 buildCounterUpdateActiveBreakpointRequest--; |
| 710 } |
| 711 |
| 712 core.int buildCounterUpdateActiveBreakpointResponse = 0; |
| 713 buildUpdateActiveBreakpointResponse() { |
| 714 var o = new api.UpdateActiveBreakpointResponse(); |
| 715 buildCounterUpdateActiveBreakpointResponse++; |
| 716 if (buildCounterUpdateActiveBreakpointResponse < 3) { |
| 717 } |
| 718 buildCounterUpdateActiveBreakpointResponse--; |
| 719 return o; |
| 720 } |
| 721 |
| 722 checkUpdateActiveBreakpointResponse(api.UpdateActiveBreakpointResponse o) { |
| 723 buildCounterUpdateActiveBreakpointResponse++; |
| 724 if (buildCounterUpdateActiveBreakpointResponse < 3) { |
| 725 } |
| 726 buildCounterUpdateActiveBreakpointResponse--; |
| 727 } |
| 728 |
| 729 buildUnnamed509() { |
| 730 var o = new core.List<api.Variable>(); |
| 731 o.add(buildVariable()); |
| 732 o.add(buildVariable()); |
| 733 return o; |
| 734 } |
| 735 |
| 736 checkUnnamed509(core.List<api.Variable> o) { |
| 737 unittest.expect(o, unittest.hasLength(2)); |
| 738 checkVariable(o[0]); |
| 739 checkVariable(o[1]); |
| 740 } |
| 741 |
| 742 core.int buildCounterVariable = 0; |
| 743 buildVariable() { |
| 744 var o = new api.Variable(); |
| 745 buildCounterVariable++; |
| 746 if (buildCounterVariable < 3) { |
| 747 o.members = buildUnnamed509(); |
| 748 o.name = "foo"; |
| 749 o.status = buildStatusMessage(); |
| 750 o.value = "foo"; |
| 751 o.varTableIndex = 42; |
| 752 } |
| 753 buildCounterVariable--; |
| 754 return o; |
| 755 } |
| 756 |
| 757 checkVariable(api.Variable o) { |
| 758 buildCounterVariable++; |
| 759 if (buildCounterVariable < 3) { |
| 760 checkUnnamed509(o.members); |
| 761 unittest.expect(o.name, unittest.equals('foo')); |
| 762 checkStatusMessage(o.status); |
| 763 unittest.expect(o.value, unittest.equals('foo')); |
| 764 unittest.expect(o.varTableIndex, unittest.equals(42)); |
| 765 } |
| 766 buildCounterVariable--; |
| 767 } |
| 768 |
| 769 |
| 770 main() { |
| 771 unittest.group("obj-schema-Breakpoint", () { |
| 772 unittest.test("to-json--from-json", () { |
| 773 var o = buildBreakpoint(); |
| 774 var od = new api.Breakpoint.fromJson(o.toJson()); |
| 775 checkBreakpoint(od); |
| 776 }); |
| 777 }); |
| 778 |
| 779 |
| 780 unittest.group("obj-schema-CloudRepoSourceContext", () { |
| 781 unittest.test("to-json--from-json", () { |
| 782 var o = buildCloudRepoSourceContext(); |
| 783 var od = new api.CloudRepoSourceContext.fromJson(o.toJson()); |
| 784 checkCloudRepoSourceContext(od); |
| 785 }); |
| 786 }); |
| 787 |
| 788 |
| 789 unittest.group("obj-schema-CloudWorkspaceId", () { |
| 790 unittest.test("to-json--from-json", () { |
| 791 var o = buildCloudWorkspaceId(); |
| 792 var od = new api.CloudWorkspaceId.fromJson(o.toJson()); |
| 793 checkCloudWorkspaceId(od); |
| 794 }); |
| 795 }); |
| 796 |
| 797 |
| 798 unittest.group("obj-schema-CloudWorkspaceSourceContext", () { |
| 799 unittest.test("to-json--from-json", () { |
| 800 var o = buildCloudWorkspaceSourceContext(); |
| 801 var od = new api.CloudWorkspaceSourceContext.fromJson(o.toJson()); |
| 802 checkCloudWorkspaceSourceContext(od); |
| 803 }); |
| 804 }); |
| 805 |
| 806 |
| 807 unittest.group("obj-schema-Debuggee", () { |
| 808 unittest.test("to-json--from-json", () { |
| 809 var o = buildDebuggee(); |
| 810 var od = new api.Debuggee.fromJson(o.toJson()); |
| 811 checkDebuggee(od); |
| 812 }); |
| 813 }); |
| 814 |
| 815 |
| 816 unittest.group("obj-schema-Empty", () { |
| 817 unittest.test("to-json--from-json", () { |
| 818 var o = buildEmpty(); |
| 819 var od = new api.Empty.fromJson(o.toJson()); |
| 820 checkEmpty(od); |
| 821 }); |
| 822 }); |
| 823 |
| 824 |
| 825 unittest.group("obj-schema-FormatMessage", () { |
| 826 unittest.test("to-json--from-json", () { |
| 827 var o = buildFormatMessage(); |
| 828 var od = new api.FormatMessage.fromJson(o.toJson()); |
| 829 checkFormatMessage(od); |
| 830 }); |
| 831 }); |
| 832 |
| 833 |
| 834 unittest.group("obj-schema-GerritSourceContext", () { |
| 835 unittest.test("to-json--from-json", () { |
| 836 var o = buildGerritSourceContext(); |
| 837 var od = new api.GerritSourceContext.fromJson(o.toJson()); |
| 838 checkGerritSourceContext(od); |
| 839 }); |
| 840 }); |
| 841 |
| 842 |
| 843 unittest.group("obj-schema-GetBreakpointResponse", () { |
| 844 unittest.test("to-json--from-json", () { |
| 845 var o = buildGetBreakpointResponse(); |
| 846 var od = new api.GetBreakpointResponse.fromJson(o.toJson()); |
| 847 checkGetBreakpointResponse(od); |
| 848 }); |
| 849 }); |
| 850 |
| 851 |
| 852 unittest.group("obj-schema-ListActiveBreakpointsResponse", () { |
| 853 unittest.test("to-json--from-json", () { |
| 854 var o = buildListActiveBreakpointsResponse(); |
| 855 var od = new api.ListActiveBreakpointsResponse.fromJson(o.toJson()); |
| 856 checkListActiveBreakpointsResponse(od); |
| 857 }); |
| 858 }); |
| 859 |
| 860 |
| 861 unittest.group("obj-schema-ListBreakpointsResponse", () { |
| 862 unittest.test("to-json--from-json", () { |
| 863 var o = buildListBreakpointsResponse(); |
| 864 var od = new api.ListBreakpointsResponse.fromJson(o.toJson()); |
| 865 checkListBreakpointsResponse(od); |
| 866 }); |
| 867 }); |
| 868 |
| 869 |
| 870 unittest.group("obj-schema-ListDebuggeesResponse", () { |
| 871 unittest.test("to-json--from-json", () { |
| 872 var o = buildListDebuggeesResponse(); |
| 873 var od = new api.ListDebuggeesResponse.fromJson(o.toJson()); |
| 874 checkListDebuggeesResponse(od); |
| 875 }); |
| 876 }); |
| 877 |
| 878 |
| 879 unittest.group("obj-schema-ProjectRepoId", () { |
| 880 unittest.test("to-json--from-json", () { |
| 881 var o = buildProjectRepoId(); |
| 882 var od = new api.ProjectRepoId.fromJson(o.toJson()); |
| 883 checkProjectRepoId(od); |
| 884 }); |
| 885 }); |
| 886 |
| 887 |
| 888 unittest.group("obj-schema-RegisterDebuggeeRequest", () { |
| 889 unittest.test("to-json--from-json", () { |
| 890 var o = buildRegisterDebuggeeRequest(); |
| 891 var od = new api.RegisterDebuggeeRequest.fromJson(o.toJson()); |
| 892 checkRegisterDebuggeeRequest(od); |
| 893 }); |
| 894 }); |
| 895 |
| 896 |
| 897 unittest.group("obj-schema-RegisterDebuggeeResponse", () { |
| 898 unittest.test("to-json--from-json", () { |
| 899 var o = buildRegisterDebuggeeResponse(); |
| 900 var od = new api.RegisterDebuggeeResponse.fromJson(o.toJson()); |
| 901 checkRegisterDebuggeeResponse(od); |
| 902 }); |
| 903 }); |
| 904 |
| 905 |
| 906 unittest.group("obj-schema-RepoId", () { |
| 907 unittest.test("to-json--from-json", () { |
| 908 var o = buildRepoId(); |
| 909 var od = new api.RepoId.fromJson(o.toJson()); |
| 910 checkRepoId(od); |
| 911 }); |
| 912 }); |
| 913 |
| 914 |
| 915 unittest.group("obj-schema-SetBreakpointResponse", () { |
| 916 unittest.test("to-json--from-json", () { |
| 917 var o = buildSetBreakpointResponse(); |
| 918 var od = new api.SetBreakpointResponse.fromJson(o.toJson()); |
| 919 checkSetBreakpointResponse(od); |
| 920 }); |
| 921 }); |
| 922 |
| 923 |
| 924 unittest.group("obj-schema-SourceContext", () { |
| 925 unittest.test("to-json--from-json", () { |
| 926 var o = buildSourceContext(); |
| 927 var od = new api.SourceContext.fromJson(o.toJson()); |
| 928 checkSourceContext(od); |
| 929 }); |
| 930 }); |
| 931 |
| 932 |
| 933 unittest.group("obj-schema-SourceLocation", () { |
| 934 unittest.test("to-json--from-json", () { |
| 935 var o = buildSourceLocation(); |
| 936 var od = new api.SourceLocation.fromJson(o.toJson()); |
| 937 checkSourceLocation(od); |
| 938 }); |
| 939 }); |
| 940 |
| 941 |
| 942 unittest.group("obj-schema-StackFrame", () { |
| 943 unittest.test("to-json--from-json", () { |
| 944 var o = buildStackFrame(); |
| 945 var od = new api.StackFrame.fromJson(o.toJson()); |
| 946 checkStackFrame(od); |
| 947 }); |
| 948 }); |
| 949 |
| 950 |
| 951 unittest.group("obj-schema-StatusMessage", () { |
| 952 unittest.test("to-json--from-json", () { |
| 953 var o = buildStatusMessage(); |
| 954 var od = new api.StatusMessage.fromJson(o.toJson()); |
| 955 checkStatusMessage(od); |
| 956 }); |
| 957 }); |
| 958 |
| 959 |
| 960 unittest.group("obj-schema-UpdateActiveBreakpointRequest", () { |
| 961 unittest.test("to-json--from-json", () { |
| 962 var o = buildUpdateActiveBreakpointRequest(); |
| 963 var od = new api.UpdateActiveBreakpointRequest.fromJson(o.toJson()); |
| 964 checkUpdateActiveBreakpointRequest(od); |
| 965 }); |
| 966 }); |
| 967 |
| 968 |
| 969 unittest.group("obj-schema-UpdateActiveBreakpointResponse", () { |
| 970 unittest.test("to-json--from-json", () { |
| 971 var o = buildUpdateActiveBreakpointResponse(); |
| 972 var od = new api.UpdateActiveBreakpointResponse.fromJson(o.toJson()); |
| 973 checkUpdateActiveBreakpointResponse(od); |
| 974 }); |
| 975 }); |
| 976 |
| 977 |
| 978 unittest.group("obj-schema-Variable", () { |
| 979 unittest.test("to-json--from-json", () { |
| 980 var o = buildVariable(); |
| 981 var od = new api.Variable.fromJson(o.toJson()); |
| 982 checkVariable(od); |
| 983 }); |
| 984 }); |
| 985 |
| 986 |
| 987 unittest.group("resource-ControllerDebuggeesResourceApi", () { |
| 988 unittest.test("method--register", () { |
| 989 |
| 990 var mock = new HttpServerMock(); |
| 991 api.ControllerDebuggeesResourceApi res = new api.ClouddebuggerApi(mock).co
ntroller.debuggees; |
| 992 var arg_request = buildRegisterDebuggeeRequest(); |
| 993 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 994 var obj = new api.RegisterDebuggeeRequest.fromJson(json); |
| 995 checkRegisterDebuggeeRequest(obj); |
| 996 |
| 997 var path = (req.url).path; |
| 998 var pathOffset = 0; |
| 999 var index; |
| 1000 var subPart; |
| 1001 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1002 pathOffset += 1; |
| 1003 unittest.expect(path.substring(pathOffset, pathOffset + 32), unittest.eq
uals("v2/controller/debuggees/register")); |
| 1004 pathOffset += 32; |
| 1005 |
| 1006 var query = (req.url).query; |
| 1007 var queryOffset = 0; |
| 1008 var queryMap = {}; |
| 1009 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1010 parseBool(n) { |
| 1011 if (n == "true") return true; |
| 1012 if (n == "false") return false; |
| 1013 if (n == null) return null; |
| 1014 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1015 } |
| 1016 if (query.length > 0) { |
| 1017 for (var part in query.split("&")) { |
| 1018 var keyvalue = part.split("="); |
| 1019 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1020 } |
| 1021 } |
| 1022 |
| 1023 |
| 1024 var h = { |
| 1025 "content-type" : "application/json; charset=utf-8", |
| 1026 }; |
| 1027 var resp = convert.JSON.encode(buildRegisterDebuggeeResponse()); |
| 1028 return new async.Future.value(stringResponse(200, h, resp)); |
| 1029 }), true); |
| 1030 res.register(arg_request).then(unittest.expectAsync(((api.RegisterDebuggee
Response response) { |
| 1031 checkRegisterDebuggeeResponse(response); |
| 1032 }))); |
| 1033 }); |
| 1034 |
| 1035 }); |
| 1036 |
| 1037 |
| 1038 unittest.group("resource-ControllerDebuggeesBreakpointsResourceApi", () { |
| 1039 unittest.test("method--list", () { |
| 1040 |
| 1041 var mock = new HttpServerMock(); |
| 1042 api.ControllerDebuggeesBreakpointsResourceApi res = new api.ClouddebuggerA
pi(mock).controller.debuggees.breakpoints; |
| 1043 var arg_debuggeeId = "foo"; |
| 1044 var arg_waitToken = "foo"; |
| 1045 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1046 var path = (req.url).path; |
| 1047 var pathOffset = 0; |
| 1048 var index; |
| 1049 var subPart; |
| 1050 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1051 pathOffset += 1; |
| 1052 unittest.expect(path.substring(pathOffset, pathOffset + 24), unittest.eq
uals("v2/controller/debuggees/")); |
| 1053 pathOffset += 24; |
| 1054 index = path.indexOf("/breakpoints", pathOffset); |
| 1055 unittest.expect(index >= 0, unittest.isTrue); |
| 1056 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1057 pathOffset = index; |
| 1058 unittest.expect(subPart, unittest.equals("$arg_debuggeeId")); |
| 1059 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/breakpoints")); |
| 1060 pathOffset += 12; |
| 1061 |
| 1062 var query = (req.url).query; |
| 1063 var queryOffset = 0; |
| 1064 var queryMap = {}; |
| 1065 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1066 parseBool(n) { |
| 1067 if (n == "true") return true; |
| 1068 if (n == "false") return false; |
| 1069 if (n == null) return null; |
| 1070 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1071 } |
| 1072 if (query.length > 0) { |
| 1073 for (var part in query.split("&")) { |
| 1074 var keyvalue = part.split("="); |
| 1075 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1076 } |
| 1077 } |
| 1078 unittest.expect(queryMap["waitToken"].first, unittest.equals(arg_waitTok
en)); |
| 1079 |
| 1080 |
| 1081 var h = { |
| 1082 "content-type" : "application/json; charset=utf-8", |
| 1083 }; |
| 1084 var resp = convert.JSON.encode(buildListActiveBreakpointsResponse()); |
| 1085 return new async.Future.value(stringResponse(200, h, resp)); |
| 1086 }), true); |
| 1087 res.list(arg_debuggeeId, waitToken: arg_waitToken).then(unittest.expectAsy
nc(((api.ListActiveBreakpointsResponse response) { |
| 1088 checkListActiveBreakpointsResponse(response); |
| 1089 }))); |
| 1090 }); |
| 1091 |
| 1092 unittest.test("method--update", () { |
| 1093 |
| 1094 var mock = new HttpServerMock(); |
| 1095 api.ControllerDebuggeesBreakpointsResourceApi res = new api.ClouddebuggerA
pi(mock).controller.debuggees.breakpoints; |
| 1096 var arg_request = buildUpdateActiveBreakpointRequest(); |
| 1097 var arg_debuggeeId = "foo"; |
| 1098 var arg_id = "foo"; |
| 1099 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1100 var obj = new api.UpdateActiveBreakpointRequest.fromJson(json); |
| 1101 checkUpdateActiveBreakpointRequest(obj); |
| 1102 |
| 1103 var path = (req.url).path; |
| 1104 var pathOffset = 0; |
| 1105 var index; |
| 1106 var subPart; |
| 1107 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1108 pathOffset += 1; |
| 1109 unittest.expect(path.substring(pathOffset, pathOffset + 24), unittest.eq
uals("v2/controller/debuggees/")); |
| 1110 pathOffset += 24; |
| 1111 index = path.indexOf("/breakpoints/", pathOffset); |
| 1112 unittest.expect(index >= 0, unittest.isTrue); |
| 1113 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1114 pathOffset = index; |
| 1115 unittest.expect(subPart, unittest.equals("$arg_debuggeeId")); |
| 1116 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/breakpoints/")); |
| 1117 pathOffset += 13; |
| 1118 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1119 pathOffset = path.length; |
| 1120 unittest.expect(subPart, unittest.equals("$arg_id")); |
| 1121 |
| 1122 var query = (req.url).query; |
| 1123 var queryOffset = 0; |
| 1124 var queryMap = {}; |
| 1125 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1126 parseBool(n) { |
| 1127 if (n == "true") return true; |
| 1128 if (n == "false") return false; |
| 1129 if (n == null) return null; |
| 1130 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1131 } |
| 1132 if (query.length > 0) { |
| 1133 for (var part in query.split("&")) { |
| 1134 var keyvalue = part.split("="); |
| 1135 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1136 } |
| 1137 } |
| 1138 |
| 1139 |
| 1140 var h = { |
| 1141 "content-type" : "application/json; charset=utf-8", |
| 1142 }; |
| 1143 var resp = convert.JSON.encode(buildUpdateActiveBreakpointResponse()); |
| 1144 return new async.Future.value(stringResponse(200, h, resp)); |
| 1145 }), true); |
| 1146 res.update(arg_request, arg_debuggeeId, arg_id).then(unittest.expectAsync(
((api.UpdateActiveBreakpointResponse response) { |
| 1147 checkUpdateActiveBreakpointResponse(response); |
| 1148 }))); |
| 1149 }); |
| 1150 |
| 1151 }); |
| 1152 |
| 1153 |
| 1154 unittest.group("resource-DebuggerDebuggeesResourceApi", () { |
| 1155 unittest.test("method--list", () { |
| 1156 |
| 1157 var mock = new HttpServerMock(); |
| 1158 api.DebuggerDebuggeesResourceApi res = new api.ClouddebuggerApi(mock).debu
gger.debuggees; |
| 1159 var arg_project = "foo"; |
| 1160 var arg_includeInactive = true; |
| 1161 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1162 var path = (req.url).path; |
| 1163 var pathOffset = 0; |
| 1164 var index; |
| 1165 var subPart; |
| 1166 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1167 pathOffset += 1; |
| 1168 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("v2/debugger/debuggees")); |
| 1169 pathOffset += 21; |
| 1170 |
| 1171 var query = (req.url).query; |
| 1172 var queryOffset = 0; |
| 1173 var queryMap = {}; |
| 1174 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1175 parseBool(n) { |
| 1176 if (n == "true") return true; |
| 1177 if (n == "false") return false; |
| 1178 if (n == null) return null; |
| 1179 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1180 } |
| 1181 if (query.length > 0) { |
| 1182 for (var part in query.split("&")) { |
| 1183 var keyvalue = part.split("="); |
| 1184 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1185 } |
| 1186 } |
| 1187 unittest.expect(queryMap["project"].first, unittest.equals(arg_project))
; |
| 1188 unittest.expect(queryMap["includeInactive"].first, unittest.equals("$arg
_includeInactive")); |
| 1189 |
| 1190 |
| 1191 var h = { |
| 1192 "content-type" : "application/json; charset=utf-8", |
| 1193 }; |
| 1194 var resp = convert.JSON.encode(buildListDebuggeesResponse()); |
| 1195 return new async.Future.value(stringResponse(200, h, resp)); |
| 1196 }), true); |
| 1197 res.list(project: arg_project, includeInactive: arg_includeInactive).then(
unittest.expectAsync(((api.ListDebuggeesResponse response) { |
| 1198 checkListDebuggeesResponse(response); |
| 1199 }))); |
| 1200 }); |
| 1201 |
| 1202 }); |
| 1203 |
| 1204 |
| 1205 unittest.group("resource-DebuggerDebuggeesBreakpointsResourceApi", () { |
| 1206 unittest.test("method--delete", () { |
| 1207 |
| 1208 var mock = new HttpServerMock(); |
| 1209 api.DebuggerDebuggeesBreakpointsResourceApi res = new api.ClouddebuggerApi
(mock).debugger.debuggees.breakpoints; |
| 1210 var arg_debuggeeId = "foo"; |
| 1211 var arg_breakpointId = "foo"; |
| 1212 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1213 var path = (req.url).path; |
| 1214 var pathOffset = 0; |
| 1215 var index; |
| 1216 var subPart; |
| 1217 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1218 pathOffset += 1; |
| 1219 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("v2/debugger/debuggees/")); |
| 1220 pathOffset += 22; |
| 1221 index = path.indexOf("/breakpoints/", pathOffset); |
| 1222 unittest.expect(index >= 0, unittest.isTrue); |
| 1223 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1224 pathOffset = index; |
| 1225 unittest.expect(subPart, unittest.equals("$arg_debuggeeId")); |
| 1226 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/breakpoints/")); |
| 1227 pathOffset += 13; |
| 1228 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1229 pathOffset = path.length; |
| 1230 unittest.expect(subPart, unittest.equals("$arg_breakpointId")); |
| 1231 |
| 1232 var query = (req.url).query; |
| 1233 var queryOffset = 0; |
| 1234 var queryMap = {}; |
| 1235 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1236 parseBool(n) { |
| 1237 if (n == "true") return true; |
| 1238 if (n == "false") return false; |
| 1239 if (n == null) return null; |
| 1240 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1241 } |
| 1242 if (query.length > 0) { |
| 1243 for (var part in query.split("&")) { |
| 1244 var keyvalue = part.split("="); |
| 1245 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1246 } |
| 1247 } |
| 1248 |
| 1249 |
| 1250 var h = { |
| 1251 "content-type" : "application/json; charset=utf-8", |
| 1252 }; |
| 1253 var resp = convert.JSON.encode(buildEmpty()); |
| 1254 return new async.Future.value(stringResponse(200, h, resp)); |
| 1255 }), true); |
| 1256 res.delete(arg_debuggeeId, arg_breakpointId).then(unittest.expectAsync(((a
pi.Empty response) { |
| 1257 checkEmpty(response); |
| 1258 }))); |
| 1259 }); |
| 1260 |
| 1261 unittest.test("method--get", () { |
| 1262 |
| 1263 var mock = new HttpServerMock(); |
| 1264 api.DebuggerDebuggeesBreakpointsResourceApi res = new api.ClouddebuggerApi
(mock).debugger.debuggees.breakpoints; |
| 1265 var arg_debuggeeId = "foo"; |
| 1266 var arg_breakpointId = "foo"; |
| 1267 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1268 var path = (req.url).path; |
| 1269 var pathOffset = 0; |
| 1270 var index; |
| 1271 var subPart; |
| 1272 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1273 pathOffset += 1; |
| 1274 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("v2/debugger/debuggees/")); |
| 1275 pathOffset += 22; |
| 1276 index = path.indexOf("/breakpoints/", pathOffset); |
| 1277 unittest.expect(index >= 0, unittest.isTrue); |
| 1278 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1279 pathOffset = index; |
| 1280 unittest.expect(subPart, unittest.equals("$arg_debuggeeId")); |
| 1281 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("/breakpoints/")); |
| 1282 pathOffset += 13; |
| 1283 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1284 pathOffset = path.length; |
| 1285 unittest.expect(subPart, unittest.equals("$arg_breakpointId")); |
| 1286 |
| 1287 var query = (req.url).query; |
| 1288 var queryOffset = 0; |
| 1289 var queryMap = {}; |
| 1290 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1291 parseBool(n) { |
| 1292 if (n == "true") return true; |
| 1293 if (n == "false") return false; |
| 1294 if (n == null) return null; |
| 1295 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1296 } |
| 1297 if (query.length > 0) { |
| 1298 for (var part in query.split("&")) { |
| 1299 var keyvalue = part.split("="); |
| 1300 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1301 } |
| 1302 } |
| 1303 |
| 1304 |
| 1305 var h = { |
| 1306 "content-type" : "application/json; charset=utf-8", |
| 1307 }; |
| 1308 var resp = convert.JSON.encode(buildGetBreakpointResponse()); |
| 1309 return new async.Future.value(stringResponse(200, h, resp)); |
| 1310 }), true); |
| 1311 res.get(arg_debuggeeId, arg_breakpointId).then(unittest.expectAsync(((api.
GetBreakpointResponse response) { |
| 1312 checkGetBreakpointResponse(response); |
| 1313 }))); |
| 1314 }); |
| 1315 |
| 1316 unittest.test("method--list", () { |
| 1317 |
| 1318 var mock = new HttpServerMock(); |
| 1319 api.DebuggerDebuggeesBreakpointsResourceApi res = new api.ClouddebuggerApi
(mock).debugger.debuggees.breakpoints; |
| 1320 var arg_debuggeeId = "foo"; |
| 1321 var arg_includeAllUsers = true; |
| 1322 var arg_includeInactive = true; |
| 1323 var arg_action_value = "foo"; |
| 1324 var arg_stripResults = true; |
| 1325 var arg_waitToken = "foo"; |
| 1326 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1327 var path = (req.url).path; |
| 1328 var pathOffset = 0; |
| 1329 var index; |
| 1330 var subPart; |
| 1331 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1332 pathOffset += 1; |
| 1333 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("v2/debugger/debuggees/")); |
| 1334 pathOffset += 22; |
| 1335 index = path.indexOf("/breakpoints", pathOffset); |
| 1336 unittest.expect(index >= 0, unittest.isTrue); |
| 1337 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1338 pathOffset = index; |
| 1339 unittest.expect(subPart, unittest.equals("$arg_debuggeeId")); |
| 1340 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/breakpoints")); |
| 1341 pathOffset += 12; |
| 1342 |
| 1343 var query = (req.url).query; |
| 1344 var queryOffset = 0; |
| 1345 var queryMap = {}; |
| 1346 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1347 parseBool(n) { |
| 1348 if (n == "true") return true; |
| 1349 if (n == "false") return false; |
| 1350 if (n == null) return null; |
| 1351 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1352 } |
| 1353 if (query.length > 0) { |
| 1354 for (var part in query.split("&")) { |
| 1355 var keyvalue = part.split("="); |
| 1356 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1357 } |
| 1358 } |
| 1359 unittest.expect(queryMap["includeAllUsers"].first, unittest.equals("$arg
_includeAllUsers")); |
| 1360 unittest.expect(queryMap["includeInactive"].first, unittest.equals("$arg
_includeInactive")); |
| 1361 unittest.expect(queryMap["action.value"].first, unittest.equals(arg_acti
on_value)); |
| 1362 unittest.expect(queryMap["stripResults"].first, unittest.equals("$arg_st
ripResults")); |
| 1363 unittest.expect(queryMap["waitToken"].first, unittest.equals(arg_waitTok
en)); |
| 1364 |
| 1365 |
| 1366 var h = { |
| 1367 "content-type" : "application/json; charset=utf-8", |
| 1368 }; |
| 1369 var resp = convert.JSON.encode(buildListBreakpointsResponse()); |
| 1370 return new async.Future.value(stringResponse(200, h, resp)); |
| 1371 }), true); |
| 1372 res.list(arg_debuggeeId, includeAllUsers: arg_includeAllUsers, includeInac
tive: arg_includeInactive, action_value: arg_action_value, stripResults: arg_str
ipResults, waitToken: arg_waitToken).then(unittest.expectAsync(((api.ListBreakpo
intsResponse response) { |
| 1373 checkListBreakpointsResponse(response); |
| 1374 }))); |
| 1375 }); |
| 1376 |
| 1377 unittest.test("method--set", () { |
| 1378 |
| 1379 var mock = new HttpServerMock(); |
| 1380 api.DebuggerDebuggeesBreakpointsResourceApi res = new api.ClouddebuggerApi
(mock).debugger.debuggees.breakpoints; |
| 1381 var arg_request = buildBreakpoint(); |
| 1382 var arg_debuggeeId = "foo"; |
| 1383 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1384 var obj = new api.Breakpoint.fromJson(json); |
| 1385 checkBreakpoint(obj); |
| 1386 |
| 1387 var path = (req.url).path; |
| 1388 var pathOffset = 0; |
| 1389 var index; |
| 1390 var subPart; |
| 1391 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1392 pathOffset += 1; |
| 1393 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("v2/debugger/debuggees/")); |
| 1394 pathOffset += 22; |
| 1395 index = path.indexOf("/breakpoints/set", pathOffset); |
| 1396 unittest.expect(index >= 0, unittest.isTrue); |
| 1397 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 1398 pathOffset = index; |
| 1399 unittest.expect(subPart, unittest.equals("$arg_debuggeeId")); |
| 1400 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("/breakpoints/set")); |
| 1401 pathOffset += 16; |
| 1402 |
| 1403 var query = (req.url).query; |
| 1404 var queryOffset = 0; |
| 1405 var queryMap = {}; |
| 1406 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1407 parseBool(n) { |
| 1408 if (n == "true") return true; |
| 1409 if (n == "false") return false; |
| 1410 if (n == null) return null; |
| 1411 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1412 } |
| 1413 if (query.length > 0) { |
| 1414 for (var part in query.split("&")) { |
| 1415 var keyvalue = part.split("="); |
| 1416 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1417 } |
| 1418 } |
| 1419 |
| 1420 |
| 1421 var h = { |
| 1422 "content-type" : "application/json; charset=utf-8", |
| 1423 }; |
| 1424 var resp = convert.JSON.encode(buildSetBreakpointResponse()); |
| 1425 return new async.Future.value(stringResponse(200, h, resp)); |
| 1426 }), true); |
| 1427 res.set(arg_request, arg_debuggeeId).then(unittest.expectAsync(((api.SetBr
eakpointResponse response) { |
| 1428 checkSetBreakpointResponse(response); |
| 1429 }))); |
| 1430 }); |
| 1431 |
| 1432 }); |
| 1433 |
| 1434 |
| 1435 } |
| 1436 |
OLD | NEW |