1515import com .google .cloud .bigtable .data .v2 .models .Row ;
1616import com .google .cloud .bigtable .data .v2 .models .RowCell ;
1717import com .google .cloud .bigtable .data .v2 .models .RowMutation ;
18+ import com .google .cloud .bigtable .data .v2 .models .TableId ;
1819import io .grpc .ManagedChannel ;
1920import io .grpc .ManagedChannelBuilder ;
2021import org .junit .Rule ;
2324
2425import java .io .IOException ;
2526import java .util .List ;
26- import java .util .concurrent .ExecutionException ;
2727
2828import static org .assertj .core .api .Assertions .assertThat ;
2929
@@ -43,28 +43,26 @@ public class BigtableEmulatorContainerTest {
4343
4444 @ Test
4545 // testWithEmulatorContainer {
46- public void testSimple () throws IOException , InterruptedException , ExecutionException {
46+ public void testSimple () throws IOException {
4747 ManagedChannel channel = ManagedChannelBuilder .forTarget (emulator .getEmulatorEndpoint ()).usePlaintext ().build ();
4848
4949 TransportChannelProvider channelProvider = FixedTransportChannelProvider .create (
5050 GrpcTransportChannel .create (channel )
5151 );
5252 NoCredentialsProvider credentialsProvider = NoCredentialsProvider .create ();
53-
54- try {
55- createTable (channelProvider , credentialsProvider , "test-table" );
56-
53+ createTable (channelProvider , credentialsProvider , "test-table" );
54+ try (
5755 BigtableDataClient client = BigtableDataClient .create (
5856 BigtableDataSettings
5957 .newBuilderForEmulator (emulator .getHost (), emulator .getEmulatorPort ())
6058 .setProjectId (PROJECT_ID )
6159 .setInstanceId (INSTANCE_ID )
6260 .build ()
63- );
64-
65- client .mutateRow (RowMutation .create ("test-table" , "1" ).setCell ("name" , "firstName" , "Ray" ));
61+ )
62+ ) {
63+ client .mutateRow (RowMutation .create (TableId . of ( "test-table" ) , "1" ).setCell ("name" , "firstName" , "Ray" ));
6664
67- Row row = client .readRow ("test-table" , "1" );
65+ Row row = client .readRow (TableId . of ( "test-table" ) , "1" );
6866 List <RowCell > cells = row .getCells ("name" , "firstName" );
6967
7068 assertThat (cells ).isNotNull ().hasSize (1 );
0 commit comments