Package se.inera.ifv.casebox.core.entity

Examples of se.inera.ifv.casebox.core.entity.Question


    @PersistenceContext
    EntityManager entityManager;

    @Test
    public void testPersist() throws Exception {
        Question question = new Question("bepa", "Some serializable object");
        questionRepository.persist(question);

        entityManager.flush();
        entityManager.clear();
View Full Code Here


        assertEquals(1, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) FROM QUESTION"));
    }

    @Test
    public void testFindByCareUnit() throws Exception {
        Question question = new Question("bepa", "Some serializable object");
        questionRepository.persist(question);

        entityManager.flush();
        entityManager.clear();

View Full Code Here

    }

    @Test
    public void testOrder() throws Exception {
        for(int i = 0 ; i < 5 ; i++) {
            entityManager.persist(new Question("careUnit1","Some content"));
        }
       
        entityManager.flush();
        entityManager.clear();
       
View Full Code Here

        assertEquals(first + 4, questions.get(4).getId().intValue());
    }

    @Test
    public void testGetNumOfQuestions() throws Exception {
        questionRepository.persist(new Question("bepa", "Some serializable object"));
        questionRepository.persist(new Question("bepa", "Some serializable object"));
        questionRepository.persist(new Question("bepa", "Some serializable object"));
        questionRepository.persist(new Question("apa", "Some serializable object"));
        questionRepository.persist(new Question("apa", "Some serializable object"));

        entityManager.flush();
        entityManager.clear();
       
        long cnt = questionRepository.getNumOfQuestionsForCareUnit("bepa");
View Full Code Here

       
    }

    @Test
    public void testDelete() throws Exception {
        Question question = new Question("bepa", "Some serializable object");
        questionRepository.persist(question);

        entityManager.flush();
        entityManager.clear();

        questionRepository.remove(question.getId());

        entityManager.flush();

        assertEquals(0, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) FROM QUESTION"));
    }
View Full Code Here

    @PersistenceContext
    EntityManager entityManager;
   
    @Test
    public void testGetCareUnitInfos() throws Exception {
        questionRepository.persist(new Question("careUnit1", "message"));
        questionRepository.persist(new Question("careUnit1", "message"));
        questionRepository.persist(new Question("careUnit1", "message"));
        Question q = new Question("careUnit1", "message");
        q.setStatusRetrieved();
        questionRepository.persist(q);
        questionRepository.persist(new Question("careUnit2", "message"));
        questionRepository.persist(new Question("careUnit2", "message"));
       
        entityManager.flush();
        entityManager.clear();
       
        List<CareUnitInfo> info = new ArrayList<CareUnitInfo>(overviewService.getCareUnitInfos(5));
View Full Code Here

    @PersistenceContext
    EntityManager entityManager;

    @Test
    public void testFind() throws Exception {
        entityManager.persist(new Question("careUnit1", "Some serializable1"));
        entityManager.persist(new Question("careUnit2", "Some serializable2"));
        entityManager.persist(new Question("careUnit2", "Some serializable3"));

        entityManager.flush();
        entityManager.clear();

        assertEquals(1, questionService.getQuestionsForCareUnit("careUnit1").getQuestions().size());
View Full Code Here

    }

    @Test
    public void testFindMoreThanMax() throws Exception {
        for (int i = 0; i < 9; i++) {
            entityManager.persist(new Question("careUnit1", "Some serializable1"));
        }

        entityManager.flush();
        entityManager.clear();
View Full Code Here

    }

    @Test
    public void testFindAndChangeStatus() throws Exception {
        for (int i = 0; i < 4; i++) {
            entityManager.persist(new Question("careUnit1", "Some serializable1"));
        }

        entityManager.flush();
        entityManager.clear();
View Full Code Here

    }

    @Test
    public void testDelete() throws Exception {
        Question[] questions = new Question[5];
        questions[0] = new Question("careUnit1", "Some Serializable1");
        questions[1] = new Question("careUnit1", "Some Serializable2");
        questions[2] = new Question("careUnit1", "Some Serializable3");
        questions[3] = new Question("careUnit1", "Some Serializable4");
        questions[4] = new Question("careUnit2", "Some Serializable5");
        Set<Long> ids = new HashSet<Long>();
        for (Question q : questions) {
            entityManager.persist(q);
            q.setStatusRetrieved();
            if (q.getCareUnit().equals("careUnit1")) {
View Full Code Here

TOP

Related Classes of se.inera.ifv.casebox.core.entity.Question

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.