public async stt::Task GetTableRequestObjectAsync() { moq::Mock <TablesService.TablesServiceClient> mockGrpcClient = new moq::Mock <TablesService.TablesServiceClient>(moq::MockBehavior.Strict); GetTableRequest request = new GetTableRequest { Name = "name1c9368b0", }; Table expectedResponse = new Table { TableName = TableName.FromTable("[TABLE]"), DisplayName = "display_name137f65c2", Columns = { new ColumnDescription(), }, }; mockGrpcClient.Setup(x => x.GetTableAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Table>(stt::Task.FromResult(expectedResponse), null, null, null, null)); TablesServiceClient client = new TablesServiceClientImpl(mockGrpcClient.Object, null); Table responseCallSettings = await client.GetTableAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Table responseCancellationToken = await client.GetTableAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary> /// Get table info by identifier. /// </summary> /// <param name="request"></param> /// <returns></returns> public GetTableResponse GetTable(GetTableRequest request) { var uriStr = $"{GetEndPoint(NoSQLServices.Tables, this.Region)}/{request.TableNameOrId}"; if (!string.IsNullOrEmpty(request.CompartmentId)) { uriStr = $"{uriStr}?compartmentId={request.CompartmentId}"; } var uri = new Uri(uriStr); var httpRequestHeaderParam = new HttpRequestHeaderParam() { OpcRequestId = request.OpcRequestId }; using (var webResponse = this.RestClient.Get(uri, httpRequestHeaderParam)) using (var stream = webResponse.GetResponseStream()) using (var reader = new StreamReader(stream)) { var response = reader.ReadToEnd(); return(new GetTableResponse() { Table = this.JsonSerializer.Deserialize <TableDetails>(response), Etag = webResponse.Headers.Get("etag"), OpcRequestId = webResponse.Headers.Get("opc-request-id") }); } }
private static object GetTable(string tableId) { // [START bigtable_create_bigtableTableAdminClient] BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create(); // [END bigtable_create_bigtableTableAdminClient] Console.WriteLine("Getting table"); // [START bigtable_get_table] // Getting information about a table. // Initialize request argument(s). // Table to get. TableName tableName = new TableName(projectId, instanceId, tableId); GetTableRequest request = new GetTableRequest { TableName = tableName }; try { // Make the request Table table = bigtableTableAdminClient.GetTable(request); // [END bigtable_get_table] // Print table information. PrintTableInfo(table); // [START bigtable_get_table] } catch (Exception ex) { Console.WriteLine($"Error getting table {ex.Message}"); } // [END bigtable_get_table] return(0); }
public void TestGetTable() { string remoteFileName = "TestGetTable.docx"; this.UploadFileToStorage( remoteDataFolder + "/" + remoteFileName, null, null, File.ReadAllBytes(LocalTestDataFolder + localFile) ); var request = new GetTableRequest( name: remoteFileName, index: 1, nodePath: "", folder: remoteDataFolder ); var actual = this.WordsApi.GetTable(request); Assert.NotNull(actual.Table); Assert.NotNull(actual.Table.TableRowList); Assert.AreEqual(1, actual.Table.TableRowList.Count); Assert.NotNull(actual.Table.TableRowList[0].TableCellList); Assert.AreEqual(2, actual.Table.TableRowList[0].TableCellList.Count); }
/// <summary> /// Creates a waiter using the provided configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="config">Wait Configuration</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetTableRequest, GetTableResponse> ForTable(GetTableRequest request, WaiterConfiguration config, params Table.LifecycleStateEnum[] targetStates) { var agent = new WaiterAgent <GetTableRequest, GetTableResponse>( request, request => client.GetTable(request), response => targetStates.Contains(response.Table.LifecycleState.Value), targetStates.Contains(Table.LifecycleStateEnum.Deleted) ); return(new Waiter <GetTableRequest, GetTableResponse>(config, agent)); }
public GetTableResponse GetTableRefresh(GetTableRequest request) { this.Validator.Validate(request); var response = this.Rules.getTableRefreshResponse(ConvertersInternal.GetTableType(request.Table)); return(new GetTableResponse() { Rows = this.Reader.ReadResponse(response), }); }
public IsTableLoadedByDefaultResponse IsTableLoadedByDefault(GetTableRequest request) { this.Validator.Validate(request); var result = this.Rules.isTableLoadedByDefault(ConvertersInternal.GetTableType(request.Table)); return(new IsTableLoadedByDefaultResponse() { IsLoaded = result, }); }
public GetTableResponse GetTable(GetTableRequest request) { this.Validator.Validate(request); var table = this.Manager.getTable(ConvertersInternal.GetTableType(request.Table)); return(new GetTableResponse() { Rows = this.Reader.ReadTable(table), }); }
public void GetTable_Test() { var ci = GetContainer(); var tableInfoService = ci.Resolve <ITableInfoService>(); var request = new GetTableRequest(); request.TableName = "Order"; var res = tableInfoService.GetTable(request); res.CheckErrorAndThrowIt(); }
/// <summary>Snippet for GetTable</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetTableRequestObject() { // Create client TablesServiceClient tablesServiceClient = TablesServiceClient.Create(); // Initialize request argument(s) GetTableRequest request = new GetTableRequest { TableName = TableName.FromTable("[TABLE]"), }; // Make the request Table response = tablesServiceClient.GetTable(request); }
public async Task <BigTable> GetTableAsync(string name, Encoding encoding = null) { encoding = encoding ?? BigModel.DefaultEncoding; var request = new GetTableRequest { Name = name.ToTableId(ClusterId) }; var response = await _client.GetTableAsync(request); await Task.Yield(); return(new BigTable(response, encoding, ClusterId)); }
public void Validate(GetTableRequest request) { if (request == null) { throw new ArgumentNullException("request"); } if (request.Table == TableType.Unknown) { throw new ArgumentOutOfRangeException("Table"); } }
public void TestGetTable() { var localName = "TablesGet.docx"; var remoteName = "TestGetTable.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(this.tableFolder) + localName)); var request = new GetTableRequest(remoteName, 1, this.dataFolder); var actual = this.WordsApi.GetTable(request); Assert.AreEqual(200, actual.Code); }
/// <summary>Snippet for GetTableAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetTableRequestObjectAsync() { // Create client TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync(); // Initialize request argument(s) GetTableRequest request = new GetTableRequest { TableName = TableName.FromTable("[TABLE]"), }; // Make the request Table response = await tablesServiceClient.GetTableAsync(request); }
/// <summary>Snippet for GetTable</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetTableRequestObject() { // Create client BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create(); // Initialize request argument(s) GetTableRequest request = new GetTableRequest { TableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]"), View = Table.Types.View.Unspecified, }; // Make the request Table response = bigtableTableAdminClient.GetTable(request); }
/// <summary>Snippet for GetTable</summary> public void GetTableRequestObject() { // Snippet: GetTable(GetTableRequest, CallSettings) // Create client TablesServiceClient tablesServiceClient = TablesServiceClient.Create(); // Initialize request argument(s) GetTableRequest request = new GetTableRequest { Name = "", }; // Make the request Table response = tablesServiceClient.GetTable(request); // End snippet }
/// <summary>Snippet for GetTable</summary> public void GetTable_RequestObject() { // Snippet: GetTable(GetTableRequest,CallSettings) // Create client BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create(); // Initialize request argument(s) GetTableRequest request = new GetTableRequest { TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), }; // Make the request Table response = bigtableTableAdminClient.GetTable(request); // End snippet }
public void GetPeersTables(String address) { IRequest request = new RPCRequest(); GetTableRequest tableRequest = new GetTableRequest() { Recipient = address }; request.Method = tableRequest.GetType().Name; request.Params = tableRequest; Backend.SendRequest(request); this.SentRequests.Add(request); }
private async void lpTableButton_Clicked(object sender, EventArgs e) { loginMatch = tableLogin.Match(lpTableEntry.Text); if (loginMatch.Success) { await GetTableRequest.SendGetTableRequest(Int32.Parse(lpTableEntry.Text)); App.changeMainPage(new NavigationPage(new MainMenu())); } else { await DisplayAlert("Login FAILED", "", "Try Again"); } }
/// <summary>Snippet for GetTableAsync</summary> public async Task GetTableRequestObjectAsync() { // Snippet: GetTableAsync(GetTableRequest, CallSettings) // Additional: GetTableAsync(GetTableRequest, CancellationToken) // Create client TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync(); // Initialize request argument(s) GetTableRequest request = new GetTableRequest { Name = "", }; // Make the request Table response = await tablesServiceClient.GetTableAsync(request); // End snippet }
private async void cpCheckoutButton_Clicked(object sender, EventArgs e) { if (checkOutOrder.orderItems.Count() == 0) { await DisplayAlert("No Items Selected", "Please select items to checkout", "OK"); return; } await UpdateOrderMenuItemsRequest.SendUpdateOrderMenuItemsRequest(order._id, order.menuItems); tip = (cpTip.Text == "") ? 0f : Double.Parse(cpTip.Text); updateItems(); MainMenu.OnReturn(); await PostTipRequest.SendPostTipRequest(order.employee_id, tip); for (int i = 0; i < coupons.Count(); i++) { if (coupons[i].couponType == "Customer") { await DeactivateCouponRequest.SendDeactivateCouponRequest(coupons[i]._id); } } bool orderComplete = true; await GetTableRequest.SendGetTableRequest(RealmManager.All <Table>().First().table_number); for (int i = 0; i < RealmManager.All <Table>().First().order_id.menuItems.Count(); i++) { if (!RealmManager.All <Table>().First().order_id.menuItems[i].paid && !RealmManager.All <Table>().First().order_id.menuItems[i].prepared) { orderComplete = false; break; } } if (orderComplete) { await FinishOrderRequest.SendFinishOrderRequest(RealmManager.All <Table>().First()._id); } await Navigation.PushAsync(new PaymentPage(totalPrice, tip)); }
/// <summary>Snippet for GetTableAsync</summary> public async Task GetTableAsync_RequestObject() { // Snippet: GetTableAsync(GetTableRequest,CallSettings) // Additional: GetTableAsync(GetTableRequest,CancellationToken) // Create client BigtableTableAdminClient bigtableTableAdminClient = await BigtableTableAdminClient.CreateAsync(); // Initialize request argument(s) GetTableRequest request = new GetTableRequest { TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), }; // Make the request Table response = await bigtableTableAdminClient.GetTableAsync(request); // End snippet }
public static async void OnReturn() { bool unpaid = false; await GetTableRequest.SendGetTableRequest(RealmManager.All <Table>().First().table_number); for (int i = 0; i < RealmManager.All <Table>().First().order_id.menuItems.Count(); i++) { if (!RealmManager.All <Table>().First().order_id.menuItems[i].paid) { unpaid = true; break; } } if (unpaid) { if (_instance.checkOutButton == null) { _instance.checkOutButton = new Button() { Margin = new Thickness(100, 0, 100, 0), Padding = new Thickness(0, 15, 0, 15), Text = "Pay Ticket", FontSize = 35, FontAttributes = FontAttributes.Bold, TextColor = Xamarin.Forms.Color.White, CornerRadius = 15, BackgroundColor = Xamarin.Forms.Color.FromHex("#24BF87") }; _instance.checkOutButton.Clicked += uxCheckOutButton_Clicked; _instance.uxTitleButtonStack.Children.Add(_instance.checkOutButton); } } else { if (_instance.checkOutButton != null) { _instance.uxTitleButtonStack.Children.Remove(_instance.checkOutButton); } _instance.checkOutButton = null; } }
public void GetTable2() { Mock <BigtableTableAdmin.BigtableTableAdminClient> mockGrpcClient = new Mock <BigtableTableAdmin.BigtableTableAdminClient>(MockBehavior.Strict); GetTableRequest request = new GetTableRequest { TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), }; Table expectedResponse = new Table { TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), }; mockGrpcClient.Setup(x => x.GetTable(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); BigtableTableAdminClient client = new BigtableTableAdminClientImpl(mockGrpcClient.Object, null); Table response = client.GetTable(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetTableAsync2() { Mock <BigtableTableAdmin.BigtableTableAdminClient> mockGrpcClient = new Mock <BigtableTableAdmin.BigtableTableAdminClient>(MockBehavior.Strict); GetTableRequest request = new GetTableRequest { TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), }; Table expectedResponse = new Table { TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), }; mockGrpcClient.Setup(x => x.GetTableAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Table>(Task.FromResult(expectedResponse), null, null, null, null)); BigtableTableAdminClient client = new BigtableTableAdminClientImpl(mockGrpcClient.Object, null); Table response = await client.GetTableAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
private void HandleOutput(GetTableRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForTable(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetTable(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Table); }
protected override void ProcessRecord() { base.ProcessRecord(); GetTableRequest request; try { request = new GetTableRequest { TableNameOrId = TableNameOrId, CompartmentId = CompartmentId, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public void ValidateGetTableRequest() { // Null. { var v = new LoginRulesProviderValidator(); GetTableRequest r = null; AssertEx.Throws <ArgumentNullException>(() => { v.Validate(r); }); } // Invalid table. { var v = new LoginRulesProviderValidator(); GetTableRequest r = new GetTableRequest(); r.Table = TableType.Unknown; AssertEx.Throws <ArgumentOutOfRangeException>(() => { v.Validate(r); }); } // Valid. { var values = (TableType[])Enum.GetValues(typeof(TableType)); foreach (var opt in values.Where(x => x != TableType.Unknown)) { var v = new LoginRulesProviderValidator(); GetTableRequest r = new GetTableRequest(); r.Table = opt; v.Validate(r); } } }
private static bool TableExist(BigtableTableAdminClient bigtableTableAdminClient) { GetTableRequest request = new GetTableRequest { TableName = new Google.Cloud.Bigtable.Common.V2.TableName(projectId, instanceId, tableId), View = Table.Types.View.NameOnly }; try { var tables = bigtableTableAdminClient.GetTable(request); return(true); } catch (RpcException ex) { if (ex.StatusCode == StatusCode.NotFound) { return(false); } throw; } }
public void GetTable() { moq::Mock <TablesService.TablesServiceClient> mockGrpcClient = new moq::Mock <TablesService.TablesServiceClient>(moq::MockBehavior.Strict); GetTableRequest request = new GetTableRequest { Name = "name1c9368b0", }; Table expectedResponse = new Table { TableName = TableName.FromTable("[TABLE]"), DisplayName = "display_name137f65c2", Columns = { new ColumnDescription(), }, }; mockGrpcClient.Setup(x => x.GetTable(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); TablesServiceClient client = new TablesServiceClientImpl(mockGrpcClient.Object, null); Table response = client.GetTable(request.Name); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }