<commit_before>package com.splicemachine.derby.test.framework;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

import com.splicemachine.derby.impl.db.AuthenticationConstants;
import org.apache.commons.dbutils.DbUtils;
import org.apache.log4j.Logger;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;

import com.splicemachine.constants.SpliceConstants;

public class SpliceUserWatcher extends TestWatcher {
	private static final Logger LOG = Logger.getLogger(SpliceUserWatcher.class);
	public String userName;
	public String password;
	public SpliceUserWatcher(String userName, String password) {
		this.userName = userName;
		this.password = password;
	}
	@Override
	protected void starting(Description description) {
		Connection connection = null;
		Statement statement = null;
		ResultSet rs = null;
		try {
			dropAndCreateUser(userName,password);
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			DbUtils.closeQuietly(rs);
			DbUtils.closeQuietly(statement);
			DbUtils.commitAndCloseQuietly(connection);
		}
		super.starting(description);
	}
	@Override
	protected void finished(Description description) {
		LOG.trace("Finished");
	}
	
	public void createUser(String userName, String password) {
	  if (!AuthenticationConstants.authentication.toUpperCase().equals("LDAP")) {
		Connection connection = null;
		PreparedStatement statement = null;
		try {
			connection = SpliceNetConnection.getConnection();
			statement = connection.prepareStatement("call syscs_util.syscs_create_user(?,?)");
			statement.setString(1, userName);
			statement.setString(2, password);
			statement.execute();
		} catch (Exception e) {
			LOG.error("error Creating " + e.getMessage());
			e.printStackTrace();
			throw new RuntimeException(e);
		} finally {
			DbUtils.closeQuietly(statement);
			DbUtils.commitAndCloseQuietly(connection);
		}
	  }
	}
	
	public void dropUser(String userName) {
	  if (AuthenticationConstants.authentication.toUpperCase().equals("LDAP")) {
		Connection connection = null;
		PreparedStatement statement = null;
		try {
			connection = SpliceNetConnection.getConnection();
			statement = connection.prepareStatement("select username from sys.sysusers where username = ?");
			statement.setString(1, userName);
			ResultSet rs = statement.executeQuery();
			if (rs.next()) {
				statement = connection.prepareStatement("call syscs_util.syscs_drop_user(?)");
				statement.setString(1, userName);
				statement.execute();
			}
		} catch (Exception e) {
			LOG.error("error Creating " + e.getMessage());
			e.printStackTrace();
			throw new RuntimeException(e);
		} finally {
			DbUtils.closeQuietly(statement);
			DbUtils.commitAndCloseQuietly(connection);
		}
	  }
	}
	
	public void dropAndCreateUser(String userName, String password) {
		dropUser(userName);
		createUser(userName,password);
	}
		
}<commit_msg>Was never dropping users. The create_user proc upper-cases the username when creating. If you don't upper-case the username before using it criteria, it won't be found.<commit_after>package com.splicemachine.derby.test.framework;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

import com.splicemachine.derby.impl.db.AuthenticationConstants;
import org.apache.commons.dbutils.DbUtils;
import org.apache.log4j.Logger;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;

import com.splicemachine.constants.SpliceConstants;

public class SpliceUserWatcher extends TestWatcher {
	private static final Logger LOG = Logger.getLogger(SpliceUserWatcher.class);
	public String userName;
	public String password;
	public SpliceUserWatcher(String userName, String password) {
		this.userName = userName;
		this.password = password;
	}
	@Override
	protected void starting(Description description) {
		Connection connection = null;
		Statement statement = null;
		ResultSet rs = null;
		try {
			dropAndCreateUser(userName,password);
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			DbUtils.closeQuietly(rs);
			DbUtils.closeQuietly(statement);
			DbUtils.commitAndCloseQuietly(connection);
		}
		super.starting(description);
	}
	@Override
	protected void finished(Description description) {
		LOG.trace("Finished");
	}
	
	public void createUser(String userName, String password) {
	  if (! AuthenticationConstants.authentication.toUpperCase().equals("LDAP")) {
		Connection connection = null;
		PreparedStatement statement = null;
		try {
			connection = SpliceNetConnection.getConnection();
			statement = connection.prepareStatement("call syscs_util.syscs_create_user(?,?)");
			statement.setString(1, userName);
			statement.setString(2, password);
			statement.execute();
		} catch (Exception e) {
			LOG.error("error Creating " + e.getMessage());
			e.printStackTrace();
			throw new RuntimeException(e);
		} finally {
			DbUtils.closeQuietly(statement);
			DbUtils.commitAndCloseQuietly(connection);
		}
	  }
	}
	
	public void dropUser(String userName) {
	  if (! AuthenticationConstants.authentication.toUpperCase().equals("LDAP")) {
		Connection connection = null;
		PreparedStatement statement = null;
		try {
			connection = SpliceNetConnection.getConnection();
			statement = connection.prepareStatement("select username from sys.sysusers where username = ?");
			statement.setString(1, userName.toUpperCase());
			ResultSet rs = statement.executeQuery();
			if (rs.next()) {
				statement = connection.prepareStatement("call syscs_util.syscs_drop_user(?)");
				statement.setString(1, userName);
				statement.execute();
			}
		} catch (Exception e) {
			LOG.error("error Creating " + e.getMessage());
			e.printStackTrace();
			throw new RuntimeException(e);
		} finally {
			DbUtils.closeQuietly(statement);
			DbUtils.commitAndCloseQuietly(connection);
		}
	  }
	}
	
	public void dropAndCreateUser(String userName, String password) {
		dropUser(userName);
		createUser(userName,password);
	}
		
}
{'fraction_non_alphanumeric': 0.10975609756097561, 'fraction_numerical': 0.0016479894528675016, 'mean_word_length': 4.985207100591716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3441808', 'n_tokens_mistral': 1991, 'n_tokens_neox': 1773, 'n_words': 375}