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

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


    }

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

        expect(repository.save(title)).andReturn(savedTitle).once();
        replay(repository);

        service.savePreference(title);
View Full Code Here


        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

        return preferences;
    }

    private static PortalPreference titlePreference() {
        return new PortalPreferenceImpl("title", "Rave");
    }
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

    }


    @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

        populateMissingPreferences();
    }

    private void populateMissingPreferences() {
        if (getPageSize() == null) {
            preferenceMap.put(PAGE_SIZE, new PortalPreferenceImpl(PAGE_SIZE, DEFAULT_PAGE_SIZE));
        }
        if (getTitleSuffix() == null) {
            preferenceMap.put(TITLE_SUFFIX, new PortalPreferenceImpl(TITLE_SUFFIX, DEFAULT_TITLE_SUFFIX));
        }
        if (getJavaScriptDebugMode() == null) {
            preferenceMap.put(JAVASCRIPT_DEBUG_MODE, new PortalPreferenceImpl(JAVASCRIPT_DEBUG_MODE, DEFAULT_JAVASCRIPT_DEBUG_MODE));
        }
        if (getInitialWidgetStatus() == null){
          preferenceMap.put(INITIAL_WIDGET_STATUS, new PortalPreferenceImpl(INITIAL_WIDGET_STATUS, DEFAULT_INITIAL_WIDGET_STATUS));
        }
        if (getExternalMarketplaceUrl() == null){
          preferenceMap.put(EXTERNAL_MARKETPLACE_URL, new PortalPreferenceImpl(EXTERNAL_MARKETPLACE_URL, DEFAULT_EXTERNAL_MARKETPLACE_URL));
        }
        if(getDefaultWidgetHeight() == null){
            preferenceMap.put(WIDGET_HEIGHT, new PortalPreferenceImpl(WIDGET_HEIGHT, DEFAULT_WIDGET_HEIGHT));
        }
        if(getShowStackTrace() == null){
            preferenceMap.put(SHOW_STACK_TRACE, new PortalPreferenceImpl(SHOW_STACK_TRACE, DEFAULT_SHOW_STACK_TRACE));
        }
    }
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

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

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

        expect(service.getPreference(PortalPreferenceKeys.JAVASCRIPT_DEBUG_MODE)).andThrow(new RuntimeException("error"));
        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.impl.PortalPreferenceImpl

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.