Index: generated/googleapis/test/logging/v2_test.dart |
diff --git a/generated/googleapis/test/logging/v2_test.dart b/generated/googleapis/test/logging/v2_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b6f74b75656485164d2ebcb58d23f3bc286009c6 |
--- /dev/null |
+++ b/generated/googleapis/test/logging/v2_test.dart |
@@ -0,0 +1,2264 @@ |
+library googleapis.logging.v2.test; |
+ |
+import "dart:core" as core; |
+import "dart:collection" as collection; |
+import "dart:async" as async; |
+import "dart:convert" as convert; |
+ |
+import 'package:http/http.dart' as http; |
+import 'package:http/testing.dart' as http_testing; |
+import 'package:unittest/unittest.dart' as unittest; |
+ |
+import 'package:googleapis/logging/v2.dart' as api; |
+ |
+class HttpServerMock extends http.BaseClient { |
+ core.Function _callback; |
+ core.bool _expectJson; |
+ |
+ void register(core.Function callback, core.bool expectJson) { |
+ _callback = callback; |
+ _expectJson = expectJson; |
+ } |
+ |
+ async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
+ if (_expectJson) { |
+ return request.finalize() |
+ .transform(convert.UTF8.decoder) |
+ .join('') |
+ .then((core.String jsonString) { |
+ if (jsonString.isEmpty) { |
+ return _callback(request, null); |
+ } else { |
+ return _callback(request, convert.JSON.decode(jsonString)); |
+ } |
+ }); |
+ } else { |
+ var stream = request.finalize(); |
+ if (stream == null) { |
+ return _callback(request, []); |
+ } else { |
+ return stream.toBytes().then((data) { |
+ return _callback(request, data); |
+ }); |
+ } |
+ } |
+ } |
+} |
+ |
+http.StreamedResponse stringResponse( |
+ core.int status, core.Map headers, core.String body) { |
+ var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
+ return new http.StreamedResponse(stream, status, headers: headers); |
+} |
+ |
+core.int buildCounterEmpty = 0; |
+buildEmpty() { |
+ var o = new api.Empty(); |
+ buildCounterEmpty++; |
+ if (buildCounterEmpty < 3) { |
+ } |
+ buildCounterEmpty--; |
+ return o; |
+} |
+ |
+checkEmpty(api.Empty o) { |
+ buildCounterEmpty++; |
+ if (buildCounterEmpty < 3) { |
+ } |
+ buildCounterEmpty--; |
+} |
+ |
+core.int buildCounterHttpRequest = 0; |
+buildHttpRequest() { |
+ var o = new api.HttpRequest(); |
+ buildCounterHttpRequest++; |
+ if (buildCounterHttpRequest < 3) { |
+ o.cacheFillBytes = "foo"; |
+ o.cacheHit = true; |
+ o.cacheLookup = true; |
+ o.cacheValidatedWithOriginServer = true; |
+ o.latency = "foo"; |
+ o.referer = "foo"; |
+ o.remoteIp = "foo"; |
+ o.requestMethod = "foo"; |
+ o.requestSize = "foo"; |
+ o.requestUrl = "foo"; |
+ o.responseSize = "foo"; |
+ o.serverIp = "foo"; |
+ o.status = 42; |
+ o.userAgent = "foo"; |
+ } |
+ buildCounterHttpRequest--; |
+ return o; |
+} |
+ |
+checkHttpRequest(api.HttpRequest o) { |
+ buildCounterHttpRequest++; |
+ if (buildCounterHttpRequest < 3) { |
+ unittest.expect(o.cacheFillBytes, unittest.equals('foo')); |
+ unittest.expect(o.cacheHit, unittest.isTrue); |
+ unittest.expect(o.cacheLookup, unittest.isTrue); |
+ unittest.expect(o.cacheValidatedWithOriginServer, unittest.isTrue); |
+ unittest.expect(o.latency, unittest.equals('foo')); |
+ unittest.expect(o.referer, unittest.equals('foo')); |
+ unittest.expect(o.remoteIp, unittest.equals('foo')); |
+ unittest.expect(o.requestMethod, unittest.equals('foo')); |
+ unittest.expect(o.requestSize, unittest.equals('foo')); |
+ unittest.expect(o.requestUrl, unittest.equals('foo')); |
+ unittest.expect(o.responseSize, unittest.equals('foo')); |
+ unittest.expect(o.serverIp, unittest.equals('foo')); |
+ unittest.expect(o.status, unittest.equals(42)); |
+ unittest.expect(o.userAgent, unittest.equals('foo')); |
+ } |
+ buildCounterHttpRequest--; |
+} |
+ |
+core.int buildCounterLabelDescriptor = 0; |
+buildLabelDescriptor() { |
+ var o = new api.LabelDescriptor(); |
+ buildCounterLabelDescriptor++; |
+ if (buildCounterLabelDescriptor < 3) { |
+ o.description = "foo"; |
+ o.key = "foo"; |
+ o.valueType = "foo"; |
+ } |
+ buildCounterLabelDescriptor--; |
+ return o; |
+} |
+ |
+checkLabelDescriptor(api.LabelDescriptor o) { |
+ buildCounterLabelDescriptor++; |
+ if (buildCounterLabelDescriptor < 3) { |
+ unittest.expect(o.description, unittest.equals('foo')); |
+ unittest.expect(o.key, unittest.equals('foo')); |
+ unittest.expect(o.valueType, unittest.equals('foo')); |
+ } |
+ buildCounterLabelDescriptor--; |
+} |
+ |
+buildUnnamed174() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed174(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')); |
+} |
+ |
+buildUnnamed175() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed175(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.int buildCounterListLogEntriesRequest = 0; |
+buildListLogEntriesRequest() { |
+ var o = new api.ListLogEntriesRequest(); |
+ buildCounterListLogEntriesRequest++; |
+ if (buildCounterListLogEntriesRequest < 3) { |
+ o.filter = "foo"; |
+ o.orderBy = "foo"; |
+ o.pageSize = 42; |
+ o.pageToken = "foo"; |
+ o.projectIds = buildUnnamed174(); |
+ o.resourceNames = buildUnnamed175(); |
+ } |
+ buildCounterListLogEntriesRequest--; |
+ return o; |
+} |
+ |
+checkListLogEntriesRequest(api.ListLogEntriesRequest o) { |
+ buildCounterListLogEntriesRequest++; |
+ if (buildCounterListLogEntriesRequest < 3) { |
+ unittest.expect(o.filter, unittest.equals('foo')); |
+ unittest.expect(o.orderBy, unittest.equals('foo')); |
+ unittest.expect(o.pageSize, unittest.equals(42)); |
+ unittest.expect(o.pageToken, unittest.equals('foo')); |
+ checkUnnamed174(o.projectIds); |
+ checkUnnamed175(o.resourceNames); |
+ } |
+ buildCounterListLogEntriesRequest--; |
+} |
+ |
+buildUnnamed176() { |
+ var o = new core.List<api.LogEntry>(); |
+ o.add(buildLogEntry()); |
+ o.add(buildLogEntry()); |
+ return o; |
+} |
+ |
+checkUnnamed176(core.List<api.LogEntry> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkLogEntry(o[0]); |
+ checkLogEntry(o[1]); |
+} |
+ |
+core.int buildCounterListLogEntriesResponse = 0; |
+buildListLogEntriesResponse() { |
+ var o = new api.ListLogEntriesResponse(); |
+ buildCounterListLogEntriesResponse++; |
+ if (buildCounterListLogEntriesResponse < 3) { |
+ o.entries = buildUnnamed176(); |
+ o.nextPageToken = "foo"; |
+ } |
+ buildCounterListLogEntriesResponse--; |
+ return o; |
+} |
+ |
+checkListLogEntriesResponse(api.ListLogEntriesResponse o) { |
+ buildCounterListLogEntriesResponse++; |
+ if (buildCounterListLogEntriesResponse < 3) { |
+ checkUnnamed176(o.entries); |
+ unittest.expect(o.nextPageToken, unittest.equals('foo')); |
+ } |
+ buildCounterListLogEntriesResponse--; |
+} |
+ |
+buildUnnamed177() { |
+ var o = new core.List<api.LogMetric>(); |
+ o.add(buildLogMetric()); |
+ o.add(buildLogMetric()); |
+ return o; |
+} |
+ |
+checkUnnamed177(core.List<api.LogMetric> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkLogMetric(o[0]); |
+ checkLogMetric(o[1]); |
+} |
+ |
+core.int buildCounterListLogMetricsResponse = 0; |
+buildListLogMetricsResponse() { |
+ var o = new api.ListLogMetricsResponse(); |
+ buildCounterListLogMetricsResponse++; |
+ if (buildCounterListLogMetricsResponse < 3) { |
+ o.metrics = buildUnnamed177(); |
+ o.nextPageToken = "foo"; |
+ } |
+ buildCounterListLogMetricsResponse--; |
+ return o; |
+} |
+ |
+checkListLogMetricsResponse(api.ListLogMetricsResponse o) { |
+ buildCounterListLogMetricsResponse++; |
+ if (buildCounterListLogMetricsResponse < 3) { |
+ checkUnnamed177(o.metrics); |
+ unittest.expect(o.nextPageToken, unittest.equals('foo')); |
+ } |
+ buildCounterListLogMetricsResponse--; |
+} |
+ |
+buildUnnamed178() { |
+ var o = new core.List<api.MonitoredResourceDescriptor>(); |
+ o.add(buildMonitoredResourceDescriptor()); |
+ o.add(buildMonitoredResourceDescriptor()); |
+ return o; |
+} |
+ |
+checkUnnamed178(core.List<api.MonitoredResourceDescriptor> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkMonitoredResourceDescriptor(o[0]); |
+ checkMonitoredResourceDescriptor(o[1]); |
+} |
+ |
+core.int buildCounterListMonitoredResourceDescriptorsResponse = 0; |
+buildListMonitoredResourceDescriptorsResponse() { |
+ var o = new api.ListMonitoredResourceDescriptorsResponse(); |
+ buildCounterListMonitoredResourceDescriptorsResponse++; |
+ if (buildCounterListMonitoredResourceDescriptorsResponse < 3) { |
+ o.nextPageToken = "foo"; |
+ o.resourceDescriptors = buildUnnamed178(); |
+ } |
+ buildCounterListMonitoredResourceDescriptorsResponse--; |
+ return o; |
+} |
+ |
+checkListMonitoredResourceDescriptorsResponse(api.ListMonitoredResourceDescriptorsResponse o) { |
+ buildCounterListMonitoredResourceDescriptorsResponse++; |
+ if (buildCounterListMonitoredResourceDescriptorsResponse < 3) { |
+ unittest.expect(o.nextPageToken, unittest.equals('foo')); |
+ checkUnnamed178(o.resourceDescriptors); |
+ } |
+ buildCounterListMonitoredResourceDescriptorsResponse--; |
+} |
+ |
+buildUnnamed179() { |
+ var o = new core.List<api.LogSink>(); |
+ o.add(buildLogSink()); |
+ o.add(buildLogSink()); |
+ return o; |
+} |
+ |
+checkUnnamed179(core.List<api.LogSink> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkLogSink(o[0]); |
+ checkLogSink(o[1]); |
+} |
+ |
+core.int buildCounterListSinksResponse = 0; |
+buildListSinksResponse() { |
+ var o = new api.ListSinksResponse(); |
+ buildCounterListSinksResponse++; |
+ if (buildCounterListSinksResponse < 3) { |
+ o.nextPageToken = "foo"; |
+ o.sinks = buildUnnamed179(); |
+ } |
+ buildCounterListSinksResponse--; |
+ return o; |
+} |
+ |
+checkListSinksResponse(api.ListSinksResponse o) { |
+ buildCounterListSinksResponse++; |
+ if (buildCounterListSinksResponse < 3) { |
+ unittest.expect(o.nextPageToken, unittest.equals('foo')); |
+ checkUnnamed179(o.sinks); |
+ } |
+ buildCounterListSinksResponse--; |
+} |
+ |
+buildUnnamed180() { |
+ var o = new core.Map<core.String, core.Object>(); |
+ o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ return o; |
+} |
+ |
+checkUnnamed180(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')); |
+} |
+ |
+buildUnnamed181() { |
+ var o = new core.Map<core.String, core.String>(); |
+ o["x"] = "foo"; |
+ o["y"] = "foo"; |
+ return o; |
+} |
+ |
+checkUnnamed181(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')); |
+} |
+ |
+buildUnnamed182() { |
+ var o = new core.Map<core.String, core.Object>(); |
+ o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ return o; |
+} |
+ |
+checkUnnamed182(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 buildCounterLogEntry = 0; |
+buildLogEntry() { |
+ var o = new api.LogEntry(); |
+ buildCounterLogEntry++; |
+ if (buildCounterLogEntry < 3) { |
+ o.httpRequest = buildHttpRequest(); |
+ o.insertId = "foo"; |
+ o.jsonPayload = buildUnnamed180(); |
+ o.labels = buildUnnamed181(); |
+ o.logName = "foo"; |
+ o.operation = buildLogEntryOperation(); |
+ o.protoPayload = buildUnnamed182(); |
+ o.resource = buildMonitoredResource(); |
+ o.severity = "foo"; |
+ o.textPayload = "foo"; |
+ o.timestamp = "foo"; |
+ } |
+ buildCounterLogEntry--; |
+ return o; |
+} |
+ |
+checkLogEntry(api.LogEntry o) { |
+ buildCounterLogEntry++; |
+ if (buildCounterLogEntry < 3) { |
+ checkHttpRequest(o.httpRequest); |
+ unittest.expect(o.insertId, unittest.equals('foo')); |
+ checkUnnamed180(o.jsonPayload); |
+ checkUnnamed181(o.labels); |
+ unittest.expect(o.logName, unittest.equals('foo')); |
+ checkLogEntryOperation(o.operation); |
+ checkUnnamed182(o.protoPayload); |
+ checkMonitoredResource(o.resource); |
+ unittest.expect(o.severity, unittest.equals('foo')); |
+ unittest.expect(o.textPayload, unittest.equals('foo')); |
+ unittest.expect(o.timestamp, unittest.equals('foo')); |
+ } |
+ buildCounterLogEntry--; |
+} |
+ |
+core.int buildCounterLogEntryOperation = 0; |
+buildLogEntryOperation() { |
+ var o = new api.LogEntryOperation(); |
+ buildCounterLogEntryOperation++; |
+ if (buildCounterLogEntryOperation < 3) { |
+ o.first = true; |
+ o.id = "foo"; |
+ o.last = true; |
+ o.producer = "foo"; |
+ } |
+ buildCounterLogEntryOperation--; |
+ return o; |
+} |
+ |
+checkLogEntryOperation(api.LogEntryOperation o) { |
+ buildCounterLogEntryOperation++; |
+ if (buildCounterLogEntryOperation < 3) { |
+ unittest.expect(o.first, unittest.isTrue); |
+ unittest.expect(o.id, unittest.equals('foo')); |
+ unittest.expect(o.last, unittest.isTrue); |
+ unittest.expect(o.producer, unittest.equals('foo')); |
+ } |
+ buildCounterLogEntryOperation--; |
+} |
+ |
+core.int buildCounterLogLine = 0; |
+buildLogLine() { |
+ var o = new api.LogLine(); |
+ buildCounterLogLine++; |
+ if (buildCounterLogLine < 3) { |
+ o.logMessage = "foo"; |
+ o.severity = "foo"; |
+ o.sourceLocation = buildSourceLocation(); |
+ o.time = "foo"; |
+ } |
+ buildCounterLogLine--; |
+ return o; |
+} |
+ |
+checkLogLine(api.LogLine o) { |
+ buildCounterLogLine++; |
+ if (buildCounterLogLine < 3) { |
+ unittest.expect(o.logMessage, unittest.equals('foo')); |
+ unittest.expect(o.severity, unittest.equals('foo')); |
+ checkSourceLocation(o.sourceLocation); |
+ unittest.expect(o.time, unittest.equals('foo')); |
+ } |
+ buildCounterLogLine--; |
+} |
+ |
+core.int buildCounterLogMetric = 0; |
+buildLogMetric() { |
+ var o = new api.LogMetric(); |
+ buildCounterLogMetric++; |
+ if (buildCounterLogMetric < 3) { |
+ o.description = "foo"; |
+ o.filter = "foo"; |
+ o.name = "foo"; |
+ o.version = "foo"; |
+ } |
+ buildCounterLogMetric--; |
+ return o; |
+} |
+ |
+checkLogMetric(api.LogMetric o) { |
+ buildCounterLogMetric++; |
+ if (buildCounterLogMetric < 3) { |
+ unittest.expect(o.description, unittest.equals('foo')); |
+ unittest.expect(o.filter, unittest.equals('foo')); |
+ unittest.expect(o.name, unittest.equals('foo')); |
+ unittest.expect(o.version, unittest.equals('foo')); |
+ } |
+ buildCounterLogMetric--; |
+} |
+ |
+core.int buildCounterLogSink = 0; |
+buildLogSink() { |
+ var o = new api.LogSink(); |
+ buildCounterLogSink++; |
+ if (buildCounterLogSink < 3) { |
+ o.destination = "foo"; |
+ o.endTime = "foo"; |
+ o.filter = "foo"; |
+ o.name = "foo"; |
+ o.outputVersionFormat = "foo"; |
+ o.startTime = "foo"; |
+ o.writerIdentity = "foo"; |
+ } |
+ buildCounterLogSink--; |
+ return o; |
+} |
+ |
+checkLogSink(api.LogSink o) { |
+ buildCounterLogSink++; |
+ if (buildCounterLogSink < 3) { |
+ unittest.expect(o.destination, unittest.equals('foo')); |
+ unittest.expect(o.endTime, unittest.equals('foo')); |
+ unittest.expect(o.filter, unittest.equals('foo')); |
+ unittest.expect(o.name, unittest.equals('foo')); |
+ unittest.expect(o.outputVersionFormat, unittest.equals('foo')); |
+ unittest.expect(o.startTime, unittest.equals('foo')); |
+ unittest.expect(o.writerIdentity, unittest.equals('foo')); |
+ } |
+ buildCounterLogSink--; |
+} |
+ |
+buildUnnamed183() { |
+ var o = new core.Map<core.String, core.String>(); |
+ o["x"] = "foo"; |
+ o["y"] = "foo"; |
+ return o; |
+} |
+ |
+checkUnnamed183(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 buildCounterMonitoredResource = 0; |
+buildMonitoredResource() { |
+ var o = new api.MonitoredResource(); |
+ buildCounterMonitoredResource++; |
+ if (buildCounterMonitoredResource < 3) { |
+ o.labels = buildUnnamed183(); |
+ o.type = "foo"; |
+ } |
+ buildCounterMonitoredResource--; |
+ return o; |
+} |
+ |
+checkMonitoredResource(api.MonitoredResource o) { |
+ buildCounterMonitoredResource++; |
+ if (buildCounterMonitoredResource < 3) { |
+ checkUnnamed183(o.labels); |
+ unittest.expect(o.type, unittest.equals('foo')); |
+ } |
+ buildCounterMonitoredResource--; |
+} |
+ |
+buildUnnamed184() { |
+ var o = new core.List<api.LabelDescriptor>(); |
+ o.add(buildLabelDescriptor()); |
+ o.add(buildLabelDescriptor()); |
+ return o; |
+} |
+ |
+checkUnnamed184(core.List<api.LabelDescriptor> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkLabelDescriptor(o[0]); |
+ checkLabelDescriptor(o[1]); |
+} |
+ |
+core.int buildCounterMonitoredResourceDescriptor = 0; |
+buildMonitoredResourceDescriptor() { |
+ var o = new api.MonitoredResourceDescriptor(); |
+ buildCounterMonitoredResourceDescriptor++; |
+ if (buildCounterMonitoredResourceDescriptor < 3) { |
+ o.description = "foo"; |
+ o.displayName = "foo"; |
+ o.labels = buildUnnamed184(); |
+ o.name = "foo"; |
+ o.type = "foo"; |
+ } |
+ buildCounterMonitoredResourceDescriptor--; |
+ return o; |
+} |
+ |
+checkMonitoredResourceDescriptor(api.MonitoredResourceDescriptor o) { |
+ buildCounterMonitoredResourceDescriptor++; |
+ if (buildCounterMonitoredResourceDescriptor < 3) { |
+ unittest.expect(o.description, unittest.equals('foo')); |
+ unittest.expect(o.displayName, unittest.equals('foo')); |
+ checkUnnamed184(o.labels); |
+ unittest.expect(o.name, unittest.equals('foo')); |
+ unittest.expect(o.type, unittest.equals('foo')); |
+ } |
+ buildCounterMonitoredResourceDescriptor--; |
+} |
+ |
+buildUnnamed185() { |
+ var o = new core.List<api.LogLine>(); |
+ o.add(buildLogLine()); |
+ o.add(buildLogLine()); |
+ return o; |
+} |
+ |
+checkUnnamed185(core.List<api.LogLine> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkLogLine(o[0]); |
+ checkLogLine(o[1]); |
+} |
+ |
+buildUnnamed186() { |
+ var o = new core.List<api.SourceReference>(); |
+ o.add(buildSourceReference()); |
+ o.add(buildSourceReference()); |
+ return o; |
+} |
+ |
+checkUnnamed186(core.List<api.SourceReference> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkSourceReference(o[0]); |
+ checkSourceReference(o[1]); |
+} |
+ |
+core.int buildCounterRequestLog = 0; |
+buildRequestLog() { |
+ var o = new api.RequestLog(); |
+ buildCounterRequestLog++; |
+ if (buildCounterRequestLog < 3) { |
+ o.appEngineRelease = "foo"; |
+ o.appId = "foo"; |
+ o.cost = 42.0; |
+ o.endTime = "foo"; |
+ o.finished = true; |
+ o.first = true; |
+ o.host = "foo"; |
+ o.httpVersion = "foo"; |
+ o.instanceId = "foo"; |
+ o.instanceIndex = 42; |
+ o.ip = "foo"; |
+ o.latency = "foo"; |
+ o.line = buildUnnamed185(); |
+ o.megaCycles = "foo"; |
+ o.method = "foo"; |
+ o.moduleId = "foo"; |
+ o.nickname = "foo"; |
+ o.pendingTime = "foo"; |
+ o.referrer = "foo"; |
+ o.requestId = "foo"; |
+ o.resource = "foo"; |
+ o.responseSize = "foo"; |
+ o.sourceReference = buildUnnamed186(); |
+ o.startTime = "foo"; |
+ o.status = 42; |
+ o.taskName = "foo"; |
+ o.taskQueueName = "foo"; |
+ o.traceId = "foo"; |
+ o.urlMapEntry = "foo"; |
+ o.userAgent = "foo"; |
+ o.versionId = "foo"; |
+ o.wasLoadingRequest = true; |
+ } |
+ buildCounterRequestLog--; |
+ return o; |
+} |
+ |
+checkRequestLog(api.RequestLog o) { |
+ buildCounterRequestLog++; |
+ if (buildCounterRequestLog < 3) { |
+ unittest.expect(o.appEngineRelease, unittest.equals('foo')); |
+ unittest.expect(o.appId, unittest.equals('foo')); |
+ unittest.expect(o.cost, unittest.equals(42.0)); |
+ unittest.expect(o.endTime, unittest.equals('foo')); |
+ unittest.expect(o.finished, unittest.isTrue); |
+ unittest.expect(o.first, unittest.isTrue); |
+ unittest.expect(o.host, unittest.equals('foo')); |
+ unittest.expect(o.httpVersion, unittest.equals('foo')); |
+ unittest.expect(o.instanceId, unittest.equals('foo')); |
+ unittest.expect(o.instanceIndex, unittest.equals(42)); |
+ unittest.expect(o.ip, unittest.equals('foo')); |
+ unittest.expect(o.latency, unittest.equals('foo')); |
+ checkUnnamed185(o.line); |
+ unittest.expect(o.megaCycles, unittest.equals('foo')); |
+ unittest.expect(o.method, unittest.equals('foo')); |
+ unittest.expect(o.moduleId, unittest.equals('foo')); |
+ unittest.expect(o.nickname, unittest.equals('foo')); |
+ unittest.expect(o.pendingTime, unittest.equals('foo')); |
+ unittest.expect(o.referrer, unittest.equals('foo')); |
+ unittest.expect(o.requestId, unittest.equals('foo')); |
+ unittest.expect(o.resource, unittest.equals('foo')); |
+ unittest.expect(o.responseSize, unittest.equals('foo')); |
+ checkUnnamed186(o.sourceReference); |
+ unittest.expect(o.startTime, unittest.equals('foo')); |
+ unittest.expect(o.status, unittest.equals(42)); |
+ unittest.expect(o.taskName, unittest.equals('foo')); |
+ unittest.expect(o.taskQueueName, unittest.equals('foo')); |
+ unittest.expect(o.traceId, unittest.equals('foo')); |
+ unittest.expect(o.urlMapEntry, unittest.equals('foo')); |
+ unittest.expect(o.userAgent, unittest.equals('foo')); |
+ unittest.expect(o.versionId, unittest.equals('foo')); |
+ unittest.expect(o.wasLoadingRequest, unittest.isTrue); |
+ } |
+ buildCounterRequestLog--; |
+} |
+ |
+core.int buildCounterSourceLocation = 0; |
+buildSourceLocation() { |
+ var o = new api.SourceLocation(); |
+ buildCounterSourceLocation++; |
+ if (buildCounterSourceLocation < 3) { |
+ o.file = "foo"; |
+ o.functionName = "foo"; |
+ o.line = "foo"; |
+ } |
+ buildCounterSourceLocation--; |
+ return o; |
+} |
+ |
+checkSourceLocation(api.SourceLocation o) { |
+ buildCounterSourceLocation++; |
+ if (buildCounterSourceLocation < 3) { |
+ unittest.expect(o.file, unittest.equals('foo')); |
+ unittest.expect(o.functionName, unittest.equals('foo')); |
+ unittest.expect(o.line, unittest.equals('foo')); |
+ } |
+ buildCounterSourceLocation--; |
+} |
+ |
+core.int buildCounterSourceReference = 0; |
+buildSourceReference() { |
+ var o = new api.SourceReference(); |
+ buildCounterSourceReference++; |
+ if (buildCounterSourceReference < 3) { |
+ o.repository = "foo"; |
+ o.revisionId = "foo"; |
+ } |
+ buildCounterSourceReference--; |
+ return o; |
+} |
+ |
+checkSourceReference(api.SourceReference o) { |
+ buildCounterSourceReference++; |
+ if (buildCounterSourceReference < 3) { |
+ unittest.expect(o.repository, unittest.equals('foo')); |
+ unittest.expect(o.revisionId, unittest.equals('foo')); |
+ } |
+ buildCounterSourceReference--; |
+} |
+ |
+buildUnnamed187() { |
+ var o = new core.List<api.LogEntry>(); |
+ o.add(buildLogEntry()); |
+ o.add(buildLogEntry()); |
+ return o; |
+} |
+ |
+checkUnnamed187(core.List<api.LogEntry> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkLogEntry(o[0]); |
+ checkLogEntry(o[1]); |
+} |
+ |
+buildUnnamed188() { |
+ var o = new core.Map<core.String, core.String>(); |
+ o["x"] = "foo"; |
+ o["y"] = "foo"; |
+ return o; |
+} |
+ |
+checkUnnamed188(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 buildCounterWriteLogEntriesRequest = 0; |
+buildWriteLogEntriesRequest() { |
+ var o = new api.WriteLogEntriesRequest(); |
+ buildCounterWriteLogEntriesRequest++; |
+ if (buildCounterWriteLogEntriesRequest < 3) { |
+ o.entries = buildUnnamed187(); |
+ o.labels = buildUnnamed188(); |
+ o.logName = "foo"; |
+ o.partialSuccess = true; |
+ o.resource = buildMonitoredResource(); |
+ } |
+ buildCounterWriteLogEntriesRequest--; |
+ return o; |
+} |
+ |
+checkWriteLogEntriesRequest(api.WriteLogEntriesRequest o) { |
+ buildCounterWriteLogEntriesRequest++; |
+ if (buildCounterWriteLogEntriesRequest < 3) { |
+ checkUnnamed187(o.entries); |
+ checkUnnamed188(o.labels); |
+ unittest.expect(o.logName, unittest.equals('foo')); |
+ unittest.expect(o.partialSuccess, unittest.isTrue); |
+ checkMonitoredResource(o.resource); |
+ } |
+ buildCounterWriteLogEntriesRequest--; |
+} |
+ |
+core.int buildCounterWriteLogEntriesResponse = 0; |
+buildWriteLogEntriesResponse() { |
+ var o = new api.WriteLogEntriesResponse(); |
+ buildCounterWriteLogEntriesResponse++; |
+ if (buildCounterWriteLogEntriesResponse < 3) { |
+ } |
+ buildCounterWriteLogEntriesResponse--; |
+ return o; |
+} |
+ |
+checkWriteLogEntriesResponse(api.WriteLogEntriesResponse o) { |
+ buildCounterWriteLogEntriesResponse++; |
+ if (buildCounterWriteLogEntriesResponse < 3) { |
+ } |
+ buildCounterWriteLogEntriesResponse--; |
+} |
+ |
+ |
+main() { |
+ unittest.group("obj-schema-Empty", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildEmpty(); |
+ var od = new api.Empty.fromJson(o.toJson()); |
+ checkEmpty(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-HttpRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildHttpRequest(); |
+ var od = new api.HttpRequest.fromJson(o.toJson()); |
+ checkHttpRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-LabelDescriptor", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildLabelDescriptor(); |
+ var od = new api.LabelDescriptor.fromJson(o.toJson()); |
+ checkLabelDescriptor(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-ListLogEntriesRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildListLogEntriesRequest(); |
+ var od = new api.ListLogEntriesRequest.fromJson(o.toJson()); |
+ checkListLogEntriesRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-ListLogEntriesResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildListLogEntriesResponse(); |
+ var od = new api.ListLogEntriesResponse.fromJson(o.toJson()); |
+ checkListLogEntriesResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-ListLogMetricsResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildListLogMetricsResponse(); |
+ var od = new api.ListLogMetricsResponse.fromJson(o.toJson()); |
+ checkListLogMetricsResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-ListMonitoredResourceDescriptorsResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildListMonitoredResourceDescriptorsResponse(); |
+ var od = new api.ListMonitoredResourceDescriptorsResponse.fromJson(o.toJson()); |
+ checkListMonitoredResourceDescriptorsResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-ListSinksResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildListSinksResponse(); |
+ var od = new api.ListSinksResponse.fromJson(o.toJson()); |
+ checkListSinksResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-LogEntry", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildLogEntry(); |
+ var od = new api.LogEntry.fromJson(o.toJson()); |
+ checkLogEntry(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-LogEntryOperation", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildLogEntryOperation(); |
+ var od = new api.LogEntryOperation.fromJson(o.toJson()); |
+ checkLogEntryOperation(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-LogLine", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildLogLine(); |
+ var od = new api.LogLine.fromJson(o.toJson()); |
+ checkLogLine(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-LogMetric", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildLogMetric(); |
+ var od = new api.LogMetric.fromJson(o.toJson()); |
+ checkLogMetric(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-LogSink", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildLogSink(); |
+ var od = new api.LogSink.fromJson(o.toJson()); |
+ checkLogSink(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-MonitoredResource", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildMonitoredResource(); |
+ var od = new api.MonitoredResource.fromJson(o.toJson()); |
+ checkMonitoredResource(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-MonitoredResourceDescriptor", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildMonitoredResourceDescriptor(); |
+ var od = new api.MonitoredResourceDescriptor.fromJson(o.toJson()); |
+ checkMonitoredResourceDescriptor(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-RequestLog", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildRequestLog(); |
+ var od = new api.RequestLog.fromJson(o.toJson()); |
+ checkRequestLog(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-SourceLocation", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildSourceLocation(); |
+ var od = new api.SourceLocation.fromJson(o.toJson()); |
+ checkSourceLocation(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-SourceReference", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildSourceReference(); |
+ var od = new api.SourceReference.fromJson(o.toJson()); |
+ checkSourceReference(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-WriteLogEntriesRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildWriteLogEntriesRequest(); |
+ var od = new api.WriteLogEntriesRequest.fromJson(o.toJson()); |
+ checkWriteLogEntriesRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-WriteLogEntriesResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildWriteLogEntriesResponse(); |
+ var od = new api.WriteLogEntriesResponse.fromJson(o.toJson()); |
+ checkWriteLogEntriesResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("resource-BillingAccountsLogsResourceApi", () { |
+ unittest.test("method--delete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.BillingAccountsLogsResourceApi res = new api.LoggingApi(mock).billingAccounts.logs; |
+ var arg_logName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildEmpty()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.delete(arg_logName).then(unittest.expectAsync(((api.Empty response) { |
+ checkEmpty(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+ unittest.group("resource-BillingAccountsSinksResourceApi", () { |
+ unittest.test("method--create", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.BillingAccountsSinksResourceApi res = new api.LoggingApi(mock).billingAccounts.sinks; |
+ var arg_request = buildLogSink(); |
+ var arg_parent = "foo"; |
+ var arg_uniqueWriterIdentity = true; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.LogSink.fromJson(json); |
+ checkLogSink(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(queryMap["uniqueWriterIdentity"].first, unittest.equals("$arg_uniqueWriterIdentity")); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogSink()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.create(arg_request, arg_parent, uniqueWriterIdentity: arg_uniqueWriterIdentity).then(unittest.expectAsync(((api.LogSink response) { |
+ checkLogSink(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--delete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.BillingAccountsSinksResourceApi res = new api.LoggingApi(mock).billingAccounts.sinks; |
+ var arg_sinkName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildEmpty()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.delete(arg_sinkName).then(unittest.expectAsync(((api.Empty response) { |
+ checkEmpty(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--get", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.BillingAccountsSinksResourceApi res = new api.LoggingApi(mock).billingAccounts.sinks; |
+ var arg_sinkName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogSink()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.get(arg_sinkName).then(unittest.expectAsync(((api.LogSink response) { |
+ checkLogSink(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--list", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.BillingAccountsSinksResourceApi res = new api.LoggingApi(mock).billingAccounts.sinks; |
+ var arg_parent = "foo"; |
+ var arg_pageSize = 42; |
+ var arg_pageToken = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize)); |
+ unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildListSinksResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.list(arg_parent, pageSize: arg_pageSize, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ListSinksResponse response) { |
+ checkListSinksResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--update", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.BillingAccountsSinksResourceApi res = new api.LoggingApi(mock).billingAccounts.sinks; |
+ var arg_request = buildLogSink(); |
+ var arg_sinkName = "foo"; |
+ var arg_uniqueWriterIdentity = true; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.LogSink.fromJson(json); |
+ checkLogSink(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(queryMap["uniqueWriterIdentity"].first, unittest.equals("$arg_uniqueWriterIdentity")); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogSink()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.update(arg_request, arg_sinkName, uniqueWriterIdentity: arg_uniqueWriterIdentity).then(unittest.expectAsync(((api.LogSink response) { |
+ checkLogSink(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+ unittest.group("resource-EntriesResourceApi", () { |
+ unittest.test("method--list", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.EntriesResourceApi res = new api.LoggingApi(mock).entries; |
+ var arg_request = buildListLogEntriesRequest(); |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.ListLogEntriesRequest.fromJson(json); |
+ checkListLogEntriesRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.equals("v2/entries:list")); |
+ pathOffset += 15; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildListLogEntriesResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.list(arg_request).then(unittest.expectAsync(((api.ListLogEntriesResponse response) { |
+ checkListLogEntriesResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--write", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.EntriesResourceApi res = new api.LoggingApi(mock).entries; |
+ var arg_request = buildWriteLogEntriesRequest(); |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.WriteLogEntriesRequest.fromJson(json); |
+ checkWriteLogEntriesRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.equals("v2/entries:write")); |
+ pathOffset += 16; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildWriteLogEntriesResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.write(arg_request).then(unittest.expectAsync(((api.WriteLogEntriesResponse response) { |
+ checkWriteLogEntriesResponse(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+ unittest.group("resource-MonitoredResourceDescriptorsResourceApi", () { |
+ unittest.test("method--list", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.MonitoredResourceDescriptorsResourceApi res = new api.LoggingApi(mock).monitoredResourceDescriptors; |
+ var arg_pageSize = 42; |
+ var arg_pageToken = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 31), unittest.equals("v2/monitoredResourceDescriptors")); |
+ pathOffset += 31; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize)); |
+ unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildListMonitoredResourceDescriptorsResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.list(pageSize: arg_pageSize, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ListMonitoredResourceDescriptorsResponse response) { |
+ checkListMonitoredResourceDescriptorsResponse(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+ unittest.group("resource-OrganizationsLogsResourceApi", () { |
+ unittest.test("method--delete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.OrganizationsLogsResourceApi res = new api.LoggingApi(mock).organizations.logs; |
+ var arg_logName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildEmpty()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.delete(arg_logName).then(unittest.expectAsync(((api.Empty response) { |
+ checkEmpty(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+ unittest.group("resource-OrganizationsSinksResourceApi", () { |
+ unittest.test("method--create", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.OrganizationsSinksResourceApi res = new api.LoggingApi(mock).organizations.sinks; |
+ var arg_request = buildLogSink(); |
+ var arg_parent = "foo"; |
+ var arg_uniqueWriterIdentity = true; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.LogSink.fromJson(json); |
+ checkLogSink(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(queryMap["uniqueWriterIdentity"].first, unittest.equals("$arg_uniqueWriterIdentity")); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogSink()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.create(arg_request, arg_parent, uniqueWriterIdentity: arg_uniqueWriterIdentity).then(unittest.expectAsync(((api.LogSink response) { |
+ checkLogSink(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--delete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.OrganizationsSinksResourceApi res = new api.LoggingApi(mock).organizations.sinks; |
+ var arg_sinkName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildEmpty()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.delete(arg_sinkName).then(unittest.expectAsync(((api.Empty response) { |
+ checkEmpty(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--get", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.OrganizationsSinksResourceApi res = new api.LoggingApi(mock).organizations.sinks; |
+ var arg_sinkName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogSink()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.get(arg_sinkName).then(unittest.expectAsync(((api.LogSink response) { |
+ checkLogSink(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--list", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.OrganizationsSinksResourceApi res = new api.LoggingApi(mock).organizations.sinks; |
+ var arg_parent = "foo"; |
+ var arg_pageSize = 42; |
+ var arg_pageToken = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize)); |
+ unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildListSinksResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.list(arg_parent, pageSize: arg_pageSize, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ListSinksResponse response) { |
+ checkListSinksResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--update", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.OrganizationsSinksResourceApi res = new api.LoggingApi(mock).organizations.sinks; |
+ var arg_request = buildLogSink(); |
+ var arg_sinkName = "foo"; |
+ var arg_uniqueWriterIdentity = true; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.LogSink.fromJson(json); |
+ checkLogSink(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(queryMap["uniqueWriterIdentity"].first, unittest.equals("$arg_uniqueWriterIdentity")); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogSink()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.update(arg_request, arg_sinkName, uniqueWriterIdentity: arg_uniqueWriterIdentity).then(unittest.expectAsync(((api.LogSink response) { |
+ checkLogSink(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+ unittest.group("resource-ProjectsLogsResourceApi", () { |
+ unittest.test("method--delete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsLogsResourceApi res = new api.LoggingApi(mock).projects.logs; |
+ var arg_logName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildEmpty()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.delete(arg_logName).then(unittest.expectAsync(((api.Empty response) { |
+ checkEmpty(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+ unittest.group("resource-ProjectsMetricsResourceApi", () { |
+ unittest.test("method--create", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsMetricsResourceApi res = new api.LoggingApi(mock).projects.metrics; |
+ var arg_request = buildLogMetric(); |
+ var arg_parent = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.LogMetric.fromJson(json); |
+ checkLogMetric(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogMetric()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.create(arg_request, arg_parent).then(unittest.expectAsync(((api.LogMetric response) { |
+ checkLogMetric(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--delete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsMetricsResourceApi res = new api.LoggingApi(mock).projects.metrics; |
+ var arg_metricName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildEmpty()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.delete(arg_metricName).then(unittest.expectAsync(((api.Empty response) { |
+ checkEmpty(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--get", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsMetricsResourceApi res = new api.LoggingApi(mock).projects.metrics; |
+ var arg_metricName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogMetric()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.get(arg_metricName).then(unittest.expectAsync(((api.LogMetric response) { |
+ checkLogMetric(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--list", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsMetricsResourceApi res = new api.LoggingApi(mock).projects.metrics; |
+ var arg_parent = "foo"; |
+ var arg_pageSize = 42; |
+ var arg_pageToken = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize)); |
+ unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildListLogMetricsResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.list(arg_parent, pageSize: arg_pageSize, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ListLogMetricsResponse response) { |
+ checkListLogMetricsResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--update", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsMetricsResourceApi res = new api.LoggingApi(mock).projects.metrics; |
+ var arg_request = buildLogMetric(); |
+ var arg_metricName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.LogMetric.fromJson(json); |
+ checkLogMetric(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogMetric()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.update(arg_request, arg_metricName).then(unittest.expectAsync(((api.LogMetric response) { |
+ checkLogMetric(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+ unittest.group("resource-ProjectsSinksResourceApi", () { |
+ unittest.test("method--create", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsSinksResourceApi res = new api.LoggingApi(mock).projects.sinks; |
+ var arg_request = buildLogSink(); |
+ var arg_parent = "foo"; |
+ var arg_uniqueWriterIdentity = true; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.LogSink.fromJson(json); |
+ checkLogSink(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(queryMap["uniqueWriterIdentity"].first, unittest.equals("$arg_uniqueWriterIdentity")); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogSink()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.create(arg_request, arg_parent, uniqueWriterIdentity: arg_uniqueWriterIdentity).then(unittest.expectAsync(((api.LogSink response) { |
+ checkLogSink(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--delete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsSinksResourceApi res = new api.LoggingApi(mock).projects.sinks; |
+ var arg_sinkName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildEmpty()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.delete(arg_sinkName).then(unittest.expectAsync(((api.Empty response) { |
+ checkEmpty(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--get", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsSinksResourceApi res = new api.LoggingApi(mock).projects.sinks; |
+ var arg_sinkName = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogSink()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.get(arg_sinkName).then(unittest.expectAsync(((api.LogSink response) { |
+ checkLogSink(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--list", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsSinksResourceApi res = new api.LoggingApi(mock).projects.sinks; |
+ var arg_parent = "foo"; |
+ var arg_pageSize = 42; |
+ var arg_pageToken = "foo"; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize)); |
+ unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildListSinksResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.list(arg_parent, pageSize: arg_pageSize, pageToken: arg_pageToken).then(unittest.expectAsync(((api.ListSinksResponse response) { |
+ checkListSinksResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--update", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.ProjectsSinksResourceApi res = new api.LoggingApi(mock).projects.sinks; |
+ var arg_request = buildLogSink(); |
+ var arg_sinkName = "foo"; |
+ var arg_uniqueWriterIdentity = true; |
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
+ var obj = new api.LogSink.fromJson(json); |
+ checkLogSink(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equals("v2/")); |
+ pathOffset += 3; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(queryMap["uniqueWriterIdentity"].first, unittest.equals("$arg_uniqueWriterIdentity")); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildLogSink()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.update(arg_request, arg_sinkName, uniqueWriterIdentity: arg_uniqueWriterIdentity).then(unittest.expectAsync(((api.LogSink response) { |
+ checkLogSink(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+} |
+ |