Package org.apache.rave.portal.model

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


    @Test(expected = NotSupportedException.class)
    public void render_invalid() {
        Widget w = new Widget();
        w.setType("NONE");
        w.setUrl("http://www.example.com/gadget.xml");
        RegionWidget rw = new RegionWidget();
        rw.setEntityId(1L);
        rw.setWidget(w);

        renderer.render(rw, null);
    }
View Full Code Here


    @Test
    public void render_valid() {
        Widget w = new Widget();
        w.setType(Constants.WIDGET_TYPE);
        w.setUrl("http://example.com/widgets/1");
        RegionWidget rw = new RegionWidget();
        rw.setEntityId(1L);
        rw.setWidget(w);

        Widget wookieWidget = new Widget();
        final String WIDGET_INSTANCE = "http://example.com/widgetinstances/1";
        wookieWidget.setUrl(WIDGET_INSTANCE);
View Full Code Here

    @Test
    public void render_null() {
        Widget w = new Widget();
        w.setType(Constants.WIDGET_TYPE);
        RegionWidget rw = new RegionWidget();
        rw.setWidget(w);

        String result = renderer.render(rw, null);
        assertThat(result.matches(".*regionWidgetId[ ]*:[ ]*null,.*"), is(true));
        assertThat(result.matches(".*type[ ]*:[ ]*'W3C',.*"), is(true));
        assertThat(result.matches(".*widgetUrl[ ]*:[ ]*'null'.*"), is(true));
View Full Code Here

    @Test(expected = NotSupportedException.class)
    public void render_invalid() {
        Widget w = new Widget();
        w.setType("NONE");
        w.setUrl("http://example.com/widgets/1");
        RegionWidget rw = new RegionWidget();
        rw.setEntityId(1L);
        rw.setWidget(w);

        renderer.render(rw, null);
    }
View Full Code Here

    @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.getEntityId(), is(notNullValue()));
    }
View Full Code Here

    public void save_cascadeMerge() {

        Region region = new Region();
        region.setEntityId(1L);
        region.setRegionWidgets(new ArrayList<RegionWidget>());
        RegionWidget regionWidget = new RegionWidget();
        regionWidget.setEntityId(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.getEntityId(), is(equalTo(1L)));
    }
View Full Code Here

        long id = region.getRegionWidgets().get(0).getEntityId();
        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

    @Autowired
    private RegionWidgetRepository repository;

    @Test
    public void getById_validId() {
        RegionWidget regionWidget = repository.get(VALID_REGION_WIDGET_ID);
        assertThat(regionWidget, is(notNullValue()));
        assertThat(regionWidget.getEntityId(), is(equalTo(VALID_REGION_WIDGET_ID)));
    }
View Full Code Here

        assertThat(regionWidget.getEntityId(), is(equalTo(VALID_REGION_WIDGET_ID)));
    }

    @Test
    public void getById_invalidId() {
        RegionWidget regionWidget = repository.get(INVALID_REGION_WIDGET_ID);
        assertThat(regionWidget, is(nullValue()));
    }
View Full Code Here

    }

    @Test
    @Rollback(true)
    public void save_newEntity() {
        RegionWidget regionWidget = new RegionWidget();
        regionWidget.setPreferences(new ArrayList<RegionWidgetPreference>());

        RegionWidget saved = repository.save(regionWidget);
        manager.flush();
        assertThat(saved, is(sameInstance(regionWidget)));
        assertThat(saved.getEntityId(), is(notNullValue()));
    }
View Full Code Here

TOP

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

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.