Examples of PortalPreference


Examples of org.apache.rave.model.PortalPreference

        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

Examples of org.apache.rave.model.PortalPreference

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

    @Test
    public void doStartTag_nullPreference() throws IOException, JspException {
        PortalPreference portalPreference = null;

        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

Examples of org.apache.rave.model.PortalPreference

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

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

        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

Examples of org.apache.rave.model.PortalPreference

    @Test
    public void testUpdatePreferences_invalidPageSizeValue() {
        ModelMap model = new ExtendedModelMap();
        HashMap<String, PortalPreference> preferenceMap = new HashMap<String, PortalPreference>();
        PortalPreference pageSizePref = new PortalPreferenceImpl(PortalPreferenceKeys.PAGE_SIZE, "invalid");
        preferenceMap.put(PortalPreferenceKeys.PAGE_SIZE, pageSizePref);
        PortalPreferenceForm form = new PortalPreferenceForm(preferenceMap);
        final BindingResult errors = new BeanPropertyBindingResult(form, "form");
        SessionStatus sessionStatus = createMock(SessionStatus.class);
View Full Code Here

Examples of org.apache.rave.model.PortalPreference

        assertTrue(preferences.size() == 2);
    }

    @Test
    public void testGetByKey() {
        PortalPreference preference = repository.getByKey("color");
        assertNotNull(preference);
        assertTrue("Expecting preference with one of the values to be red", preference.getValues().contains("red"));
        assertTrue("Expecting preference with one of the values to be blue", preference.getValues().contains("blue"));
    }
View Full Code Here

Examples of org.apache.rave.model.PortalPreference

        assertTrue("Expecting preference with one of the values to be blue", preference.getValues().contains("blue"));
    }

    @Test
    public void testGetByKey_notExisting() {
        PortalPreference preference = repository.getByKey("foo");
        assertNull(preference);
    }
View Full Code Here

Examples of org.apache.rave.model.PortalPreference

        assertNull(preference);
    }

    @Test
    public void testValuesAreOverwritten() throws Exception {
        PortalPreference preference = repository.getByKey("color");
        List<String> newColors = new ArrayList<String>();
        newColors.add("purple");
        newColors.add("green");
        preference.setValues(newColors);
        final PortalPreference saved = repository.save(preference);
        assertEquals(2, saved.getValues().size());
    }
View Full Code Here

Examples of org.apache.rave.model.PortalPreference

    private String getShowStackTraceValue() {
        // default to off
        String showStackTrace = SHOW_STACK_TRACE_OFF;
        try {
            PortalPreference debugModePref = getBean().getPreference(PortalPreferenceKeys.SHOW_STACK_TRACE);
            if (debugModePref != null && SHOW_STACK_TRACE_ON.equals(debugModePref.getValue())) {
                showStackTrace = SHOW_STACK_TRACE_ON;
            }
        }
        catch(Exception e) {
            // if there are any errors we will revert to the default value
View Full Code Here

Examples of org.apache.rave.model.PortalPreference

    private String getJavaScriptDebugModeValue() {
        // default to off
        String debugMode = DEBUG_MODE_OFF;
        try {
            PortalPreference debugModePref = getBean().getPreference(PortalPreferenceKeys.JAVASCRIPT_DEBUG_MODE);
            if (debugModePref != null && DEBUG_MODE_ON.equals(debugModePref.getValue())) {
                debugMode = DEBUG_MODE_ON;
            }
        }
        catch(Exception e) {
            // if there are any errors we will revert to the default value
View Full Code Here

Examples of org.apache.rave.model.PortalPreference

    }

    @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
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.