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.dal.bo.som.Visibility;
20 import org.splat.exception.BusinessException;
23 * Utility class for creating test entities.
25 public class TestEntitiesGenerator {
28 * Create a transient user.
30 * @param userName the userName
31 * @return a transient StepCommentDTO
32 * @throws BusinessException if something's wrong
34 public static User getTestUser(final String userName) throws BusinessException {
36 User.Properties uprop = new User.Properties();
37 uprop.setUsername(userName)
38 .setName("TST_Username")
39 .setFirstName("TST_FirstName")
40 .setDisplayName("TST_test.user")
41 .setMailAddress("noreply@salome-platform.org")
44 User user = new User(uprop);
49 * Create a transient study.
51 * @param user the user that will be placed in 'manager' and 'actor' properties
52 * @return the test study
53 * @throws BusinessException if something's wrong
55 public static Study getTestStudy(final User user) throws BusinessException{
56 Study.Properties studyProps = new Study.Properties();
57 studyProps.setActor(user)
59 .setTitle("a test study")
60 //.setDescription("description")
62 .setReference("test reference")
63 .setSimulationContexts(new ArrayList<SimulationContext>())
64 .setState(ProgressState.inWORK)
65 .setVisibility(Visibility.PUBLIC);
66 Study study = new Study(studyProps);