package org.cipres.treebase.domain.admin;

import java.util.List;
import java.util.Set;

import org.cipres.treebase.dao.AbstractDAOTest;
import org.cipres.treebase.dao.admin.UserDAO;
import org.cipres.treebase.domain.study.Submission;

/**
 * The class <code>UserTest</code> contains tests for the class {@link <code>User</code>}.
 * 
 * @generatedBy CodePro at 10/6/05 1:26 PM
 * @author Jin Ruan
 * @version $Revision: 1.0 $
 */
public class UserTest extends AbstractDAOTest {

	private UserHome mUserHome;

	/**
	 * Return an instance of the class being tested.
	 * 
	 * @return an instance of the class being tested
	 * @see UserDAO
	 * @generatedBy CodePro at 10/6/05 1:26 PM
	 */
	public UserHome getUserHome() {
		return mUserHome;
	}

	/**
	 * Injected by the super class based on autowiring by type.
	 * 
	 * @param pUserDAO
	 */
	public void setUserHome(UserHome pUserDAO) {
		mUserHome = pUserDAO;
	}

	/**
	 * 
	 */
	public void testgetInProgressSubmissions() throws Exception {
		String testName = "getInProgressSubmissions";
		if (logger.isInfoEnabled()) {
			logger.info("\n\t\tRunning Test: " + testName);
		}

		// 1. find a user with submission:
		int inprogressSubCount = 0;
		List<Submission> subs = (List<Submission>) loadAllObject(Submission.class);
		assertTrue("Empty submission table.", !subs.isEmpty());

		for (Submission sub : subs) {
			if (sub.isInProgress()) {
				inprogressSubCount++;
				User user = sub.getSubmitter();

				Set<Submission> inprogressSubs = user.getInProgressSubmissions();
				assertTrue("in progress submission is null", !inprogressSubs.isEmpty());
			}
		}

		// 2. verify
		assertTrue("Failed to get any in progress submission.", inprogressSubCount > 0);
		logger.info("in progress submitter tested: " + inprogressSubCount);

		if (logger.isInfoEnabled()) {
			logger.info(testName + " - end "); //$NON-NLS-1$
		}
	}

}

@@ -952,24 +952,54 @@
 %0D%0A%09/**%0D%0A%09 * 
+ TODO: Too slow.  20090528 MJD
 %0D%0A%09 */%0D%0A%09pub

test commit