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

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


    @Test
    @Rollback(true)
    public void delete_implObject() {
        RegionWidget regionWidget = repository.get(VALID_REGION_WIDGET_ID);
        assertThat(regionWidget, is(notNullValue()));
        RegionWidgetImpl impl = new RegionWidgetImpl(regionWidget.getId());
        repository.delete(impl);
        regionWidget = repository.get(VALID_REGION_WIDGET_ID);
        assertThat(regionWidget, is(nullValue()));
    }
View Full Code Here


    @Test
    public void render_supported_foo() {
        WidgetImpl w = new WidgetImpl();
        w.setType(SUPPORTED_TYPE_1);

        RegionWidget rw = new RegionWidgetImpl();
        rw.setWidget(w);

        expect(widgetRenderer1.render(rw, context)).andReturn(RENDERED_TYPE_1);
        replayMocks();

        constructFooBarRenderService();
View Full Code Here

    @Test
    public void render_supported_bar() {
        WidgetImpl w = new WidgetImpl();
        w.setType(SUPPORTED_TYPE_2);
        RegionWidget rw = new RegionWidgetImpl();
        rw.setWidget(w);

        expect(widgetRenderer2.render(rw, context)).andReturn(RENDERED_TYPE_2);
        replayMocks();

        constructFooBarRenderService();
View Full Code Here

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

        RegionWidget rw = new RegionWidgetImpl();
        rw.setWidget(w);

        replayMocks();

        constructFooBarRenderService();
        service.render(rw, context);
View Full Code Here

    }


    @Test
    public void newRegion() {
        RegionWidget rw = new RegionWidgetImpl();
        rw.setId(9L);
        rw.setLocked(false);
        rw.setCollapsed(false);
        rw.setHideChrome(true);
        rw.setRenderOrder(9);
        rw.setPreferences(new ArrayList<RegionWidgetPreference>());
        rw.setRegion(new RegionImpl());
        rw.setRenderPosition("last");
        rw.setWidget(new WidgetImpl());

        JpaRegionWidget converted = regionWidgetConverter.convert(rw);
        assertThat(converted, is(not(sameInstance(rw))));
        assertThat(converted, is(instanceOf(JpaRegionWidget.class)));
        assertThat(converted.getPreferences(), is(equalTo(rw.getPreferences())));
        assertThat(converted.getEntityId(), is(equalTo(rw.getId())));
        assertThat(converted.getId(), is(equalTo(rw.getId())));
        assertThat(converted.isCollapsed(), is(equalTo(rw.isCollapsed())));
        assertThat(converted.getRenderOrder(), is(equalTo(rw.getRenderOrder())));
        assertThat(converted.isLocked(), is(equalTo(rw.isLocked())));
        assertThat(converted.isHideChrome(), is(equalTo(rw.isHideChrome())));
        assertThat(converted.getRegion(), is(instanceOf(JpaRegion.class)));
        assertThat(converted.getRenderPosition(), is(equalTo(rw.getRenderPosition())));
        assertThat(converted.getWidget(), is(instanceOf(JpaWidget.class)));
    }
View Full Code Here

    }
       
    @Test
    public void saveRegionWidgetCollapsedState() {
        final boolean COLLAPSED = true;
        RegionWidget regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
       
        expect(regionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);               
        regionWidget.setCollapsed(COLLAPSED);
        expect(regionWidgetRepository.save(regionWidget)).andReturn(regionWidget);
        replay(regionWidgetRepository);

        assertThat(regionWidgetService.saveRegionWidgetCollapsedState(VALID_REGION_WIDGET_ID, COLLAPSED).isCollapsed(), is(COLLAPSED));
    }
View Full Code Here

        page.setId(VALID_PAGE_ID);
        page.setOwner(user);
        region = new RegionImpl();
        region.setId(VALID_REGION_ID);
        region.setPage(page);
        regionWidget = new RegionWidgetImpl();
        regionWidget.setId(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
    }
View Full Code Here

        regionWidgetService = new DefaultRegionWidgetService(regionWidgetRepository);
    }

    @Test
    public void getRegionWidget_validId() {
        final RegionWidget VALID_REGION_WIDGET = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);

        expect(regionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(VALID_REGION_WIDGET);
        replay(regionWidgetRepository);

        assertThat(regionWidgetService.getRegionWidget(VALID_REGION_WIDGET_ID), sameInstance(VALID_REGION_WIDGET));
View Full Code Here

        assertThat(regionWidgetService.getRegionWidget(INVALID_REGION_WIDGET_ID), is(nullValue()));
    }

    @Test
    public void saveRegionWidget() {
        final RegionWidget VALID_REGION_WIDGET = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);

        expect(regionWidgetRepository.save(VALID_REGION_WIDGET)).andReturn(VALID_REGION_WIDGET);
        replay(regionWidgetRepository);

        assertThat(regionWidgetService.saveRegionWidget(VALID_REGION_WIDGET), sameInstance(VALID_REGION_WIDGET));
View Full Code Here

        assertThat(regionWidgetService.saveRegionWidget(VALID_REGION_WIDGET), sameInstance(VALID_REGION_WIDGET));
    }

    @Test
    public void saveRegionWidgetPreferences() {
        final RegionWidget VALID_REGION_WIDGET = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        VALID_REGION_WIDGET.setPreferences(getTestExistingRegionWidgetPreferences());

        expect(regionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(VALID_REGION_WIDGET);
        expect(regionWidgetRepository.save(VALID_REGION_WIDGET)).andReturn(VALID_REGION_WIDGET);
        replay(regionWidgetRepository);
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.