Package org.apache.rave.portal.model

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


    }

    @Test
    public void renderOpenSocial() {
        Page page = new PageImpl("1", VALID_USER_ID);
        Region region = new RegionImpl("1", page, 1);
        page.setRegions(Arrays.asList(region));

        WidgetImpl w = new WidgetImpl();
        w.setType("OpenSocial");
        w.setId("1");
        w.setTitle("Wikipedia");
        w.setUrl("http://www.widget-dico.com/wikipedia/google/wikipedia.xml");

        RegionWidget rw = new RegionWidgetImpl("1", w.getId(), region);
        region.setRegionWidgets(Arrays.asList(rw));

        RegionWidgetWrapper wrapper = new RegionWidgetWrapper(w, rw);

        RenderContext context = new RenderContext();
        context.setProperties(new HashMap());
View Full Code Here


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

        RegionWidget regionWidget = new RegionWidgetImpl();
        Region region = new RegionImpl("25");
        WidgetImpl widget = new WidgetImpl("8");
        regionWidget.setWidgetId(widget.getId());
        regionWidget.setRegion(region);
        widget.setType("INVALID");
View Full Code Here

        pageRepository = createNiceMock(PageRepository.class);
        regionRepository = createNiceMock(RegionRepository.class);
        widgetRepository = createNiceMock(WidgetRepository.class);
        pageService = new DefaultPageService(pageRepository, regionRepository, widgetRepository);

        targetRegion = new Region();
        targetRegion.setRegionWidgets(new ArrayList<RegionWidget>());
        targetRegion.getRegionWidgets().add(new RegionWidget(1L, 0));
        targetRegion.getRegionWidgets().add(new RegionWidget(2L, 1));
        targetRegion.getRegionWidgets().add(new RegionWidget(3L, 2));

        originalRegion = new Region();
        originalRegion.setRegionWidgets(new ArrayList<RegionWidget>());
        originalRegion.getRegionWidgets().add(new RegionWidget(4L, 0));
        originalRegion.getRegionWidgets().add(new RegionWidget(5L, 1));
        originalRegion.getRegionWidgets().add(new RegionWidget(6L, 2));
    }
View Full Code Here

    @Autowired
    private RegionRepository repository;

    @Test
    public void getById_validId() {
        Region region = repository.get(REGION_ID);
        assertThat(region, is(notNullValue()));
        assertThat(region.getId(), is(equalTo(1L)));
        assertThat(region.getRegionWidgets().size(), is(equalTo(2)));
    }
View Full Code Here

        assertThat(region.getRegionWidgets().size(), is(equalTo(2)));
    }

    @Test
    public void getById_invalidId() {
        Region region = repository.get(INVALID_REGION_ID);
        assertThat(region, is(nullValue()));
    }
View Full Code Here

    }

    @Test
    @Rollback(true)
    public void save_newEntity() {
        Region region = new Region();
        region.setRegionWidgets(new ArrayList<RegionWidget>());
        Region saved = repository.save(region);
        manager.flush();
        assertThat(saved, is(sameInstance(region)));
        assertThat(saved.getId(), is(notNullValue()));
    }
View Full Code Here

    }

    @Test
    @Rollback(true)
    public void save_existingEntity() {
        Region region = new Region();
        region.setId(1L);
        region.setRegionWidgets(new ArrayList<RegionWidget>());
        Region saved = repository.save(region);
        manager.flush();
        assertThat(saved, is(not(sameInstance(region))));
        assertThat(saved.getId(), is(equalTo(region.getId())));
    }
View Full Code Here

        assertThat(saved.getId(), is(equalTo(region.getId())));
    }

    @Test
    public void save_cascadePersist() {
        Region region = new Region();
        region.setRegionWidgets(new ArrayList<RegionWidget>());
        RegionWidget regionWidget = new RegionWidget();
        region.getRegionWidgets().add(regionWidget);

        Region saved = repository.save(region);
        manager.flush();

        assertThat(saved.getRegionWidgets().size(), is(equalTo(1)));
        RegionWidget actual = saved.getRegionWidgets().get(0);

        assertThat(actual, is(sameInstance(regionWidget)));
        assertThat(actual.getId(), is(notNullValue()));
    }
View Full Code Here

    }

    @Test
    public void save_cascadeMerge() {

        Region region = new Region();
        region.setId(1L);
        region.setRegionWidgets(new ArrayList<RegionWidget>());
        RegionWidget regionWidget = new RegionWidget();
        regionWidget.setId(1L);
        region.getRegionWidgets().add(regionWidget);

        Region saved = repository.save(region);
        manager.flush();

        assertThat(saved.getRegionWidgets().size(), is(equalTo(1)));
        RegionWidget actual = saved.getRegionWidgets().get(0);

        assertThat(actual, is(not(sameInstance(regionWidget))));
        assertThat(actual.getId(), is(equalTo(1L)));
    }
View Full Code Here

        assertThat(actual.getId(), is(equalTo(1L)));
    }

    @Test
    public void save_cascadeOrphan() {
        Region region = repository.get(1L);
        long id = region.getRegionWidgets().get(0).getId();
        region.getRegionWidgets().remove(0);

        Region saved = repository.save(region);
        manager.flush();
        RegionWidget widget = manager.find(RegionWidget.class, id);

        assertThat(saved.getRegionWidgets().size(), is(equalTo(1)));
        assertThat(widget, is(nullValue()));


    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.Region

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.