Package org.apache.rave.model

Examples of org.apache.rave.model.Person


        verify(repository, pageContext, servletContext, wContext, writer);
    }

    @Test
    public void doStartTag_noResult() throws IOException, JspException {
        Person p = new PersonImpl();

        expect(repository.get(null)).andReturn(null);
        expect(pageContext.getServletContext()).andReturn(servletContext).anyTimes();
        expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)).andReturn(wContext).anyTimes();
        expect(wContext.getBean(PersonRepository.class)).andReturn(repository).anyTimes();
View Full Code Here


        verify(repository, pageContext, servletContext, wContext, writer);
    }

    @Test
    public void doStartTag_noResult_ScopeSet() throws IOException, JspException {
        Person p = new PersonImpl();

        expect(repository.get(null)).andReturn(null);
        expect(pageContext.getServletContext()).andReturn(servletContext).anyTimes();
        expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)).andReturn(wContext).anyTimes();
        expect(wContext.getBean(PersonRepository.class)).andReturn(repository).anyTimes();
View Full Code Here

        assertThat(p.getUsername(), is(VALID_USER));
    }

    @Test
    public void findByUsername_valid() {
        Person person = repository.findByUsername(VALID_USER);
        assertThat(person, is(not(nullValue())));
        assertThat(person.getUsername(), is(equalTo(VALID_USER)));
    }
View Full Code Here

        assertThat(person, is(not(nullValue())));
        assertThat(person.getUsername(), is(equalTo(VALID_USER)));
    }
    @Test
    public void findByUsername_null() {
        Person person = repository.findByUsername(INVALID_USERNAME);
        assertThat(person, is(nullValue()));
    }
View Full Code Here

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void save_existing() {
        final String UPDATED_ABOUT_ME = "updated about me";
        Person person = repository.get(VALID_ID);
        assertThat(person.getAboutMe(), is(not(UPDATED_ABOUT_ME)));
        person.setAboutMe(UPDATED_ABOUT_ME);
        repository.save(person);
        assertThat(repository.get(VALID_ID).getAboutMe(), is(UPDATED_ABOUT_ME));
    }
View Full Code Here

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void delete_jpaObject() {
        Person person = repository.get(VALID_ID);
        assertThat(person, is(notNullValue()));
        repository.delete(person);
        person = repository.get(VALID_ID);
        assertThat(person, is(nullValue()));
    }
View Full Code Here

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void delete_implObject() {
        Person person = repository.get(VALID_ID);
        assertThat(person, is(notNullValue()));
        PersonImpl impl = new PersonImpl();
        impl.setUsername(person.getUsername());
        repository.delete(impl);
        person = repository.get(VALID_ID);
        assertThat(person, is(nullValue()));
    }
View Full Code Here

        assertThat(friendsUser2.size(), is(equalTo(0)));
    }

    @Test
    public void read_properties() {
        Person person = repository.get(VALID_ID);
      assertThat(person.getProperties().size(), is(1));
    }
View Full Code Here

        return getSingleResult(query.getResultList());
    }

    @Override
    public List<Person> findAllConnectedPeople(String username) {
        Person person = findByUsername(username);
        List<Person> connections = Lists.newLinkedList();
        if (person != null) {
            String personId = person.getId();
            connections.addAll(findFriends(username));
            TypedQuery<JpaGroup> members = manager.createQuery("SELECT g from JpaGroup g where :userId member of g.members", JpaGroup.class);
            members.setParameter("userId", personId);
            for(JpaGroup groups : members.getResultList()) {
                addPeopleByIds(groups, connections);
View Full Code Here

    }

    private void addPeopleByIds(JpaGroup result, List<Person> members) {
        if (result != null) {
            for (String personId : result.getMemberIds()) {
                Person person = get(personId);
                if (!members.contains(person)) {
                    members.add(person);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.rave.model.Person

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.