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

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


    }

    @Test
    public void viewWidget() {
        Model model = new ExtendedModelMap();
        Widget w = new WidgetImpl(1L, "http://example.com/widget.xml");

        expect(widgetService.getAllWidgetStatistics(validUser.getId())).andReturn(allWidgetStatisticsMap);
        expect(tagService.getAllTags()).andReturn(new ArrayList<Tag>());
        expect(categoryService.getAll()).andReturn(new ArrayList<Category>());
        expect(widgetService.getWidget(WIDGET_ID)).andReturn(w);
View Full Code Here


        String searchTerm = "gAdGet";

        int offset = 0;
        int pagesize = 10;
        int totalResults = 2;
        WidgetImpl widget = new WidgetImpl();
        widget.setId(1L);
        List<Widget> widgets = new ArrayList<Widget>();
        widgets.add(widget);
        SearchResult<Widget> result = new SearchResult<Widget>(widgets, totalResults);
        result.setPageSize(pagesize);
View Full Code Here

    @Test
    public void doAddWidget() {
        final String widgetUrl = "http://example.com/newwidget.xml";
        final Model model = new ExtendedModelMap();
        final WidgetImpl widget = new WidgetImpl();
        widget.setId(1L);
        widget.setTitle("Widget title");
        widget.setUrl(widgetUrl);
        widget.setType("OpenSocial");
        widget.setDescription("Lorem ipsum");
        final BindingResult errors = new BeanPropertyBindingResult(widget, "widget");

        expect(widgetService.registerNewWidget(widget)).andReturn(widget);
        expect(widgetService.isRegisteredUrl(widgetUrl)).andReturn(false);
        replay(widgetService);
        String view = controller.viewAddWidgetResult(widget, errors, model,REFERRER_ID);
        verify(widgetService);

        assertEquals("redirect:/app/store/widget/" + widget.getId() +     "?referringPageId=" + REFERRER_ID, view);
        assertFalse("Valid widget data", errors.hasErrors());
    }
View Full Code Here

    @Test
    public void doAddWidget_existing() {
        final String widgetUrl = "http://example.com/existingwidget.xml";
        final Model model = new ExtendedModelMap();

        final WidgetImpl existingWidget = new WidgetImpl();
        existingWidget.setId(123L);
        existingWidget.setTitle("Widget title");
        existingWidget.setUrl(widgetUrl);
        existingWidget.setType("OpenSocial");

        final WidgetImpl widget = new WidgetImpl();
        widget.setTitle("Widget title");
        widget.setUrl(widgetUrl);
        widget.setType("OpenSocial");
        final BindingResult errors = new BeanPropertyBindingResult(widget, "widget");

        expect(widgetService.isRegisteredUrl(widgetUrl)).andReturn(true);
        replay(widgetService);
        String view = controller.viewAddWidgetResult(widget, errors, model,REFERRER_ID);
View Full Code Here

        assertNotNull(model.asMap().get(ModelKeys.WIDGET));
    }

    @Test
    public void doAddWidget_invalid() {
        final WidgetImpl widget = new WidgetImpl();
        widget.setTitle("Not enough data");
        final Model model = new ExtendedModelMap();
        final BindingResult errors = new BeanPropertyBindingResult(widget, "widget");
        String view = controller.viewAddWidgetResult(widget, errors, model,REFERRER_ID);
        assertTrue("Invalid widget data", errors.hasErrors());
        assertEquals(ViewNames.ADD_WIDGET_FORM, view);
View Full Code Here

        final long REGION_ID = 8675309L;

        expect(openSocialService.getGadgetMetadata(VALID_GADGET_URL)).andReturn(VALID_METADATA);
        replay(openSocialService);

        WidgetImpl w = new WidgetImpl();
        w.setId(WIDGET_ID);
        w.setType(Constants.WIDGET_TYPE);
        w.setUrl(VALID_GADGET_URL);
        Region region = new RegionImpl(REGION_ID);
        RegionWidget rw = new RegionWidgetImpl();
        rw.setId(REGION_WIDGET_ID);
        rw.setCollapsed(VALID_COLLAPSED);
        rw.setWidget(w);
View Full Code Here

        verify(scriptManager);
    }

    @Test
    public void render_null() {
        WidgetImpl w = new WidgetImpl();
        w.setType(Constants.WIDGET_TYPE);
        Region region = new RegionImpl(1L);
        RegionWidget rw = new RegionWidgetImpl();
        rw.setWidget(w);
        rw.setRegion(region);
View Full Code Here

        verify(scriptManager);
    }

    @Test(expected = NotSupportedException.class)
    public void render_invalid() {
        WidgetImpl w = new WidgetImpl();
        w.setType("NONE");
        w.setUrl("http://www.example.com/gadget.xml");
        RegionWidget rw = new RegionWidgetImpl();
        rw.setId(1L);
        rw.setWidget(w);

        renderer.render(rw, null);
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 WidgetImpl();
        final String view = ViewNames.ADD_WIDGET_FORM;
        model.addAttribute(ModelKeys.WIDGET, widget);
        model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
        ControllerUtils.addNavItemsToModel(view, model, referringPageId, userService.getAuthenticatedUser());
        return view;
View Full Code Here

        assertEquals("Script block for widget is incorrect", "<!-- RegionWidget " + REGION_WIDGET_ID + " placeholder -->", placeholder);
    }

    @Test(expected = NotSupportedException.class)
    public void render_invalid() {
        Widget w = new WidgetImpl();
        w.setType("NONE");
        w.setUrl(VALID_WIDGET_URL);
        RegionWidget rw = new RegionWidgetImpl();
        rw.setId(1L);
        rw.setWidget(w);

        RenderContext renderContext = createNiceMock(RenderContext.class);
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.