OLD | NEW |
(Empty) | |
| 1 library googleapis_beta.cloudmonitoring.v2beta1.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 import 'package:googleapis_beta/common/common.dart' as common; |
| 12 import 'package:googleapis_beta/src/common_internal.dart' as common_internal; |
| 13 import '../common/common_internal_test.dart' as common_test; |
| 14 |
| 15 import 'package:googleapis_beta/cloudmonitoring/v2beta1.dart' as api; |
| 16 |
| 17 |
| 18 |
| 19 core.int buildCounterListMetricDescriptorsRequest = 0; |
| 20 buildListMetricDescriptorsRequest() { |
| 21 var o = new api.ListMetricDescriptorsRequest(); |
| 22 buildCounterListMetricDescriptorsRequest++; |
| 23 if (buildCounterListMetricDescriptorsRequest < 3) { |
| 24 o.kind = "foo"; |
| 25 } |
| 26 buildCounterListMetricDescriptorsRequest--; |
| 27 return o; |
| 28 } |
| 29 |
| 30 checkListMetricDescriptorsRequest(api.ListMetricDescriptorsRequest o) { |
| 31 buildCounterListMetricDescriptorsRequest++; |
| 32 if (buildCounterListMetricDescriptorsRequest < 3) { |
| 33 unittest.expect(o.kind, unittest.equals('foo')); |
| 34 } |
| 35 buildCounterListMetricDescriptorsRequest--; |
| 36 } |
| 37 |
| 38 buildUnnamed1174() { |
| 39 var o = new core.List<api.MetricDescriptor>(); |
| 40 o.add(buildMetricDescriptor()); |
| 41 o.add(buildMetricDescriptor()); |
| 42 return o; |
| 43 } |
| 44 |
| 45 checkUnnamed1174(core.List<api.MetricDescriptor> o) { |
| 46 unittest.expect(o, unittest.hasLength(2)); |
| 47 checkMetricDescriptor(o[0]); |
| 48 checkMetricDescriptor(o[1]); |
| 49 } |
| 50 |
| 51 core.int buildCounterListMetricDescriptorsResponse = 0; |
| 52 buildListMetricDescriptorsResponse() { |
| 53 var o = new api.ListMetricDescriptorsResponse(); |
| 54 buildCounterListMetricDescriptorsResponse++; |
| 55 if (buildCounterListMetricDescriptorsResponse < 3) { |
| 56 o.kind = "foo"; |
| 57 o.metrics = buildUnnamed1174(); |
| 58 o.nextPageToken = "foo"; |
| 59 } |
| 60 buildCounterListMetricDescriptorsResponse--; |
| 61 return o; |
| 62 } |
| 63 |
| 64 checkListMetricDescriptorsResponse(api.ListMetricDescriptorsResponse o) { |
| 65 buildCounterListMetricDescriptorsResponse++; |
| 66 if (buildCounterListMetricDescriptorsResponse < 3) { |
| 67 unittest.expect(o.kind, unittest.equals('foo')); |
| 68 checkUnnamed1174(o.metrics); |
| 69 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 70 } |
| 71 buildCounterListMetricDescriptorsResponse--; |
| 72 } |
| 73 |
| 74 core.int buildCounterListTimeseriesDescriptorsRequest = 0; |
| 75 buildListTimeseriesDescriptorsRequest() { |
| 76 var o = new api.ListTimeseriesDescriptorsRequest(); |
| 77 buildCounterListTimeseriesDescriptorsRequest++; |
| 78 if (buildCounterListTimeseriesDescriptorsRequest < 3) { |
| 79 o.kind = "foo"; |
| 80 } |
| 81 buildCounterListTimeseriesDescriptorsRequest--; |
| 82 return o; |
| 83 } |
| 84 |
| 85 checkListTimeseriesDescriptorsRequest(api.ListTimeseriesDescriptorsRequest o) { |
| 86 buildCounterListTimeseriesDescriptorsRequest++; |
| 87 if (buildCounterListTimeseriesDescriptorsRequest < 3) { |
| 88 unittest.expect(o.kind, unittest.equals('foo')); |
| 89 } |
| 90 buildCounterListTimeseriesDescriptorsRequest--; |
| 91 } |
| 92 |
| 93 buildUnnamed1175() { |
| 94 var o = new core.List<api.TimeseriesDescriptor>(); |
| 95 o.add(buildTimeseriesDescriptor()); |
| 96 o.add(buildTimeseriesDescriptor()); |
| 97 return o; |
| 98 } |
| 99 |
| 100 checkUnnamed1175(core.List<api.TimeseriesDescriptor> o) { |
| 101 unittest.expect(o, unittest.hasLength(2)); |
| 102 checkTimeseriesDescriptor(o[0]); |
| 103 checkTimeseriesDescriptor(o[1]); |
| 104 } |
| 105 |
| 106 core.int buildCounterListTimeseriesDescriptorsResponse = 0; |
| 107 buildListTimeseriesDescriptorsResponse() { |
| 108 var o = new api.ListTimeseriesDescriptorsResponse(); |
| 109 buildCounterListTimeseriesDescriptorsResponse++; |
| 110 if (buildCounterListTimeseriesDescriptorsResponse < 3) { |
| 111 o.kind = "foo"; |
| 112 o.nextPageToken = "foo"; |
| 113 o.oldest = core.DateTime.parse("2002-02-27T14:01:02"); |
| 114 o.timeseries = buildUnnamed1175(); |
| 115 o.youngest = core.DateTime.parse("2002-02-27T14:01:02"); |
| 116 } |
| 117 buildCounterListTimeseriesDescriptorsResponse--; |
| 118 return o; |
| 119 } |
| 120 |
| 121 checkListTimeseriesDescriptorsResponse(api.ListTimeseriesDescriptorsResponse o)
{ |
| 122 buildCounterListTimeseriesDescriptorsResponse++; |
| 123 if (buildCounterListTimeseriesDescriptorsResponse < 3) { |
| 124 unittest.expect(o.kind, unittest.equals('foo')); |
| 125 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 126 unittest.expect(o.oldest, unittest.equals(core.DateTime.parse("2002-02-27T14
:01:02"))); |
| 127 checkUnnamed1175(o.timeseries); |
| 128 unittest.expect(o.youngest, unittest.equals(core.DateTime.parse("2002-02-27T
14:01:02"))); |
| 129 } |
| 130 buildCounterListTimeseriesDescriptorsResponse--; |
| 131 } |
| 132 |
| 133 core.int buildCounterListTimeseriesRequest = 0; |
| 134 buildListTimeseriesRequest() { |
| 135 var o = new api.ListTimeseriesRequest(); |
| 136 buildCounterListTimeseriesRequest++; |
| 137 if (buildCounterListTimeseriesRequest < 3) { |
| 138 o.kind = "foo"; |
| 139 } |
| 140 buildCounterListTimeseriesRequest--; |
| 141 return o; |
| 142 } |
| 143 |
| 144 checkListTimeseriesRequest(api.ListTimeseriesRequest o) { |
| 145 buildCounterListTimeseriesRequest++; |
| 146 if (buildCounterListTimeseriesRequest < 3) { |
| 147 unittest.expect(o.kind, unittest.equals('foo')); |
| 148 } |
| 149 buildCounterListTimeseriesRequest--; |
| 150 } |
| 151 |
| 152 buildUnnamed1176() { |
| 153 var o = new core.List<api.Timeseries>(); |
| 154 o.add(buildTimeseries()); |
| 155 o.add(buildTimeseries()); |
| 156 return o; |
| 157 } |
| 158 |
| 159 checkUnnamed1176(core.List<api.Timeseries> o) { |
| 160 unittest.expect(o, unittest.hasLength(2)); |
| 161 checkTimeseries(o[0]); |
| 162 checkTimeseries(o[1]); |
| 163 } |
| 164 |
| 165 core.int buildCounterListTimeseriesResponse = 0; |
| 166 buildListTimeseriesResponse() { |
| 167 var o = new api.ListTimeseriesResponse(); |
| 168 buildCounterListTimeseriesResponse++; |
| 169 if (buildCounterListTimeseriesResponse < 3) { |
| 170 o.kind = "foo"; |
| 171 o.nextPageToken = "foo"; |
| 172 o.oldest = core.DateTime.parse("2002-02-27T14:01:02"); |
| 173 o.timeseries = buildUnnamed1176(); |
| 174 o.youngest = core.DateTime.parse("2002-02-27T14:01:02"); |
| 175 } |
| 176 buildCounterListTimeseriesResponse--; |
| 177 return o; |
| 178 } |
| 179 |
| 180 checkListTimeseriesResponse(api.ListTimeseriesResponse o) { |
| 181 buildCounterListTimeseriesResponse++; |
| 182 if (buildCounterListTimeseriesResponse < 3) { |
| 183 unittest.expect(o.kind, unittest.equals('foo')); |
| 184 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 185 unittest.expect(o.oldest, unittest.equals(core.DateTime.parse("2002-02-27T14
:01:02"))); |
| 186 checkUnnamed1176(o.timeseries); |
| 187 unittest.expect(o.youngest, unittest.equals(core.DateTime.parse("2002-02-27T
14:01:02"))); |
| 188 } |
| 189 buildCounterListTimeseriesResponse--; |
| 190 } |
| 191 |
| 192 buildUnnamed1177() { |
| 193 var o = new core.List<api.MetricDescriptorLabelDescriptor>(); |
| 194 o.add(buildMetricDescriptorLabelDescriptor()); |
| 195 o.add(buildMetricDescriptorLabelDescriptor()); |
| 196 return o; |
| 197 } |
| 198 |
| 199 checkUnnamed1177(core.List<api.MetricDescriptorLabelDescriptor> o) { |
| 200 unittest.expect(o, unittest.hasLength(2)); |
| 201 checkMetricDescriptorLabelDescriptor(o[0]); |
| 202 checkMetricDescriptorLabelDescriptor(o[1]); |
| 203 } |
| 204 |
| 205 core.int buildCounterMetricDescriptor = 0; |
| 206 buildMetricDescriptor() { |
| 207 var o = new api.MetricDescriptor(); |
| 208 buildCounterMetricDescriptor++; |
| 209 if (buildCounterMetricDescriptor < 3) { |
| 210 o.description = "foo"; |
| 211 o.labels = buildUnnamed1177(); |
| 212 o.name = "foo"; |
| 213 o.project = "foo"; |
| 214 o.typeDescriptor = buildMetricDescriptorTypeDescriptor(); |
| 215 } |
| 216 buildCounterMetricDescriptor--; |
| 217 return o; |
| 218 } |
| 219 |
| 220 checkMetricDescriptor(api.MetricDescriptor o) { |
| 221 buildCounterMetricDescriptor++; |
| 222 if (buildCounterMetricDescriptor < 3) { |
| 223 unittest.expect(o.description, unittest.equals('foo')); |
| 224 checkUnnamed1177(o.labels); |
| 225 unittest.expect(o.name, unittest.equals('foo')); |
| 226 unittest.expect(o.project, unittest.equals('foo')); |
| 227 checkMetricDescriptorTypeDescriptor(o.typeDescriptor); |
| 228 } |
| 229 buildCounterMetricDescriptor--; |
| 230 } |
| 231 |
| 232 core.int buildCounterMetricDescriptorLabelDescriptor = 0; |
| 233 buildMetricDescriptorLabelDescriptor() { |
| 234 var o = new api.MetricDescriptorLabelDescriptor(); |
| 235 buildCounterMetricDescriptorLabelDescriptor++; |
| 236 if (buildCounterMetricDescriptorLabelDescriptor < 3) { |
| 237 o.description = "foo"; |
| 238 o.key = "foo"; |
| 239 } |
| 240 buildCounterMetricDescriptorLabelDescriptor--; |
| 241 return o; |
| 242 } |
| 243 |
| 244 checkMetricDescriptorLabelDescriptor(api.MetricDescriptorLabelDescriptor o) { |
| 245 buildCounterMetricDescriptorLabelDescriptor++; |
| 246 if (buildCounterMetricDescriptorLabelDescriptor < 3) { |
| 247 unittest.expect(o.description, unittest.equals('foo')); |
| 248 unittest.expect(o.key, unittest.equals('foo')); |
| 249 } |
| 250 buildCounterMetricDescriptorLabelDescriptor--; |
| 251 } |
| 252 |
| 253 core.int buildCounterMetricDescriptorTypeDescriptor = 0; |
| 254 buildMetricDescriptorTypeDescriptor() { |
| 255 var o = new api.MetricDescriptorTypeDescriptor(); |
| 256 buildCounterMetricDescriptorTypeDescriptor++; |
| 257 if (buildCounterMetricDescriptorTypeDescriptor < 3) { |
| 258 o.metricType = "foo"; |
| 259 o.valueType = "foo"; |
| 260 } |
| 261 buildCounterMetricDescriptorTypeDescriptor--; |
| 262 return o; |
| 263 } |
| 264 |
| 265 checkMetricDescriptorTypeDescriptor(api.MetricDescriptorTypeDescriptor o) { |
| 266 buildCounterMetricDescriptorTypeDescriptor++; |
| 267 if (buildCounterMetricDescriptorTypeDescriptor < 3) { |
| 268 unittest.expect(o.metricType, unittest.equals('foo')); |
| 269 unittest.expect(o.valueType, unittest.equals('foo')); |
| 270 } |
| 271 buildCounterMetricDescriptorTypeDescriptor--; |
| 272 } |
| 273 |
| 274 core.int buildCounterPoint = 0; |
| 275 buildPoint() { |
| 276 var o = new api.Point(); |
| 277 buildCounterPoint++; |
| 278 if (buildCounterPoint < 3) { |
| 279 o.boolValue = true; |
| 280 o.distributionValue = buildPointDistribution(); |
| 281 o.doubleValue = 42.0; |
| 282 o.end = core.DateTime.parse("2002-02-27T14:01:02"); |
| 283 o.int64Value = "foo"; |
| 284 o.start = core.DateTime.parse("2002-02-27T14:01:02"); |
| 285 o.stringValue = "foo"; |
| 286 } |
| 287 buildCounterPoint--; |
| 288 return o; |
| 289 } |
| 290 |
| 291 checkPoint(api.Point o) { |
| 292 buildCounterPoint++; |
| 293 if (buildCounterPoint < 3) { |
| 294 unittest.expect(o.boolValue, unittest.isTrue); |
| 295 checkPointDistribution(o.distributionValue); |
| 296 unittest.expect(o.doubleValue, unittest.equals(42.0)); |
| 297 unittest.expect(o.end, unittest.equals(core.DateTime.parse("2002-02-27T14:01
:02"))); |
| 298 unittest.expect(o.int64Value, unittest.equals('foo')); |
| 299 unittest.expect(o.start, unittest.equals(core.DateTime.parse("2002-02-27T14:
01:02"))); |
| 300 unittest.expect(o.stringValue, unittest.equals('foo')); |
| 301 } |
| 302 buildCounterPoint--; |
| 303 } |
| 304 |
| 305 buildUnnamed1178() { |
| 306 var o = new core.List<api.PointDistributionBucket>(); |
| 307 o.add(buildPointDistributionBucket()); |
| 308 o.add(buildPointDistributionBucket()); |
| 309 return o; |
| 310 } |
| 311 |
| 312 checkUnnamed1178(core.List<api.PointDistributionBucket> o) { |
| 313 unittest.expect(o, unittest.hasLength(2)); |
| 314 checkPointDistributionBucket(o[0]); |
| 315 checkPointDistributionBucket(o[1]); |
| 316 } |
| 317 |
| 318 core.int buildCounterPointDistribution = 0; |
| 319 buildPointDistribution() { |
| 320 var o = new api.PointDistribution(); |
| 321 buildCounterPointDistribution++; |
| 322 if (buildCounterPointDistribution < 3) { |
| 323 o.buckets = buildUnnamed1178(); |
| 324 o.overflowBucket = buildPointDistributionOverflowBucket(); |
| 325 o.underflowBucket = buildPointDistributionUnderflowBucket(); |
| 326 } |
| 327 buildCounterPointDistribution--; |
| 328 return o; |
| 329 } |
| 330 |
| 331 checkPointDistribution(api.PointDistribution o) { |
| 332 buildCounterPointDistribution++; |
| 333 if (buildCounterPointDistribution < 3) { |
| 334 checkUnnamed1178(o.buckets); |
| 335 checkPointDistributionOverflowBucket(o.overflowBucket); |
| 336 checkPointDistributionUnderflowBucket(o.underflowBucket); |
| 337 } |
| 338 buildCounterPointDistribution--; |
| 339 } |
| 340 |
| 341 core.int buildCounterPointDistributionBucket = 0; |
| 342 buildPointDistributionBucket() { |
| 343 var o = new api.PointDistributionBucket(); |
| 344 buildCounterPointDistributionBucket++; |
| 345 if (buildCounterPointDistributionBucket < 3) { |
| 346 o.count = "foo"; |
| 347 o.lowerBound = 42.0; |
| 348 o.upperBound = 42.0; |
| 349 } |
| 350 buildCounterPointDistributionBucket--; |
| 351 return o; |
| 352 } |
| 353 |
| 354 checkPointDistributionBucket(api.PointDistributionBucket o) { |
| 355 buildCounterPointDistributionBucket++; |
| 356 if (buildCounterPointDistributionBucket < 3) { |
| 357 unittest.expect(o.count, unittest.equals('foo')); |
| 358 unittest.expect(o.lowerBound, unittest.equals(42.0)); |
| 359 unittest.expect(o.upperBound, unittest.equals(42.0)); |
| 360 } |
| 361 buildCounterPointDistributionBucket--; |
| 362 } |
| 363 |
| 364 core.int buildCounterPointDistributionOverflowBucket = 0; |
| 365 buildPointDistributionOverflowBucket() { |
| 366 var o = new api.PointDistributionOverflowBucket(); |
| 367 buildCounterPointDistributionOverflowBucket++; |
| 368 if (buildCounterPointDistributionOverflowBucket < 3) { |
| 369 o.count = "foo"; |
| 370 o.lowerBound = 42.0; |
| 371 } |
| 372 buildCounterPointDistributionOverflowBucket--; |
| 373 return o; |
| 374 } |
| 375 |
| 376 checkPointDistributionOverflowBucket(api.PointDistributionOverflowBucket o) { |
| 377 buildCounterPointDistributionOverflowBucket++; |
| 378 if (buildCounterPointDistributionOverflowBucket < 3) { |
| 379 unittest.expect(o.count, unittest.equals('foo')); |
| 380 unittest.expect(o.lowerBound, unittest.equals(42.0)); |
| 381 } |
| 382 buildCounterPointDistributionOverflowBucket--; |
| 383 } |
| 384 |
| 385 core.int buildCounterPointDistributionUnderflowBucket = 0; |
| 386 buildPointDistributionUnderflowBucket() { |
| 387 var o = new api.PointDistributionUnderflowBucket(); |
| 388 buildCounterPointDistributionUnderflowBucket++; |
| 389 if (buildCounterPointDistributionUnderflowBucket < 3) { |
| 390 o.count = "foo"; |
| 391 o.upperBound = 42.0; |
| 392 } |
| 393 buildCounterPointDistributionUnderflowBucket--; |
| 394 return o; |
| 395 } |
| 396 |
| 397 checkPointDistributionUnderflowBucket(api.PointDistributionUnderflowBucket o) { |
| 398 buildCounterPointDistributionUnderflowBucket++; |
| 399 if (buildCounterPointDistributionUnderflowBucket < 3) { |
| 400 unittest.expect(o.count, unittest.equals('foo')); |
| 401 unittest.expect(o.upperBound, unittest.equals(42.0)); |
| 402 } |
| 403 buildCounterPointDistributionUnderflowBucket--; |
| 404 } |
| 405 |
| 406 buildUnnamed1179() { |
| 407 var o = new core.List<api.Point>(); |
| 408 o.add(buildPoint()); |
| 409 o.add(buildPoint()); |
| 410 return o; |
| 411 } |
| 412 |
| 413 checkUnnamed1179(core.List<api.Point> o) { |
| 414 unittest.expect(o, unittest.hasLength(2)); |
| 415 checkPoint(o[0]); |
| 416 checkPoint(o[1]); |
| 417 } |
| 418 |
| 419 core.int buildCounterTimeseries = 0; |
| 420 buildTimeseries() { |
| 421 var o = new api.Timeseries(); |
| 422 buildCounterTimeseries++; |
| 423 if (buildCounterTimeseries < 3) { |
| 424 o.points = buildUnnamed1179(); |
| 425 o.timeseriesDesc = buildTimeseriesDescriptor(); |
| 426 } |
| 427 buildCounterTimeseries--; |
| 428 return o; |
| 429 } |
| 430 |
| 431 checkTimeseries(api.Timeseries o) { |
| 432 buildCounterTimeseries++; |
| 433 if (buildCounterTimeseries < 3) { |
| 434 checkUnnamed1179(o.points); |
| 435 checkTimeseriesDescriptor(o.timeseriesDesc); |
| 436 } |
| 437 buildCounterTimeseries--; |
| 438 } |
| 439 |
| 440 buildUnnamed1180() { |
| 441 var o = new core.Map<core.String, core.String>(); |
| 442 o["x"] = "foo"; |
| 443 o["y"] = "foo"; |
| 444 return o; |
| 445 } |
| 446 |
| 447 checkUnnamed1180(core.Map<core.String, core.String> o) { |
| 448 unittest.expect(o, unittest.hasLength(2)); |
| 449 unittest.expect(o["x"], unittest.equals('foo')); |
| 450 unittest.expect(o["y"], unittest.equals('foo')); |
| 451 } |
| 452 |
| 453 core.int buildCounterTimeseriesDescriptor = 0; |
| 454 buildTimeseriesDescriptor() { |
| 455 var o = new api.TimeseriesDescriptor(); |
| 456 buildCounterTimeseriesDescriptor++; |
| 457 if (buildCounterTimeseriesDescriptor < 3) { |
| 458 o.labels = buildUnnamed1180(); |
| 459 o.metric = "foo"; |
| 460 o.project = "foo"; |
| 461 } |
| 462 buildCounterTimeseriesDescriptor--; |
| 463 return o; |
| 464 } |
| 465 |
| 466 checkTimeseriesDescriptor(api.TimeseriesDescriptor o) { |
| 467 buildCounterTimeseriesDescriptor++; |
| 468 if (buildCounterTimeseriesDescriptor < 3) { |
| 469 checkUnnamed1180(o.labels); |
| 470 unittest.expect(o.metric, unittest.equals('foo')); |
| 471 unittest.expect(o.project, unittest.equals('foo')); |
| 472 } |
| 473 buildCounterTimeseriesDescriptor--; |
| 474 } |
| 475 |
| 476 buildUnnamed1181() { |
| 477 var o = new core.List<core.String>(); |
| 478 o.add("foo"); |
| 479 o.add("foo"); |
| 480 return o; |
| 481 } |
| 482 |
| 483 checkUnnamed1181(core.List<core.String> o) { |
| 484 unittest.expect(o, unittest.hasLength(2)); |
| 485 unittest.expect(o[0], unittest.equals('foo')); |
| 486 unittest.expect(o[1], unittest.equals('foo')); |
| 487 } |
| 488 |
| 489 buildUnnamed1182() { |
| 490 var o = new core.List<core.String>(); |
| 491 o.add("foo"); |
| 492 o.add("foo"); |
| 493 return o; |
| 494 } |
| 495 |
| 496 checkUnnamed1182(core.List<core.String> o) { |
| 497 unittest.expect(o, unittest.hasLength(2)); |
| 498 unittest.expect(o[0], unittest.equals('foo')); |
| 499 unittest.expect(o[1], unittest.equals('foo')); |
| 500 } |
| 501 |
| 502 |
| 503 main() { |
| 504 unittest.group("obj-schema-ListMetricDescriptorsRequest", () { |
| 505 unittest.test("to-json--from-json", () { |
| 506 var o = buildListMetricDescriptorsRequest(); |
| 507 var od = new api.ListMetricDescriptorsRequest.fromJson(o.toJson()); |
| 508 checkListMetricDescriptorsRequest(od); |
| 509 }); |
| 510 }); |
| 511 |
| 512 |
| 513 unittest.group("obj-schema-ListMetricDescriptorsResponse", () { |
| 514 unittest.test("to-json--from-json", () { |
| 515 var o = buildListMetricDescriptorsResponse(); |
| 516 var od = new api.ListMetricDescriptorsResponse.fromJson(o.toJson()); |
| 517 checkListMetricDescriptorsResponse(od); |
| 518 }); |
| 519 }); |
| 520 |
| 521 |
| 522 unittest.group("obj-schema-ListTimeseriesDescriptorsRequest", () { |
| 523 unittest.test("to-json--from-json", () { |
| 524 var o = buildListTimeseriesDescriptorsRequest(); |
| 525 var od = new api.ListTimeseriesDescriptorsRequest.fromJson(o.toJson()); |
| 526 checkListTimeseriesDescriptorsRequest(od); |
| 527 }); |
| 528 }); |
| 529 |
| 530 |
| 531 unittest.group("obj-schema-ListTimeseriesDescriptorsResponse", () { |
| 532 unittest.test("to-json--from-json", () { |
| 533 var o = buildListTimeseriesDescriptorsResponse(); |
| 534 var od = new api.ListTimeseriesDescriptorsResponse.fromJson(o.toJson()); |
| 535 checkListTimeseriesDescriptorsResponse(od); |
| 536 }); |
| 537 }); |
| 538 |
| 539 |
| 540 unittest.group("obj-schema-ListTimeseriesRequest", () { |
| 541 unittest.test("to-json--from-json", () { |
| 542 var o = buildListTimeseriesRequest(); |
| 543 var od = new api.ListTimeseriesRequest.fromJson(o.toJson()); |
| 544 checkListTimeseriesRequest(od); |
| 545 }); |
| 546 }); |
| 547 |
| 548 |
| 549 unittest.group("obj-schema-ListTimeseriesResponse", () { |
| 550 unittest.test("to-json--from-json", () { |
| 551 var o = buildListTimeseriesResponse(); |
| 552 var od = new api.ListTimeseriesResponse.fromJson(o.toJson()); |
| 553 checkListTimeseriesResponse(od); |
| 554 }); |
| 555 }); |
| 556 |
| 557 |
| 558 unittest.group("obj-schema-MetricDescriptor", () { |
| 559 unittest.test("to-json--from-json", () { |
| 560 var o = buildMetricDescriptor(); |
| 561 var od = new api.MetricDescriptor.fromJson(o.toJson()); |
| 562 checkMetricDescriptor(od); |
| 563 }); |
| 564 }); |
| 565 |
| 566 |
| 567 unittest.group("obj-schema-MetricDescriptorLabelDescriptor", () { |
| 568 unittest.test("to-json--from-json", () { |
| 569 var o = buildMetricDescriptorLabelDescriptor(); |
| 570 var od = new api.MetricDescriptorLabelDescriptor.fromJson(o.toJson()); |
| 571 checkMetricDescriptorLabelDescriptor(od); |
| 572 }); |
| 573 }); |
| 574 |
| 575 |
| 576 unittest.group("obj-schema-MetricDescriptorTypeDescriptor", () { |
| 577 unittest.test("to-json--from-json", () { |
| 578 var o = buildMetricDescriptorTypeDescriptor(); |
| 579 var od = new api.MetricDescriptorTypeDescriptor.fromJson(o.toJson()); |
| 580 checkMetricDescriptorTypeDescriptor(od); |
| 581 }); |
| 582 }); |
| 583 |
| 584 |
| 585 unittest.group("obj-schema-Point", () { |
| 586 unittest.test("to-json--from-json", () { |
| 587 var o = buildPoint(); |
| 588 var od = new api.Point.fromJson(o.toJson()); |
| 589 checkPoint(od); |
| 590 }); |
| 591 }); |
| 592 |
| 593 |
| 594 unittest.group("obj-schema-PointDistribution", () { |
| 595 unittest.test("to-json--from-json", () { |
| 596 var o = buildPointDistribution(); |
| 597 var od = new api.PointDistribution.fromJson(o.toJson()); |
| 598 checkPointDistribution(od); |
| 599 }); |
| 600 }); |
| 601 |
| 602 |
| 603 unittest.group("obj-schema-PointDistributionBucket", () { |
| 604 unittest.test("to-json--from-json", () { |
| 605 var o = buildPointDistributionBucket(); |
| 606 var od = new api.PointDistributionBucket.fromJson(o.toJson()); |
| 607 checkPointDistributionBucket(od); |
| 608 }); |
| 609 }); |
| 610 |
| 611 |
| 612 unittest.group("obj-schema-PointDistributionOverflowBucket", () { |
| 613 unittest.test("to-json--from-json", () { |
| 614 var o = buildPointDistributionOverflowBucket(); |
| 615 var od = new api.PointDistributionOverflowBucket.fromJson(o.toJson()); |
| 616 checkPointDistributionOverflowBucket(od); |
| 617 }); |
| 618 }); |
| 619 |
| 620 |
| 621 unittest.group("obj-schema-PointDistributionUnderflowBucket", () { |
| 622 unittest.test("to-json--from-json", () { |
| 623 var o = buildPointDistributionUnderflowBucket(); |
| 624 var od = new api.PointDistributionUnderflowBucket.fromJson(o.toJson()); |
| 625 checkPointDistributionUnderflowBucket(od); |
| 626 }); |
| 627 }); |
| 628 |
| 629 |
| 630 unittest.group("obj-schema-Timeseries", () { |
| 631 unittest.test("to-json--from-json", () { |
| 632 var o = buildTimeseries(); |
| 633 var od = new api.Timeseries.fromJson(o.toJson()); |
| 634 checkTimeseries(od); |
| 635 }); |
| 636 }); |
| 637 |
| 638 |
| 639 unittest.group("obj-schema-TimeseriesDescriptor", () { |
| 640 unittest.test("to-json--from-json", () { |
| 641 var o = buildTimeseriesDescriptor(); |
| 642 var od = new api.TimeseriesDescriptor.fromJson(o.toJson()); |
| 643 checkTimeseriesDescriptor(od); |
| 644 }); |
| 645 }); |
| 646 |
| 647 |
| 648 unittest.group("resource-MetricDescriptorsResourceApi", () { |
| 649 unittest.test("method--list", () { |
| 650 |
| 651 var mock = new common_test.HttpServerMock(); |
| 652 api.MetricDescriptorsResourceApi res = new api.CloudmonitoringApi(mock).me
tricDescriptors; |
| 653 var arg_request = buildListMetricDescriptorsRequest(); |
| 654 var arg_project = "foo"; |
| 655 var arg_count = 42; |
| 656 var arg_pageToken = "foo"; |
| 657 var arg_query = "foo"; |
| 658 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 659 var obj = new api.ListMetricDescriptorsRequest.fromJson(json); |
| 660 checkListMetricDescriptorsRequest(obj); |
| 661 |
| 662 var path = (req.url).path; |
| 663 var pathOffset = 0; |
| 664 var index; |
| 665 var subPart; |
| 666 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/cloudmonitoring/v2beta1/projects/")); |
| 667 pathOffset += 34; |
| 668 index = path.indexOf("/metricDescriptors", pathOffset); |
| 669 unittest.expect(index >= 0, unittest.isTrue); |
| 670 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 671 pathOffset = index; |
| 672 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 673 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("/metricDescriptors")); |
| 674 pathOffset += 18; |
| 675 |
| 676 var query = (req.url).query; |
| 677 var queryOffset = 0; |
| 678 var queryMap = {}; |
| 679 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 680 parseBool(n) { |
| 681 if (n == "true") return true; |
| 682 if (n == "false") return false; |
| 683 if (n == null) return null; |
| 684 throw new core.ArgumentError("Invalid boolean: $n"); |
| 685 } |
| 686 if (query.length > 0) { |
| 687 for (var part in query.split("&")) { |
| 688 var keyvalue = part.split("="); |
| 689 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 690 } |
| 691 } |
| 692 unittest.expect(core.int.parse(queryMap["count"].first), unittest.equals
(arg_count)); |
| 693 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 694 unittest.expect(queryMap["query"].first, unittest.equals(arg_query)); |
| 695 |
| 696 |
| 697 var h = { |
| 698 "content-type" : "application/json; charset=utf-8", |
| 699 }; |
| 700 var resp = convert.JSON.encode(buildListMetricDescriptorsResponse()); |
| 701 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 702 }), true); |
| 703 res.list(arg_request, arg_project, count: arg_count, pageToken: arg_pageTo
ken, query: arg_query).then(unittest.expectAsync(((api.ListMetricDescriptorsResp
onse response) { |
| 704 checkListMetricDescriptorsResponse(response); |
| 705 }))); |
| 706 }); |
| 707 |
| 708 }); |
| 709 |
| 710 |
| 711 unittest.group("resource-TimeseriesResourceApi", () { |
| 712 unittest.test("method--list", () { |
| 713 |
| 714 var mock = new common_test.HttpServerMock(); |
| 715 api.TimeseriesResourceApi res = new api.CloudmonitoringApi(mock).timeserie
s; |
| 716 var arg_request = buildListTimeseriesRequest(); |
| 717 var arg_project = "foo"; |
| 718 var arg_metric = "foo"; |
| 719 var arg_youngest = "foo"; |
| 720 var arg_count = 42; |
| 721 var arg_labels = buildUnnamed1181(); |
| 722 var arg_oldest = "foo"; |
| 723 var arg_pageToken = "foo"; |
| 724 var arg_timespan = "foo"; |
| 725 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 726 var obj = new api.ListTimeseriesRequest.fromJson(json); |
| 727 checkListTimeseriesRequest(obj); |
| 728 |
| 729 var path = (req.url).path; |
| 730 var pathOffset = 0; |
| 731 var index; |
| 732 var subPart; |
| 733 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/cloudmonitoring/v2beta1/projects/")); |
| 734 pathOffset += 34; |
| 735 index = path.indexOf("/timeseries/", pathOffset); |
| 736 unittest.expect(index >= 0, unittest.isTrue); |
| 737 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 738 pathOffset = index; |
| 739 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 740 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/timeseries/")); |
| 741 pathOffset += 12; |
| 742 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 743 pathOffset = path.length; |
| 744 unittest.expect(subPart, unittest.equals("$arg_metric")); |
| 745 |
| 746 var query = (req.url).query; |
| 747 var queryOffset = 0; |
| 748 var queryMap = {}; |
| 749 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 750 parseBool(n) { |
| 751 if (n == "true") return true; |
| 752 if (n == "false") return false; |
| 753 if (n == null) return null; |
| 754 throw new core.ArgumentError("Invalid boolean: $n"); |
| 755 } |
| 756 if (query.length > 0) { |
| 757 for (var part in query.split("&")) { |
| 758 var keyvalue = part.split("="); |
| 759 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 760 } |
| 761 } |
| 762 unittest.expect(queryMap["youngest"].first, unittest.equals(arg_youngest
)); |
| 763 unittest.expect(core.int.parse(queryMap["count"].first), unittest.equals
(arg_count)); |
| 764 unittest.expect(queryMap["labels"], unittest.equals(arg_labels)); |
| 765 unittest.expect(queryMap["oldest"].first, unittest.equals(arg_oldest)); |
| 766 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 767 unittest.expect(queryMap["timespan"].first, unittest.equals(arg_timespan
)); |
| 768 |
| 769 |
| 770 var h = { |
| 771 "content-type" : "application/json; charset=utf-8", |
| 772 }; |
| 773 var resp = convert.JSON.encode(buildListTimeseriesResponse()); |
| 774 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 775 }), true); |
| 776 res.list(arg_request, arg_project, arg_metric, arg_youngest, count: arg_co
unt, labels: arg_labels, oldest: arg_oldest, pageToken: arg_pageToken, timespan:
arg_timespan).then(unittest.expectAsync(((api.ListTimeseriesResponse response)
{ |
| 777 checkListTimeseriesResponse(response); |
| 778 }))); |
| 779 }); |
| 780 |
| 781 }); |
| 782 |
| 783 |
| 784 unittest.group("resource-TimeseriesDescriptorsResourceApi", () { |
| 785 unittest.test("method--list", () { |
| 786 |
| 787 var mock = new common_test.HttpServerMock(); |
| 788 api.TimeseriesDescriptorsResourceApi res = new api.CloudmonitoringApi(mock
).timeseriesDescriptors; |
| 789 var arg_request = buildListTimeseriesDescriptorsRequest(); |
| 790 var arg_project = "foo"; |
| 791 var arg_metric = "foo"; |
| 792 var arg_youngest = "foo"; |
| 793 var arg_count = 42; |
| 794 var arg_labels = buildUnnamed1182(); |
| 795 var arg_oldest = "foo"; |
| 796 var arg_pageToken = "foo"; |
| 797 var arg_timespan = "foo"; |
| 798 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 799 var obj = new api.ListTimeseriesDescriptorsRequest.fromJson(json); |
| 800 checkListTimeseriesDescriptorsRequest(obj); |
| 801 |
| 802 var path = (req.url).path; |
| 803 var pathOffset = 0; |
| 804 var index; |
| 805 var subPart; |
| 806 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq
uals("/cloudmonitoring/v2beta1/projects/")); |
| 807 pathOffset += 34; |
| 808 index = path.indexOf("/timeseriesDescriptors/", pathOffset); |
| 809 unittest.expect(index >= 0, unittest.isTrue); |
| 810 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 811 pathOffset = index; |
| 812 unittest.expect(subPart, unittest.equals("$arg_project")); |
| 813 unittest.expect(path.substring(pathOffset, pathOffset + 23), unittest.eq
uals("/timeseriesDescriptors/")); |
| 814 pathOffset += 23; |
| 815 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 816 pathOffset = path.length; |
| 817 unittest.expect(subPart, unittest.equals("$arg_metric")); |
| 818 |
| 819 var query = (req.url).query; |
| 820 var queryOffset = 0; |
| 821 var queryMap = {}; |
| 822 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 823 parseBool(n) { |
| 824 if (n == "true") return true; |
| 825 if (n == "false") return false; |
| 826 if (n == null) return null; |
| 827 throw new core.ArgumentError("Invalid boolean: $n"); |
| 828 } |
| 829 if (query.length > 0) { |
| 830 for (var part in query.split("&")) { |
| 831 var keyvalue = part.split("="); |
| 832 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 833 } |
| 834 } |
| 835 unittest.expect(queryMap["youngest"].first, unittest.equals(arg_youngest
)); |
| 836 unittest.expect(core.int.parse(queryMap["count"].first), unittest.equals
(arg_count)); |
| 837 unittest.expect(queryMap["labels"], unittest.equals(arg_labels)); |
| 838 unittest.expect(queryMap["oldest"].first, unittest.equals(arg_oldest)); |
| 839 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 840 unittest.expect(queryMap["timespan"].first, unittest.equals(arg_timespan
)); |
| 841 |
| 842 |
| 843 var h = { |
| 844 "content-type" : "application/json; charset=utf-8", |
| 845 }; |
| 846 var resp = convert.JSON.encode(buildListTimeseriesDescriptorsResponse())
; |
| 847 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 848 }), true); |
| 849 res.list(arg_request, arg_project, arg_metric, arg_youngest, count: arg_co
unt, labels: arg_labels, oldest: arg_oldest, pageToken: arg_pageToken, timespan:
arg_timespan).then(unittest.expectAsync(((api.ListTimeseriesDescriptorsResponse
response) { |
| 850 checkListTimeseriesDescriptorsResponse(response); |
| 851 }))); |
| 852 }); |
| 853 |
| 854 }); |
| 855 |
| 856 |
| 857 } |
| 858 |
OLD | NEW |