[infinispan-commits] Infinispan SVN: r637 - in trunk/core/src/test: resources/stacks and 1 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Thu Aug 6 15:25:45 EDT 2009


Author: mircea.markus
Date: 2009-08-06 15:25:44 -0400 (Thu, 06 Aug 2009)
New Revision: 637

Added:
   trunk/core/src/test/java/org/infinispan/test/fwk/TcpMPingEnvironmentTest.java
   trunk/core/src/test/resources/stacks/tcp_mping/
   trunk/core/src/test/resources/stacks/tcp_mping/tcp1.xml
   trunk/core/src/test/resources/stacks/tcp_mping/tcp2.xml
Log:
added test to check weather TCP+MPING works in this environment

Added: trunk/core/src/test/java/org/infinispan/test/fwk/TcpMPingEnvironmentTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/fwk/TcpMPingEnvironmentTest.java	                        (rev 0)
+++ trunk/core/src/test/java/org/infinispan/test/fwk/TcpMPingEnvironmentTest.java	2009-08-06 19:25:44 UTC (rev 637)
@@ -0,0 +1,96 @@
+package org.infinispan.test.fwk;
+
+import org.jgroups.JChannel;
+import org.jgroups.View;
+import org.testng.annotations.Test;
+import org.testng.annotations.AfterMethod;
+import static org.testng.Assert.fail;
+import org.infinispan.util.logging.Log;
+import org.infinispan.util.logging.LogFactory;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Properties;
+
+/**
+ * The purpose of this class is to test that/if tcp + mping works fine in the given environment.
+ *
+ *  @author Mircea.Markus at jboss.com
+ */
+ at Test(testName = "test,fwk.TcpMPingEnvironmentTest", groups = "functional")
+public class TcpMPingEnvironmentTest {
+
+   Log log = LogFactory.getLog(TcpMPingEnvironmentTest.class);
+
+   List<JChannel> openedChannles = new ArrayList<JChannel>();
+   private boolean success = false;
+
+   @AfterMethod
+   public void destroyCaches() {
+      for (JChannel ch : openedChannles) {
+         ch.disconnect();
+         ch.close();
+      }
+      if (!success) {
+         Properties properties = System.getProperties();
+         log.trace("System props are " + properties);
+         System.out.println("System props are " + properties);
+      }
+   }
+
+   /**
+    * Tests that different clusters are created and that they don't overlap.
+    */
+   public void testDifferentClusters() throws Exception {
+      log.trace("aaaaa");
+      log.info("aaaaa");
+
+      JChannel first1 = new JChannel("stacks/tcp_mping/tcp1.xml");
+      JChannel first2 = new JChannel("stacks/tcp_mping/tcp1.xml");
+      JChannel first3 = new JChannel("stacks/tcp_mping/tcp1.xml");
+      initiChannel(first1);
+      initiChannel(first2);
+      initiChannel(first3);
+
+      expectView(first1, first2, first3);
+
+      JChannel second1 = new JChannel("stacks/tcp_mping/tcp2.xml");
+      JChannel second2 = new JChannel("stacks/tcp_mping/tcp2.xml");
+      JChannel second3 = new JChannel("stacks/tcp_mping/tcp2.xml");
+      initiChannel(second1);
+      initiChannel(second2);
+      initiChannel(second3);
+
+      expectView(first1, first2, first3);
+      expectView(second1, second2, second3);
+      success = true;
+   }
+
+   private void expectView(JChannel... channels) throws Exception {
+      for (int i = 0; i < 20; i++) {
+         boolean success = true;
+         for (int j = 0; j < channels.length; j++) {
+            View view = channels[j].getView();
+            if (view == null) {
+               success = false;
+               break;
+            }
+            System.out.println("view = " + view);
+            success = success && (view.size() == channels.length);
+         }
+         if (success) return;
+         Thread.sleep(1000);
+      }
+      fail("Could not for cluster in given timeout");
+   }
+
+
+   public void initiChannel(JChannel channel) throws Exception {
+      openedChannles.add(channel);
+      channel.setOpt(org.jgroups.Channel.LOCAL, false);
+      channel.setOpt(org.jgroups.Channel.AUTO_RECONNECT, true);
+      channel.setOpt(org.jgroups.Channel.AUTO_GETSTATE, false);
+      channel.setOpt(org.jgroups.Channel.BLOCK, true);
+      channel.connect("someChannel");
+   }
+}

