<commit_before>package org.basex.test.unresolved;

import java.io.IOException;
import java.util.Random;

import org.basex.BaseXServer;
import org.basex.core.cmd.CreateDB;
import org.basex.core.cmd.DropDB;
import org.basex.core.cmd.XQuery;
import org.basex.server.ClientSession;
import org.basex.util.Performance;

/**
 * Testing concurrent XQUF statements on a single database.
 *
 * @author BaseX Team 2005-11, ISC License
 */
public class XQUFStressTestClientServer {
  /** Server. */
  BaseXServer server;
  /** Number of queries per client. */
  static final int NQUERIES = 20;
  /** Number of clients. */
  static final int NCLIENTS = 40;
  /** Database name. */
  static final String DBNAME = "XQUFStress";
  /** Random number generator. */
  static final Random RND = new Random();
  /** Number of runs. */
  static final int RUNS = 20;

  /**
   * Starting test.
   */
  public void startTest() {
    server = new BaseXServer("-z");

    for(int i = RUNS; i > 0; i--) {
      p("\n");
      queryInsert();
      p("\n");
      queryDelete();
      p("\n");
      dropDB();
    }
    server.stop();
  }

  /**
   * Performs the query.
   */
  private void queryInsert() {
    try {
      p("INSERT ... creating database.");
      ClientSession s = newSession();
      s.execute(new CreateDB(DBNAME, "<doc/>"));
      s.close();<commit_msg>[CG] Lock class replaced, temporary instances removed.<commit_after>package org.basex.test.unresolved;

import java.io.IOException;
import java.util.Random;

import org.basex.BaseXServer;
import org.basex.core.cmd.CreateDB;
import org.basex.core.cmd.DropDB;
import org.basex.core.cmd.XQuery;
import org.basex.server.ClientSession;
import org.basex.util.Performance;

/**
 * Testing concurrent XQUF statements on a single database.
 *
 * @author BaseX Team 2005-11, ISC License
 */
public class XQUFStressTestClientServer {
  /** Server. */
  BaseXServer server;
  /** Number of queries per client. */
  static final int NQUERIES = 100;
  /** Number of clients. */
  static final int NCLIENTS = 100;
  /** Database name. */
  static final String DBNAME = "XQUFStress";
  /** Random number generator. */
  static final Random RND = new Random();
  /** Number of runs. */
  static final int RUNS = 10;

  /**
   * Starting test.
   */
  public void startTest() {
    server = new BaseXServer("-z");

    for(int i = RUNS; i > 0; i--) {
      p("\n");
      queryInsert();
      p("\n");
      queryDelete();
      p("\n");
      dropDB();
    }
    server.stop();
  }

  /**
   * Performs the query.
   */
  private void queryInsert() {
    try {
      p("INSERT ... creating database.");
      ClientSession s = newSession();
      s.execute(new CreateDB(DBNAME, "<doc/>"));
      s.close();
{'fraction_non_alphanumeric': 0.14917733089579524, 'fraction_numerical': 0.010237659963436929, 'mean_word_length': 2.737704918032787, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6890803', 'n_tokens_mistral': 916, 'n_tokens_neox': 878, 'n_words': 241}