// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnectionFactoryProvider.java
// public static final Option<String> INSTANCE = Option.valueOf("instance");
// 
// Path: cloud-spanner-spring-data-r2dbc/src/test/java/com/google/cloud/spanner/r2dbc/springdata/it/entities/President.java
// public class President {
// 
//   @Column("NAME")
//   private String name;
// 
//   @Column("START_YEAR")
//   private long startYear;
// 
//   public President(String name, long startYear) {
//     this.name = name;
//     this.startYear = startYear;
//   }
// 
//   public String getName() {
//     return this.name;
//   }
// 
//   public void setName(String name) {
//     this.name = name;
//   }
// 
//   public long getStartYear() {
//     return this.startYear;
//   }
// 
//   public void setStartYear(long startYear) {
//     this.startYear = startYear;
//   }
// 
//   @Override
//   public String toString() {
//     return "President{"
//         + "name='"
//         + this.name + '\''
//         + ", startYear="
//         + this.startYear + '}';
//   }
// }


import static com.google.cloud.spanner.r2dbc.SpannerConnectionFactoryProvider.INSTANCE;
import static io.r2dbc.spi.ConnectionFactoryOptions.DATABASE;
import static io.r2dbc.spi.ConnectionFactoryOptions.DRIVER;
import com.google.cloud.ServiceOptions;
import com.google.cloud.spanner.r2dbc.springdata.it.entities.President;
import io.r2dbc.spi.Connection;
import io.r2dbc.spi.ConnectionFactories;
import io.r2dbc.spi.ConnectionFactory;
import io.r2dbc.spi.ConnectionFactoryOptions;
import io.r2dbc.spi.Option;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
import org.springframework.data.relational.core.query.Query;
import org.springframework.r2dbc.core.DatabaseClient;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
    this.databaseClient = this.r2dbcEntityTemplate.getDatabaseClient();

    if (SpannerTestUtils.tableExists(connection, "PRESIDENT")) {
      this.databaseClient.sql("DROP TABLE PRESIDENT")
          .fetch()
          .rowsUpdated()
          .block();
    }

    this.databaseClient.sql(
        "CREATE TABLE PRESIDENT ("
            + "  NAME STRING(256) NOT NULL,"
            + "  START_YEAR INT64 NOT NULL"
            + ") PRIMARY KEY (NAME)")
        .fetch()
        .rowsUpdated()
        .block();
  }

  @AfterEach
  public void cleanupTableAfterTest() {
    this.databaseClient
            .sql("DELETE FROM PRESIDENT where NAME is not null")
            .fetch()
            .rowsUpdated()
            .block();
  }

  @Test
  void testReadWrite() {
// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnectionFactoryProvider.java
// public static final Option<String> INSTANCE = Option.valueOf("instance");
// 
// Path: cloud-spanner-spring-data-r2dbc/src/test/java/com/google/cloud/spanner/r2dbc/springdata/it/entities/President.java
// public class President {
// 
//   @Column("NAME")
//   private String name;
// 
//   @Column("START_YEAR")
//   private long startYear;
// 
//   public President(String name, long startYear) {
//     this.name = name;
//     this.startYear = startYear;
//   }
// 
//   public String getName() {
//     return this.name;
//   }
// 
//   public void setName(String name) {
//     this.name = name;
//   }
// 
//   public long getStartYear() {
//     return this.startYear;
//   }
// 
//   public void setStartYear(long startYear) {
//     this.startYear = startYear;
//   }
// 
//   @Override
//   public String toString() {
//     return "President{"
//         + "name='"
//         + this.name + '\''
//         + ", startYear="
//         + this.startYear + '}';
//   }
// }


// Path: cloud-spanner-spring-data-r2dbc/src/test/java/com/google/cloud/spanner/r2dbc/springdata/it/SpannerR2dbcDialectIntegrationTest.java
import static com.google.cloud.spanner.r2dbc.SpannerConnectionFactoryProvider.INSTANCE;
import static io.r2dbc.spi.ConnectionFactoryOptions.DATABASE;
import static io.r2dbc.spi.ConnectionFactoryOptions.DRIVER;
import com.google.cloud.ServiceOptions;
import com.google.cloud.spanner.r2dbc.springdata.it.entities.President;
import io.r2dbc.spi.Connection;
import io.r2dbc.spi.ConnectionFactories;
import io.r2dbc.spi.ConnectionFactory;
import io.r2dbc.spi.ConnectionFactoryOptions;
import io.r2dbc.spi.Option;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
import org.springframework.data.relational.core.query.Query;
import org.springframework.r2dbc.core.DatabaseClient;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;

    this.databaseClient = this.r2dbcEntityTemplate.getDatabaseClient();

    if (SpannerTestUtils.tableExists(connection, "PRESIDENT")) {
      this.databaseClient.sql("DROP TABLE PRESIDENT")
          .fetch()
          .rowsUpdated()
          .block();
    }

    this.databaseClient.sql(
        "CREATE TABLE PRESIDENT ("
            + "  NAME STRING(256) NOT NULL,"
            + "  START_YEAR INT64 NOT NULL"
            + ") PRIMARY KEY (NAME)")
        .fetch()
        .rowsUpdated()
        .block();
  }

  @AfterEach
  public void cleanupTableAfterTest() {
    this.databaseClient
            .sql("DELETE FROM PRESIDENT where NAME is not null")
            .fetch()
            .rowsUpdated()
            .block();
  }

  @Test
  void testReadWrite() {
    insertPresident(new President("Bill Clinton", 1992));