Examples of PortalPreferenceImpl


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

    }

    @Test
    public void testValidate_InvalidPageSize() throws Exception {
        Map<String, PortalPreference> preferenceMap = new HashMap<String, PortalPreference>();
        preferenceMap.put(PAGE_SIZE, new PortalPreferenceImpl(PAGE_SIZE, "10.5"));
        PortalPreferenceForm form = new PortalPreferenceForm(preferenceMap);
        Errors errors = new BindException(form, "form");
        validator.validate(form, errors);

        assertEquals(1, errors.getErrorCount());
View Full Code Here

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

        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

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

    }

    @Test
    public void getByKey_Valid(){
        String key = "key";
        PortalPreferenceImpl found = new PortalPreferenceImpl();
        expect(template.findOne(query(where("key").is(key)), preferenceRepository.CLASS, CollectionNames.PREFERENCE_COLLECTION)).andReturn(found);
        replay(template);

        assertThat(found, is(sameInstance(preferenceRepository.getByKey(key))));
    }
View Full Code Here

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

    }

    @Test
    public void get_Valid(){
        String id = "123";
        PortalPreference found = new PortalPreferenceImpl();
        expect(template.findById(id, preferenceRepository.CLASS, CollectionNames.PREFERENCE_COLLECTION)).andReturn((PortalPreferenceImpl)found);
        replay(template);

        assertThat(found, is(sameInstance(preferenceRepository.get(id))));
    }
View Full Code Here

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

        assertThat(found, is(sameInstance(preferenceRepository.get(id))));
    }

    @Test
    public void save_Valid(){
        PortalPreference item = new PortalPreferenceImpl();
        item.setKey("123");
        PortalPreference fromDb = new MongoDbPortalPreference();
        ((MongoDbPortalPreference)fromDb).setId("123");
        PortalPreference converted = new MongoDbPortalPreference();
        expect(converter.convert(item, PortalPreference.class)).andReturn(converted);
        expect(template.findOne(query(where("key").is("123")), preferenceRepository.CLASS, CollectionNames.PREFERENCE_COLLECTION)).andReturn((MongoDbPortalPreference)fromDb);
View Full Code Here

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

        assertThat(result, is(sameInstance(converted)));
    }

    @Test
    public void save_Null(){
        PortalPreference item = new PortalPreferenceImpl();
        item.setKey("123");
        PortalPreference converted = new MongoDbPortalPreference();
        expect(template.findOne(query(where("key").is("123")), preferenceRepository.CLASS, CollectionNames.PREFERENCE_COLLECTION)).andReturn(null);
        expect(converter.convert(item, PortalPreference.class)).andReturn(converted);
        template.save(converted, PREFERENCE_COLLECTION);
        expectLastCall();
View Full Code Here

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

        assertThat(result, is(sameInstance(converted)));
    }

    @Test
    public void delete_Valid(){
        PortalPreference item = new PortalPreferenceImpl();
        item.setKey("123");
        PortalPreference found = new PortalPreferenceImpl();
        expect(template.findOne(query(where("key").is("123")), preferenceRepository.CLASS, CollectionNames.PREFERENCE_COLLECTION)).andReturn((PortalPreferenceImpl)found);
        template.remove(found, CollectionNames.PREFERENCE_COLLECTION);
        expectLastCall();
        replay(template);
View Full Code Here

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

    }

    @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

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

        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));
        }
    }
View Full Code Here

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

        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));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.