Package org.apache.rave.portal.model

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


    public void getWidgetsForSearchTerm() {
        final String searchTerm = "gAdGet";
        int offset = 0;
        int pageSize = 10;
        int totalResults = 2;
        Widget widget = new Widget();
        widget.setEntityId(1L);
        List<Widget> widgets = new ArrayList<Widget>();
        widgets.add(widget);

        expect(widgetRepository.getCountFreeTextSearch(searchTerm)).andReturn(totalResults);
        expect(widgetRepository.getByFreeTextSearch(searchTerm, offset, pageSize)).andReturn(widgets);
View Full Code Here


    public void getPublishedWidgetsForSearchTerm() {
        final String searchTerm = "gAdGet";
        int offset = 0;
        int pageSize = 10;
        int totalResults = 2;
        Widget widget = new Widget();
        widget.setWidgetStatus(WidgetStatus.PUBLISHED);
        widget.setEntityId(1L);
        List<Widget> widgets = new ArrayList<Widget>();
        widgets.add(widget);

        expect(widgetRepository.getCountByStatusAndTypeAndFreeText(WidgetStatus.PUBLISHED, null, searchTerm))
                .andReturn(totalResults);
View Full Code Here

    public void getPublishedOpenSocialWidgetsForSearchTerm() {
        final String searchTerm = "gAdGet";
        int offset = 0;
        int pageSize = 10;
        int totalResults = 2;
        Widget widget = new Widget();
        widget.setWidgetStatus(WidgetStatus.PUBLISHED);
        final String type = "OpenSocial";
        widget.setType(type);
        widget.setEntityId(1L);
        List<Widget> widgets = new ArrayList<Widget>();
        widgets.add(widget);

        expect(widgetRepository.getCountByStatusAndTypeAndFreeText(WidgetStatus.PUBLISHED, type, searchTerm))
                .andReturn(totalResults);
View Full Code Here

        final User user = new User(5L);
        expect(userRepository.get(user.getEntityId())).andReturn(user);
        replay(userRepository);

        final List<Widget> widgets = new ArrayList();
        final Widget widget = new Widget(3L, "http://www.widgetsRus.com/");
        widgets.add(widget);

        expect(widgetRepository.getCountByOwner(user, offset, pageSize)).andReturn(widgets.size());
        expect(widgetRepository.getByOwner(user, offset, pageSize)).andReturn(widgets);
        replay(widgetRepository);
View Full Code Here

    @Test
    public void getWidget_null() {
        expect(widgetRepository.get(1L)).andReturn(null);
        replay(widgetRepository);

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

    @Test
    public void getWidgetByUrl() {
        final String widgetUrl =
                "http://hosting.gmodules.com/ig/gadgets/file/112581010116074801021/hamster.xml";
        Widget widget = new Widget();
        widget.setUrl(widgetUrl);
        expect(widgetRepository.getByUrl(widgetUrl)).andReturn(widget);
        replay(widgetRepository);

        Widget result = widgetService.getWidgetByUrl(widgetUrl);
        assertNotNull(result);
        assertEquals(result.getUrl(), widgetUrl);
        verify(widgetRepository);
    }
View Full Code Here

    @Test
    public void isRegisteredWidget() {
        final String widgetUrl =
                "http://hosting.gmodules.com/ig/gadgets/file/112581010116074801021/hamster.xml";
        Widget widget = new Widget();
        widget.setUrl(widgetUrl);
        expect(widgetRepository.getByUrl(widgetUrl)).andReturn(widget);
        replay(widgetRepository);

        boolean isExisting = widgetService.isRegisteredUrl(widgetUrl);
        verify(widgetRepository);
View Full Code Here

    @Test
    public void isNotRegisteredWidget_() {
        final String widgetUrl =
                "http://example.com/doesnotexistinrepository.xml";
        Widget widget = new Widget();
        widget.setUrl(widgetUrl);
        expect(widgetRepository.getByUrl(widgetUrl)).andReturn(null);
        replay(widgetRepository);

        boolean isExisting = widgetService.isRegisteredUrl(widgetUrl);
        verify(widgetRepository);
View Full Code Here

    }

    @Test
    public void registerNewWidget() {
        final String widgetUrl = "http://example.com/newwidget.xml";
        Widget widget = new Widget();
        widget.setUrl(widgetUrl);
        expect(widgetRepository.getByUrl(widgetUrl)).andReturn(null);
        expect(widgetRepository.save(widget)).andReturn(widget);
        replay(widgetRepository);

        Widget savedWidget = widgetService.registerNewWidget(widget);
        assertNotNull(savedWidget);
        assertEquals(widget.getEntityId(), savedWidget.getEntityId());

        verify(widgetRepository);
    }
View Full Code Here

    @Test(expected = DuplicateItemException.class)
    public void registerExistingWidgetAsNew() {
        final String widgetUrl =
                "http://hosting.gmodules.com/ig/gadgets/file/112581010116074801021/hamster.xml";
        Widget widget = new Widget();
        widget.setUrl(widgetUrl);
        expect(widgetRepository.getByUrl(widgetUrl)).andReturn(widget);
        replay(widgetRepository);

        widgetService.registerNewWidget(widget);
        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.