Author: chris.laprun(a)jboss.com
Date: 2009-11-23 09:01:38 -0500 (Mon, 23 Nov 2009)
New Revision: 761
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
Log:
- Added more tests and additional check.
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2009-11-23
13:39:25 UTC (rev 760)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2009-11-23
14:01:38 UTC (rev 761)
@@ -232,6 +232,7 @@
public void setRegistrationInfo(RegistrationInfo registrationInfo)
{
+ ParameterValidation.throwIllegalArgExceptionIfNull(registrationInfo,
"RegistrationInfo");
this.persistentRegistrationInfo = registrationInfo;
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2009-11-23
13:39:25 UTC (rev 760)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2009-11-23
14:01:38 UTC (rev 761)
@@ -77,6 +77,33 @@
info.setRegistry(new MockConsumerRegistry());
}
+ public void testSetRegistrationInfo()
+ {
+ RegistrationInfo regInfo = new RegistrationInfo(info);
+ assertEquals(regInfo, info.getRegistrationInfo());
+ assertEquals(info, regInfo.getParent());
+
+ RegistrationInfo regInfo2 = new RegistrationInfo();
+ assertEquals(regInfo, info.getRegistrationInfo());
+ assertNull(regInfo2.getParent());
+
+ info.setRegistrationInfo(regInfo2);
+ assertEquals(regInfo2, info.getRegistrationInfo());
+ assertEquals(info, regInfo2.getParent());
+ }
+
+ public void testSetNullRegistrationInfo()
+ {
+ try
+ {
+ info.setRegistrationInfo(null);
+ fail("Shouldn't be possible to set a null RegistrationInfo");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
public void testRefreshAndCache() throws Exception
{
ServiceDescriptionBehavior behavior = new ServiceDescriptionBehavior();