Package org.apache.rave.portal.model

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


        }

        //We know the lists are the same length - so as long as all the savedPreferences exist and match the updated
        //preferences then we are all good.
        for (RegionWidgetPreference savedPreference : savedPreferences) {
            RegionWidgetPreference updatedPreference = updatedPreferencesMap.get(savedPreference.getName());
            if (updatedPreference == null || !StringUtils.equals(savedPreference.getName(), updatedPreference.getName())
                    || !StringUtils.equals(savedPreference.getValue(), updatedPreference.getValue())) {
                return false;
            }
        }

        return true;
View Full Code Here


        return true;
    }

    private List<RegionWidgetPreference> getTestExistingRegionWidgetPreferences() {
        ArrayList<RegionWidgetPreference> regionWidgetPreferences = new ArrayList<RegionWidgetPreference>();
        regionWidgetPreferences.add(new RegionWidgetPreference(1L, VALID_REGION_WIDGET_ID, "color", "blue"));
        regionWidgetPreferences.add(new RegionWidgetPreference(2L, VALID_REGION_WIDGET_ID, "speed", "fast"));
        return regionWidgetPreferences;
    }
View Full Code Here

    private List<RegionWidgetPreference> getTestUpdatedRegionWidgetPreferences() {
        List<RegionWidgetPreference> regionWidgetPreferences = getTestExistingRegionWidgetPreferences();
        regionWidgetPreferences.remove(0);
        regionWidgetPreferences.get(0).setValue("slow");
        regionWidgetPreferences.add(new RegionWidgetPreference(null, VALID_REGION_WIDGET_ID, "size", "small"));
        return regionWidgetPreferences;
    }
View Full Code Here

    }

    @Test
    public void replaceAllRegionWidgetPreferences_validParams() {
        RegionWidgetPreferenceListWrapper LIST_WRAPPER = new RegionWidgetPreferenceListWrapper(Arrays.asList(
                new RegionWidgetPreference(), new RegionWidgetPreference()
        ));

        expect(regionWidgetService.saveRegionWidgetPreferences(VALID_REGION_WIDGET_ID, LIST_WRAPPER.getPreferences())).
                andReturn(LIST_WRAPPER.getPreferences());
        replay(regionWidgetService);
View Full Code Here

    }

    @Test(expected = IllegalArgumentException.class)
    public void replaceAllRegionWidgetPreferences_invalidParams() {
        RegionWidgetPreferenceListWrapper LIST_WRAPPER = new RegionWidgetPreferenceListWrapper(Arrays.asList(
                new RegionWidgetPreference(), new RegionWidgetPreference()
        ));

        expect(regionWidgetService.saveRegionWidgetPreferences(INVALID_REGION_WIDGET_ID, LIST_WRAPPER.getPreferences())).
                andThrow(new IllegalArgumentException());
        replay(regionWidgetService);
View Full Code Here

        regionWidgetApi.replaceAllRegionWidgetPreferences(INVALID_REGION_WIDGET_ID, LIST_WRAPPER);
    }

    @Test
    public void createOrReplaceRegionWidgetPreference_validParams() {
        RegionWidgetPreference PREFERENCE = new RegionWidgetPreference(1L, VALID_REGION_WIDGET_ID, VALID_PREFERENCE_NAME,
                VALID_PREFERENCE_VALUE);

        expect(regionWidgetService.saveRegionWidgetPreference(VALID_REGION_WIDGET_ID, PREFERENCE)).andReturn(PREFERENCE);
        replay(regionWidgetService);

        RegionWidgetPreference result = regionWidgetApi.createOrReplaceRegionWidgetPreference(VALID_REGION_WIDGET_ID,
                VALID_PREFERENCE_NAME, PREFERENCE);

        verify(regionWidgetService);
        assertThat(result, CoreMatchers.sameInstance(PREFERENCE));
    }
View Full Code Here

        assertThat(result, CoreMatchers.sameInstance(PREFERENCE));
    }

    @Test(expected = IllegalArgumentException.class)
    public void createOrReplaceRegionWidgetPreference_invalidParams_preferenceName() {
        RegionWidgetPreference PREFERENCE = new RegionWidgetPreference(1L, VALID_REGION_WIDGET_ID, VALID_PREFERENCE_NAME,
                VALID_PREFERENCE_VALUE);

        regionWidgetApi.createOrReplaceRegionWidgetPreference(VALID_REGION_WIDGET_ID, "different", PREFERENCE);
    }
View Full Code Here

        regionWidgetApi.createOrReplaceRegionWidgetPreference(VALID_REGION_WIDGET_ID, "different", PREFERENCE);
    }

    @Test(expected = IllegalArgumentException.class)
    public void createOrReplaceRegionWidgetPreference_invalidParams_regionWidgetId() {
        RegionWidgetPreference PREFERENCE = new RegionWidgetPreference(1L, VALID_REGION_WIDGET_ID, VALID_PREFERENCE_NAME,
                VALID_PREFERENCE_VALUE);

        expect(regionWidgetService.saveRegionWidgetPreference(INVALID_REGION_WIDGET_ID, PREFERENCE)).andThrow(
                new IllegalArgumentException());
        replay(regionWidgetService);
View Full Code Here

public class ModelUtilsTest {
    long VALID_REGION_WIDGET_ID = 1L;

    @Test
    public void normalizeRegionWidgetPreference() {
        RegionWidgetPreference testPreference = new RegionWidgetPreference(null, null, "camelCaseName", "FOO");
        ModelUtils.normalizeRegionWidgetPreference(VALID_REGION_WIDGET_ID, testPreference);

        assertTrue(isAllLowerCase(testPreference.getName()));
        assertTrue(testPreference.getRegionWidgetId() == VALID_REGION_WIDGET_ID);
    }
View Full Code Here

            assertTrue(testPreference.getRegionWidgetId() == VALID_REGION_WIDGET_ID);
        }
    }

    public List<RegionWidgetPreference> getTestRegionWidgetPreferences() {
        return Arrays.asList(new RegionWidgetPreference(null, null, "camelCaseName", "FOO"),
                new RegionWidgetPreference(null, 20L, "lowercasename", "FOO"),
                new RegionWidgetPreference(null, -100L, "UPPERCASENAME", "FOO"));
    }
View Full Code Here

TOP

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

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.