blob: afa46e84b29278bc577deed35ea0b3c5852bce02 [file] [log] [blame]
library googleapis_beta.logging.v2beta1.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:test/test.dart' as unittest;
import 'package:googleapis_beta/logging/v2beta1.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<core.String, core.String> 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--;
}
buildUnnamed3450() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed3450(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'));
}
buildUnnamed3451() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed3451(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 = buildUnnamed3450();
o.resourceNames = buildUnnamed3451();
}
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'));
checkUnnamed3450(o.projectIds);
checkUnnamed3451(o.resourceNames);
}
buildCounterListLogEntriesRequest--;
}
buildUnnamed3452() {
var o = new core.List<api.LogEntry>();
o.add(buildLogEntry());
o.add(buildLogEntry());
return o;
}
checkUnnamed3452(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 = buildUnnamed3452();
o.nextPageToken = "foo";
}
buildCounterListLogEntriesResponse--;
return o;
}
checkListLogEntriesResponse(api.ListLogEntriesResponse o) {
buildCounterListLogEntriesResponse++;
if (buildCounterListLogEntriesResponse < 3) {
checkUnnamed3452(o.entries);
unittest.expect(o.nextPageToken, unittest.equals('foo'));
}
buildCounterListLogEntriesResponse--;
}
buildUnnamed3453() {
var o = new core.List<api.LogMetric>();
o.add(buildLogMetric());
o.add(buildLogMetric());
return o;
}
checkUnnamed3453(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 = buildUnnamed3453();
o.nextPageToken = "foo";
}
buildCounterListLogMetricsResponse--;
return o;
}
checkListLogMetricsResponse(api.ListLogMetricsResponse o) {
buildCounterListLogMetricsResponse++;
if (buildCounterListLogMetricsResponse < 3) {
checkUnnamed3453(o.metrics);
unittest.expect(o.nextPageToken, unittest.equals('foo'));
}
buildCounterListLogMetricsResponse--;
}
buildUnnamed3454() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed3454(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 buildCounterListLogsResponse = 0;
buildListLogsResponse() {
var o = new api.ListLogsResponse();
buildCounterListLogsResponse++;
if (buildCounterListLogsResponse < 3) {
o.logNames = buildUnnamed3454();
o.nextPageToken = "foo";
}
buildCounterListLogsResponse--;
return o;
}
checkListLogsResponse(api.ListLogsResponse o) {
buildCounterListLogsResponse++;
if (buildCounterListLogsResponse < 3) {
checkUnnamed3454(o.logNames);
unittest.expect(o.nextPageToken, unittest.equals('foo'));
}
buildCounterListLogsResponse--;
}
buildUnnamed3455() {
var o = new core.List<api.MonitoredResourceDescriptor>();
o.add(buildMonitoredResourceDescriptor());
o.add(buildMonitoredResourceDescriptor());
return o;
}
checkUnnamed3455(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 = buildUnnamed3455();
}
buildCounterListMonitoredResourceDescriptorsResponse--;
return o;
}
checkListMonitoredResourceDescriptorsResponse(api.ListMonitoredResourceDescriptorsResponse o) {
buildCounterListMonitoredResourceDescriptorsResponse++;
if (buildCounterListMonitoredResourceDescriptorsResponse < 3) {
unittest.expect(o.nextPageToken, unittest.equals('foo'));
checkUnnamed3455(o.resourceDescriptors);
}
buildCounterListMonitoredResourceDescriptorsResponse--;
}
buildUnnamed3456() {
var o = new core.List<api.LogSink>();
o.add(buildLogSink());
o.add(buildLogSink());
return o;
}
checkUnnamed3456(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 = buildUnnamed3456();
}
buildCounterListSinksResponse--;
return o;
}
checkListSinksResponse(api.ListSinksResponse o) {
buildCounterListSinksResponse++;
if (buildCounterListSinksResponse < 3) {
unittest.expect(o.nextPageToken, unittest.equals('foo'));
checkUnnamed3456(o.sinks);
}
buildCounterListSinksResponse--;
}
buildUnnamed3457() {
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;
}
checkUnnamed3457(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'));
}
buildUnnamed3458() {
var o = new core.Map<core.String, core.String>();
o["x"] = "foo";
o["y"] = "foo";
return o;
}
checkUnnamed3458(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'));
}
buildUnnamed3459() {
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;
}
checkUnnamed3459(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 = buildUnnamed3457();
o.labels = buildUnnamed3458();
o.logName = "foo";
o.operation = buildLogEntryOperation();
o.protoPayload = buildUnnamed3459();
o.receiveTimestamp = "foo";
o.resource = buildMonitoredResource();
o.severity = "foo";
o.sourceLocation = buildLogEntrySourceLocation();
o.textPayload = "foo";
o.timestamp = "foo";
o.trace = "foo";
}
buildCounterLogEntry--;
return o;
}
checkLogEntry(api.LogEntry o) {
buildCounterLogEntry++;
if (buildCounterLogEntry < 3) {
checkHttpRequest(o.httpRequest);
unittest.expect(o.insertId, unittest.equals('foo'));
checkUnnamed3457(o.jsonPayload);
checkUnnamed3458(o.labels);
unittest.expect(o.logName, unittest.equals('foo'));
checkLogEntryOperation(o.operation);
checkUnnamed3459(o.protoPayload);
unittest.expect(o.receiveTimestamp, unittest.equals('foo'));
checkMonitoredResource(o.resource);
unittest.expect(o.severity, unittest.equals('foo'));
checkLogEntrySourceLocation(o.sourceLocation);
unittest.expect(o.textPayload, unittest.equals('foo'));
unittest.expect(o.timestamp, unittest.equals('foo'));
unittest.expect(o.trace, 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 buildCounterLogEntrySourceLocation = 0;
buildLogEntrySourceLocation() {
var o = new api.LogEntrySourceLocation();
buildCounterLogEntrySourceLocation++;
if (buildCounterLogEntrySourceLocation < 3) {
o.file = "foo";
o.function = "foo";
o.line = "foo";
}
buildCounterLogEntrySourceLocation--;
return o;
}
checkLogEntrySourceLocation(api.LogEntrySourceLocation o) {
buildCounterLogEntrySourceLocation++;
if (buildCounterLogEntrySourceLocation < 3) {
unittest.expect(o.file, unittest.equals('foo'));
unittest.expect(o.function, unittest.equals('foo'));
unittest.expect(o.line, unittest.equals('foo'));
}
buildCounterLogEntrySourceLocation--;
}
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.includeChildren = true;
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.includeChildren, unittest.isTrue);
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--;
}
buildUnnamed3460() {
var o = new core.Map<core.String, core.String>();
o["x"] = "foo";
o["y"] = "foo";
return o;
}
checkUnnamed3460(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 = buildUnnamed3460();
o.type = "foo";
}
buildCounterMonitoredResource--;
return o;
}
checkMonitoredResource(api.MonitoredResource o) {
buildCounterMonitoredResource++;
if (buildCounterMonitoredResource < 3) {
checkUnnamed3460(o.labels);
unittest.expect(o.type, unittest.equals('foo'));
}
buildCounterMonitoredResource--;
}
buildUnnamed3461() {
var o = new core.List<api.LabelDescriptor>();
o.add(buildLabelDescriptor());
o.add(buildLabelDescriptor());
return o;
}
checkUnnamed3461(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 = buildUnnamed3461();
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'));
checkUnnamed3461(o.labels);
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.type, unittest.equals('foo'));
}
buildCounterMonitoredResourceDescriptor--;
}
buildUnnamed3462() {
var o = new core.List<api.LogLine>();
o.add(buildLogLine());
o.add(buildLogLine());
return o;
}
checkUnnamed3462(core.List<api.LogLine> o) {
unittest.expect(o, unittest.hasLength(2));
checkLogLine(o[0]);
checkLogLine(o[1]);
}
buildUnnamed3463() {
var o = new core.List<api.SourceReference>();
o.add(buildSourceReference());
o.add(buildSourceReference());
return o;
}
checkUnnamed3463(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 = buildUnnamed3462();
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 = buildUnnamed3463();
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'));
checkUnnamed3462(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'));
checkUnnamed3463(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--;
}
buildUnnamed3464() {
var o = new core.List<api.LogEntry>();
o.add(buildLogEntry());
o.add(buildLogEntry());
return o;
}
checkUnnamed3464(core.List<api.LogEntry> o) {
unittest.expect(o, unittest.hasLength(2));
checkLogEntry(o[0]);
checkLogEntry(o[1]);
}
buildUnnamed3465() {
var o = new core.Map<core.String, core.String>();
o["x"] = "foo";
o["y"] = "foo";
return o;
}
checkUnnamed3465(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 = buildUnnamed3464();
o.labels = buildUnnamed3465();
o.logName = "foo";
o.partialSuccess = true;
o.resource = buildMonitoredResource();
}
buildCounterWriteLogEntriesRequest--;
return o;
}
checkWriteLogEntriesRequest(api.WriteLogEntriesRequest o) {
buildCounterWriteLogEntriesRequest++;
if (buildCounterWriteLogEntriesRequest < 3) {
checkUnnamed3464(o.entries);
checkUnnamed3465(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-ListLogsResponse", () {
unittest.test("to-json--from-json", () {
var o = buildListLogsResponse();
var od = new api.ListLogsResponse.fromJson(o.toJson());
checkListLogsResponse(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-LogEntrySourceLocation", () {
unittest.test("to-json--from-json", () {
var o = buildLogEntrySourceLocation();
var od = new api.LogEntrySourceLocation.fromJson(o.toJson());
checkLogEntrySourceLocation(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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((api.Empty response) {
checkEmpty(response);
})));
});
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.BillingAccountsLogsResourceApi res = new api.LoggingApi(mock).billingAccounts.logs;
var arg_parent = "foo";
var arg_pageToken = "foo";
var arg_pageSize = 42;
mock.register(unittest.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize));
var h = {
"content-type" : "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildListLogsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).then(unittest.expectAsync1(((api.ListLogsResponse response) {
checkListLogsResponse(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.expectAsync2((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 + 20), unittest.equals("v2beta1/entries:list"));
pathOffset += 20;
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.expectAsync1(((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.expectAsync2((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 + 21), unittest.equals("v2beta1/entries:write"));
pathOffset += 21;
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.expectAsync1(((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_pageToken = "foo";
var arg_pageSize = 42;
mock.register(unittest.expectAsync2((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 + 36), unittest.equals("v2beta1/monitoredResourceDescriptors"));
pathOffset += 36;
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["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize));
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(pageToken: arg_pageToken, pageSize: arg_pageSize).then(unittest.expectAsync1(((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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((api.Empty response) {
checkEmpty(response);
})));
});
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.OrganizationsLogsResourceApi res = new api.LoggingApi(mock).organizations.logs;
var arg_parent = "foo";
var arg_pageToken = "foo";
var arg_pageSize = 42;
mock.register(unittest.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize));
var h = {
"content-type" : "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildListLogsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).then(unittest.expectAsync1(((api.ListLogsResponse response) {
checkListLogsResponse(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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((api.Empty response) {
checkEmpty(response);
})));
});
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.ProjectsLogsResourceApi res = new api.LoggingApi(mock).projects.logs;
var arg_parent = "foo";
var arg_pageToken = "foo";
var arg_pageSize = 42;
mock.register(unittest.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize));
var h = {
"content-type" : "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildListLogsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).then(unittest.expectAsync1(((api.ListLogsResponse response) {
checkListLogsResponse(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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((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_pageToken = "foo";
var arg_pageSize = 42;
mock.register(unittest.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize));
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, pageToken: arg_pageToken, pageSize: arg_pageSize).then(unittest.expectAsync1(((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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((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_pageToken = "foo";
var arg_pageSize = 42;
mock.register(unittest.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize));
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, pageToken: arg_pageToken, pageSize: arg_pageSize).then(unittest.expectAsync1(((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.expectAsync2((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 + 8), unittest.equals("v2beta1/"));
pathOffset += 8;
// 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.expectAsync1(((api.LogSink response) {
checkLogSink(response);
})));
});
});
}