Package org.apache.jetspeed.om.common.preference

Examples of org.apache.jetspeed.om.common.preference.PreferenceSetComposite


        mockf1.expects(new InvokeAtLeastOnceMatcher()).method("getId").will(new ReturnStub(TEST_ENTITY));
        ContentFragment f1 = new ContentFragmentTestImpl((Fragment) mockf1.proxy(), new HashMap());

        MutablePortletEntity entity = entityAccess
                .generateEntityFromFragment(new ContentFragmentTestImpl(f1, new HashMap()));
        PreferenceSetComposite prefs = (PreferenceSetComposite) entity.getPreferenceSet();
        prefs.remove("pref1");
        assertNotNull(prefs);
        assertNull(prefs.get("pref1"));

        // test adding a pref
        prefs.add("pref1", Arrays.asList(new String[]
        { "1" }));
        assertNotNull(prefs.get("pref1"));

        // Remove should return the deleted pref
        assertNotNull(prefs.remove("pref1"));

        // Should be gone
        assertNull(prefs.get("pref1"));

        // Add it back so we can test tole back
        prefs.add("pref1", Arrays.asList(new String[]
        { "1" }));

        entityAccess.storePortletEntity(entity);

        prefs = (PreferenceSetComposite) entity.getPreferenceSet();

        assertNotNull(prefs.get("pref1"));

        PreferenceComposite pref = (PreferenceComposite) prefs.get("pref1");

        assertEquals("1", pref.getValueAt(0));

        pref.setValueAt(0, "2");

        assertEquals("2", pref.getValueAt(0));

        prefs.add("pref2", Arrays.asList(new String[]
        { "2", "3" }));

        entity.store();

        PreferenceComposite pref2 = (PreferenceComposite) prefs.get("pref2");

        assertNotNull(pref2);

        Iterator prefsValues = pref2.getValues();
        int count = 0;
View Full Code Here


        app.addPortletDefinition(portlet);

        app.setWebApplicationDefinition(webApp);

        PreferenceSetComposite prefSet = (PreferenceSetComposite) portlet.getPreferenceSet();
        prefSet.add("pref1", Arrays.asList(new String[]
        { "1" }));

        registry.registerPortletApplication(app);
    }
View Full Code Here

        if(newValues == null || newValues.length == 0)
        {
            throw new PortletException("You must specfiy a value for the new preference "+newName);
        }
       
        PreferenceSetComposite prefSet = (PreferenceSetComposite) entity.getPreferenceSet();
        prefSet.add(newName, Arrays.asList(newValues));
        try
        {
            entityAccess.storePortletEntity(entity);
        }
        catch (PortletEntityNotStoredException e)
View Full Code Here

        mockf1.expects(new InvokeAtLeastOnceMatcher()).method("getId").will(new ReturnStub(TEST_ENTITY));
        ContentFragment f1 = new ContentFragmentTestImpl((Fragment) mockf1.proxy(), new HashMap());

        MutablePortletEntity entity = entityAccess
                .generateEntityFromFragment(new ContentFragmentTestImpl(f1, new HashMap()));
        PreferenceSetComposite prefs = (PreferenceSetComposite) entity.getPreferenceSet();
        prefs.remove("pref1");
        assertNotNull(prefs);
        assertNull(prefs.get("pref1"));

        // test adding a pref
        prefs.add("pref1", Arrays.asList(new String[]
        { "1" }));
        assertNotNull(prefs.get("pref1"));

        // Remove should return the deleted pref
        assertNotNull(prefs.remove("pref1"));

        // Should be gone
        assertNull(prefs.get("pref1"));

        // Add it back so we can test tole back
        prefs.add("pref1", Arrays.asList(new String[]
        { "1" }));

        entityAccess.storePortletEntity(entity);

        prefs = (PreferenceSetComposite) entity.getPreferenceSet();

        assertNotNull(prefs.get("pref1"));

        PreferenceComposite pref = (PreferenceComposite) prefs.get("pref1");

        assertEquals("1", pref.getValueAt(0));

        pref.setValueAt(0, "2");

        assertEquals("2", pref.getValueAt(0));

        entity.reset();

        pref = (PreferenceComposite) prefs.get("pref1");

        assertEquals("1", pref.getValueAt(0));

        prefs.remove(pref);

        assertNull(prefs.get("pref1"));

        entity.reset();

        assertNotNull(prefs.get("pref1"));

        prefs.add("pref2", Arrays.asList(new String[]
        { "2", "3" }));

        entity.store();

        PreferenceComposite pref2 = (PreferenceComposite) prefs.get("pref2");

        assertNotNull(pref2);

        Iterator prefsValues = pref2.getValues();
        int count = 0;
View Full Code Here

        app.addPortletDefinition(portlet);

        app.setWebApplicationDefinition(webApp);

        PreferenceSetComposite prefSet = (PreferenceSetComposite) portlet.getPreferenceSet();
        prefSet.add("pref1", Arrays.asList(new String[]
        { "1" }));

        registry.registerPortletApplication(app);
    }
