@Before public void setUp() throws Exception { individualGroup = userGroupDAO.findGroup(TEST_USER_NAME, true); if (individualGroup == null) { individualGroup = new UserGroup(); individualGroup.setName(TEST_USER_NAME); individualGroup.setIsIndividual(true); individualGroup.setCreationDate(new Date()); individualGroup.setId(userGroupDAO.create(individualGroup)); } if (node == null) { node = NodeTestUtils.createNew("foo", Long.parseLong(individualGroup.getId())); node.setId(nodeDAO.createNew(node)); } ; if (node2 == null) { node2 = NodeTestUtils.createNew("bar", Long.parseLong(individualGroup.getId())); node2.setId(nodeDAO.createNew(node2)); } ; }
@Before public void setUp() throws DatastoreException, InvalidModelException, NotFoundException { // create a node Node toCreate = NodeTestUtils.createNew(name, userId); toCreate.setVersionComment("This is the first version of the first node ever!"); toCreate.setVersionLabel("0.0.1"); nodeId = nodeDAO.createNew(toCreate).substring(3); // trim "syn" from node ID // Initialize a new Evaluation EvaluationDBO evaluation = new EvaluationDBO(); evaluation.setId(evalId); evaluation.seteTag("etag"); evaluation.setName("name"); evaluation.setOwnerId(userId); evaluation.setContentSource(KeyFactory.ROOT_ID); evaluation.setCreatedOn(System.currentTimeMillis()); evaluation.setStatusEnum(EvaluationStatus.PLANNED); evalId = dboBasicDao.createNew(evaluation).getId(); // Initialize a new Participant ParticipantDBO participant = new ParticipantDBO(); participant.setUserId(userId); participant.setEvalId(evalId); participant.setCreatedOn(System.currentTimeMillis()); participant.setId(idGenerator.generateNewId(TYPE.PARTICIPANT_ID)); dboBasicDao.createNew(participant); // Initialize a new Submission SubmissionDBO submission = new SubmissionDBO(); submission.setId(submissionId); submission.setName(name); submission.setEntityId(Long.parseLong(nodeId)); submission.setVersionNumber(1L); submission.setUserId(userId); submission.setEvalId(evalId); submission.setCreatedOn(System.currentTimeMillis()); dboBasicDao.createNew(submission); }
@Before public void setUp() throws Exception { individualGroup = userGroupDAO.findGroup(TEST_USER_NAME, true); if (individualGroup == null) { individualGroup = new UserGroup(); individualGroup.setName(TEST_USER_NAME); individualGroup.setIsIndividual(true); individualGroup.setCreationDate(new Date()); individualGroup.setId(userGroupDAO.create(individualGroup)); } individualGroup2 = userGroupDAO.findGroup(TEST_USER_NAME, true); if (individualGroup2 == null) { individualGroup2 = new UserGroup(); individualGroup2.setName(TEST_USER_NAME_2); individualGroup2.setIsIndividual(true); individualGroup2.setCreationDate(new Date()); individualGroup2.setId(userGroupDAO.create(individualGroup2)); } if (node == null) { node = NodeTestUtils.createNew("foo", Long.parseLong(individualGroup.getId())); node.setId(nodeDAO.createNew(node)); } ; if (node2 == null) { node2 = NodeTestUtils.createNew("bar", Long.parseLong(individualGroup.getId())); node2.setId(nodeDAO.createNew(node2)); } ; accessRequirement = DBOAccessRequirementDAOImplTest.newEntityAccessRequirement(individualGroup, node, "foo"); accessRequirement = accessRequirementDAO.create(accessRequirement); Long id = accessRequirement.getId(); assertNotNull(id); if (evaluation == null) { evaluation = DBOAccessRequirementDAOImplTest.createNewEvaluation( "foo", individualGroup.getId(), idGenerator, node.getId()); evaluation.setId(evaluationDAO.create(evaluation, Long.parseLong(individualGroup.getId()))); } ; accessRequirement2 = DBOAccessRequirementDAOImplTest.newMixedAccessRequirement( individualGroup, node2, evaluation, "bar"); accessRequirement2 = accessRequirementDAO.create(accessRequirement2); id = accessRequirement2.getId(); assertNotNull(id); if (participateAndDownload == null) { participateAndDownload = new ArrayList<ACCESS_TYPE>(); participateAndDownload.add(ACCESS_TYPE.DOWNLOAD); participateAndDownload.add(ACCESS_TYPE.PARTICIPATE); } if (downloadAccessType == null) { downloadAccessType = new ArrayList<ACCESS_TYPE>(); downloadAccessType.add(ACCESS_TYPE.DOWNLOAD); } if (updateAccessType == null) { updateAccessType = new ArrayList<ACCESS_TYPE>(); updateAccessType.add(ACCESS_TYPE.UPDATE); } }