[portal-commits] JBoss Portal SVN: r11967 - in branches/JBoss_Portal_Branch_2_7: wsrp/src/main/org/jboss/portal/test/wsrp/consumer and 1 other directories.
portal-commits at lists.jboss.org
portal-commits at lists.jboss.org
Wed Sep 24 10:02:12 EDT 2008
Author: chris.laprun at jboss.com
Date: 2008-09-24 10:02:12 -0400 (Wed, 24 Sep 2008)
New Revision: 11967
Modified:
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
Log:
- JBPORTAL-2083: more improvements on registration properties handling, more testing needed.
- Improved message as modify registration can also be required via a change on the producer side.
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-09-24 14:02:12 UTC (rev 11967)
@@ -155,7 +155,7 @@
bean_consumermanager_refresh_success = Refresh was successful.
bean_consumermanager_refresh_failure = Refresh failed (probably because the registration information was not valid).
bean_consumermanager_refresh_exception = An unexpected error occurred.
-bean_consumermanager_refresh_modify = The local information has been changed, you should modify your registration with the remote producer.
+bean_consumermanager_refresh_modify = Either local or remote information has been changed, you should modify your registration with the remote producer.
# ProducerBean
bean_producer_regpolicy_unset = RegistrationPolicy unset
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-09-24 14:02:12 UTC (rev 11967)
@@ -133,7 +133,7 @@
bean_consumermanager_refresh_success=Le rafra\u00eechissement a r\u00e9ussi.
bean_producer_cancel_success=Toutes les modifications faites \u00e0 la configuration du producteur ont \u00e9t\u00e9 annull\u00e9es!
bean_producer_save_success=La configuration du producteur a bien \u00e9t\u00e9 sauvegard\u00e9e!
-bean_consumermanager_refresh_modify=Les informations locales ont chang\u00e9, vous devriez modifier votre enregistrement avec le producteur.
+bean_consumermanager_refresh_modify=Les informations locales ou distantes ont chang\u00e9, vous devriez modifier votre enregistrement avec le producteur.
bean_consumer_update_success=Consommateur mis \u00e0 jour!
registration_property_status_inexistent=Inexistant sur le producteur
registration_property_status_invalid_value=Invalide valeur
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2008-09-24 14:02:12 UTC (rev 11967)
@@ -257,6 +257,35 @@
assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
}
+ public void testRefreshRegistrationRegistrationNoLocalInfoWhileRegistered()
+ {
+ // producer requests 2 registration properties
+ ServiceDescription sd = createServiceDescription(true, 2);
+
+ // simulate registration
+ info.setRegistrationHandle("blah");
+
+ RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId, false, false, false);
+ assertNotNull(result);
+ assertTrue(result.hasIssues());
+ assertEquals(RefreshResult.Status.MODIFY_REGISTRATION_REQUIRED, result.getStatus());
+ assertEquals(0, info.getRegistrationProperties().size());
+ assertEquals(2, result.getRegistrationProperties().size());
+ assertTrue(info.isModifyRegistrationNeeded());
+
+ Map regProps = result.getRegistrationProperties();
+ assertNotNull(regProps);
+
+ RegistrationProperty prop = (RegistrationProperty)regProps.get("prop0");
+ assertNotNull(prop);
+ assertTrue(prop.isInvalid());
+ assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
+ prop = (RegistrationProperty)regProps.get("prop1");
+ assertNotNull(prop);
+ assertTrue(prop.isInvalid());
+ assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
+ }
+
public void testRefreshRegistrationRegistrationMergeWithLocalInfo()
{
info.setRegistrationPropertyValue("foo", "bar");
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-09-24 14:02:12 UTC (rev 11967)
@@ -250,7 +250,7 @@
public boolean isModifyRegistrationRequired()
{
- return isModifyRegistrationRequired || (persistentRegistrationInfo != null && persistentRegistrationInfo.isModifiedSinceLastRefresh());
+ return isModifyRegistrationRequired || (persistentRegistrationInfo != null && persistentRegistrationInfo.isModifyRegistrationNeeded());
}
// FIX-ME: remove when a better dirty management is in place at property level
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2008-09-24 14:02:12 UTC (rev 11967)
@@ -295,6 +295,8 @@
// todo: deal with language more appropriately
prop = new RegistrationProperty(name, value, WSRPUtils.toString(Locale.getDefault()), this);
getOrCreateRegistrationPropertiesMap(false).put(name, prop);
+ setModifiedSinceLastRefresh(true);
+ modifyRegistrationNeeded = true;
}
return prop;
@@ -309,6 +311,7 @@
throw new IllegalArgumentException("Cannot remove inexistent registration property '" + name + "'");
}
setModifiedSinceLastRefresh(true);
+ modifyRegistrationNeeded = true;
}
private Map<String, RegistrationProperty> getOrCreateRegistrationPropertiesMap(boolean forceCreate)
@@ -662,7 +665,7 @@
public boolean isModifyRegistrationNeeded()
{
- return modifyRegistrationNeeded;
+ return modifyRegistrationNeeded || isModifiedSinceLastRefresh();
}
public boolean isModifiedSinceLastRefresh()
More information about the portal-commits
mailing list