Search in sources :

Example 6 with SkillDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.SkillDTO in project ArachneCentralAPI by OHDSI.

the class UserProfileDTOToUserConverter method convert.

@Override
public User convert(UserProfileDTO dto) {
    User user = new User();
    HashSet<Skill> skills = new HashSet<>();
    if (dto.getSkills() != null) {
        for (SkillDTO skillDTO : dto.getSkills()) {
            skills.add(conversionService.convert(skillDTO, Skill.class));
        }
    }
    user.setSkills(skills);
    return user;
}
Also used : Skill(com.odysseusinc.arachne.portal.model.Skill) User(com.odysseusinc.arachne.portal.model.User) SkillDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.SkillDTO) HashSet(java.util.HashSet)

Example 7 with SkillDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.dictionary.SkillDTO 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)

Aggregations

SkillDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.SkillDTO)7 DatabaseSetup (com.github.springtestdbunit.annotation.DatabaseSetup)2 ExpectedDatabase (com.github.springtestdbunit.annotation.ExpectedDatabase)2 Skill (com.odysseusinc.arachne.portal.model.Skill)2 ApiOperation (io.swagger.annotations.ApiOperation)2 HashSet (java.util.HashSet)2 Test (org.junit.Test)2 MvcResult (org.springframework.test.web.servlet.MvcResult)2 FieldError (org.springframework.validation.FieldError)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 UserLinkDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserLinkDTO)1 UserProfileDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserProfileDTO)1 UserProfileGeneralDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserProfileGeneralDTO)1 UserPublicationDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserPublicationDTO)1 User (com.odysseusinc.arachne.portal.model.User)1 UserLink (com.odysseusinc.arachne.portal.model.UserLink)1 UserPublication (com.odysseusinc.arachne.portal.model.UserPublication)1 LinkedList (java.util.LinkedList)1