1 /*****************************************************************************
5 * Creation date Feb 12, 2013
8 *****************************************************************************/
10 package test.splat.util;
12 import java.util.ArrayList;
13 import java.util.Date;
15 import org.splat.dal.bo.kernel.User;
16 import org.splat.dal.bo.som.ProgressState;
17 import org.splat.dal.bo.som.SimulationContext;
18 import org.splat.dal.bo.som.Study;
19 import org.splat.exception.BusinessException;
22 * Utility class for creating test entities.
24 public class TestEntitiesGenerator {
27 * Create a transient user.
29 * @param userName the userName
30 * @return a transient StepCommentDTO
31 * @throws BusinessException if something's wrong
33 public static User getTestUser(final String userName) throws BusinessException {
35 User.Properties uprop = new User.Properties();
36 uprop.setUsername(userName)
37 .setName("TST_Username")
38 .setFirstName("TST_FirstName")
39 .setDisplayName("TST_test.user")
40 .setMailAddress("noreply@salome-platform.org")
43 User user = new User(uprop);
48 * Create a transient study.
50 * @param user the user that will be placed in 'manager' and 'actor' properties
51 * @return the test study
52 * @throws BusinessException if something's wrong
54 public static Study getTestStudy(final User user) throws BusinessException{
55 Study.Properties studyProps = new Study.Properties();
56 studyProps.setActor(user)
58 .setTitle("a test study")
59 //.setDescription("description")
61 .setReference("test reference")
62 .setSimulationContexts(new ArrayList<SimulationContext>())
63 .setState(ProgressState.inWORK);
64 Study study = new Study(studyProps);