Author: chris.laprun(a)jboss.com
Date: 2010-11-05 13:15:49 -0400 (Fri, 05 Nov 2010)
New Revision: 4959
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java
Log:
- GTNWSRP-149: modifyNow wasn't properly called when setRegistrationProperties
didn't add new registration properties so it wouldn't be called in the case of
simply removing properties.
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2010-11-05
16:24:35 UTC (rev 4958)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2010-11-05
17:15:49 UTC (rev 4959)
@@ -105,12 +105,8 @@
public void setRegistrationProperties(Map<QName,
RegistrationPropertyDescription> regProps)
{
- if (registrationProperties.equals(regProps))
+ if (!registrationProperties.equals(regProps))
{
- return;
- }
- else
- {
registrationProperties.clear();
for (RegistrationPropertyDescription propertyDescription : regProps.values())
@@ -118,6 +114,8 @@
addRegistrationProperty(new
RegistrationPropertyDescription(propertyDescription));
}
+ modifyNow();
+
notifyRegistrationPropertyChangeListeners();
}
}
Modified:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java
===================================================================
---
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java 2010-11-05
16:24:35 UTC (rev 4958)
+++
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java 2010-11-05
17:15:49 UTC (rev 4959)
@@ -33,6 +33,7 @@
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
import javax.xml.namespace.QName;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -91,6 +92,28 @@
assertEquals(lastModified, requirements.getLastModified());
}
+ public void testSetRegistrationPropertiesPropertyRemoval()
+ {
+ ProducerRegistrationRequirements requirements = new
ProducerRegistrationRequirementsImpl();
+ requirements.addEmptyRegistrationProperty("foo");
+
+ final Map<QName, RegistrationPropertyDescription> expected =
Collections.emptyMap();
+
+ long lastModified = requirements.getLastModified();
+
+ requirements.addRegistrationPropertyChangeListener(new
RegistrationPropertyChangeListener()
+ {
+ public void propertiesHaveChanged(Map<QName, ? extends
PropertyDescription> newRegistrationProperties)
+ {
+ assertEquals(expected, newRegistrationProperties);
+ }
+ });
+
+ requirements.setRegistrationProperties(expected);
+
+ assertTrue(requirements.getLastModified() > lastModified);
+ }
+
public void testReloadSamePolicy()
{
ProducerRegistrationRequirements requirements = new
ProducerRegistrationRequirementsImpl();
@@ -129,4 +152,24 @@
requirements.setRegistrationRequired(true);
}
+ public void testRemoveProperty()
+ {
+ ProducerRegistrationRequirements requirements = new
ProducerRegistrationRequirementsImpl();
+ requirements.addEmptyRegistrationProperty("foo");
+
+ long lastModified = requirements.getLastModified();
+
+ requirements.removeRegistrationProperty("foo");
+
+ requirements.addRegistrationPropertyChangeListener(new
RegistrationPropertyChangeListener()
+ {
+ public void propertiesHaveChanged(Map<QName, ? extends
PropertyDescription> newRegistrationProperties)
+ {
+ assertTrue(newRegistrationProperties.isEmpty());
+ }
+ });
+
+ assertTrue(requirements.getLastModified() > lastModified);
+ }
+
}
Show replies by date