| library googleapis.dataproc.v1.test; |
| |
| import "dart:core" as core; |
| import "dart:async" as async; |
| import "dart:convert" as convert; |
| |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import 'package:googleapis/dataproc/v1.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 buildCounterAcceleratorConfig = 0; |
| buildAcceleratorConfig() { |
| var o = new api.AcceleratorConfig(); |
| buildCounterAcceleratorConfig++; |
| if (buildCounterAcceleratorConfig < 3) { |
| o.acceleratorCount = 42; |
| o.acceleratorTypeUri = "foo"; |
| } |
| buildCounterAcceleratorConfig--; |
| return o; |
| } |
| |
| checkAcceleratorConfig(api.AcceleratorConfig o) { |
| buildCounterAcceleratorConfig++; |
| if (buildCounterAcceleratorConfig < 3) { |
| unittest.expect(o.acceleratorCount, unittest.equals(42)); |
| unittest.expect(o.acceleratorTypeUri, unittest.equals('foo')); |
| } |
| buildCounterAcceleratorConfig--; |
| } |
| |
| core.int buildCounterCancelJobRequest = 0; |
| buildCancelJobRequest() { |
| var o = new api.CancelJobRequest(); |
| buildCounterCancelJobRequest++; |
| if (buildCounterCancelJobRequest < 3) {} |
| buildCounterCancelJobRequest--; |
| return o; |
| } |
| |
| checkCancelJobRequest(api.CancelJobRequest o) { |
| buildCounterCancelJobRequest++; |
| if (buildCounterCancelJobRequest < 3) {} |
| buildCounterCancelJobRequest--; |
| } |
| |
| buildUnnamed540() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed540(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')); |
| } |
| |
| buildUnnamed541() { |
| var o = new core.List<api.ClusterStatus>(); |
| o.add(buildClusterStatus()); |
| o.add(buildClusterStatus()); |
| return o; |
| } |
| |
| checkUnnamed541(core.List<api.ClusterStatus> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkClusterStatus(o[0]); |
| checkClusterStatus(o[1]); |
| } |
| |
| core.int buildCounterCluster = 0; |
| buildCluster() { |
| var o = new api.Cluster(); |
| buildCounterCluster++; |
| if (buildCounterCluster < 3) { |
| o.clusterName = "foo"; |
| o.clusterUuid = "foo"; |
| o.config = buildClusterConfig(); |
| o.labels = buildUnnamed540(); |
| o.metrics = buildClusterMetrics(); |
| o.projectId = "foo"; |
| o.status = buildClusterStatus(); |
| o.statusHistory = buildUnnamed541(); |
| } |
| buildCounterCluster--; |
| return o; |
| } |
| |
| checkCluster(api.Cluster o) { |
| buildCounterCluster++; |
| if (buildCounterCluster < 3) { |
| unittest.expect(o.clusterName, unittest.equals('foo')); |
| unittest.expect(o.clusterUuid, unittest.equals('foo')); |
| checkClusterConfig(o.config); |
| checkUnnamed540(o.labels); |
| checkClusterMetrics(o.metrics); |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| checkClusterStatus(o.status); |
| checkUnnamed541(o.statusHistory); |
| } |
| buildCounterCluster--; |
| } |
| |
| buildUnnamed542() { |
| var o = new core.List<api.NodeInitializationAction>(); |
| o.add(buildNodeInitializationAction()); |
| o.add(buildNodeInitializationAction()); |
| return o; |
| } |
| |
| checkUnnamed542(core.List<api.NodeInitializationAction> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkNodeInitializationAction(o[0]); |
| checkNodeInitializationAction(o[1]); |
| } |
| |
| core.int buildCounterClusterConfig = 0; |
| buildClusterConfig() { |
| var o = new api.ClusterConfig(); |
| buildCounterClusterConfig++; |
| if (buildCounterClusterConfig < 3) { |
| o.configBucket = "foo"; |
| o.gceClusterConfig = buildGceClusterConfig(); |
| o.initializationActions = buildUnnamed542(); |
| o.masterConfig = buildInstanceGroupConfig(); |
| o.secondaryWorkerConfig = buildInstanceGroupConfig(); |
| o.softwareConfig = buildSoftwareConfig(); |
| o.workerConfig = buildInstanceGroupConfig(); |
| } |
| buildCounterClusterConfig--; |
| return o; |
| } |
| |
| checkClusterConfig(api.ClusterConfig o) { |
| buildCounterClusterConfig++; |
| if (buildCounterClusterConfig < 3) { |
| unittest.expect(o.configBucket, unittest.equals('foo')); |
| checkGceClusterConfig(o.gceClusterConfig); |
| checkUnnamed542(o.initializationActions); |
| checkInstanceGroupConfig(o.masterConfig); |
| checkInstanceGroupConfig(o.secondaryWorkerConfig); |
| checkSoftwareConfig(o.softwareConfig); |
| checkInstanceGroupConfig(o.workerConfig); |
| } |
| buildCounterClusterConfig--; |
| } |
| |
| buildUnnamed543() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed543(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')); |
| } |
| |
| buildUnnamed544() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed544(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 buildCounterClusterMetrics = 0; |
| buildClusterMetrics() { |
| var o = new api.ClusterMetrics(); |
| buildCounterClusterMetrics++; |
| if (buildCounterClusterMetrics < 3) { |
| o.hdfsMetrics = buildUnnamed543(); |
| o.yarnMetrics = buildUnnamed544(); |
| } |
| buildCounterClusterMetrics--; |
| return o; |
| } |
| |
| checkClusterMetrics(api.ClusterMetrics o) { |
| buildCounterClusterMetrics++; |
| if (buildCounterClusterMetrics < 3) { |
| checkUnnamed543(o.hdfsMetrics); |
| checkUnnamed544(o.yarnMetrics); |
| } |
| buildCounterClusterMetrics--; |
| } |
| |
| buildUnnamed545() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed545(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')); |
| } |
| |
| buildUnnamed546() { |
| var o = new core.List<api.ClusterOperationStatus>(); |
| o.add(buildClusterOperationStatus()); |
| o.add(buildClusterOperationStatus()); |
| return o; |
| } |
| |
| checkUnnamed546(core.List<api.ClusterOperationStatus> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkClusterOperationStatus(o[0]); |
| checkClusterOperationStatus(o[1]); |
| } |
| |
| buildUnnamed547() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed547(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 buildCounterClusterOperationMetadata = 0; |
| buildClusterOperationMetadata() { |
| var o = new api.ClusterOperationMetadata(); |
| buildCounterClusterOperationMetadata++; |
| if (buildCounterClusterOperationMetadata < 3) { |
| o.clusterName = "foo"; |
| o.clusterUuid = "foo"; |
| o.description = "foo"; |
| o.labels = buildUnnamed545(); |
| o.operationType = "foo"; |
| o.status = buildClusterOperationStatus(); |
| o.statusHistory = buildUnnamed546(); |
| o.warnings = buildUnnamed547(); |
| } |
| buildCounterClusterOperationMetadata--; |
| return o; |
| } |
| |
| checkClusterOperationMetadata(api.ClusterOperationMetadata o) { |
| buildCounterClusterOperationMetadata++; |
| if (buildCounterClusterOperationMetadata < 3) { |
| unittest.expect(o.clusterName, unittest.equals('foo')); |
| unittest.expect(o.clusterUuid, unittest.equals('foo')); |
| unittest.expect(o.description, unittest.equals('foo')); |
| checkUnnamed545(o.labels); |
| unittest.expect(o.operationType, unittest.equals('foo')); |
| checkClusterOperationStatus(o.status); |
| checkUnnamed546(o.statusHistory); |
| checkUnnamed547(o.warnings); |
| } |
| buildCounterClusterOperationMetadata--; |
| } |
| |
| core.int buildCounterClusterOperationStatus = 0; |
| buildClusterOperationStatus() { |
| var o = new api.ClusterOperationStatus(); |
| buildCounterClusterOperationStatus++; |
| if (buildCounterClusterOperationStatus < 3) { |
| o.details = "foo"; |
| o.innerState = "foo"; |
| o.state = "foo"; |
| o.stateStartTime = "foo"; |
| } |
| buildCounterClusterOperationStatus--; |
| return o; |
| } |
| |
| checkClusterOperationStatus(api.ClusterOperationStatus o) { |
| buildCounterClusterOperationStatus++; |
| if (buildCounterClusterOperationStatus < 3) { |
| unittest.expect(o.details, unittest.equals('foo')); |
| unittest.expect(o.innerState, unittest.equals('foo')); |
| unittest.expect(o.state, unittest.equals('foo')); |
| unittest.expect(o.stateStartTime, unittest.equals('foo')); |
| } |
| buildCounterClusterOperationStatus--; |
| } |
| |
| core.int buildCounterClusterStatus = 0; |
| buildClusterStatus() { |
| var o = new api.ClusterStatus(); |
| buildCounterClusterStatus++; |
| if (buildCounterClusterStatus < 3) { |
| o.detail = "foo"; |
| o.state = "foo"; |
| o.stateStartTime = "foo"; |
| o.substate = "foo"; |
| } |
| buildCounterClusterStatus--; |
| return o; |
| } |
| |
| checkClusterStatus(api.ClusterStatus o) { |
| buildCounterClusterStatus++; |
| if (buildCounterClusterStatus < 3) { |
| unittest.expect(o.detail, unittest.equals('foo')); |
| unittest.expect(o.state, unittest.equals('foo')); |
| unittest.expect(o.stateStartTime, unittest.equals('foo')); |
| unittest.expect(o.substate, unittest.equals('foo')); |
| } |
| buildCounterClusterStatus--; |
| } |
| |
| core.int buildCounterDiagnoseClusterRequest = 0; |
| buildDiagnoseClusterRequest() { |
| var o = new api.DiagnoseClusterRequest(); |
| buildCounterDiagnoseClusterRequest++; |
| if (buildCounterDiagnoseClusterRequest < 3) {} |
| buildCounterDiagnoseClusterRequest--; |
| return o; |
| } |
| |
| checkDiagnoseClusterRequest(api.DiagnoseClusterRequest o) { |
| buildCounterDiagnoseClusterRequest++; |
| if (buildCounterDiagnoseClusterRequest < 3) {} |
| buildCounterDiagnoseClusterRequest--; |
| } |
| |
| core.int buildCounterDiagnoseClusterResults = 0; |
| buildDiagnoseClusterResults() { |
| var o = new api.DiagnoseClusterResults(); |
| buildCounterDiagnoseClusterResults++; |
| if (buildCounterDiagnoseClusterResults < 3) { |
| o.outputUri = "foo"; |
| } |
| buildCounterDiagnoseClusterResults--; |
| return o; |
| } |
| |
| checkDiagnoseClusterResults(api.DiagnoseClusterResults o) { |
| buildCounterDiagnoseClusterResults++; |
| if (buildCounterDiagnoseClusterResults < 3) { |
| unittest.expect(o.outputUri, unittest.equals('foo')); |
| } |
| buildCounterDiagnoseClusterResults--; |
| } |
| |
| core.int buildCounterDiskConfig = 0; |
| buildDiskConfig() { |
| var o = new api.DiskConfig(); |
| buildCounterDiskConfig++; |
| if (buildCounterDiskConfig < 3) { |
| o.bootDiskSizeGb = 42; |
| o.numLocalSsds = 42; |
| } |
| buildCounterDiskConfig--; |
| return o; |
| } |
| |
| checkDiskConfig(api.DiskConfig o) { |
| buildCounterDiskConfig++; |
| if (buildCounterDiskConfig < 3) { |
| unittest.expect(o.bootDiskSizeGb, unittest.equals(42)); |
| unittest.expect(o.numLocalSsds, unittest.equals(42)); |
| } |
| buildCounterDiskConfig--; |
| } |
| |
| 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--; |
| } |
| |
| buildUnnamed548() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed548(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')); |
| } |
| |
| buildUnnamed549() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed549(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')); |
| } |
| |
| buildUnnamed550() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed550(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 buildCounterGceClusterConfig = 0; |
| buildGceClusterConfig() { |
| var o = new api.GceClusterConfig(); |
| buildCounterGceClusterConfig++; |
| if (buildCounterGceClusterConfig < 3) { |
| o.internalIpOnly = true; |
| o.metadata = buildUnnamed548(); |
| o.networkUri = "foo"; |
| o.serviceAccount = "foo"; |
| o.serviceAccountScopes = buildUnnamed549(); |
| o.subnetworkUri = "foo"; |
| o.tags = buildUnnamed550(); |
| o.zoneUri = "foo"; |
| } |
| buildCounterGceClusterConfig--; |
| return o; |
| } |
| |
| checkGceClusterConfig(api.GceClusterConfig o) { |
| buildCounterGceClusterConfig++; |
| if (buildCounterGceClusterConfig < 3) { |
| unittest.expect(o.internalIpOnly, unittest.isTrue); |
| checkUnnamed548(o.metadata); |
| unittest.expect(o.networkUri, unittest.equals('foo')); |
| unittest.expect(o.serviceAccount, unittest.equals('foo')); |
| checkUnnamed549(o.serviceAccountScopes); |
| unittest.expect(o.subnetworkUri, unittest.equals('foo')); |
| checkUnnamed550(o.tags); |
| unittest.expect(o.zoneUri, unittest.equals('foo')); |
| } |
| buildCounterGceClusterConfig--; |
| } |
| |
| buildUnnamed551() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed551(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')); |
| } |
| |
| buildUnnamed552() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed552(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')); |
| } |
| |
| buildUnnamed553() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed553(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')); |
| } |
| |
| buildUnnamed554() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed554(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')); |
| } |
| |
| buildUnnamed555() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed555(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 buildCounterHadoopJob = 0; |
| buildHadoopJob() { |
| var o = new api.HadoopJob(); |
| buildCounterHadoopJob++; |
| if (buildCounterHadoopJob < 3) { |
| o.archiveUris = buildUnnamed551(); |
| o.args = buildUnnamed552(); |
| o.fileUris = buildUnnamed553(); |
| o.jarFileUris = buildUnnamed554(); |
| o.loggingConfig = buildLoggingConfig(); |
| o.mainClass = "foo"; |
| o.mainJarFileUri = "foo"; |
| o.properties = buildUnnamed555(); |
| } |
| buildCounterHadoopJob--; |
| return o; |
| } |
| |
| checkHadoopJob(api.HadoopJob o) { |
| buildCounterHadoopJob++; |
| if (buildCounterHadoopJob < 3) { |
| checkUnnamed551(o.archiveUris); |
| checkUnnamed552(o.args); |
| checkUnnamed553(o.fileUris); |
| checkUnnamed554(o.jarFileUris); |
| checkLoggingConfig(o.loggingConfig); |
| unittest.expect(o.mainClass, unittest.equals('foo')); |
| unittest.expect(o.mainJarFileUri, unittest.equals('foo')); |
| checkUnnamed555(o.properties); |
| } |
| buildCounterHadoopJob--; |
| } |
| |
| buildUnnamed556() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed556(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')); |
| } |
| |
| buildUnnamed557() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed557(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')); |
| } |
| |
| buildUnnamed558() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed558(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 buildCounterHiveJob = 0; |
| buildHiveJob() { |
| var o = new api.HiveJob(); |
| buildCounterHiveJob++; |
| if (buildCounterHiveJob < 3) { |
| o.continueOnFailure = true; |
| o.jarFileUris = buildUnnamed556(); |
| o.properties = buildUnnamed557(); |
| o.queryFileUri = "foo"; |
| o.queryList = buildQueryList(); |
| o.scriptVariables = buildUnnamed558(); |
| } |
| buildCounterHiveJob--; |
| return o; |
| } |
| |
| checkHiveJob(api.HiveJob o) { |
| buildCounterHiveJob++; |
| if (buildCounterHiveJob < 3) { |
| unittest.expect(o.continueOnFailure, unittest.isTrue); |
| checkUnnamed556(o.jarFileUris); |
| checkUnnamed557(o.properties); |
| unittest.expect(o.queryFileUri, unittest.equals('foo')); |
| checkQueryList(o.queryList); |
| checkUnnamed558(o.scriptVariables); |
| } |
| buildCounterHiveJob--; |
| } |
| |
| buildUnnamed559() { |
| var o = new core.List<api.AcceleratorConfig>(); |
| o.add(buildAcceleratorConfig()); |
| o.add(buildAcceleratorConfig()); |
| return o; |
| } |
| |
| checkUnnamed559(core.List<api.AcceleratorConfig> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkAcceleratorConfig(o[0]); |
| checkAcceleratorConfig(o[1]); |
| } |
| |
| buildUnnamed560() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed560(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 buildCounterInstanceGroupConfig = 0; |
| buildInstanceGroupConfig() { |
| var o = new api.InstanceGroupConfig(); |
| buildCounterInstanceGroupConfig++; |
| if (buildCounterInstanceGroupConfig < 3) { |
| o.accelerators = buildUnnamed559(); |
| o.diskConfig = buildDiskConfig(); |
| o.imageUri = "foo"; |
| o.instanceNames = buildUnnamed560(); |
| o.isPreemptible = true; |
| o.machineTypeUri = "foo"; |
| o.managedGroupConfig = buildManagedGroupConfig(); |
| o.numInstances = 42; |
| } |
| buildCounterInstanceGroupConfig--; |
| return o; |
| } |
| |
| checkInstanceGroupConfig(api.InstanceGroupConfig o) { |
| buildCounterInstanceGroupConfig++; |
| if (buildCounterInstanceGroupConfig < 3) { |
| checkUnnamed559(o.accelerators); |
| checkDiskConfig(o.diskConfig); |
| unittest.expect(o.imageUri, unittest.equals('foo')); |
| checkUnnamed560(o.instanceNames); |
| unittest.expect(o.isPreemptible, unittest.isTrue); |
| unittest.expect(o.machineTypeUri, unittest.equals('foo')); |
| checkManagedGroupConfig(o.managedGroupConfig); |
| unittest.expect(o.numInstances, unittest.equals(42)); |
| } |
| buildCounterInstanceGroupConfig--; |
| } |
| |
| buildUnnamed561() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed561(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')); |
| } |
| |
| buildUnnamed562() { |
| var o = new core.List<api.JobStatus>(); |
| o.add(buildJobStatus()); |
| o.add(buildJobStatus()); |
| return o; |
| } |
| |
| checkUnnamed562(core.List<api.JobStatus> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkJobStatus(o[0]); |
| checkJobStatus(o[1]); |
| } |
| |
| buildUnnamed563() { |
| var o = new core.List<api.YarnApplication>(); |
| o.add(buildYarnApplication()); |
| o.add(buildYarnApplication()); |
| return o; |
| } |
| |
| checkUnnamed563(core.List<api.YarnApplication> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkYarnApplication(o[0]); |
| checkYarnApplication(o[1]); |
| } |
| |
| core.int buildCounterJob = 0; |
| buildJob() { |
| var o = new api.Job(); |
| buildCounterJob++; |
| if (buildCounterJob < 3) { |
| o.driverControlFilesUri = "foo"; |
| o.driverOutputResourceUri = "foo"; |
| o.hadoopJob = buildHadoopJob(); |
| o.hiveJob = buildHiveJob(); |
| o.labels = buildUnnamed561(); |
| o.pigJob = buildPigJob(); |
| o.placement = buildJobPlacement(); |
| o.pysparkJob = buildPySparkJob(); |
| o.reference = buildJobReference(); |
| o.scheduling = buildJobScheduling(); |
| o.sparkJob = buildSparkJob(); |
| o.sparkSqlJob = buildSparkSqlJob(); |
| o.status = buildJobStatus(); |
| o.statusHistory = buildUnnamed562(); |
| o.yarnApplications = buildUnnamed563(); |
| } |
| buildCounterJob--; |
| return o; |
| } |
| |
| checkJob(api.Job o) { |
| buildCounterJob++; |
| if (buildCounterJob < 3) { |
| unittest.expect(o.driverControlFilesUri, unittest.equals('foo')); |
| unittest.expect(o.driverOutputResourceUri, unittest.equals('foo')); |
| checkHadoopJob(o.hadoopJob); |
| checkHiveJob(o.hiveJob); |
| checkUnnamed561(o.labels); |
| checkPigJob(o.pigJob); |
| checkJobPlacement(o.placement); |
| checkPySparkJob(o.pysparkJob); |
| checkJobReference(o.reference); |
| checkJobScheduling(o.scheduling); |
| checkSparkJob(o.sparkJob); |
| checkSparkSqlJob(o.sparkSqlJob); |
| checkJobStatus(o.status); |
| checkUnnamed562(o.statusHistory); |
| checkUnnamed563(o.yarnApplications); |
| } |
| buildCounterJob--; |
| } |
| |
| core.int buildCounterJobPlacement = 0; |
| buildJobPlacement() { |
| var o = new api.JobPlacement(); |
| buildCounterJobPlacement++; |
| if (buildCounterJobPlacement < 3) { |
| o.clusterName = "foo"; |
| o.clusterUuid = "foo"; |
| } |
| buildCounterJobPlacement--; |
| return o; |
| } |
| |
| checkJobPlacement(api.JobPlacement o) { |
| buildCounterJobPlacement++; |
| if (buildCounterJobPlacement < 3) { |
| unittest.expect(o.clusterName, unittest.equals('foo')); |
| unittest.expect(o.clusterUuid, unittest.equals('foo')); |
| } |
| buildCounterJobPlacement--; |
| } |
| |
| core.int buildCounterJobReference = 0; |
| buildJobReference() { |
| var o = new api.JobReference(); |
| buildCounterJobReference++; |
| if (buildCounterJobReference < 3) { |
| o.jobId = "foo"; |
| o.projectId = "foo"; |
| } |
| buildCounterJobReference--; |
| return o; |
| } |
| |
| checkJobReference(api.JobReference o) { |
| buildCounterJobReference++; |
| if (buildCounterJobReference < 3) { |
| unittest.expect(o.jobId, unittest.equals('foo')); |
| unittest.expect(o.projectId, unittest.equals('foo')); |
| } |
| buildCounterJobReference--; |
| } |
| |
| core.int buildCounterJobScheduling = 0; |
| buildJobScheduling() { |
| var o = new api.JobScheduling(); |
| buildCounterJobScheduling++; |
| if (buildCounterJobScheduling < 3) { |
| o.maxFailuresPerHour = 42; |
| } |
| buildCounterJobScheduling--; |
| return o; |
| } |
| |
| checkJobScheduling(api.JobScheduling o) { |
| buildCounterJobScheduling++; |
| if (buildCounterJobScheduling < 3) { |
| unittest.expect(o.maxFailuresPerHour, unittest.equals(42)); |
| } |
| buildCounterJobScheduling--; |
| } |
| |
| core.int buildCounterJobStatus = 0; |
| buildJobStatus() { |
| var o = new api.JobStatus(); |
| buildCounterJobStatus++; |
| if (buildCounterJobStatus < 3) { |
| o.details = "foo"; |
| o.state = "foo"; |
| o.stateStartTime = "foo"; |
| o.substate = "foo"; |
| } |
| buildCounterJobStatus--; |
| return o; |
| } |
| |
| checkJobStatus(api.JobStatus o) { |
| buildCounterJobStatus++; |
| if (buildCounterJobStatus < 3) { |
| unittest.expect(o.details, unittest.equals('foo')); |
| unittest.expect(o.state, unittest.equals('foo')); |
| unittest.expect(o.stateStartTime, unittest.equals('foo')); |
| unittest.expect(o.substate, unittest.equals('foo')); |
| } |
| buildCounterJobStatus--; |
| } |
| |
| buildUnnamed564() { |
| var o = new core.List<api.Cluster>(); |
| o.add(buildCluster()); |
| o.add(buildCluster()); |
| return o; |
| } |
| |
| checkUnnamed564(core.List<api.Cluster> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkCluster(o[0]); |
| checkCluster(o[1]); |
| } |
| |
| core.int buildCounterListClustersResponse = 0; |
| buildListClustersResponse() { |
| var o = new api.ListClustersResponse(); |
| buildCounterListClustersResponse++; |
| if (buildCounterListClustersResponse < 3) { |
| o.clusters = buildUnnamed564(); |
| o.nextPageToken = "foo"; |
| } |
| buildCounterListClustersResponse--; |
| return o; |
| } |
| |
| checkListClustersResponse(api.ListClustersResponse o) { |
| buildCounterListClustersResponse++; |
| if (buildCounterListClustersResponse < 3) { |
| checkUnnamed564(o.clusters); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| } |
| buildCounterListClustersResponse--; |
| } |
| |
| buildUnnamed565() { |
| var o = new core.List<api.Job>(); |
| o.add(buildJob()); |
| o.add(buildJob()); |
| return o; |
| } |
| |
| checkUnnamed565(core.List<api.Job> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkJob(o[0]); |
| checkJob(o[1]); |
| } |
| |
| core.int buildCounterListJobsResponse = 0; |
| buildListJobsResponse() { |
| var o = new api.ListJobsResponse(); |
| buildCounterListJobsResponse++; |
| if (buildCounterListJobsResponse < 3) { |
| o.jobs = buildUnnamed565(); |
| o.nextPageToken = "foo"; |
| } |
| buildCounterListJobsResponse--; |
| return o; |
| } |
| |
| checkListJobsResponse(api.ListJobsResponse o) { |
| buildCounterListJobsResponse++; |
| if (buildCounterListJobsResponse < 3) { |
| checkUnnamed565(o.jobs); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| } |
| buildCounterListJobsResponse--; |
| } |
| |
| buildUnnamed566() { |
| var o = new core.List<api.Operation>(); |
| o.add(buildOperation()); |
| o.add(buildOperation()); |
| return o; |
| } |
| |
| checkUnnamed566(core.List<api.Operation> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOperation(o[0]); |
| checkOperation(o[1]); |
| } |
| |
| core.int buildCounterListOperationsResponse = 0; |
| buildListOperationsResponse() { |
| var o = new api.ListOperationsResponse(); |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| o.nextPageToken = "foo"; |
| o.operations = buildUnnamed566(); |
| } |
| buildCounterListOperationsResponse--; |
| return o; |
| } |
| |
| checkListOperationsResponse(api.ListOperationsResponse o) { |
| buildCounterListOperationsResponse++; |
| if (buildCounterListOperationsResponse < 3) { |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| checkUnnamed566(o.operations); |
| } |
| buildCounterListOperationsResponse--; |
| } |
| |
| buildUnnamed567() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed567(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 buildCounterLoggingConfig = 0; |
| buildLoggingConfig() { |
| var o = new api.LoggingConfig(); |
| buildCounterLoggingConfig++; |
| if (buildCounterLoggingConfig < 3) { |
| o.driverLogLevels = buildUnnamed567(); |
| } |
| buildCounterLoggingConfig--; |
| return o; |
| } |
| |
| checkLoggingConfig(api.LoggingConfig o) { |
| buildCounterLoggingConfig++; |
| if (buildCounterLoggingConfig < 3) { |
| checkUnnamed567(o.driverLogLevels); |
| } |
| buildCounterLoggingConfig--; |
| } |
| |
| core.int buildCounterManagedGroupConfig = 0; |
| buildManagedGroupConfig() { |
| var o = new api.ManagedGroupConfig(); |
| buildCounterManagedGroupConfig++; |
| if (buildCounterManagedGroupConfig < 3) { |
| o.instanceGroupManagerName = "foo"; |
| o.instanceTemplateName = "foo"; |
| } |
| buildCounterManagedGroupConfig--; |
| return o; |
| } |
| |
| checkManagedGroupConfig(api.ManagedGroupConfig o) { |
| buildCounterManagedGroupConfig++; |
| if (buildCounterManagedGroupConfig < 3) { |
| unittest.expect(o.instanceGroupManagerName, unittest.equals('foo')); |
| unittest.expect(o.instanceTemplateName, unittest.equals('foo')); |
| } |
| buildCounterManagedGroupConfig--; |
| } |
| |
| core.int buildCounterNodeInitializationAction = 0; |
| buildNodeInitializationAction() { |
| var o = new api.NodeInitializationAction(); |
| buildCounterNodeInitializationAction++; |
| if (buildCounterNodeInitializationAction < 3) { |
| o.executableFile = "foo"; |
| o.executionTimeout = "foo"; |
| } |
| buildCounterNodeInitializationAction--; |
| return o; |
| } |
| |
| checkNodeInitializationAction(api.NodeInitializationAction o) { |
| buildCounterNodeInitializationAction++; |
| if (buildCounterNodeInitializationAction < 3) { |
| unittest.expect(o.executableFile, unittest.equals('foo')); |
| unittest.expect(o.executionTimeout, unittest.equals('foo')); |
| } |
| buildCounterNodeInitializationAction--; |
| } |
| |
| buildUnnamed568() { |
| 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; |
| } |
| |
| checkUnnamed568(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')); |
| } |
| |
| buildUnnamed569() { |
| 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; |
| } |
| |
| checkUnnamed569(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 buildCounterOperation = 0; |
| buildOperation() { |
| var o = new api.Operation(); |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| o.done = true; |
| o.error = buildStatus(); |
| o.metadata = buildUnnamed568(); |
| o.name = "foo"; |
| o.response = buildUnnamed569(); |
| } |
| buildCounterOperation--; |
| return o; |
| } |
| |
| checkOperation(api.Operation o) { |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| unittest.expect(o.done, unittest.isTrue); |
| checkStatus(o.error); |
| checkUnnamed568(o.metadata); |
| unittest.expect(o.name, unittest.equals('foo')); |
| checkUnnamed569(o.response); |
| } |
| buildCounterOperation--; |
| } |
| |
| buildUnnamed570() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed570(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')); |
| } |
| |
| buildUnnamed571() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed571(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')); |
| } |
| |
| buildUnnamed572() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed572(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 buildCounterPigJob = 0; |
| buildPigJob() { |
| var o = new api.PigJob(); |
| buildCounterPigJob++; |
| if (buildCounterPigJob < 3) { |
| o.continueOnFailure = true; |
| o.jarFileUris = buildUnnamed570(); |
| o.loggingConfig = buildLoggingConfig(); |
| o.properties = buildUnnamed571(); |
| o.queryFileUri = "foo"; |
| o.queryList = buildQueryList(); |
| o.scriptVariables = buildUnnamed572(); |
| } |
| buildCounterPigJob--; |
| return o; |
| } |
| |
| checkPigJob(api.PigJob o) { |
| buildCounterPigJob++; |
| if (buildCounterPigJob < 3) { |
| unittest.expect(o.continueOnFailure, unittest.isTrue); |
| checkUnnamed570(o.jarFileUris); |
| checkLoggingConfig(o.loggingConfig); |
| checkUnnamed571(o.properties); |
| unittest.expect(o.queryFileUri, unittest.equals('foo')); |
| checkQueryList(o.queryList); |
| checkUnnamed572(o.scriptVariables); |
| } |
| buildCounterPigJob--; |
| } |
| |
| buildUnnamed573() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed573(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')); |
| } |
| |
| buildUnnamed574() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed574(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')); |
| } |
| |
| buildUnnamed575() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed575(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')); |
| } |
| |
| buildUnnamed576() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed576(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')); |
| } |
| |
| buildUnnamed577() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed577(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')); |
| } |
| |
| buildUnnamed578() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed578(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 buildCounterPySparkJob = 0; |
| buildPySparkJob() { |
| var o = new api.PySparkJob(); |
| buildCounterPySparkJob++; |
| if (buildCounterPySparkJob < 3) { |
| o.archiveUris = buildUnnamed573(); |
| o.args = buildUnnamed574(); |
| o.fileUris = buildUnnamed575(); |
| o.jarFileUris = buildUnnamed576(); |
| o.loggingConfig = buildLoggingConfig(); |
| o.mainPythonFileUri = "foo"; |
| o.properties = buildUnnamed577(); |
| o.pythonFileUris = buildUnnamed578(); |
| } |
| buildCounterPySparkJob--; |
| return o; |
| } |
| |
| checkPySparkJob(api.PySparkJob o) { |
| buildCounterPySparkJob++; |
| if (buildCounterPySparkJob < 3) { |
| checkUnnamed573(o.archiveUris); |
| checkUnnamed574(o.args); |
| checkUnnamed575(o.fileUris); |
| checkUnnamed576(o.jarFileUris); |
| checkLoggingConfig(o.loggingConfig); |
| unittest.expect(o.mainPythonFileUri, unittest.equals('foo')); |
| checkUnnamed577(o.properties); |
| checkUnnamed578(o.pythonFileUris); |
| } |
| buildCounterPySparkJob--; |
| } |
| |
| buildUnnamed579() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed579(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 buildCounterQueryList = 0; |
| buildQueryList() { |
| var o = new api.QueryList(); |
| buildCounterQueryList++; |
| if (buildCounterQueryList < 3) { |
| o.queries = buildUnnamed579(); |
| } |
| buildCounterQueryList--; |
| return o; |
| } |
| |
| checkQueryList(api.QueryList o) { |
| buildCounterQueryList++; |
| if (buildCounterQueryList < 3) { |
| checkUnnamed579(o.queries); |
| } |
| buildCounterQueryList--; |
| } |
| |
| buildUnnamed580() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed580(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 buildCounterSoftwareConfig = 0; |
| buildSoftwareConfig() { |
| var o = new api.SoftwareConfig(); |
| buildCounterSoftwareConfig++; |
| if (buildCounterSoftwareConfig < 3) { |
| o.imageVersion = "foo"; |
| o.properties = buildUnnamed580(); |
| } |
| buildCounterSoftwareConfig--; |
| return o; |
| } |
| |
| checkSoftwareConfig(api.SoftwareConfig o) { |
| buildCounterSoftwareConfig++; |
| if (buildCounterSoftwareConfig < 3) { |
| unittest.expect(o.imageVersion, unittest.equals('foo')); |
| checkUnnamed580(o.properties); |
| } |
| buildCounterSoftwareConfig--; |
| } |
| |
| buildUnnamed581() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed581(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')); |
| } |
| |
| buildUnnamed582() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed582(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')); |
| } |
| |
| buildUnnamed583() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed583(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')); |
| } |
| |
| buildUnnamed584() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed584(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')); |
| } |
| |
| buildUnnamed585() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed585(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 buildCounterSparkJob = 0; |
| buildSparkJob() { |
| var o = new api.SparkJob(); |
| buildCounterSparkJob++; |
| if (buildCounterSparkJob < 3) { |
| o.archiveUris = buildUnnamed581(); |
| o.args = buildUnnamed582(); |
| o.fileUris = buildUnnamed583(); |
| o.jarFileUris = buildUnnamed584(); |
| o.loggingConfig = buildLoggingConfig(); |
| o.mainClass = "foo"; |
| o.mainJarFileUri = "foo"; |
| o.properties = buildUnnamed585(); |
| } |
| buildCounterSparkJob--; |
| return o; |
| } |
| |
| checkSparkJob(api.SparkJob o) { |
| buildCounterSparkJob++; |
| if (buildCounterSparkJob < 3) { |
| checkUnnamed581(o.archiveUris); |
| checkUnnamed582(o.args); |
| checkUnnamed583(o.fileUris); |
| checkUnnamed584(o.jarFileUris); |
| checkLoggingConfig(o.loggingConfig); |
| unittest.expect(o.mainClass, unittest.equals('foo')); |
| unittest.expect(o.mainJarFileUri, unittest.equals('foo')); |
| checkUnnamed585(o.properties); |
| } |
| buildCounterSparkJob--; |
| } |
| |
| buildUnnamed586() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed586(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')); |
| } |
| |
| buildUnnamed587() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed587(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')); |
| } |
| |
| buildUnnamed588() { |
| var o = new core.Map<core.String, core.String>(); |
| o["x"] = "foo"; |
| o["y"] = "foo"; |
| return o; |
| } |
| |
| checkUnnamed588(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 buildCounterSparkSqlJob = 0; |
| buildSparkSqlJob() { |
| var o = new api.SparkSqlJob(); |
| buildCounterSparkSqlJob++; |
| if (buildCounterSparkSqlJob < 3) { |
| o.jarFileUris = buildUnnamed586(); |
| o.loggingConfig = buildLoggingConfig(); |
| o.properties = buildUnnamed587(); |
| o.queryFileUri = "foo"; |
| o.queryList = buildQueryList(); |
| o.scriptVariables = buildUnnamed588(); |
| } |
| buildCounterSparkSqlJob--; |
| return o; |
| } |
| |
| checkSparkSqlJob(api.SparkSqlJob o) { |
| buildCounterSparkSqlJob++; |
| if (buildCounterSparkSqlJob < 3) { |
| checkUnnamed586(o.jarFileUris); |
| checkLoggingConfig(o.loggingConfig); |
| checkUnnamed587(o.properties); |
| unittest.expect(o.queryFileUri, unittest.equals('foo')); |
| checkQueryList(o.queryList); |
| checkUnnamed588(o.scriptVariables); |
| } |
| buildCounterSparkSqlJob--; |
| } |
| |
| buildUnnamed589() { |
| 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; |
| } |
| |
| checkUnnamed589(core.Map<core.String, core.Object> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| var casted5 = (o["x"]) as core.Map; |
| unittest.expect(casted5, unittest.hasLength(3)); |
| unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); |
| unittest.expect(casted5["bool"], unittest.equals(true)); |
| unittest.expect(casted5["string"], unittest.equals('foo')); |
| var casted6 = (o["y"]) as core.Map; |
| unittest.expect(casted6, unittest.hasLength(3)); |
| unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); |
| unittest.expect(casted6["bool"], unittest.equals(true)); |
| unittest.expect(casted6["string"], unittest.equals('foo')); |
| } |
| |
| buildUnnamed590() { |
| var o = new core.List<core.Map<core.String, core.Object>>(); |
| o.add(buildUnnamed589()); |
| o.add(buildUnnamed589()); |
| return o; |
| } |
| |
| checkUnnamed590(core.List<core.Map<core.String, core.Object>> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUnnamed589(o[0]); |
| checkUnnamed589(o[1]); |
| } |
| |
| core.int buildCounterStatus = 0; |
| buildStatus() { |
| var o = new api.Status(); |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| o.code = 42; |
| o.details = buildUnnamed590(); |
| o.message = "foo"; |
| } |
| buildCounterStatus--; |
| return o; |
| } |
| |
| checkStatus(api.Status o) { |
| buildCounterStatus++; |
| if (buildCounterStatus < 3) { |
| unittest.expect(o.code, unittest.equals(42)); |
| checkUnnamed590(o.details); |
| unittest.expect(o.message, unittest.equals('foo')); |
| } |
| buildCounterStatus--; |
| } |
| |
| core.int buildCounterSubmitJobRequest = 0; |
| buildSubmitJobRequest() { |
| var o = new api.SubmitJobRequest(); |
| buildCounterSubmitJobRequest++; |
| if (buildCounterSubmitJobRequest < 3) { |
| o.job = buildJob(); |
| } |
| buildCounterSubmitJobRequest--; |
| return o; |
| } |
| |
| checkSubmitJobRequest(api.SubmitJobRequest o) { |
| buildCounterSubmitJobRequest++; |
| if (buildCounterSubmitJobRequest < 3) { |
| checkJob(o.job); |
| } |
| buildCounterSubmitJobRequest--; |
| } |
| |
| core.int buildCounterYarnApplication = 0; |
| buildYarnApplication() { |
| var o = new api.YarnApplication(); |
| buildCounterYarnApplication++; |
| if (buildCounterYarnApplication < 3) { |
| o.name = "foo"; |
| o.progress = 42.0; |
| o.state = "foo"; |
| o.trackingUrl = "foo"; |
| } |
| buildCounterYarnApplication--; |
| return o; |
| } |
| |
| checkYarnApplication(api.YarnApplication o) { |
| buildCounterYarnApplication++; |
| if (buildCounterYarnApplication < 3) { |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.progress, unittest.equals(42.0)); |
| unittest.expect(o.state, unittest.equals('foo')); |
| unittest.expect(o.trackingUrl, unittest.equals('foo')); |
| } |
| buildCounterYarnApplication--; |
| } |
| |
| main() { |
| unittest.group("obj-schema-AcceleratorConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAcceleratorConfig(); |
| var od = new api.AcceleratorConfig.fromJson(o.toJson()); |
| checkAcceleratorConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-CancelJobRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCancelJobRequest(); |
| var od = new api.CancelJobRequest.fromJson(o.toJson()); |
| checkCancelJobRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Cluster", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildCluster(); |
| var od = new api.Cluster.fromJson(o.toJson()); |
| checkCluster(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ClusterConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildClusterConfig(); |
| var od = new api.ClusterConfig.fromJson(o.toJson()); |
| checkClusterConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ClusterMetrics", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildClusterMetrics(); |
| var od = new api.ClusterMetrics.fromJson(o.toJson()); |
| checkClusterMetrics(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ClusterOperationMetadata", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildClusterOperationMetadata(); |
| var od = new api.ClusterOperationMetadata.fromJson(o.toJson()); |
| checkClusterOperationMetadata(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ClusterOperationStatus", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildClusterOperationStatus(); |
| var od = new api.ClusterOperationStatus.fromJson(o.toJson()); |
| checkClusterOperationStatus(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ClusterStatus", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildClusterStatus(); |
| var od = new api.ClusterStatus.fromJson(o.toJson()); |
| checkClusterStatus(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-DiagnoseClusterRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildDiagnoseClusterRequest(); |
| var od = new api.DiagnoseClusterRequest.fromJson(o.toJson()); |
| checkDiagnoseClusterRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-DiagnoseClusterResults", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildDiagnoseClusterResults(); |
| var od = new api.DiagnoseClusterResults.fromJson(o.toJson()); |
| checkDiagnoseClusterResults(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-DiskConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildDiskConfig(); |
| var od = new api.DiskConfig.fromJson(o.toJson()); |
| checkDiskConfig(od); |
| }); |
| }); |
| |
| 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-GceClusterConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildGceClusterConfig(); |
| var od = new api.GceClusterConfig.fromJson(o.toJson()); |
| checkGceClusterConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-HadoopJob", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildHadoopJob(); |
| var od = new api.HadoopJob.fromJson(o.toJson()); |
| checkHadoopJob(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-HiveJob", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildHiveJob(); |
| var od = new api.HiveJob.fromJson(o.toJson()); |
| checkHiveJob(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-InstanceGroupConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildInstanceGroupConfig(); |
| var od = new api.InstanceGroupConfig.fromJson(o.toJson()); |
| checkInstanceGroupConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Job", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJob(); |
| var od = new api.Job.fromJson(o.toJson()); |
| checkJob(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-JobPlacement", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobPlacement(); |
| var od = new api.JobPlacement.fromJson(o.toJson()); |
| checkJobPlacement(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-JobReference", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobReference(); |
| var od = new api.JobReference.fromJson(o.toJson()); |
| checkJobReference(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-JobScheduling", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobScheduling(); |
| var od = new api.JobScheduling.fromJson(o.toJson()); |
| checkJobScheduling(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-JobStatus", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildJobStatus(); |
| var od = new api.JobStatus.fromJson(o.toJson()); |
| checkJobStatus(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ListClustersResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildListClustersResponse(); |
| var od = new api.ListClustersResponse.fromJson(o.toJson()); |
| checkListClustersResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ListJobsResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildListJobsResponse(); |
| var od = new api.ListJobsResponse.fromJson(o.toJson()); |
| checkListJobsResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ListOperationsResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildListOperationsResponse(); |
| var od = new api.ListOperationsResponse.fromJson(o.toJson()); |
| checkListOperationsResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-LoggingConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildLoggingConfig(); |
| var od = new api.LoggingConfig.fromJson(o.toJson()); |
| checkLoggingConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-ManagedGroupConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildManagedGroupConfig(); |
| var od = new api.ManagedGroupConfig.fromJson(o.toJson()); |
| checkManagedGroupConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-NodeInitializationAction", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildNodeInitializationAction(); |
| var od = new api.NodeInitializationAction.fromJson(o.toJson()); |
| checkNodeInitializationAction(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Operation", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildOperation(); |
| var od = new api.Operation.fromJson(o.toJson()); |
| checkOperation(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PigJob", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPigJob(); |
| var od = new api.PigJob.fromJson(o.toJson()); |
| checkPigJob(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PySparkJob", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPySparkJob(); |
| var od = new api.PySparkJob.fromJson(o.toJson()); |
| checkPySparkJob(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-QueryList", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildQueryList(); |
| var od = new api.QueryList.fromJson(o.toJson()); |
| checkQueryList(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SoftwareConfig", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSoftwareConfig(); |
| var od = new api.SoftwareConfig.fromJson(o.toJson()); |
| checkSoftwareConfig(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SparkJob", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSparkJob(); |
| var od = new api.SparkJob.fromJson(o.toJson()); |
| checkSparkJob(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SparkSqlJob", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSparkSqlJob(); |
| var od = new api.SparkSqlJob.fromJson(o.toJson()); |
| checkSparkSqlJob(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Status", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildStatus(); |
| var od = new api.Status.fromJson(o.toJson()); |
| checkStatus(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-SubmitJobRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildSubmitJobRequest(); |
| var od = new api.SubmitJobRequest.fromJson(o.toJson()); |
| checkSubmitJobRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-YarnApplication", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildYarnApplication(); |
| var od = new api.YarnApplication.fromJson(o.toJson()); |
| checkYarnApplication(od); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsRegionsClustersResourceApi", () { |
| unittest.test("method--create", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsClustersResourceApi res = |
| new api.DataprocApi(mock).projects.regions.clusters; |
| var arg_request = buildCluster(); |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.Cluster.fromJson(json); |
| checkCluster(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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/clusters", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/clusters")); |
| pathOffset += 9; |
| |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .create(arg_request, arg_projectId, arg_region, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsClustersResourceApi res = |
| new api.DataprocApi(mock).projects.regions.clusters; |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_clusterName = "foo"; |
| var arg_$fields = "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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_clusterName")); |
| |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_projectId, arg_region, arg_clusterName, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--diagnose", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsClustersResourceApi res = |
| new api.DataprocApi(mock).projects.regions.clusters; |
| var arg_request = buildDiagnoseClusterRequest(); |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_clusterName = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.DiagnoseClusterRequest.fromJson(json); |
| checkDiagnoseClusterRequest(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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| index = path.indexOf(":diagnose", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_clusterName")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals(":diagnose")); |
| pathOffset += 9; |
| |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .diagnose(arg_request, arg_projectId, arg_region, arg_clusterName, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsClustersResourceApi res = |
| new api.DataprocApi(mock).projects.regions.clusters; |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_clusterName = "foo"; |
| var arg_$fields = "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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_clusterName")); |
| |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildCluster()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_projectId, arg_region, arg_clusterName, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Cluster response) { |
| checkCluster(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsClustersResourceApi res = |
| new api.DataprocApi(mock).projects.regions.clusters; |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_pageToken = "foo"; |
| var arg_pageSize = 42; |
| var arg_filter = "foo"; |
| var arg_$fields = "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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/clusters", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/clusters")); |
| pathOffset += 9; |
| |
| 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)); |
| unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildListClustersResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_projectId, arg_region, |
| pageToken: arg_pageToken, |
| pageSize: arg_pageSize, |
| filter: arg_filter, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.ListClustersResponse response) { |
| checkListClustersResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--patch", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsClustersResourceApi res = |
| new api.DataprocApi(mock).projects.regions.clusters; |
| var arg_request = buildCluster(); |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_clusterName = "foo"; |
| var arg_gracefulDecommissionTimeout = "foo"; |
| var arg_updateMask = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.Cluster.fromJson(json); |
| checkCluster(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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/clusters/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| unittest.equals("/clusters/")); |
| pathOffset += 10; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_clusterName")); |
| |
| 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["gracefulDecommissionTimeout"].first, |
| unittest.equals(arg_gracefulDecommissionTimeout)); |
| unittest.expect( |
| queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .patch(arg_request, arg_projectId, arg_region, arg_clusterName, |
| gracefulDecommissionTimeout: arg_gracefulDecommissionTimeout, |
| updateMask: arg_updateMask, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsRegionsJobsResourceApi", () { |
| unittest.test("method--cancel", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsJobsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.jobs; |
| var arg_request = buildCancelJobRequest(); |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_jobId = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.CancelJobRequest.fromJson(json); |
| checkCancelJobRequest(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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/jobs/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 6), |
| unittest.equals("/jobs/")); |
| pathOffset += 6; |
| index = path.indexOf(":cancel", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_jobId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| unittest.equals(":cancel")); |
| pathOffset += 7; |
| |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildJob()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .cancel(arg_request, arg_projectId, arg_region, arg_jobId, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Job response) { |
| checkJob(response); |
| }))); |
| }); |
| |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsJobsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.jobs; |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_jobId = "foo"; |
| var arg_$fields = "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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/jobs/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 6), |
| unittest.equals("/jobs/")); |
| pathOffset += 6; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_jobId")); |
| |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| 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_projectId, arg_region, arg_jobId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Empty response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsJobsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.jobs; |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_jobId = "foo"; |
| var arg_$fields = "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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/jobs/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 6), |
| unittest.equals("/jobs/")); |
| pathOffset += 6; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_jobId")); |
| |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildJob()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_projectId, arg_region, arg_jobId, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Job response) { |
| checkJob(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsJobsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.jobs; |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_filter = "foo"; |
| var arg_jobStateMatcher = "foo"; |
| var arg_pageToken = "foo"; |
| var arg_pageSize = 42; |
| var arg_clusterName = "foo"; |
| var arg_$fields = "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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/jobs", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 5), |
| unittest.equals("/jobs")); |
| pathOffset += 5; |
| |
| 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["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect(queryMap["jobStateMatcher"].first, |
| unittest.equals(arg_jobStateMatcher)); |
| unittest.expect( |
| queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| unittest.equals(arg_pageSize)); |
| unittest.expect( |
| queryMap["clusterName"].first, unittest.equals(arg_clusterName)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildListJobsResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_projectId, arg_region, |
| filter: arg_filter, |
| jobStateMatcher: arg_jobStateMatcher, |
| pageToken: arg_pageToken, |
| pageSize: arg_pageSize, |
| clusterName: arg_clusterName, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.ListJobsResponse response) { |
| checkListJobsResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--patch", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsJobsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.jobs; |
| var arg_request = buildJob(); |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_jobId = "foo"; |
| var arg_updateMask = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.Job.fromJson(json); |
| checkJob(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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/jobs/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 6), |
| unittest.equals("/jobs/")); |
| pathOffset += 6; |
| subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| pathOffset = path.length; |
| unittest.expect(subPart, unittest.equals("$arg_jobId")); |
| |
| 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["updateMask"].first, unittest.equals(arg_updateMask)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildJob()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .patch(arg_request, arg_projectId, arg_region, arg_jobId, |
| updateMask: arg_updateMask, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Job response) { |
| checkJob(response); |
| }))); |
| }); |
| |
| unittest.test("method--submit", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsJobsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.jobs; |
| var arg_request = buildSubmitJobRequest(); |
| var arg_projectId = "foo"; |
| var arg_region = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.SubmitJobRequest.fromJson(json); |
| checkSubmitJobRequest(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 + 12), |
| unittest.equals("v1/projects/")); |
| pathOffset += 12; |
| index = path.indexOf("/regions/", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| unittest.equals("/regions/")); |
| pathOffset += 9; |
| index = path.indexOf("/jobs:submit", pathOffset); |
| unittest.expect(index >= 0, unittest.isTrue); |
| subPart = |
| core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| pathOffset = index; |
| unittest.expect(subPart, unittest.equals("$arg_region")); |
| unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| unittest.equals("/jobs:submit")); |
| pathOffset += 12; |
| |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildJob()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .submit(arg_request, arg_projectId, arg_region, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Job response) { |
| checkJob(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-ProjectsRegionsOperationsResourceApi", () { |
| unittest.test("method--cancel", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsOperationsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.operations; |
| var arg_name = "foo"; |
| var arg_$fields = "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 + 3), unittest.equals("v1/")); |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| 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 |
| .cancel(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Empty response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsOperationsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.operations; |
| var arg_name = "foo"; |
| var arg_$fields = "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 + 3), unittest.equals("v1/")); |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| 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_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Empty response) { |
| checkEmpty(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsOperationsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.operations; |
| var arg_name = "foo"; |
| var arg_$fields = "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 + 3), unittest.equals("v1/")); |
| 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["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_name, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.ProjectsRegionsOperationsResourceApi res = |
| new api.DataprocApi(mock).projects.regions.operations; |
| var arg_name = "foo"; |
| var arg_filter = "foo"; |
| var arg_pageToken = "foo"; |
| var arg_pageSize = 42; |
| var arg_$fields = "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 + 3), unittest.equals("v1/")); |
| 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["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect( |
| queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| unittest.equals(arg_pageSize)); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = convert.JSON.encode(buildListOperationsResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_name, |
| filter: arg_filter, |
| pageToken: arg_pageToken, |
| pageSize: arg_pageSize, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.ListOperationsResponse response) { |
| checkListOperationsResponse(response); |
| }))); |
| }); |
| }); |
| } |