Package cz.muni.fi.pa165.ddtroops.entities

Examples of cz.muni.fi.pa165.ddtroops.entities.Skill


   
    @Transactional
    @Secured("ROLE_SUPERVISOR")
    public SkillDTO createNewSkill(String name, String description, String profession, Long minXP)
    {
        Skill s = new EntityBuilder<Skill>(Skill.class)
                .withProperty("Name", name)
                .withProperty("Description", description)
                .withProperty("Profession", profession)
                .withProperty("minXP", minXP)
                .Build();
View Full Code Here


    @Transactional(readOnly=true)
    @Secured("IS_AUTHENTICATED_ANONYMOUSLY")
    public SkillDTO getById(Long id)
    {
        Skill s = dao.getById(id);
        return (s!=null)?DTOFactory.createSkillDTO(s):null;
    }
View Full Code Here

        return hero;
    }

    public static Skill createSkill(SkillDTO skillDTO){
        Skill skill = new Skill();

        skill.setDescription(skillDTO.description);
        skill.setId(skillDTO.id);
        skill.setMinXP(skillDTO.minXP);
        skill.setName(skillDTO.name);
        skill.setProfession(skillDTO.profession);

        return skill;
    }
View Full Code Here

     * Test checks whether skill after creation has received id
     */
     @Test
    public void testHasIdAfterCreation(){

        Skill newSkill = new Skill();
        newSkill.setDescription("Brand new skill");
        newSkill.setName("New skill");
        newSkill.setMinXP(1000L);
        newSkill.setProfession("Wizard");
        skillDAO.create(newSkill);

        assertNotNull(newSkill.getId());
    }
View Full Code Here

     * Test checks whether the skill was created in db and can be retreived.
     */
     @Test
    public void testCreate(){

        Skill newSkill = new Skill();
        newSkill.setDescription("Brand new skill");
        newSkill.setName("Created skill");
        newSkill.setMinXP(1000L);
        newSkill.setProfession("Wizard");
        newSkill.setDescription("abc");

        skillDAO.create(newSkill);

        Skill fromDB = skillDAO.getById(newSkill.getId());

        assertEquals(newSkill,fromDB);
    }
View Full Code Here

     * Test checks whether a skill can be retreived by id.
     */
      @Test
    public void testGetById(){

        Skill newSkill = new Skill();
        newSkill.setDescription("Brand new skill");
        newSkill.setName("New skill");
        newSkill.setMinXP(1000L);
        newSkill.setProfession("Wizard");
        skillDAO.create(newSkill);
        Skill skillFromDB = skillDAO.getById(newSkill.getId());

        assertEquals(newSkill, skillFromDB);
    }
View Full Code Here

     * Test checks update function on persisted object.
     */
       @Test
    public void testUpdate(){

        Skill newSkill = new Skill();
        newSkill.setDescription("Brand new skill");
        newSkill.setName("New skill");
        newSkill.setMinXP(1000L);
        newSkill.setProfession("Wizard");
        skillDAO.create(newSkill);

        newSkill.setName("Edited");

        skillDAO.update(newSkill);

        Skill control = skillDAO.getById(newSkill.getId());

        assertEquals("Edited", control.getName());
    }
View Full Code Here

    /**
     * Test checks retreival of all the skills.
     */
        @Test
    public void testGetAll(){
        Skill newSkill = new Skill();
        newSkill.setDescription("Brand new skill");
        newSkill.setName("New skill");
        newSkill.setMinXP(1000L);
        newSkill.setProfession("Wizard");

        Skill anotherSkill = new Skill();
        anotherSkill.setDescription("Brand new skill");
        anotherSkill.setName("New skill");
        anotherSkill.setMinXP(1000L);
        anotherSkill.setProfession("Wizard");

        skillDAO.create(newSkill);
        skillDAO.create(anotherSkill);

        List<Skill> skills = skillDAO.getAll();
View Full Code Here

    /**
     * Test checks delete method by deleting all entries in db.
     */
         @Test
    public void testDelete(){
        Skill newSkill = new Skill();
        newSkill.setDescription("Brand new skill");
        newSkill.setName("New skill");
        newSkill.setMinXP(1000L);
        newSkill.setProfession("Wizard");
        skillDAO.create(newSkill);
        List<Skill> skills = skillDAO.getAll();

        for(Skill s:skills){
            skillDAO.delete(s);
View Full Code Here

    }

    @Test
    public void testSkills(){
        hero = getHero();
        Skill newSkill = new Skill();
        newSkill.setDescription("Brand new skill");
        newSkill.setName("New skill");
        newSkill.setMinXP(1000L);
        newSkill.setProfession("Wizard");

        skillDao.create(newSkill);
        assertTrue(hero.getSkills().isEmpty());

        hero.addSkill(newSkill);
View Full Code Here

TOP

Related Classes of cz.muni.fi.pa165.ddtroops.entities.Skill

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.