| // Copyright 2021 Google LLC |
| // |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file or at |
| // https://developers.google.com/open-source/licenses/bsd |
| |
| // ignore_for_file: camel_case_types |
| // ignore_for_file: comment_references |
| // ignore_for_file: deprecated_member_use_from_same_package |
| // ignore_for_file: doc_directive_unknown |
| // ignore_for_file: lines_longer_than_80_chars |
| // ignore_for_file: non_constant_identifier_names |
| // ignore_for_file: prefer_const_declarations |
| // ignore_for_file: prefer_expression_function_bodies |
| // ignore_for_file: prefer_final_locals |
| // ignore_for_file: prefer_interpolation_to_compose_strings |
| // ignore_for_file: unintended_html_in_doc_comment |
| // ignore_for_file: unnecessary_brace_in_string_interps |
| // ignore_for_file: unnecessary_cast |
| // ignore_for_file: unnecessary_lambdas |
| // ignore_for_file: unnecessary_string_interpolations |
| // ignore_for_file: unreachable_from_main |
| // ignore_for_file: unused_local_variable |
| |
| import 'dart:async' as async; |
| import 'dart:convert' as convert; |
| import 'dart:core' as core; |
| |
| import 'package:googleapis/servicecontrol/v2.dart' as api; |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import '../test_shared.dart'; |
| |
| core.int buildCounterApi = 0; |
| api.Api buildApi() { |
| final o = api.Api(); |
| buildCounterApi++; |
| if (buildCounterApi < 3) { |
| o.operation = 'foo'; |
| o.protocol = 'foo'; |
| o.service = 'foo'; |
| o.version = 'foo'; |
| } |
| buildCounterApi--; |
| return o; |
| } |
| |
| void checkApi(api.Api o) { |
| buildCounterApi++; |
| if (buildCounterApi < 3) { |
| unittest.expect(o.operation!, unittest.equals('foo')); |
| unittest.expect(o.protocol!, unittest.equals('foo')); |
| unittest.expect(o.service!, unittest.equals('foo')); |
| unittest.expect(o.version!, unittest.equals('foo')); |
| } |
| buildCounterApi--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed0() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed0(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted1 = (o['x']!) as core.Map; |
| unittest.expect(casted1, unittest.hasLength(3)); |
| unittest.expect(casted1['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted1['bool'], unittest.equals(true)); |
| unittest.expect(casted1['string'], unittest.equals('foo')); |
| var casted2 = (o['y']!) as core.Map; |
| unittest.expect(casted2, unittest.hasLength(3)); |
| unittest.expect(casted2['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted2['bool'], unittest.equals(true)); |
| unittest.expect(casted2['string'], unittest.equals('foo')); |
| } |
| |
| core.List<core.Map<core.String, core.Object?>> buildUnnamed1() => [ |
| buildUnnamed0(), |
| buildUnnamed0(), |
| ]; |
| |
| void checkUnnamed1(core.List<core.Map<core.String, core.Object?>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed0(o[0]); |
| checkUnnamed0(o[1]); |
| } |
| |
| core.int buildCounterAttributeContext = 0; |
| api.AttributeContext buildAttributeContext() { |
| final o = api.AttributeContext(); |
| buildCounterAttributeContext++; |
| if (buildCounterAttributeContext < 3) { |
| o.api = buildApi(); |
| o.destination = buildPeer(); |
| o.extensions = buildUnnamed1(); |
| o.origin = buildPeer(); |
| o.request = buildRequest(); |
| o.resource = buildResource(); |
| o.response = buildResponse(); |
| o.source = buildPeer(); |
| } |
| buildCounterAttributeContext--; |
| return o; |
| } |
| |
| void checkAttributeContext(api.AttributeContext o) { |
| buildCounterAttributeContext++; |
| if (buildCounterAttributeContext < 3) { |
| checkApi(o.api!); |
| checkPeer(o.destination!); |
| checkUnnamed1(o.extensions!); |
| checkPeer(o.origin!); |
| checkRequest(o.request!); |
| checkResource(o.resource!); |
| checkResponse(o.response!); |
| checkPeer(o.source!); |
| } |
| buildCounterAttributeContext--; |
| } |
| |
| core.List<core.String> buildUnnamed2() => ['foo', 'foo']; |
| |
| void checkUnnamed2(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.List<core.String> buildUnnamed3() => ['foo', 'foo']; |
| |
| void checkUnnamed3(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o[0], unittest.equals('foo')); |
| unittest.expect(o[1], unittest.equals('foo')); |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed4() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed4(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted3 = (o['x']!) as core.Map; |
| unittest.expect(casted3, unittest.hasLength(3)); |
| unittest.expect(casted3['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted3['bool'], unittest.equals(true)); |
| unittest.expect(casted3['string'], unittest.equals('foo')); |
| var casted4 = (o['y']!) as core.Map; |
| unittest.expect(casted4, unittest.hasLength(3)); |
| unittest.expect(casted4['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted4['bool'], unittest.equals(true)); |
| unittest.expect(casted4['string'], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterAuth = 0; |
| api.Auth buildAuth() { |
| final o = api.Auth(); |
| buildCounterAuth++; |
| if (buildCounterAuth < 3) { |
| o.accessLevels = buildUnnamed2(); |
| o.audiences = buildUnnamed3(); |
| o.claims = buildUnnamed4(); |
| o.oauth = buildOauth(); |
| o.presenter = 'foo'; |
| o.principal = 'foo'; |
| } |
| buildCounterAuth--; |
| return o; |
| } |
| |
| void checkAuth(api.Auth o) { |
| buildCounterAuth++; |
| if (buildCounterAuth < 3) { |
| checkUnnamed2(o.accessLevels!); |
| checkUnnamed3(o.audiences!); |
| checkUnnamed4(o.claims!); |
| checkOauth(o.oauth!); |
| unittest.expect(o.presenter!, unittest.equals('foo')); |
| unittest.expect(o.principal!, unittest.equals('foo')); |
| } |
| buildCounterAuth--; |
| } |
| |
| core.List<api.ResourceInfo> buildUnnamed5() => [ |
| buildResourceInfo(), |
| buildResourceInfo(), |
| ]; |
| |
| void checkUnnamed5(core.List<api.ResourceInfo> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkResourceInfo(o[0]); |
| checkResourceInfo(o[1]); |
| } |
| |
| core.int buildCounterCheckRequest = 0; |
| api.CheckRequest buildCheckRequest() { |
| final o = api.CheckRequest(); |
| buildCounterCheckRequest++; |
| if (buildCounterCheckRequest < 3) { |
| o.attributes = buildAttributeContext(); |
| o.flags = 'foo'; |
| o.resources = buildUnnamed5(); |
| o.serviceConfigId = 'foo'; |
| } |
| buildCounterCheckRequest--; |
| return o; |
| } |
| |
| void checkCheckRequest(api.CheckRequest o) { |
| buildCounterCheckRequest++; |
| if (buildCounterCheckRequest < 3) { |
| checkAttributeContext(o.attributes!); |
| unittest.expect(o.flags!, unittest.equals('foo')); |
| checkUnnamed5(o.resources!); |
| unittest.expect(o.serviceConfigId!, unittest.equals('foo')); |
| } |
| buildCounterCheckRequest--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed6() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed6(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted5 = (o['x']!) as core.Map; |
| unittest.expect(casted5, unittest.hasLength(3)); |
| unittest.expect(casted5['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted5['bool'], unittest.equals(true)); |
| unittest.expect(casted5['string'], unittest.equals('foo')); |
| var casted6 = (o['y']!) as core.Map; |
| unittest.expect(casted6, unittest.hasLength(3)); |
| unittest.expect(casted6['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted6['bool'], unittest.equals(true)); |
| unittest.expect(casted6['string'], unittest.equals('foo')); |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed7() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed7(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.int buildCounterCheckResponse = 0; |
| api.CheckResponse buildCheckResponse() { |
| final o = api.CheckResponse(); |
| buildCounterCheckResponse++; |
| if (buildCounterCheckResponse < 3) { |
| o.dynamicMetadata = buildUnnamed6(); |
| o.headers = buildUnnamed7(); |
| o.status = buildStatus(); |
| } |
| buildCounterCheckResponse--; |
| return o; |
| } |
| |
| void checkCheckResponse(api.CheckResponse o) { |
| buildCounterCheckResponse++; |
| if (buildCounterCheckResponse < 3) { |
| checkUnnamed6(o.dynamicMetadata!); |
| checkUnnamed7(o.headers!); |
| checkStatus(o.status!); |
| } |
| buildCounterCheckResponse--; |
| } |
| |
| core.int buildCounterOauth = 0; |
| api.Oauth buildOauth() { |
| final o = api.Oauth(); |
| buildCounterOauth++; |
| if (buildCounterOauth < 3) { |
| o.clientId = 'foo'; |
| } |
| buildCounterOauth--; |
| return o; |
| } |
| |
| void checkOauth(api.Oauth o) { |
| buildCounterOauth++; |
| if (buildCounterOauth < 3) { |
| unittest.expect(o.clientId!, unittest.equals('foo')); |
| } |
| buildCounterOauth--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed8() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed8(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.int buildCounterPeer = 0; |
| api.Peer buildPeer() { |
| final o = api.Peer(); |
| buildCounterPeer++; |
| if (buildCounterPeer < 3) { |
| o.ip = 'foo'; |
| o.labels = buildUnnamed8(); |
| o.port = 'foo'; |
| o.principal = 'foo'; |
| o.regionCode = 'foo'; |
| } |
| buildCounterPeer--; |
| return o; |
| } |
| |
| void checkPeer(api.Peer o) { |
| buildCounterPeer++; |
| if (buildCounterPeer < 3) { |
| unittest.expect(o.ip!, unittest.equals('foo')); |
| checkUnnamed8(o.labels!); |
| unittest.expect(o.port!, unittest.equals('foo')); |
| unittest.expect(o.principal!, unittest.equals('foo')); |
| unittest.expect(o.regionCode!, unittest.equals('foo')); |
| } |
| buildCounterPeer--; |
| } |
| |
| core.List<api.AttributeContext> buildUnnamed9() => [ |
| buildAttributeContext(), |
| buildAttributeContext(), |
| ]; |
| |
| void checkUnnamed9(core.List<api.AttributeContext> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAttributeContext(o[0]); |
| checkAttributeContext(o[1]); |
| } |
| |
| core.int buildCounterReportRequest = 0; |
| api.ReportRequest buildReportRequest() { |
| final o = api.ReportRequest(); |
| buildCounterReportRequest++; |
| if (buildCounterReportRequest < 3) { |
| o.operations = buildUnnamed9(); |
| o.serviceConfigId = 'foo'; |
| } |
| buildCounterReportRequest--; |
| return o; |
| } |
| |
| void checkReportRequest(api.ReportRequest o) { |
| buildCounterReportRequest++; |
| if (buildCounterReportRequest < 3) { |
| checkUnnamed9(o.operations!); |
| unittest.expect(o.serviceConfigId!, unittest.equals('foo')); |
| } |
| buildCounterReportRequest--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed10() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed10(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted7 = (o['x']!) as core.Map; |
| unittest.expect(casted7, unittest.hasLength(3)); |
| unittest.expect(casted7['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted7['bool'], unittest.equals(true)); |
| unittest.expect(casted7['string'], unittest.equals('foo')); |
| var casted8 = (o['y']!) as core.Map; |
| unittest.expect(casted8, unittest.hasLength(3)); |
| unittest.expect(casted8['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted8['bool'], unittest.equals(true)); |
| unittest.expect(casted8['string'], unittest.equals('foo')); |
| } |
| |
| core.int buildCounterReportResponse = 0; |
| api.ReportResponse buildReportResponse() { |
| final o = api.ReportResponse(); |
| buildCounterReportResponse++; |
| if (buildCounterReportResponse < 3) { |
| o.extensions = buildUnnamed10(); |
| } |
| buildCounterReportResponse--; |
| return o; |
| } |
| |
| void checkReportResponse(api.ReportResponse o) { |
| buildCounterReportResponse++; |
| if (buildCounterReportResponse < 3) { |
| checkUnnamed10(o.extensions!); |
| } |
| buildCounterReportResponse--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed11() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed11(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.int buildCounterRequest = 0; |
| api.Request buildRequest() { |
| final o = api.Request(); |
| buildCounterRequest++; |
| if (buildCounterRequest < 3) { |
| o.auth = buildAuth(); |
| o.headers = buildUnnamed11(); |
| o.host = 'foo'; |
| o.id = 'foo'; |
| o.method = 'foo'; |
| o.origin = 'foo'; |
| o.path = 'foo'; |
| o.protocol = 'foo'; |
| o.query = 'foo'; |
| o.reason = 'foo'; |
| o.scheme = 'foo'; |
| o.size = 'foo'; |
| o.time = 'foo'; |
| } |
| buildCounterRequest--; |
| return o; |
| } |
| |
| void checkRequest(api.Request o) { |
| buildCounterRequest++; |
| if (buildCounterRequest < 3) { |
| checkAuth(o.auth!); |
| checkUnnamed11(o.headers!); |
| unittest.expect(o.host!, unittest.equals('foo')); |
| unittest.expect(o.id!, unittest.equals('foo')); |
| unittest.expect(o.method!, unittest.equals('foo')); |
| unittest.expect(o.origin!, unittest.equals('foo')); |
| unittest.expect(o.path!, unittest.equals('foo')); |
| unittest.expect(o.protocol!, unittest.equals('foo')); |
| unittest.expect(o.query!, unittest.equals('foo')); |
| unittest.expect(o.reason!, unittest.equals('foo')); |
| unittest.expect(o.scheme!, unittest.equals('foo')); |
| unittest.expect(o.size!, unittest.equals('foo')); |
| unittest.expect(o.time!, unittest.equals('foo')); |
| } |
| buildCounterRequest--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed12() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed12(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed13() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed13(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.int buildCounterResource = 0; |
| api.Resource buildResource() { |
| final o = api.Resource(); |
| buildCounterResource++; |
| if (buildCounterResource < 3) { |
| o.annotations = buildUnnamed12(); |
| o.createTime = 'foo'; |
| o.deleteTime = 'foo'; |
| o.displayName = 'foo'; |
| o.etag = 'foo'; |
| o.labels = buildUnnamed13(); |
| o.location = 'foo'; |
| o.name = 'foo'; |
| o.service = 'foo'; |
| o.type = 'foo'; |
| o.uid = 'foo'; |
| o.updateTime = 'foo'; |
| } |
| buildCounterResource--; |
| return o; |
| } |
| |
| void checkResource(api.Resource o) { |
| buildCounterResource++; |
| if (buildCounterResource < 3) { |
| checkUnnamed12(o.annotations!); |
| unittest.expect(o.createTime!, unittest.equals('foo')); |
| unittest.expect(o.deleteTime!, unittest.equals('foo')); |
| unittest.expect(o.displayName!, unittest.equals('foo')); |
| unittest.expect(o.etag!, unittest.equals('foo')); |
| checkUnnamed13(o.labels!); |
| unittest.expect(o.location!, unittest.equals('foo')); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| unittest.expect(o.service!, unittest.equals('foo')); |
| unittest.expect(o.type!, unittest.equals('foo')); |
| unittest.expect(o.uid!, unittest.equals('foo')); |
| unittest.expect(o.updateTime!, unittest.equals('foo')); |
| } |
| buildCounterResource--; |
| } |
| |
| core.int buildCounterResourceInfo = 0; |
| api.ResourceInfo buildResourceInfo() { |
| final o = api.ResourceInfo(); |
| buildCounterResourceInfo++; |
| if (buildCounterResourceInfo < 3) { |
| o.container = 'foo'; |
| o.location = 'foo'; |
| o.name = 'foo'; |
| o.permission = 'foo'; |
| o.type = 'foo'; |
| } |
| buildCounterResourceInfo--; |
| return o; |
| } |
| |
| void checkResourceInfo(api.ResourceInfo o) { |
| buildCounterResourceInfo++; |
| if (buildCounterResourceInfo < 3) { |
| unittest.expect(o.container!, unittest.equals('foo')); |
| unittest.expect(o.location!, unittest.equals('foo')); |
| unittest.expect(o.name!, unittest.equals('foo')); |
| unittest.expect(o.permission!, unittest.equals('foo')); |
| unittest.expect(o.type!, unittest.equals('foo')); |
| } |
| buildCounterResourceInfo--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed14() => {'x': 'foo', 'y': 'foo'}; |
| |
| void checkUnnamed14(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect(o['x']!, unittest.equals('foo')); |
| unittest.expect(o['y']!, unittest.equals('foo')); |
| } |
| |
| core.int buildCounterResponse = 0; |
| api.Response buildResponse() { |
| final o = api.Response(); |
| buildCounterResponse++; |
| if (buildCounterResponse < 3) { |
| o.backendLatency = 'foo'; |
| o.code = 'foo'; |
| o.headers = buildUnnamed14(); |
| o.size = 'foo'; |
| o.time = 'foo'; |
| } |
| buildCounterResponse--; |
| return o; |
| } |
| |
| void checkResponse(api.Response o) { |
| buildCounterResponse++; |
| if (buildCounterResponse < 3) { |
| unittest.expect(o.backendLatency!, unittest.equals('foo')); |
| unittest.expect(o.code!, unittest.equals('foo')); |
| checkUnnamed14(o.headers!); |
| unittest.expect(o.size!, unittest.equals('foo')); |
| unittest.expect(o.time!, unittest.equals('foo')); |
| } |
| buildCounterResponse--; |
| } |
| |
| core.Map<core.String, core.Object?> buildUnnamed15() => { |
| 'x': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| 'y': { |
| 'list': [1, 2, 3], |
| 'bool': true, |
| 'string': 'foo', |
| }, |
| }; |
| |
| void checkUnnamed15(core.Map<core.String, core.Object?> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted9 = (o['x']!) as core.Map; |
| unittest.expect(casted9, unittest.hasLength(3)); |
| unittest.expect(casted9['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted9['bool'], unittest.equals(true)); |
| unittest.expect(casted9['string'], unittest.equals('foo')); |
| var casted10 = (o['y']!) as core.Map; |
| unittest.expect(casted10, unittest.hasLength(3)); |
| unittest.expect(casted10['list'], unittest.equals([1, 2, 3])); |
| unittest.expect(casted10['bool'], unittest.equals(true)); |
| unittest.expect(casted10['string'], unittest.equals('foo')); |
| } |
| |
| core.List<core.Map<core.String, core.Object?>> buildUnnamed16() => [ |
| buildUnnamed15(), |
| buildUnnamed15(), |
| ]; |
| |
| void checkUnnamed16(core.List<core.Map<core.String, core.Object?>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed15(o[0]); |
| checkUnnamed15(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| api.Status buildStatus() { |
| final o = api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed16(); |
| o.message = 'foo'; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| void checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect(o.code!, unittest.equals(42)); |
| checkUnnamed16(o.details!); |
| unittest.expect(o.message!, unittest.equals('foo')); |
| } |
| buildCounterStatus--; |
| } |
| |
| void main() { |
| unittest.group('obj-schema-Api', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildApi(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Api.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkApi(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-AttributeContext', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildAttributeContext(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.AttributeContext.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkAttributeContext(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Auth', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildAuth(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Auth.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkAuth(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CheckRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildCheckRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.CheckRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkCheckRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CheckResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildCheckResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.CheckResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkCheckResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Oauth', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildOauth(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Oauth.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkOauth(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Peer', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPeer(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Peer.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkPeer(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ReportRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildReportRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ReportRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkReportRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ReportResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildReportResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ReportResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkReportResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Request', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Request.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Resource', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildResource(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Resource.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkResource(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ResourceInfo', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildResourceInfo(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ResourceInfo.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkResourceInfo(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Response', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Response.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Status', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildStatus(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Status.fromJson( |
| oJson as core.Map<core.String, core.dynamic>, |
| ); |
| checkStatus(od); |
| }); |
| }); |
| |
| unittest.group('resource-ServicesResource', () { |
| unittest.test('method--check', () async { |
| final mock = HttpServerMock(); |
| final res = api.ServiceControlApi(mock).services; |
| final arg_request = buildCheckRequest(); |
| final arg_serviceName = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.CheckRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkCheckRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v2/services/'), |
| ); |
| pathOffset += 12; |
| index = path.indexOf(':check', pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent( |
| path.substring(pathOffset, index), |
| ); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals('$arg_serviceName')); |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 6), |
| unittest.equals(':check'), |
| ); |
| pathOffset += 6; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildCheckResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.check( |
| arg_request, |
| arg_serviceName, |
| $fields: arg_$fields, |
| ); |
| checkCheckResponse(response as api.CheckResponse); |
| }); |
| |
| unittest.test('method--report', () async { |
| final mock = HttpServerMock(); |
| final res = api.ServiceControlApi(mock).services; |
| final arg_request = buildReportRequest(); |
| final arg_serviceName = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register( |
| unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ReportRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>, |
| ); |
| checkReportRequest(obj); |
| |
| final path = req.url.path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 12), |
| unittest.equals('v2/services/'), |
| ); |
| pathOffset += 12; |
| index = path.indexOf(':report', pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = core.Uri.decodeQueryComponent( |
| path.substring(pathOffset, index), |
| ); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals('$arg_serviceName')); |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 7), |
| unittest.equals(':report'), |
| ); |
| pathOffset += 7; |
| |
| final query = req.url.query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = {'content-type': 'application/json; charset=utf-8'}; |
| final resp = convert.json.encode(buildReportResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), |
| true, |
| ); |
| final response = await res.report( |
| arg_request, |
| arg_serviceName, |
| $fields: arg_$fields, |
| ); |
| checkReportResponse(response as api.ReportResponse); |
| }); |
| }); |
| } |