Author: chris.laprun(a)jboss.com
Date: 2011-09-16 18:27:25 -0400 (Fri, 16 Sep 2011)
New Revision: 7457
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerCache.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/registry/ConsumerRegistryTestCase.java
Log:
- Fixed an issue with consumers not being properly reloaded by adding invalidation support
to ConsumerCache.
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java 2011-09-16
21:09:30 UTC (rev 7456)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java 2011-09-16
22:27:25 UTC (rev 7457)
@@ -503,9 +503,10 @@
}
}
- protected class InMemoryConsumerCache implements ConsumerCache
+ protected static class InMemoryConsumerCache implements ConsumerCache
{
private Map<String, WSRPConsumer> consumers = new HashMap<String,
WSRPConsumer>(11);
+ private boolean invalidated;
public Collection<WSRPConsumer> getConsumers()
{
@@ -530,6 +531,17 @@
public void clear()
{
consumers.clear();
+ invalidated = true;
}
+
+ public boolean isInvalidated()
+ {
+ return invalidated;
+ }
+
+ public void setInvalidated(boolean invalidated)
+ {
+ this.invalidated = invalidated;
+ }
}
}
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerCache.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerCache.java 2011-09-16
21:09:30 UTC (rev 7456)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerCache.java 2011-09-16
22:27:25 UTC (rev 7457)
@@ -39,4 +39,8 @@
void putConsumer(String id, WSRPConsumer consumer);
void clear();
+
+ boolean isInvalidated();
+
+ void setInvalidated(boolean invalidated);
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/registry/ConsumerRegistryTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/registry/ConsumerRegistryTestCase.java 2011-09-16
21:09:30 UTC (rev 7456)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/registry/ConsumerRegistryTestCase.java 2011-09-16
22:27:25 UTC (rev 7457)
@@ -185,4 +185,20 @@
// check that consumer is not known by the FederatingPortletInvoker anymore
assertEquals(null,
registrySpy.getFederatingPortletInvoker().getFederatedInvoker("foo"));
}
+
+ public void testReloadConsumers()
+ {
+ WSRPConsumer consumer1 = registry.createConsumer("consumer1", null,
null);
+ WSRPConsumer consumer2 = registry.createConsumer("consumer2", null,
null);
+
+ assertEquals(2, registry.getConfiguredConsumersIds().size());
+ assertEquals(consumer1, registry.getConsumer(consumer1.getProducerId()));
+ assertEquals(consumer2, registry.getConsumer(consumer2.getProducerId()));
+
+ registry.reloadConsumers();
+
+ assertEquals(2, registry.getConfiguredConsumersIds().size());
+ assertEquals(consumer1, registry.getConsumer(consumer1.getProducerId()));
+ assertEquals(consumer2, registry.getConsumer(consumer2.getProducerId()));
+ }
}
Show replies by date