<commit_before>package com.google.sps;

import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.spanner.Database;
import com.google.cloud.spanner.DatabaseAdminClient;
import com.google.cloud.spanner.DatabaseId;
import com.google.cloud.spanner.Spanner;
import com.google.cloud.spanner.SpannerOptions;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.sps.data.User;
import com.google.sps.utilities.DatabaseWrapper;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.UUID;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@code DatabaseWrapper} */
@RunWith(JUnit4.class)
@SuppressWarnings("checkstyle:abbreviationaswordinname")
// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class DatabaseWrapperTest {
  // private static final User USER = new User.Builder("<NAME>", "<EMAIL>").build();

  private static final String instanceId = System.getProperty("spanner.test.instance");
  private static final String databaseId =
      formatForTest(System.getProperty("spanner.sample.database"));
  static Spanner spanner;
  static DatabaseId dbId;
  static DatabaseAdminClient dbClient;

  @BeforeClass
  public static void setUp() throws Exception {
    SpannerOptions options = SpannerOptions.newBuilder().build();
    System.out.println(options.getProjectId());
    spanner = options.getService();
    dbClient = spanner.getDatabaseAdminClient();
    dbId = DatabaseId.of(options.getProjectId(), instanceId, databaseId);
    dbClient.dropDatabase(dbId.getInstanceId().getInstance(), dbId.getDatabase());
    dbClient.dropDatabase(
        dbId.getInstanceId().getInstance(), DatabaseWrapper.createRestoredSampleDbId(dbId));

    // COMMENTED OUT TO MATCH EXAMPLE BETTER

    // OperationFuture<Database, CreateDatabaseMetadata> op =
    //     dbClient.createDatabase(
    //         dbId.getInstanceId().getInstance(),
    //         dbId.getDatabase(),
    //         Arrays.asList(
    //             "CREATE TABLE Users ("
    //                 + "  UserID               INT64 NOT NULL,"
    //                 + "  Name                 STRING(MAX) NOT NULL,"
    //                 + "  Email               	STRING(MAX) NOT NULL,"
    //                 + "  Interests            ARRAY<STRING(MAX)>,"
    //                 + "  Skills               ARRAY<STRING(MAX)>,"
    //                 + "  EventsHosting        ARRAY<INT64>,"
    //                 + "  EventsParticipating  ARRAY<INT64>,"
    //                 + "  EventsVolunteering   ARRAY<INT64>"
    //                 + ") PRIMARY KEY (UserID)",
    //             "CREATE TABLE Events ("
    //                 + "  EventID        INT64 NOT NULL,"
    //                 + "  Name           STRING(MAX) NOT NULL,"
    //                 + "  Description    STRING(MAX),"
    //                 + "  Date           DATE,"
    //                 + "  Location       STRING(MAX),"
    //                 + "  Attendees      ARRAY<INT64>,"
    //                 + "  Host           INT64,"
    //                 + "  Labels         ARRAY<STRING(MAX)>,"
    //                 + "  Opportunities  ARRAY<INT64>"
    //                 + ") PRIMARY KEY (EventID)",
    //             "CREATE TABLE VolunteeringOpportunity ("
    //                 + "  VolunteeringOpportunityID  INT64 NOT NULL,"
    //                 + "  Name                       STRING(MAX) NOT NULL,"
    //                 + "  NumSpotsLeft               INT64 NOT NULL,"
    //                 + "  RequiredSkills             ARRAY<STRING(MAX)>,"
    //                 + "  Volunteers                 ARRAY<INT64>"
    //                 + ") PRIMARY KEY (VolunteeringOpportunityID)"));

    // spanner.close();
  }

  @AfterClass
  public static void tearDown() throws Exception {
    dbClient.dropDatabase(dbId.getInstanceId().getInstance(), dbId.getDatabase());<commit_msg>Uncomment wrapper test code<commit_after>package com.google.sps;

import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.spanner.Database;
import com.google.cloud.spanner.DatabaseAdminClient;
import com.google.cloud.spanner.DatabaseId;
import com.google.cloud.spanner.Spanner;
import com.google.cloud.spanner.SpannerOptions;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.sps.data.User;
import com.google.sps.utilities.DatabaseWrapper;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.UUID;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@code DatabaseWrapper} */
@RunWith(JUnit4.class)
@SuppressWarnings("checkstyle:abbreviationaswordinname")
// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class DatabaseWrapperTest {
  private static final User USER = new User.Builder("<NAME>", "<EMAIL>").build();

  private static final String instanceId = "step-188-instance";
  private static final String databaseId = formatForTest("mysample");
  private static Spanner spanner;
  private static DatabaseId dbId;
  private static DatabaseAdminClient dbClient;

  @BeforeClass
  public static void setUp() throws Exception {
    SpannerOptions options = SpannerOptions.newBuilder().build();
    spanner = options.getService();
    dbClient = spanner.getDatabaseAdminClient();
    dbId = DatabaseId.of(options.getProjectId(), instanceId, databaseId);
    dbClient.dropDatabase(dbId.getInstanceId().getInstance(), dbId.getDatabase());
    dbClient.dropDatabase(
        dbId.getInstanceId().getInstance(), DatabaseWrapper.createRestoredSampleDbId(dbId));

    OperationFuture<Database, CreateDatabaseMetadata> op =
        dbClient.createDatabase(
            dbId.getInstanceId().getInstance(),
            dbId.getDatabase(),
            Arrays.asList(
                "CREATE TABLE users ("
                    + "  UserID               INT64 NOT NULL,"
                    + "  Name                 STRING(MAX) NOT NULL,"
                    + "  Email               	STRING(MAX) NOT NULL,"
                    + "  Interests            ARRAY<STRING(MAX)>,"
                    + "  Skills               ARRAY<STRING(MAX)>,"
                    + "  EventsHosting        ARRAY<INT64>,"
                    + "  EventsParticipating  ARRAY<INT64>,"
                    + "  EventsVolunteering   ARRAY<INT64>"
                    + ") PRIMARY KEY (UserID)",
                "CREATE TABLE events ("
                    + "  EventID        INT64 NOT NULL,"
                    + "  Name           STRING(MAX) NOT NULL,"
                    + "  Description    STRING(MAX),"
                    + "  Date           DATE,"
                    + "  Location       STRING(MAX),"
                    + "  Attendees      ARRAY<INT64>,"
                    + "  Host           INT64,"
                    + "  Labels         ARRAY<STRING(MAX)>,"
                    + "  Opportunities  ARRAY<INT64>"
                    + ") PRIMARY KEY (EventID)",
                "CREATE TABLE volunteeringOpportunity ("
                    + "  VolunteeringOpportunityID  INT64 NOT NULL,"
                    + "  Name                       STRING(MAX) NOT NULL,"
                    + "  NumSpotsLeft               INT64 NOT NULL,"
                    + "  RequiredSkills             ARRAY<STRING(MAX)>,"
                    + "  Volunteers                 ARRAY<INT64>"
                    + ") PRIMARY KEY (VolunteeringOpportunityID)"));

  }

  @AfterClass
  public static void tearDown() throws Exception {
    dbClient.dropDatabase(dbId.getInstanceId().getInstance(), dbId.getDatabase());
{'fraction_non_alphanumeric': 0.11178584706902962, 'fraction_numerical': 0.006568347998512827, 'mean_word_length': 2.029279279279279, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5323984', 'n_tokens_mistral': 2240, 'n_tokens_neox': 2129, 'n_words': 415}