View Full Code Here

        if(newValues == null || newValues.length == 0)
        {
            throw new PortletException("You must specfiy a value for the new preference "+newName);
        }
       
        PreferenceSetComposite prefSet = (PreferenceSetComposite) entity.getPreferenceSet();
        prefSet.add(newName, Arrays.asList(newValues));
        try
        {
            entityAccess.storePortletEntity(entity);
        }
        catch (PortletEntityNotStoredException e)
View Full Code Here

        app.addPortletDefinition(portlet);

        app.setWebApplicationDefinition(webApp);

        PreferenceSetComposite prefSet = (PreferenceSetComposite) portlet.getPreferenceSet();
        prefSet.add("pref1", Arrays.asList(new String[]
        { "1" }));

        registry.registerPortletApplication(app);
    }
View Full Code Here

        mockf1.expects(new InvokeAtLeastOnceMatcher()).method("getId").will(new ReturnStub(TEST_ENTITY));
        ContentFragment f1 = new ContentFragmentTestImpl((Fragment) mockf1.proxy(), new HashMap());

        MutablePortletEntity entity = entityAccess
                .generateEntityFromFragment(new ContentFragmentTestImpl(f1, new HashMap()));
        PreferenceSetComposite prefs = (PreferenceSetComposite) entity.getPreferenceSet();
        prefs.remove("pref1");
        assertNotNull(prefs);
        assertNull(prefs.get("pref1"));

        // test adding a pref
        prefs.add("pref1", Arrays.asList(new String[]
        { "1" }));
        assertNotNull(prefs.get("pref1"));

        // Remove should return the deleted pref
        assertNotNull(prefs.remove("pref1"));

        // Should be gone
        assertNull(prefs.get("pref1"));

        // Add it back so we can test tole back
        prefs.add("pref1", Arrays.asList(new String[]
        { "1" }));

        entityAccess.storePortletEntity(entity);

        prefs = (PreferenceSetComposite) entity.getPreferenceSet();

        assertNotNull(prefs.get("pref1"));

        PreferenceComposite pref = (PreferenceComposite) prefs.get("pref1");

        assertEquals("1", pref.getValueAt(0));

        pref.setValueAt(0, "2");

        assertEquals("2", pref.getValueAt(0));

        entity.reset();

        pref = (PreferenceComposite) prefs.get("pref1");

        assertEquals("1", pref.getValueAt(0));

        prefs.remove(pref);

        assertNull(prefs.get("pref1"));

        entity.reset();

        assertNotNull(prefs.get("pref1"));

        prefs.add("pref2", Arrays.asList(new String[]
        { "2", "3" }));

        entity.store();

        PreferenceComposite pref2 = (PreferenceComposite) prefs.get("pref2");

        assertNotNull(pref2);

        Iterator prefsValues = pref2.getValues();
        int count = 0;
View Full Code Here

        return preferenceSet;
    }
   
    private PreferenceSet getPreferenceSetFromPage()
    {
        PreferenceSetComposite preferenceSet = this.pagePreferenceSet;
       
        if (preferenceSet == null || !dirty)
        {
            preferenceSet = new FragmentPreferenceSet(fragment, pm);
           
View Full Code Here

        mockf1.expects(new InvokeAtLeastOnceMatcher()).method("getName").will(new ReturnStub(pd.getUniqueName()));
        mockf1.expects(new InvokeAtLeastOnceMatcher()).method("getId").will(new ReturnStub(TEST_ENTITY));
        Fragment f1 =(Fragment) mockf1.proxy();
           
        MutablePortletEntity entity = entityAccess.generateEntityFromFragment(f1);
        PreferenceSetComposite prefs = (PreferenceSetComposite) entity.getPreferenceSet();
        prefs.remove("pref1");
        assertNotNull(prefs);
        assertNull(prefs.get("pref1"));
       
        // test adding a pref
        prefs.add("pref1", Arrays.asList(new String[]{"1"}));
        assertNotNull(prefs.get("pref1"));
       
        // Remove should return the deleted pref
        assertNotNull(prefs.remove("pref1"));
       
        // Should be gone
        assertNull(prefs.get("pref1"));       
       
        // Add it back so we can test tole back
        prefs.add("pref1", Arrays.asList(new String[]{"1"}));
   
        entityAccess.storePortletEntity(entity);
       
        prefs = (PreferenceSetComposite) entity.getPreferenceSet();
       
        assertNotNull(prefs.get("pref1"));
       
        PreferenceComposite pref = (PreferenceComposite) prefs.get("pref1");
       
        assertEquals("1", pref.getValueAt(0));
       
        pref.setValueAt(0, "2");
       
        assertEquals("2", pref.getValueAt(0));
       
        entity.reset();
       
        pref = (PreferenceComposite) prefs.get("pref1");
       
        assertEquals("1", pref.getValueAt(0));
       
        prefs.remove(pref);      
       
        assertNull(prefs.get("pref1"));
       
        entity.reset();
       
        assertNotNull(prefs.get("pref1"));
       
        prefs.add("pref2", Arrays.asList(new String[]{"2", "3"}));
       
        entity.store();
       
        PreferenceComposite pref2 = (PreferenceComposite) prefs.get("pref2");
       
        assertNotNull(pref2);
       
        Iterator prefsValues = pref2.getValues();
        int count = 0;
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.common.preference.PreferenceSetComposite

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.