You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/09/14 02:17:43 UTC
svn commit: r280726 - in /portals/pluto/branches/pluto-1.1:
pluto-container/src/main/java/org/apache/pluto/core/impl/PortletPreferencesImpl.java
pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimplePreferenceTest.java
Author: ddewolf
Date: Tue Sep 13 17:17:37 2005
New Revision: 280726
URL: http://svn.apache.org/viewcvs?rev=280726&view=rev
Log:
Applied PLUTO-167. Thanks Zheng.
Modified:
portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletPreferencesImpl.java
portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimplePreferenceTest.java
Modified: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletPreferencesImpl.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletPreferencesImpl.java?rev=280726&r1=280725&r2=280726&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletPreferencesImpl.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/PortletPreferencesImpl.java Tue Sep 13 17:17:37 2005
@@ -178,7 +178,7 @@
Iterator it = preferences.keySet().iterator();
while (it.hasNext()) {
PortletPreference pref = (PortletPreference)preferences.get(it.next());
- map.put(pref.getName(), pref.getValues());
+ map.put(pref.getName(), pref.getValues().clone());
}
return Collections.unmodifiableMap(map);
}
Modified: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimplePreferenceTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimplePreferenceTest.java?rev=280726&r1=280725&r2=280726&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimplePreferenceTest.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimplePreferenceTest.java Tue Sep 13 17:17:37 2005
@@ -178,22 +178,22 @@
try {
preferences.setValue("VALIDATION_TEST_KEY", " Spaces removed by trim ");
preferences.store();
- }
- catch (ReadOnlyException roe) {
+ } catch (ReadOnlyException roe) {
- }
- catch (ValidatorException e) {
+ } catch (ValidatorException e) {
exceptionThrown = true;
- try { preferences.reset("VALIDATION_TEST_KEY"); }catch(Throwable t) {}
- }
- catch (IOException io) {
+ try {
+ preferences.reset("VALIDATION_TEST_KEY");
+ } catch (Throwable t) {
+
+ }
+ } catch (IOException io) {
}
- if(exceptionThrown) {
+ if (exceptionThrown) {
res.setReturnCode(TestResult.PASSED);
- }
- else {
+ } else {
res.setReturnCode(TestResult.FAILED);
res.setResults("Illegal value not caught by validator.");
}
@@ -348,7 +348,12 @@
}
return res;
}
-
+
+ /**
+ * Check PLT. 14.3: Read-only preference attributes could not be modifed.
+ * @param req the portlet request.
+ * @return the test result.
+ */
protected TestResult checkReadOnlyPreferences(PortletRequest req) {
TestResult res = new TestResult();
res.setName("Preference Read Only Test");
@@ -405,6 +410,37 @@
res.setResults("All names not found as preferences.");
}
return res;
+ }
+
+ /**
+ * Check (xci) SPEC 91, PLT 14.1:
+ * Preferences values are not modified if the values in the Map are altered.
+ * @param req the portlet request.
+ * @return the test result.
+ */
+ protected TestResult checkPreferencesValuesNotModified(PortletRequest req) {
+ TestResult res = new TestResult();
+ res.setName("Preferences Map Not Modifiable Test.");
+ res.setDesc("Preferences values are not modified if the values " +
+ "in the Map are altered.");
+ PortletPreferences prefs = req.getPreferences();
+ Map prefMap = prefs.getMap();
+ String[] values = (String[]) prefMap.get("dummyName");
+ String originalValue = null;
+ String modifiedValue = "Dummy value modified in preferences map.";
+ if (values != null && values.length == 1) {
+ originalValue = values[0];
+ values[0] = modifiedValue;
+ }
+
+ String newValue = prefs.getValue("dummyName", "");
+ if (!newValue.equals(originalValue)) {
+ res.setReturnCode(TestResult.FAILED);
+ res.setResults("Preferences values modified.");
+ } else {
+ res.setReturnCode(TestResult.PASSED);
+ }
+ return res;
}