use of com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO in project ArachneCentralAPI by OHDSI.
the class StudyToStudyShortDTOConverter method convert.
@Override
public StudyShortDTO convert(Study source) {
StudyShortDTO studyDTO = new StudyShortDTO();
studyDTO.setId(source.getId());
studyDTO.setTitle(source.getTitle());
return studyDTO;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyEndDate.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-end-date.xml", assertionMode = NON_STRICT) })
public void testUpdateStudyEndDate() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setDescription("description");
updatedStudyDTO.setEndDate(UPDATED_DATE);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_END_DATE_JSON_OBJECT, UPDATED_DATE);
}
use of com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyStartDate.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-start-date.xml", assertionMode = NON_STRICT) })
public void testUpdateStudyStartDate() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setDescription("description");
updatedStudyDTO.setStartDate(UPDATED_DATE);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_START_DATE_JSON_OBJECT, UPDATED_DATE);
}
use of com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyTitle.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-title.xml", assertionMode = NON_STRICT) })
public void testUpdateStudyTitle() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setTitle("Study Title New");
updatedStudyDTO.setDescription("description");
StudyTypeDTO type = new StudyTypeDTO(STUDY_TYPE_ID);
type.setName("type");
updatedStudyDTO.setType(type);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_TITLE_JSON_OBJECT, UPDATED_STUDY_TITLE);
}
use of com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testCreateStudy.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/user/admin-user.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study.xml", assertionMode = NON_STRICT) })
public void testCreateStudy() throws Exception {
CreateStudyDTO studyDTO = new CreateStudyDTO();
studyDTO.setTypeId(STUDY_TYPE_ID);
studyDTO.setTitle(STUDY_TITLE);
MvcResult mvcResult = mvc.perform(post("/api/v1/study-management/studies/").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(studyDTO))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(NO_ERROR_CODE).andExpect(OK_STATUS).andReturn();
JSONObject result = getResultJSONObject(mvcResult);
JSONAssert.assertEquals(STUDY_JSON_OBJECT, result, false);
}
Aggregations