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

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


    public void removeWidgetFromPage_lockedRegion() {
        String WIDGET_ID = "1";
        String REGION_ID = "2";
        Region region = new RegionImpl(REGION_ID);
        region.setLocked(true);
        RegionWidget regionWidget = new RegionWidgetImpl(WIDGET_ID);
        regionWidget.setRegion(region);

        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget);
        regionWidgetRepository.delete(regionWidget);
        expectLastCall();
        replay(regionWidgetRepository);
View Full Code Here


    public void removeWidgetFromPage_lockedRegionWidget() {
        String WIDGET_ID = "1";
        String REGION_ID = "2";
        Region region = new RegionImpl(REGION_ID);
        region.setLocked(true);
        RegionWidget regionWidget = new RegionWidgetImpl(WIDGET_ID);
        regionWidget.setLocked(true);
        regionWidget.setRegion(region);

        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget);
        regionWidgetRepository.delete(regionWidget);
        expectLastCall();
        replay(regionWidgetRepository);
View Full Code Here

        Region region = new RegionImpl();
        region.setLocked(false);
        region.setRegionWidgets(Lists.<RegionWidget>newArrayList());

        RegionWidget regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        region.getRegionWidgets().add(regionWidget);

        expect(pageRepository.get(TO_PAGE_ID)).andReturn(toPageValue);
        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget).times(2);
        expect(regionRepository.save(originalRegion)).andReturn(originalRegion);
View Full Code Here

        toPageValue.getRegions().add(targetRegion);

        Region region = new RegionImpl();
        region.setLocked(false);

        RegionWidget regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        regionWidget.setLocked(true);

        expect(pageRepository.get(TO_PAGE_ID)).andReturn(toPageValue);
        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget).times(2);
        replay(pageRepository,regionWidgetRepository);
View Full Code Here

        toPageValue.getRegions().add(targetRegion);

        Region region = new RegionImpl();
        region.setLocked(false);

        RegionWidget regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        regionWidget.setLocked(true);

        expect(pageRepository.get(TO_PAGE_ID)).andReturn(toPageValue);
        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget).times(2);
        replay(pageRepository,regionWidgetRepository);
View Full Code Here

        toPageValue.getRegions().add(targetRegion);

        Region region = new RegionImpl();
        region.setLocked(false);

        RegionWidget regionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID);
        regionWidget.setRegion(region);
        regionWidget.setLocked(true);

        expect(pageRepository.get(TO_PAGE_ID)).andReturn(toPageValue);
        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget).times(2);
        replay(pageRepository,regionWidgetRepository);
View Full Code Here

    public Map<String, Object> getSecurityToken(@RequestParam("url") final String url, @RequestParam("pageid") final String pageId) {
      Widget widget = widgetService.getWidgetByUrl(url);
      Page page = pageService.getPage(pageId);
     
      // Use a dummy RegionWidget to generate the security token
      RegionWidget regionWidget = new RegionWidgetImpl(String.valueOf(System.currentTimeMillis()),"-1",
          new RegionImpl("-1", page, -1));
     
      Map<String, Object> jsonResponse = new HashMap<String, Object>();
      Map<String, String> errorMessage = new HashMap<String, String>();
     
View Full Code Here

        pageMembers.add(pageUser);
        sourcePage.setMembers(pageMembers);

        Region region = new RegionImpl();
        region.setRegionWidgets(Lists.<RegionWidget>newLinkedList());
        RegionWidgetImpl rw = new RegionWidgetImpl();
        rw.setId("2222");
        rw.setWidgetId("3333");
        rw.setPreferences(Lists.<RegionWidgetPreference>newLinkedList());

        region.getRegionWidgets().add(rw);
        sourcePage.setRegions(Lists.<Region>newLinkedList());
        sourcePage.getRegions().add(region);
View Full Code Here

    //Convert Widget test
    @Test
    public void convertWidget_valid() {

        RegionWidgetImpl rw = new RegionWidgetImpl();
        RegionWidgetImpl rwResults;

        rw.setPreferences(Lists.<RegionWidgetPreference>newLinkedList());
        RegionWidgetPreference preference = new RegionWidgetPreferenceImpl();
        preference.setName("name");
        preference.setValue("value");
        rw.setWidgetId("1234L");
        rw.getPreferences().add(preference);
        rw.setLocked(false);
        rw.setCollapsed(false);
        rw.setHideChrome(false);
        rw.setRenderPosition("test");
        rw.setRenderOrder(1);

        rwResults = converter.convert(rw);

        assertThat(rwResults.getWidgetId(), is(equalTo("1234L")));
        assertNotNull(rwResults.getId());
        assertThat(rwResults.getPreferences().get(0), is(equalTo(preference)));
        assertThat(rwResults.isCollapsed(), is(false));
        assertThat(rwResults.isHideChrome(), is(false));
        assertThat(rwResults.isLocked(), is(false));
        assertThat(rwResults.getRenderPosition(), is(equalTo("test")));
        assertThat(rwResults.getRenderOrder(), is(1));
        assertThat(rwResults.getRegion(), is(nullValue()));

    }//end convertRegion_valid
View Full Code Here

    }//end convertRegion_valid

    @Test
    public void convertWidget_NullPreferences(){
        RegionWidgetImpl rw = new RegionWidgetImpl();
        RegionWidgetImpl rwResults;

        rw.setWidgetId("1234L");
        rw.setLocked(false);
        rw.setCollapsed(false);
        rw.setHideChrome(false);
        rw.setRenderPosition("test");
        rw.setRenderOrder(1);

        rwResults = converter.convert(rw);

        assertThat(rwResults.getWidgetId(), is(equalTo("1234L")));
        assertNotNull(rwResults.getId());
        assertNotNull(rwResults.getPreferences());
        assertThat(rwResults.isCollapsed(), is(false));
        assertThat(rwResults.isHideChrome(), is(false));
        assertThat(rwResults.isLocked(), is(false));
        assertThat(rwResults.getRenderPosition(), is(equalTo("test")));
        assertThat(rwResults.getRenderOrder(), is(1));
        assertThat(rwResults.getRegion(), is(nullValue()));
    }
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.