Fixed failing test in ClusterTest

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@358594 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2005-12-22 17:36:17 +00:00
parent 749c76d57f
commit 08d4b5ff25
4 changed files with 22 additions and 37 deletions

View File

@ -1,32 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry excluding="" kind="src" path="src/java"> <classpathentry kind="src" path="src/java"/>
</classpathentry> <classpathentry output="target/test-classes" kind="src" path="src/test"/>
<classpathentry output="workspace/eclipse/activemq/bin" kind="src" path="src/test"> <classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar"/>
</classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar"> <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.4.jar"/>
</classpathentry> <classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-jms-1.1-rc4.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> <classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-jta-1.0.1B-rc4.jar"/>
</classpathentry> <classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-j2ee-management-1.0-rc4.jar"/>
<classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.4.jar"> <classpathentry kind="var" path="MAVEN_REPO/backport-util-concurrent/jars/backport-util-concurrent-2.0_01_pd.jar"/>
</classpathentry> <classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-j2ee-jacc-1.0-rc4.jar"/>
<classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-jms-1.1-rc4.jar"> <classpathentry kind="var" path="MAVEN_REPO/log4j/jars/log4j-1.2.8.jar"/>
</classpathentry> <classpathentry combineaccessrules="false" kind="src" path="/activeio"/>
<classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-jta-1.0.1B-rc4.jar"> <classpathentry combineaccessrules="false" kind="src" path="/activemq-core"/>
</classpathentry> <classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-j2ee-management-1.0-rc4.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/activemq/jars/activemq-core-4.0-SNAPSHOT.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/activeio/jars/activeio-2.1-SNAPSHOT.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/backport-util-concurrent/jars/backport-util-concurrent-2.0_01_pd.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/geronimo-spec/jars/geronimo-spec-j2ee-jacc-1.0-rc4.jar">
</classpathentry>
<classpathentry kind="var" path="MAVEN_REPO/log4j/jars/log4j-1.2.8.jar">
</classpathentry>
<classpathentry kind="output" path="workspace/eclipse/activemq/bin">
</classpathentry>
</classpath> </classpath>

View File

@ -164,7 +164,7 @@ public class DefaultClusterFactory implements ClusterFactory {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
protected Cluster createCluster(Connection connection,Session session,String name,Destination groupDestination, protected Cluster createCluster(Connection connection,Session session,String name,Destination groupDestination,
DestinationMarshaller marshaller) throws JMSException{ DestinationMarshaller marshaller) throws JMSException{
String dataDestination=dataTopicPrefix+groupDestination; String dataDestination = dataTopicPrefix + marshaller.getDestinationName(groupDestination);
log.info("Creating cluster group producer on topic: "+groupDestination); log.info("Creating cluster group producer on topic: "+groupDestination);
MessageProducer producer=createProducer(session,null); MessageProducer producer=createProducer(session,null);
producer.setDeliveryMode(deliveryMode); producer.setDeliveryMode(deliveryMode);

View File

@ -123,7 +123,7 @@ public class StateServiceImpl implements StateService {
HashMap answer = new HashMap(nodes.size()); HashMap answer = new HashMap(nodes.size());
for (Iterator iter = nodes.entrySet().iterator(); iter.hasNext();) { for (Iterator iter = nodes.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next(); Map.Entry entry = (Map.Entry) iter.next();
String key = entry.getKey().toString(); Object key = entry.getKey();
NodeEntry nodeEntry = (NodeEntry) entry.getValue(); NodeEntry nodeEntry = (NodeEntry) entry.getValue();
answer.put(key, nodeEntry.node); answer.put(key, nodeEntry.node);
} }

View File

@ -27,7 +27,7 @@ import javax.jms.Message;
*/ */
public class ClusterTest extends ClusterTestSupport { public class ClusterTest extends ClusterTestSupport {
protected int count = 2; protected int count = 3;
public void testCluster() throws Exception { public void testCluster() throws Exception {
cluster = createCluster(); cluster = createCluster();
@ -76,8 +76,6 @@ public class ClusterTest extends ClusterTestSupport {
assertClusterMembership(clusters); assertClusterMembership(clusters);
// lets wait for a while to see if things fail
Thread.sleep(10000L);
assertClusterMembership(clusters); assertClusterMembership(clusters);
@ -90,9 +88,11 @@ public class ClusterTest extends ClusterTestSupport {
map.put(key, value); map.put(key, value);
testNode.setState(map); testNode.setState(map);
Thread.sleep(5000);
Thread.sleep(500);
for (int i = 1; i < count; i++) { for (int i = 1; i < count; i++) {
Node node = (Node) clusters[i].getNodes().get(testNode.getDestination()); Node node = (Node) clusters[i].getNodes().get(testNode.getDestination());
assertTrue("The current test node should be in the cluster: " + i, node != null); assertTrue("The current test node should be in the cluster: " + i, node != null);
assertTrue(node.getState().get(key).equals(value)); assertTrue(node.getState().get(key).equals(value));
} }