Copied: trunk/core/src/test/resources/stacks/tcp_mping/tcp1.xml (from rev 636, trunk/core/src/test/resources/stacks/tcp.xml)
===================================================================
--- trunk/core/src/test/resources/stacks/tcp_mping/tcp1.xml	                        (rev 0)
+++ trunk/core/src/test/resources/stacks/tcp_mping/tcp1.xml	2009-08-06 19:25:44 UTC (rev 637)
@@ -0,0 +1,67 @@
+<config xmlns="urn:org:jgroups"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="urn:org:jgroups file:schema/JGroups-2.8.xsd">
+    <TCP bind_port="7800"
+         loopback="true"
+         port_range="30"
+         recv_buf_size="20000000"
+         send_buf_size="640000"
+         discard_incompatible_packets="true"
+         max_bundle_size="64000"
+         max_bundle_timeout="30"
+         enable_bundling="false"
+         use_send_queues="false"
+         sock_conn_timeout="300"
+         skip_suspected_members="true"
+         
+         thread_pool.enabled="true"
+         thread_pool.min_threads="1"
+         thread_pool.max_threads="25"
+         thread_pool.keep_alive_time="5000"
+         thread_pool.queue_enabled="false"
+         thread_pool.queue_max_size="100"
+         thread_pool.rejection_policy="run"
+
+         oob_thread_pool.enabled="true"
+         oob_thread_pool.min_threads="1"
+         oob_thread_pool.max_threads="8"
+         oob_thread_pool.keep_alive_time="5000"
+         oob_thread_pool.queue_enabled="false"
+         oob_thread_pool.queue_max_size="100"
+         oob_thread_pool.rejection_policy="run"/>
+         
+    <!--<TCPPING timeout="3000"-->
+             <!--initial_hosts="localhost[7800],localhost[7801]}"-->
+             <!--port_range="1"-->
+             <!--num_initial_members="3"/>-->
+
+   <MPING bind_addr="127.0.0.1" break_on_coord_rsp="true"
+          mcast_addr="228.10.10.5" mcast_port="43589" ip_ttl="2"
+          num_initial_members="3"/>
+   
+    <MERGE2 max_interval="30000"
+              min_interval="10000"/>
+    <FD_SOCK/>
+    <!--
+      Note that this is an atypically short timeout and a small number of retries
+      configured this way to speed up unit testing, since we know all nodes run in the same JVM
+      and hence failure detections will be very quick.
+   	   -->
+    <FD timeout="3000" max_tries="3" shun="true"/>
+    <VERIFY_SUSPECT timeout="1500"  />
+    <pbcast.NAKACK 
+                   use_mcast_xmit="false" gc_lag="0"
+                   retransmit_timeout="300,600,1200,2400,4800"
+                   discard_delivered_msgs="false"/>
+    <UNICAST timeout="300,600,1200" />
+    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+                   max_bytes="400000"/>
+    <pbcast.GMS print_local_addr="false" join_timeout="7000" 
+                shun="false" view_bundling="true"/>
+    <FC max_credits="2000000"
+        min_threshold="0.10"/>
+    <FRAG2 frag_size="60000"  />
+    <pbcast.STREAMING_STATE_TRANSFER/>
+    <!-- <pbcast.STATE_TRANSFER/> -->
+    <pbcast.FLUSH timeout="0"/>
+</config>


Property changes on: trunk/core/src/test/resources/stacks/tcp_mping/tcp1.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/core/src/test/resources/stacks/tcp_mping/tcp2.xml
===================================================================
--- trunk/core/src/test/resources/stacks/tcp_mping/tcp2.xml	                        (rev 0)
+++ trunk/core/src/test/resources/stacks/tcp_mping/tcp2.xml	2009-08-06 19:25:44 UTC (rev 637)
@@ -0,0 +1,67 @@
+<config xmlns="urn:org:jgroups"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="urn:org:jgroups file:schema/JGroups-2.8.xsd">
+    <TCP bind_port="7800"
+         loopback="true"
+         port_range="30"
+         recv_buf_size="20000000"
+         send_buf_size="640000"
+         discard_incompatible_packets="true"
+         max_bundle_size="64000"
+         max_bundle_timeout="30"
+         enable_bundling="false"
+         use_send_queues="false"
+         sock_conn_timeout="300"
+         skip_suspected_members="true"
+         
+         thread_pool.enabled="true"
+         thread_pool.min_threads="1"
+         thread_pool.max_threads="25"
+         thread_pool.keep_alive_time="5000"
+         thread_pool.queue_enabled="false"
+         thread_pool.queue_max_size="100"
+         thread_pool.rejection_policy="run"
+
+         oob_thread_pool.enabled="true"
+         oob_thread_pool.min_threads="1"
+         oob_thread_pool.max_threads="8"
+         oob_thread_pool.keep_alive_time="5000"
+         oob_thread_pool.queue_enabled="false"
+         oob_thread_pool.queue_max_size="100"
+         oob_thread_pool.rejection_policy="run"/>
+         
+    <!--<TCPPING timeout="3000"-->
+             <!--initial_hosts="localhost[7800],localhost[7801]}"-->
+             <!--port_range="1"-->
+             <!--num_initial_members="3"/>-->
+
+   <MPING bind_addr="127.0.0.1" break_on_coord_rsp="true"
+          mcast_addr="228.10.10.6" mcast_port="43590" ip_ttl="2"
+          num_initial_members="3"/>
+   
+    <MERGE2 max_interval="30000"
+              min_interval="10000"/>
+    <FD_SOCK/>
+    <!--
+      Note that this is an atypically short timeout and a small number of retries
+      configured this way to speed up unit testing, since we know all nodes run in the same JVM
+      and hence failure detections will be very quick.
+   	   -->
+    <FD timeout="3000" max_tries="3" shun="true"/>
+    <VERIFY_SUSPECT timeout="1500"  />
+    <pbcast.NAKACK 
+                   use_mcast_xmit="false" gc_lag="0"
+                   retransmit_timeout="300,600,1200,2400,4800"
+                   discard_delivered_msgs="false"/>
+    <UNICAST timeout="300,600,1200" />
+    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+                   max_bytes="400000"/>
+    <pbcast.GMS print_local_addr="false" join_timeout="7000" 
+                shun="false" view_bundling="true"/>
+    <FC max_credits="2000000"
+        min_threshold="0.10"/>
+    <FRAG2 frag_size="60000"  />
+    <pbcast.STREAMING_STATE_TRANSFER/>
+    <!-- <pbcast.STATE_TRANSFER/> -->
+    <pbcast.FLUSH timeout="0"/>
+</config>



More information about the infinispan-commits mailing list