<commit_before>package edu.columbia.gemma.common.auditAndSecurity;

import java.util.Collection;
import java.util.Date;
import java.util.HashSet;

import net.sf.hibernate.SessionFactory;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import edu.columbia.gemma.BaseDAOTestCase;

/**
 * Tests the Contact, Person, User interitance hierarchy and the association 
 * between User and UserRole.
 * 
 *
 * <hr>
 * <p>Copyright (c) 2004 - 2005 Columbia University
 * @author keshav
 * @version $Id$
 */
public class UserDaoImplTest extends BaseDAOTestCase {

    private UserDao dao = null;
    private final Log log = LogFactory.getLog( UserDaoImplTest.class );
    private SessionFactory sf = null;
    private User testUser = null;
    private UserRole ur = null;

    public final void testCreateUser() throws Exception {
        dao.create( testUser );
    }

    protected void setUp() throws Exception {
        super.setUp();

        sf = ( SessionFactory ) ctx.getBean( "sessionFactory" );
        dao = ( UserDao ) ctx.getBean( "userDao" );

        // User Object
        testUser = User.Factory.newInstance();
        // UserRole Object
        ur = UserRole.Factory.newInstance();

        String rand = ( new Date() ).toString();

        String adminName = "admin";
        User checkUser = dao.findByUserName( adminName );

        if ( ( checkUser == null ) ) {
            // User Object
            testUser.setUserName( adminName );
            // UserRole Object
            ur.setUserName( adminName );
            ur.setName( adminName );
        } else {
            testUser.setUserName( rand );
            log.info( rand );
            ur.setUserName( rand );
        }

        Collection set = new HashSet();
        testUser.setUserRoles( set );

        testUser.setPassword( "<PASSWORD>" );
        testUser.setConfirmPassword( "<PASSWORD>" );
        testUser.setPasswordHint( "<PASSWORD>" );

        testUser.getUserRoles().add( ur );

        // dao.create( testUser );
    }

    protected void tearDown() throws Exception {
        // dao.remove( testUser );
        dao = null;
    }
}<commit_msg>updated test<commit_after>package edu.columbia.gemma.common.auditAndSecurity;

import java.util.Collection;
import java.util.Date;
import java.util.HashSet;

import net.sf.hibernate.SessionFactory;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import edu.columbia.gemma.BaseDAOTestCase;

/**
 * Tests the Contact, Person, User interitance hierarchy and the association 
 * between User and UserRole.
 * 
 *
 * <hr>
 * <p>Copyright (c) 2004 - 2005 Columbia University
 * @author keshav
 * @version $Id$
 */
public class UserDaoImplTest extends BaseDAOTestCase {

    private UserDao dao = null;
    private final Log log = LogFactory.getLog( UserDaoImplTest.class );
    private SessionFactory sf = null;
    private User testUser = null;
    private UserRole ur = null;

    public final void testCreateUser() throws Exception {
        dao.create( testUser );
    }

    protected void setUp() throws Exception {
        super.setUp();

        sf = ( SessionFactory ) ctx.getBean( "sessionFactory" );
        dao = ( UserDao ) ctx.getBean( "userDao" );

        // User Object
        testUser = User.Factory.newInstance();
        // UserRole Object
        ur = UserRole.Factory.newInstance();

        String rand = ( new Date() ).toString();

        String adminName = "admin";
        String userName = "user";
        User checkUser = dao.findByUserName( adminName );

        if ( ( checkUser == null ) ) {
            // User Object
            testUser.setUserName( adminName );
            // UserRole Object
            ur.setUserName( adminName );
            ur.setName( adminName );
        } else {
            testUser.setUserName( rand );
            log.info( rand );
            ur.setUserName( rand );
            ur.setName( userName );
        }

        Collection set = new HashSet();
        testUser.setUserRoles( set );

        testUser.setPassword( "<PASSWORD>" );
        testUser.setConfirmPassword( "<PASSWORD>" );
        testUser.setPasswordHint( "<PASSWORD>" );

        testUser.getUserRoles().add( ur );

        // dao.create( testUser );
    }

    protected void tearDown() throws Exception {
        // dao.remove( testUser );
        dao = null;
    }
}
{'fraction_non_alphanumeric': 0.11113631208890905, 'fraction_numerical': 0.0036289408029031526, 'mean_word_length': 2.34597875569044, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '2893399', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1255, 'n_words': 316}