Package org.apache.rave.portal.model.impl

Examples of org.apache.rave.portal.model.impl.WidgetImpl


        int score = 838;
        item.setUserId(userId);
        item.setScore(score);
        item.setId(id);
        lookup.setId(id);
        Widget widget = new WidgetImpl();
        widget.setRatings(Arrays.asList((WidgetRating)lookup));

        expect(template.get(widgetId)).andReturn(widget);
        expect(template.save(widget)).andReturn(widget);
        replay(template);
View Full Code Here


    @Test
    public void save_Id_Null(){
        WidgetRating item = new WidgetRatingImpl();
        String widgetId = "5544";
        Widget widget = new WidgetImpl();
        widget.setRatings(new ArrayList<WidgetRating>());
        expect(template.get(widgetId)).andReturn(widget);
        expect(template.save(widget)).andReturn(widget);
        replay(template);

        WidgetRating widgetRating = ratingRepository.createWidgetRating(widgetId, item);
        assertTrue(widget.getRatings().contains(item));
        assertThat(widgetRating, is(sameInstance(item)));
    }
View Full Code Here

    }

    @Test
    public void save_Null(){
        WidgetRatingImpl item = new WidgetRatingImpl();
        Widget widget = new WidgetImpl();
        widget.setRatings(new ArrayList<WidgetRating>());
        String id = "123";
        String widgetId = "321";
        Widget saved = new WidgetImpl();
        saved.setRatings(new ArrayList<WidgetRating>());
        item.setId(id);
        expect(template.get(widgetId)).andReturn(widget);
        expect(template.save(widget)).andReturn(saved);
        replay(template);
View Full Code Here

    public void save_Diff_Id(){
        WidgetRating item = new WidgetRatingImpl();
        String widgetId = "3333";
        String itemId = "123";
        ((WidgetRatingImpl)item).setId(itemId);
        Widget widget = new WidgetImpl();
        WidgetRating exist = new WidgetRatingImpl();
        ((WidgetRatingImpl)exist).setId("4444");
        widget.setRatings(Arrays.asList(exist));

        expect(template.get(widgetId)).andReturn(widget);
        expect(template.save(widget)).andReturn(widget);
        replay(template);
View Full Code Here

    public void delete_Valid(){
        WidgetRating item = new WidgetRatingImpl();
        String widgetId = "387383";
        String id = "234";
        ((WidgetRatingImpl)item).setId(id);
        Widget widget = new WidgetImpl();
        ArrayList<WidgetRating> ratings = new ArrayList<WidgetRating>();
        ratings.add(item);
        widget.setRatings(ratings);
        expect(template.get(widgetId)).andReturn(widget);
        expect(template.save(widget)).andReturn(null);
        replay(template);

        ratingRepository.deleteWidgetRating(widgetId, item);
View Full Code Here

    @Test
    public void delete_Id_Not_Equals(){
         WidgetRating item = new WidgetRatingImpl();
        String widgetId = "32323";
        ((WidgetRatingImpl)item).setId("333333");
        Widget widget = new WidgetImpl();
        WidgetRating exist = new WidgetRatingImpl();
        ((WidgetRatingImpl)exist).setId("323");
        widget.setRatings(Arrays.asList(exist));
        expect(template.get(widgetId)).andReturn(widget);
        expect(template.save(widget)).andReturn(null);
        replay(template);

        ratingRepository.deleteWidgetRating(widgetId, item);
View Full Code Here

     *            the source {@link org.apache.rave.model.Page } ID
     * @return the view name of the Add new Widget form
     */
    @RequestMapping(method = RequestMethod.GET, value = "widget/add")
    public String viewAddWidgetForm(Model model, @RequestParam String referringPageId) {
        final Widget widget = new WidgetImpl();
        final String view = ViewNames.ADD_WIDGET_FORM;
        model.addAttribute(ModelKeys.MARKETPLACE, this.preferenceService.getPreference(PortalPreferenceKeys.EXTERNAL_MARKETPLACE_URL));
        model.addAttribute(ModelKeys.WIDGET, widget);
        model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
        ControllerUtils.addNavItemsToModel(view, model, referringPageId, userService.getAuthenticatedUser());
View Full Code Here

     *            the type of widget add form to display, e.g. W3C or OpenSocial (default)
     * @return the view name of the Add new Widget form
     */
    @RequestMapping(method = RequestMethod.GET, value = "widget/add/{type}")
    public String viewAddWidgetFormByType(Model model, @RequestParam String referringPageId, @PathVariable String type) {
        final Widget widget = new WidgetImpl();
        String view;
        if (type != null && type.equalsIgnoreCase("w3c")){
          view = ViewNames.ADD_WIDGET_W3C;
        } else {
          view = ViewNames.ADD_WIDGET_FORM;
View Full Code Here

        assertThat(types.contains(SUPPORTED_TYPE_2), is(true));
    }

    @Test
    public void render_supported_foo() {
        WidgetImpl w = new WidgetImpl();
        w.setId("1");
        w.setType(SUPPORTED_TYPE_1);

        RegionWidget rw = new RegionWidgetImpl();
        rw.setWidgetId(w.getId());

        RegionWidgetWrapper wrapper = new RegionWidgetWrapper(w, rw);

        expect(widgetRenderer1.render(wrapper, context)).andReturn(RENDERED_TYPE_1);
        expect(widgetRepository.get("1")).andReturn(w);
View Full Code Here

        assertThat(service.render(wrapper, context), is(equalTo(RENDERED_TYPE_1)));
    }

    @Test
    public void render_supported_bar() {
        WidgetImpl w = new WidgetImpl();
        w.setId("1");
        w.setType(SUPPORTED_TYPE_2);
        RegionWidget rw = new RegionWidgetImpl();
        rw.setWidgetId(w.getId());

        RegionWidgetWrapper wrapper = new RegionWidgetWrapper(w, rw);

        expect(widgetRenderer2.render(wrapper, context)).andReturn(RENDERED_TYPE_2);
        expect(widgetRepository.get("1")).andReturn(w);
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.impl.WidgetImpl

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.