Package org.apache.rave.portal.model

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


    public void testSaveKeyValues_new() {
        final String key = "foo";
        List<String> values = new ArrayList<String>();
        values.add("bar");
        values.add("baz");
        PortalPreference fooBar = new PortalPreferenceImpl(key, values);
        PortalPreferenceImpl fooBarSaved = new PortalPreferenceImpl(key, values);

        expect(repository.getByKey(key)).andReturn(null).once();
        expect(repository.save(fooBar)).andReturn(fooBarSaved).once();
        replay(repository);
View Full Code Here


        verify(repository);
    }

    @Test
    public void testSavePreference() {
        PortalPreference title = titlePreference();
        PortalPreferenceImpl savedTitle = new PortalPreferenceImpl("title", "Rave");

        expect(repository.save(title)).andReturn(savedTitle).once();
        replay(repository);
View Full Code Here

        service.savePreference(title);
        verify(repository);
    }

    private static List<PortalPreference> portalPreferenceList() {
        PortalPreference title = titlePreference();

        List<String> colors = new ArrayList<String>();
        colors.add("red");
        colors.add("yellow");
        colors.add("blue");
        PortalPreference colorPref = new PortalPreferenceImpl("colors", colors);

        List<PortalPreference> preferences = new ArrayList<PortalPreference>();
        preferences.add(title);
        preferences.add(colorPref);
View Full Code Here

    }

    @Test
    public void convertPreference_valid(){

        PortalPreference pp = new PortalPreferenceImpl();
        pp.setKey("key");
        pp.setValues(Lists.<String>newLinkedList());
        MongoDbPortalPreference converted;
        MongoDbPortalPreference mpp = new MongoDbPortalPreference();
        mpp.setKey("carol");
        mpp.setValues(Lists.<String>newLinkedList());
View Full Code Here

    }

    @Override
    @Transactional
    public void savePreference(String key, List<String> values) {
        PortalPreference preference = getPreference(key);
        if (preference == null) {
            preference = new PortalPreferenceImpl(key, values);
        } else {
            preference.setValues(values);
        }
        this.savePreference(preference);
    }
View Full Code Here

        assertThat(converter.convert(template), is(sameInstance(template)));
    }

    @Test
    public void nullConversion() {
        PortalPreference template = null;
        assertThat(converter.convert(template), is(nullValue()));
    }
View Full Code Here

    }


    @Test
    public void convertValid() {
        PortalPreference template = new PortalPreferenceImpl();
        template.setKey("KEY");
        template.setValue("VALUE");

        JpaPortalPreference jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
        assertThat(jpaTemplate, is(instanceOf(JpaPortalPreference.class)));
        assertThat(jpaTemplate.getKey(), is(equalTo(template.getKey())));
        assertThat(jpaTemplate.getValue(), is(equalTo(template.getValue())));
    }
View Full Code Here

    public void setCategoryEditor(CategoryEditor categoryEditor) {
        this.categoryEditor = categoryEditor;
    }

    public int getPageSize() {
        final PortalPreference pageSizePref = preferenceService.getPreference(PortalPreferenceKeys.PAGE_SIZE);
        if (pageSizePref == null) {
            return DEFAULT_PAGE_SIZE;
        }
        try {
            return Integer.parseInt(pageSizePref.getValue());
        } catch (NumberFormatException e) {
            return DEFAULT_PAGE_SIZE;
        }
    }
View Full Code Here

        tag.setPageContext(pageContext);
    }

    @Test
    public void doStartTag_debugOn() throws IOException, JspException {
        PortalPreference portalPreference = new PortalPreferenceImpl(PortalPreferenceKeys.JAVASCRIPT_DEBUG_MODE, DEBUG_ON);

        expect(service.getPreference(PortalPreferenceKeys.JAVASCRIPT_DEBUG_MODE)).andReturn(portalPreference);
        expect(pageContext.getServletContext()).andReturn(servletContext).anyTimes();
        expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)).andReturn(wContext).anyTimes();
        expect(wContext.getBean(PortalPreferenceService.class)).andReturn(service).anyTimes();
View Full Code Here

        verify(service, pageContext, servletContext, wContext, writer);
    }

    @Test
    public void doStartTag_debugOff() throws IOException, JspException {
        PortalPreference portalPreference = new PortalPreferenceImpl(PortalPreferenceKeys.JAVASCRIPT_DEBUG_MODE, DEBUG_OFF);

        expect(service.getPreference(PortalPreferenceKeys.JAVASCRIPT_DEBUG_MODE)).andReturn(portalPreference);
        expect(pageContext.getServletContext()).andReturn(servletContext).anyTimes();
        expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)).andReturn(wContext).anyTimes();
        expect(wContext.getBean(PortalPreferenceService.class)).andReturn(service).anyTimes();
View Full Code Here

TOP

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

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.