public void CreateClientWithEmptyOptions() { GoogleCredential credential = GoogleCredential.GetApplicationDefault(); invoker = new GcpCallInvoker(Target, credential.ToChannelCredentials()); client = new Bigtable.BigtableClient(invoker); MutateRowRequest mutateRowRequest = new MutateRowRequest { TableName = TableName, RowKey = ByteString.CopyFromUtf8(RowKey) }; Mutation mutation = new Mutation { SetCell = new Mutation.Types.SetCell { FamilyName = ColumnFamily, ColumnQualifier = ByteString.CopyFromUtf8(ColumnQualifier), Value = ByteString.CopyFromUtf8(TestValue), } }; mutateRowRequest.Mutations.Add(mutation); client.MutateRow(mutateRowRequest); Assert.AreEqual(1, invoker.GetChannelRefsForTest().Count); }
private void AssertNoAffinity(GcpCallInvoker invoker) { var channelRefs = invoker.GetChannelRefsForTest(); Assert.AreEqual(0, channelRefs.Sum(cr => cr.AffinityCount)); Assert.AreEqual(0, invoker.GetChannelRefsByAffinityKeyForTest().Count); }
public void CreateSessionWithNewChannel() { IList <AsyncUnaryCall <Session> > calls = new List <AsyncUnaryCall <Session> >(); for (int i = 0; i < DefaultMaxChannelsPerTarget; i++) { var call = client.CreateSessionAsync( new CreateSessionRequest { Database = DatabaseUrl }); calls.Add(call); Assert.AreEqual(i + 1, invoker.GetChannelRefsForTest().Count); } for (int i = 0; i < calls.Count; i++) { client.DeleteSession( new DeleteSessionRequest { Name = calls[i].ResponseAsync.Result.Name }); } calls.Clear(); for (int i = 0; i < DefaultMaxChannelsPerTarget; i++) { var call = client.CreateSessionAsync( new CreateSessionRequest { Database = DatabaseUrl }); calls.Add(call); Assert.AreEqual(DefaultMaxChannelsPerTarget, invoker.GetChannelRefsForTest().Count); } for (int i = 0; i < calls.Count; i++) { client.DeleteSession( new DeleteSessionRequest { Name = calls[i].ResponseAsync.Result.Name }); } }
private void AssertNoActiveStreams(GcpCallInvoker invoker) { var channelRefs = invoker.GetChannelRefsForTest(); Assert.AreEqual(0, channelRefs.Sum(cr => cr.ActiveStreamCount)); }
public void MutateRow() { MutateRowRequest mutateRowRequest = new MutateRowRequest { TableName = TableName, RowKey = ByteString.CopyFromUtf8(RowKey) }; Mutation mutation = new Mutation { SetCell = new Mutation.Types.SetCell { FamilyName = ColumnFamily, ColumnQualifier = ByteString.CopyFromUtf8(ColumnQualifier), Value = ByteString.CopyFromUtf8(TestValue), } }; mutateRowRequest.Mutations.Add(mutation); client.MutateRow(mutateRowRequest); Assert.AreEqual(1, invoker.GetChannelRefsForTest().Count); }