Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.Widget


    }

    @Test
    public void viewAdminWidgetDetail() throws Exception {
        Model model = new ExtendedModelMap();
        Widget widget = new Widget();
        final long entityId = 123L;
        widget.setEntityId(entityId);
        widget.setTitle("My widget");

        expect(service.getWidget(entityId)).andReturn(widget);
        expect(categoryService.getAll()).andReturn(categories);
        replay(service, categoryService);
        String adminWidgetDetailView = controller.viewWidgetDetail(entityId, model);
View Full Code Here


    }

    @Test
    public void updateWidget_valid() {
        final String widgetUrl = "http://example.com/widget";
        Widget widget = new Widget(123L, widgetUrl);
        widget.setTitle("Widget title");
        widget.setType("OpenSocial");
        widget.setDescription("Lorem ipsum");
        BindingResult errors = new BeanPropertyBindingResult(widget, "widget");
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        ModelMap modelMap = new ExtendedModelMap();

        expect(service.getWidgetByUrl(widgetUrl)).andReturn(widget);
View Full Code Here

    }

    @Test(expected = SecurityException.class)
    public void updateWidget_wrongToken() {
        Widget widget = new Widget();
        BindingResult errors = new BeanPropertyBindingResult(widget, "widget");
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        ModelMap modelMap = new ExtendedModelMap();

        sessionStatus.setComplete();
View Full Code Here

        assertFalse("Can't come here", true);
    }

    @Test
    public void updateWidget_invalid() {
        Widget widget = new Widget(123L, "http://broken/url");
        BindingResult errors = new BeanPropertyBindingResult(widget, "widget");
        SessionStatus sessionStatus = createMock(SessionStatus.class);
        ModelMap modelMap = new ExtendedModelMap();

        String view = controller.updateWidgetDetail(widget, errors, validToken, validToken, modelMap, sessionStatus);
View Full Code Here


    private static SearchResult<Widget> populateWidgetSearchResult() {
        List<Widget> widgetList = new ArrayList<Widget>();
        for (int i = 0; i < DEFAULT_PAGESIZE; i++) {
            Widget widget = new Widget();
            widget.setTitle("Widget " + i);
            widgetList.add(widget);
        }
        return new SearchResult<Widget>(widgetList, 25);
    }
View Full Code Here

        verify(widgetRepository);
    }

    @Test
    public void getLimitedListOfWidgets() {
        Widget widget1 = new Widget(1L, "http://example.com/widget1.xml");
        Widget widget2 = new Widget(2L, "http://example.com/widget2.xml");
        List<Widget> widgets = new ArrayList<Widget>();
        widgets.add(widget1);
        widgets.add(widget2);
        final int pageSize = 10;
        expect(widgetRepository.getCountAll()).andReturn(1);
View Full Code Here

        verify(widgetRepository);
    }

    @Test
    public void getPublishedWidgets() {
        Widget widget1 = new Widget(1L, "http://example.com/widget1.xml");
        widget1.setWidgetStatus(WidgetStatus.PUBLISHED);
        Widget widget2 = new Widget(2L, "http://example.com/widget2.xml");
        widget2.setWidgetStatus(WidgetStatus.PUBLISHED);
        List<Widget> widgets = new ArrayList<Widget>();
        widgets.add(widget1);
        widgets.add(widget2);
        final int pageSize = 10;
        expect(widgetRepository.getCountByStatus(WidgetStatus.PUBLISHED)).andReturn(1);
View Full Code Here

     *            the source {@link org.apache.rave.portal.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 long referringPageId) {
        final Widget widget = new Widget();
        model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
        model.addAttribute(ModelKeys.WIDGET, widget);
        return ViewNames.ADD_WIDGET_FORM;
    }
View Full Code Here

            return ViewNames.ADD_WIDGET_FORM;
        }
        widget.setWidgetStatus(WidgetStatus.PREVIEW);
        widget.setOwner(user);

        final Widget storedWidget = widgetService.registerNewWidget(widget);
        return "redirect:/app/store/widget/" + storedWidget.getEntityId() + "?referringPageId=" + referringPageId;
    }
View Full Code Here

        verify(widgetRepository);
    }

    @Test
    public void getWidget() {
        Widget w = new Widget();
        expect(widgetRepository.get(1L)).andReturn(w);
        replay(widgetRepository);

        Widget result = widgetService.getWidget(1L);
        assertThat(result, is(sameInstance(w)));
        verify(widgetRepository);
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.Widget

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.