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

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


        tag.setPageContext(pageContext);
    }

    @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);
View Full Code Here



    @Test(expected = JspException.class)
    public void doStartTag_IOException() throws JspException, IOException {

        RegionWidget regionWidget = new RegionWidgetImpl();
        WidgetImpl widget = new WidgetImpl();
        regionWidget.setWidget(widget);
        widget.setType("INVALID");

        Set<String> strings = new HashSet<String>();
        strings.add(WIDGET_TYPE);
View Full Code Here

    @Test(expected = JspException.class)
    public void doStartTag_unsupportedWidget() throws JspException {
        replay(pageContext);

        RegionWidget regionWidget = new RegionWidgetImpl();
        Region region = new RegionImpl(25L);
        WidgetImpl widget = new WidgetImpl();
        regionWidget.setWidget(widget);
        regionWidget.setRegion(region);
        widget.setType("INVALID");

        Set<String> strings = new HashSet<String>();
        strings.add(WIDGET_TYPE);
View Full Code Here

        widget.setId(8L);
        widget.setType(WIDGET_TYPE);
        widget.setDisableRendering(true);
        widget.setDisableRenderingMessage(DISABLED_WIDGET_MESSAGE);

        RegionWidget regionWidget = new RegionWidgetImpl();
        regionWidget.setId(99L);
        regionWidget.setWidget(widget);
        regionWidget.setRegion(new RegionImpl(2L));

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

        expect(service.getSupportedWidgetTypes()).andReturn(strings);
View Full Code Here

        verify(writer);
    }

    @Test
    public void getRegionWidget() throws IOException, JspException {
        RegionWidget regionWidget = new RegionWidgetImpl();
        tag.setRegionWidget(regionWidget);
        assertThat(tag.getRegionWidget(), sameInstance(regionWidget));
    }
View Full Code Here

        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);
        rw.setRegion(region);
        rw.setHideChrome(VALID_HIDE_CHROME);
        rw.setLocked(VALID_LOCKED);
        rw.setPreferences(Arrays.asList((RegionWidgetPreference)new RegionWidgetPreferenceImpl( 1L, "color", "blue"),
                                        new RegionWidgetPreferenceImpl(1L, "speed", "fast"),
                                        new RegionWidgetPreferenceImpl( 1L, null, null)));

        final String markup =
            "<script>rave.registerWidget(" + REGION_ID + ", {type: 'OpenSocial'," +
            " regionWidgetId: " + REGION_WIDGET_ID + "," +
            " widgetUrl: '" + VALID_GADGET_URL +"', " +
            " securityToken: '" + VALID_SECURITY_TOKEN + "', " +
            " metadata: " + VALID_METADATA + "," +
            " userPrefs: {\"speed\":\"fast\",\"color\":\"blue\"}," +
            " collapsed: " + VALID_COLLAPSED + ", " +
            " widgetId: " + WIDGET_ID + "," +
            " locked: " + VALID_LOCKED + "," +
            " hideChrome: " + VALID_HIDE_CHROME +
            "});</script>";

        expect(securityTokenService.getEncryptedSecurityToken(rw)).andReturn(VALID_SECURITY_TOKEN);
        replay(securityTokenService);

        String key = OpenSocialWidgetRenderer.REGISTER_WIDGET_KEY+"-"+rw.getId();
        scriptManager.registerScriptBlock(key, markup, ScriptLocation.AFTER_RAVE, RenderScope.CURRENT_REQUEST, renderContext);
        expectLastCall();
        replay(scriptManager);

        String result = renderer.render(rw, renderContext);

        assertThat(result, is(equalTo("<!-- RegionWidget " + rw.getId() + " placeholder -->")));
        verify(scriptManager);
    }
View Full Code Here

    @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);

        final String markup =
            "<script>rave.registerWidget(1, {type: 'OpenSocial'," +
            " regionWidgetId: null," +
            " widgetUrl: 'null', " +
View Full Code Here

    @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

       
        W3CWidget w = new W3CWidget();
        w.setType(Constants.WIDGET_TYPE);
        w.setUrl("http://example.com/widgets/1");
        Region region = new RegionImpl(REGION_ID);
        RegionWidget rw = new RegionWidgetImpl();
        rw.setId(REGION_WIDGET_ID);
        rw.setWidget(w);
        rw.setRegion(region);

        W3CWidget wookieWidget = new W3CWidget();
        wookieWidget.setUrl(VALID_WIDGET_INSTANCE_URL);

        expect(wookieService.getWidget(eq(user), eq(rw.getId().toString()), isA(Widget.class))).andReturn(wookieWidget);
        replay(wookieService);

        String placeholder = renderer.render(rw, renderContext);
        assertEquals("Script block for widget is incorrect", "<!-- RegionWidget " + REGION_WIDGET_ID + " placeholder -->", placeholder);
    }
View Full Code Here

    @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);
        renderer.render(rw, renderContext);
    }
View Full Code Here

TOP

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

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.