Search in sources :

Example 71 with DatabaseSetup

use of com.github.springtestdbunit.annotation.DatabaseSetup in project ArachneCentralAPI by OHDSI.

the class StudyControllerTests method testUpdateStudyType.

@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-type.xml", assertionMode = NON_STRICT_UNORDERED) })
public void testUpdateStudyType() throws Exception {
    StudyDTO updatedStudyDTO = new StudyDTO();
    updatedStudyDTO.setId(STUDY_ID);
    updatedStudyDTO.setDescription("description");
    StudyTypeDTO type = new StudyTypeDTO(1L);
    type.setName("type1");
    updatedStudyDTO.setType(type);
    StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
    updatedStudyDTO.setStatus(status);
    testUpdate(updatedStudyDTO, UPDATED_STUDY_TYPE_JSON_OBJECT, "type1");
}
Also used : CreateStudyDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateStudyDTO) StudyDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO) StudyStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO) StudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup)

Example 72 with DatabaseSetup

use of com.github.springtestdbunit.annotation.DatabaseSetup in project ArachneCentralAPI by OHDSI.

the class StudyControllerTests method testUpdateStudyStatus.

@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-status.xml", assertionMode = NON_STRICT_UNORDERED) })
public void testUpdateStudyStatus() throws Exception {
    StudyDTO updatedStudyDTO = new StudyDTO();
    updatedStudyDTO.setId(STUDY_ID);
    updatedStudyDTO.setDescription("description");
    StudyTypeDTO type = new StudyTypeDTO(STUDY_TYPE_ID);
    type.setName("type1");
    updatedStudyDTO.setType(type);
    StudyStatusDTO status = new StudyStatusDTO(2L, "Active");
    updatedStudyDTO.setStatus(status);
    testUpdate(updatedStudyDTO, UPDATED_STUDY_STATUS_JSON_OBJECT, "Active");
}
Also used : CreateStudyDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateStudyDTO) StudyDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO) StudyStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO) StudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup)

Example 73 with DatabaseSetup

use of com.github.springtestdbunit.annotation.DatabaseSetup in project ArachneCentralAPI by OHDSI.

the class StudyControllerTests method testUpdateStudyDescription.

@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-description.xml", assertionMode = NON_STRICT) })
public void testUpdateStudyDescription() throws Exception {
    StudyDTO updatedStudyDTO = new StudyDTO();
    updatedStudyDTO.setId(STUDY_ID);
    updatedStudyDTO.setDescription(UPDATED_DESCRIPTION);
    StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
    updatedStudyDTO.setStatus(status);
    testUpdate(updatedStudyDTO, UPDATED_STUDY_JSON_OBJECT, null);
}
Also used : CreateStudyDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateStudyDTO) StudyDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO) StudyStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup)

Example 74 with DatabaseSetup

use of com.github.springtestdbunit.annotation.DatabaseSetup in project ArachneCentralAPI by OHDSI.

the class SkillControllerTests method testUpdateSkill.

@Test
@DatabaseSetup("/data/skill/skill-before-updating.xml")
@ExpectedDatabase(value = "/data/skill/skill-after-updating.xml", assertionMode = NON_STRICT)
public void testUpdateSkill() throws Exception {
    SkillDTO skillDTO = new SkillDTO();
    skillDTO.setId(SKILL_ID);
    skillDTO.setName(UPDATED_SKILL_NAME);
    MvcResult mvcResult = mvc.perform(put("/api/v1/admin/skills/" + SKILL_ID).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(skillDTO))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
    JSONAssert.assertEquals(UPDATED_SKILL_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
Also used : SkillDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.SkillDTO) MvcResult(org.springframework.test.web.servlet.MvcResult) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup)

Example 75 with DatabaseSetup

use of com.github.springtestdbunit.annotation.DatabaseSetup in project ArachneCentralAPI by OHDSI.

the class StudyTypeControllerTests method testUpdateStudyType.

@Test
@DatabaseSetup("/data/study/type/study-type-before-updating.xml")
@ExpectedDatabase(value = "/data/study/type/study-type-after-updating.xml", assertionMode = NON_STRICT)
public void testUpdateStudyType() throws Exception {
    StudyTypeDTO dto = new StudyTypeDTO(ID);
    dto.setName(UPDATED_NAME);
    MvcResult mvcResult = mvc.perform(put("/api/v1/admin/study-types/" + ID).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(dto))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andReturn();
    JSONAssert.assertEquals(UPDATED_STUDY_TYPE_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
Also used : MvcResult(org.springframework.test.web.servlet.MvcResult) CreateStudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.CreateStudyTypeDTO) StudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup)

Aggregations

DatabaseSetup (com.github.springtestdbunit.annotation.DatabaseSetup)79 Test (org.junit.Test)78 ExpectedDatabase (com.github.springtestdbunit.annotation.ExpectedDatabase)53 DatabaseTearDown (com.github.springtestdbunit.annotation.DatabaseTearDown)44 MvcResult (org.springframework.test.web.servlet.MvcResult)26 Account_ (indi.mybatis.flying.pojo.Account_)25 Account_Condition (indi.mybatis.flying.pojo.condition.Account_Condition)22 WithUserDetails (org.springframework.security.test.context.support.WithUserDetails)21 LoginLog_ (indi.mybatis.flying.pojo.LoginLog_)12 LoginLog_Condition (indi.mybatis.flying.pojo.condition.LoginLog_Condition)11 ArrayList (java.util.ArrayList)11 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)8 CreateStudyDTO (com.odysseusinc.arachne.portal.api.v1.dto.CreateStudyDTO)7 StudyDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO)6 StudyStatusDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO)6 IfProfileValue (org.springframework.test.annotation.IfProfileValue)5 StudyTypeDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO)4 Order (indi.mybatis.flying.pagination.Order)4 SortParam (indi.mybatis.flying.pagination.SortParam)4 Role_ (indi.mybatis.flying.pojo.Role_)4