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

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


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

    @Test(expected = NotSupportedException.class)
    public void render_invalid() {
        WidgetImpl w = new WidgetImpl();
        w.setId("1");
        w.setType("NONE");

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

        RegionWidgetWrapper wrapper = new RegionWidgetWrapper(w, rw);

        expect(widgetRepository.get("1")).andReturn(w);
View Full Code Here


    @SuppressWarnings("unchecked")
    @Test
    public void viewAdminWidgetDetail() throws Exception {
        Model model = new ExtendedModelMap();
        WidgetImpl widget = new WidgetImpl();
        final long entityId = 123L;
        widget.setId(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";
        WidgetImpl widget = new WidgetImpl(123L, widgetUrl);
        widget.setTitle("WidgetImpl 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() {
        WidgetImpl widget = new WidgetImpl();
        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() {
        WidgetImpl widget = new WidgetImpl(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++) {
            WidgetImpl widget = new WidgetImpl();
            widget.setTitle("WidgetImpl " + i);
            widgetList.add(widget);
        }
        return new SearchResult<Widget>(widgetList, 25);
    }
View Full Code Here

    private UpdateWidgetValidator widgetValidator;
    private WidgetService widgetService;

    @Test
    public void testValidateValidFormData() throws Exception {
        WidgetImpl widget = new WidgetImpl();
        widget.setId(123L);
        widget.setTitle(VALID_TITLE);
        widget.setUrl(VALID_URL);
        widget.setType(VALID_TYPE);
        widget.setDescription(VALID_DESCRIPTION);
        Errors errors = new BindException(widget, WIDGET);

        expect(widgetService.getWidgetByUrl(VALID_URL)).andReturn(widget);
        replay(widgetService);
        widgetValidator.validate(widget, errors);
View Full Code Here

        assertFalse("No validation errors", errors.hasErrors());
    }

    @Test
    public void testValidationFailsOnEmptyValues() {
        Widget widget = new WidgetImpl();
        Errors errors = new BindException(widget, WIDGET);

        widgetValidator.validate(widget, errors);

        assertEquals(4, errors.getErrorCount());
View Full Code Here

    @Test
    public void testValidationFailsOnDuplicateUrl() {
        final String existingUrl = "http://example.com/existing_widget.xml";

        WidgetImpl widget = new WidgetImpl();
        widget.setId(123L);
        widget.setTitle(VALID_TITLE);
        widget.setType(VALID_TYPE);
        widget.setDescription(VALID_DESCRIPTION);
        widget.setUrl(existingUrl);

        Widget newWidget = new WidgetImpl();
        newWidget.setTitle(VALID_TITLE);
        newWidget.setType(VALID_TYPE);
        newWidget.setDescription(VALID_DESCRIPTION);
        newWidget.setUrl(existingUrl);
        Errors errors = new BindException(newWidget, WIDGET);

        expect(widgetService.getWidgetByUrl(existingUrl)).andReturn(widget);
        replay(widgetService);
View Full Code Here

    }

    @Test
    public void doStartTag_valid() throws IOException, JspException {
        RegionWidget regionWidget = new RegionWidgetImpl();
        WidgetImpl widget = new WidgetImpl();
        regionWidget.setWidget(widget);
        widget.setType(WIDGET_TYPE);

        Set<String> strings = new HashSet<String>();
        strings.add(WIDGET_TYPE);

        expect(service.getSupportedWidgetTypes()).andReturn(strings);
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.