Package sagan.team

Examples of sagan.team.MemberProfile


        return teamRepository.findById(id);
    }

    @Cacheable(DatabaseConfig.CACHE_NAME)
    public MemberProfile fetchMemberProfileUsername(String username) {
        MemberProfile profile = teamRepository.findByUsername(username);
        if (profile == null) {
            profile = MemberProfile.NOT_FOUND;
        }
        return profile;
    }
View Full Code Here


    public List<MemberProfile> fetchHiddenMembers() {
        return teamRepository.findByHiddenOrderByNameAsc(true);
    }

    public MemberProfile createOrUpdateMemberProfile(Long githubId, String username, String avatarUrl, String name) {
        MemberProfile profile = teamRepository.findByGithubId(githubId);

        if (profile == null) {
            profile = new MemberProfile();
            profile.setGithubId(githubId);
            profile.setUsername(username);
            profile.setAvatarUrl(avatarUrl);
            profile.setName(name);
            profile.setHidden(true);
        }

        profile.setGithubUsername(username);
        return teamRepository.save(profile);
    }
View Full Code Here

        SecurityContextHolder.clearContext();
    }

    @Test
    public void signInSunnyDay() {
        MemberProfile newMember = new MemberProfile();
        given(signInService.getOrCreateMemberProfile(anyLong(), any(GitHub.class))).willReturn(newMember);
        given(connection.getDisplayName()).willReturn("dsyer");
        given(signInService.isSpringMember(eq("dsyer"), any(GitHub.class))).willReturn(true);

        adapter.signIn("12345", connection, new ServletWebRequest(new MockHttpServletRequest()));
View Full Code Here

    }

    public Post createPostFromPostForm(PostForm postForm, String username) {
        String content = postForm.getContent();
        Post post = new Post(postForm.getTitle(), content, postForm.getCategory());
        MemberProfile profile = teamRepository.findByUsername(username);
        post.setAuthor(profile);
        post.setCreatedAt(createdDate(postForm, dateFactory.now()));

        setPostProperties(postForm, content, post);
        return post;
View Full Code Here

    @Test
    public void creatingABlogPostRecordsTheUser() {
        String username = "username";

        MemberProfile member = new MemberProfile();
        member.setUsername(username);

        given(teamRepository.findById(12345L)).willReturn(member);
        PostForm postForm = new PostForm();

        given(blogService.addPost(eq(postForm), anyString())).willReturn(TEST_POST);
View Full Code Here

    @Test
    public void redirectToPostAfterCreation() throws Exception {
        String username = "username";

        MemberProfile member = new MemberProfile();
        member.setUsername(username);

        given(teamRepository.findById(12345L)).willReturn(member);

        PostForm postForm = new PostForm();
        postForm.setTitle("title");
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void attemptingToCreateADuplicatePostReturnsToPostForm() throws Exception {
        String username = "username";

        MemberProfile member = new MemberProfile();
        member.setUsername(username);

        given(teamRepository.findById(12345L)).willReturn(member);

        PostForm postForm = new PostForm();
        postForm.setTitle("title");
View Full Code Here

        mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
    }

    @Test
    public void getTeamPageOnlyShowsNotHiddenMembers() throws Exception {
        MemberProfile visible = new MemberProfile();
        visible.setName("First Last");
        visible.setGithubUsername("someguy");
        visible.setUsername("someguy");

        teamRepository.save(visible);

        MemberProfile hidden = new MemberProfile();
        hidden.setName("Other dude");
        hidden.setGithubUsername("dude");
        hidden.setUsername("dude");
        hidden.setHidden(true);

        teamRepository.save(hidden);

        mockMvc.perform(get("/team"))
                .andExpect(status().isOk())
View Full Code Here

    private boolean broadcast;
    private boolean draft;

    public PostBuilder() {
        title = "My Post";
        author = new MemberProfile();
        author.setUsername("test");
        category = PostCategory.ENGINEERING;
        rawContent = "post body";
        renderedContent = "post body";
        renderedSummary = "summary";
View Full Code Here

    @Autowired
    private TeamService teamService;

    @Test
    public void newlyCreatedTeamMembersAreHiddenByDefault() throws Exception {
        MemberProfile jdoe = teamService.createOrUpdateMemberProfile(123L, "jdoe", "http://avatarurl.com", "John Doe");
        assertThat(jdoe.isHidden(), is(true));
    }
View Full Code Here

TOP

Related Classes of sagan.team.MemberProfile

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.