Package org.jtalks.jcommune.model.entity

Examples of org.jtalks.jcommune.model.entity.Branch


                grant(eq(sids), eq(listFromArray(changes.getPermission())), eq(branch));
    }

    @Test
    public void testRestrictGrantsOfAnonymousGroup() throws Exception {
        Branch branch = ObjectsFactory.getDefaultBranch();
        PermissionChanges changes = new PermissionChanges(BranchPermission.CLOSE_TOPICS);
        List<Group> groupList = new ArrayList<>();
        groupList.add(AnonymousGroup.ANONYMOUS_GROUP);
        changes.addNewlyAddedGroups(groupList);
        manager.changeRestrictions(branch, changes);
View Full Code Here


                restrict(eq(sids), eq(listFromArray(changes.getPermission())), eq(branch));
    }

    @Test
    public void testDeleteGrantsOfAnonymousGroup() throws Exception {
        Branch branch = ObjectsFactory.getDefaultBranch();
        PermissionChanges changes = new PermissionChanges(BranchPermission.CLOSE_TOPICS);
        changes.addRemovedGroups(Lists.newArrayList(AnonymousGroup.ANONYMOUS_GROUP));
        manager.changeGrants(branch, changes);
        List<Sid> sids = Lists.<Sid>newArrayList(UserSid.createAnonymous());
View Full Code Here

     * @throws NotFoundException if no object is found for id given
     */
    @RequestMapping("branches/{id}/subscribe")
    @ResponseBody
    public ModelAndView subscribeToBranch(@PathVariable Long id, @RequestHeader(value = "X-Requested-With", defaultValue = "NotAjax") String header) throws NotFoundException {
        Branch branch = branchService.get(id);
        subscriptionService.toggleBranchSubscription(branch);
        if (header.equals("NotAjax")) {
            //redirect to new page
            return new ModelAndView("redirect:/branches/" + id);
        } else {
View Full Code Here

     * @throws NotFoundException if no object is found for id given
     */
    @RequestMapping("branches/{id}/unsubscribe")
    @ResponseBody
    public ModelAndView unsubscribeFromBranch(@PathVariable Long id, @RequestHeader(value = "X-Requested-With", defaultValue = "NotAjax") String header) throws NotFoundException {
        Branch branch = branchService.get(id);
        subscriptionService.toggleBranchSubscription(branch);
        if (header.equals("NotAjax")) {
            //redirect to new page
            return new ModelAndView("redirect:/branches/" + id);
        } else {
View Full Code Here

        JCUser user = new JCUser("user", "mail@mail.com", "password");

        section = new Section("Section Name");
        section.setId(ID);

        branch = new Branch("Branch Name", "Branch description");
        branch.setId(ID);
        section.addOrUpdateBranch(branch);
        branch.setSection(section);

        topic = new Topic(user, "Topic Name");
View Full Code Here

     * @return {@code ModelAndView} object with "codeReviewForm" view, new {@link TopicDto} and branch id
     * @throws NotFoundException when branch was not found
     */
    @RequestMapping(value = "/reviews/new", method = RequestMethod.GET)
    public ModelAndView showNewCodeReviewPage(@RequestParam(BRANCH_ID) Long branchId) throws NotFoundException {
        Branch branch = branchService.get(branchId);
        Topic topic = new Topic();
        topic.setBranch(branch);
        TopicDto dto = new TopicDto(topic);
        return new ModelAndView(CODE_REVIEW_VIEW)
                .addObject(TOPIC_DTO, dto)
View Full Code Here

     */
    @RequestMapping(value = "/reviews/new", method = RequestMethod.POST)
    public ModelAndView createCodeReview(@Valid @ModelAttribute TopicDto topicDto,
                                         BindingResult result,
                                         @RequestParam(BRANCH_ID) Long branchId) throws NotFoundException {
        Branch branch = branchService.get(branchId);
        if (result.hasErrors()) {
            return new ModelAndView(CODE_REVIEW_VIEW)
                    .addObject(TOPIC_DTO, topicDto)
                    .addObject(BRANCH_ID, branchId)
                    .addObject(SUBMIT_URL, "/reviews/new?branchId=" + branchId)
View Full Code Here

                userService,
                mailService,
                subscriptionService);
        topic = new Topic(user1, "title");
        topic.setId(TOPIC_ID);
        branch = new Branch("name", "description");
        branch.addTopic(topic);
        codeReview = new CodeReview();
        topic.setCodeReview(codeReview);
        codeReview.setTopic(topic);
       
View Full Code Here

    }

    @Test
    public void testGetTopics() {
        String pageNumber = "50";
        Branch branch = createBranch();
        Page<Topic> expectedPage = new PageImpl<>(Collections.<Topic>emptyList());

        JCUser currentUser = new JCUser("current", null, null);
        currentUser.setPageSize(50);
        when(userService.getCurrentUser()).thenReturn(currentUser);
View Full Code Here

        verify(topicDao).getTopics(
                Matchers.any(Branch.class), Matchers.any(PageRequest.class));
    }

    private Branch createBranch() {
        Branch branch = new Branch("branch name", "branch description");
        branch.setId(1L);
        branch.setUuid("uuid");
        return branch;
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.entity.Branch

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.