[jboss-cvs] JBossAS SVN: r109020 - branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 29 15:34:26 EDT 2010


Author: rachmatowicz at jboss.com
Date: 2010-10-29 15:34:26 -0400 (Fri, 29 Oct 2010)
New Revision: 109020

Modified:
   branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/HotRodClientTestCase.java
Log:
Fix up HotRodClientTestCase

Modified: branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/HotRodClientTestCase.java
===================================================================
--- branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/HotRodClientTestCase.java	2010-10-29 18:54:01 UTC (rev 109019)
+++ branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/HotRodClientTestCase.java	2010-10-29 19:34:26 UTC (rev 109020)
@@ -55,7 +55,8 @@
 {
 
 	private static final Log log = LogFactory.getLog(HotRodClientTestCase.class);
-	private static final String CACHE_NAME = "replSync";
+	private static final String REPL_CACHE_NAME = "sampleReplicatedCache";
+	private static final String PERSIST_CACHE_NAME = "samplePersistentCache";
 
 	private RemoteCache defaultRemote;
 	private RemoteCache remoteCache;
@@ -74,49 +75,71 @@
 		System.out.println("per test set up") ;
 		
 		servers = getServers() ;
-		hotRodServerList = servers[0] + ":" + "11216" ;
+		hotRodServerList = servers[0] + ":" + "11222" + ";" + servers[1] + ":" + "11222";
 		System.out.println("datagrid host0 = " + servers[0]) ;
 		System.out.println("datagrid host1 = " + servers[1]) ;		
 		System.out.println("HotRodServer list = " + hotRodServerList ) ;
 		
-		createCacheManager() ;
+		// get the Remote Cache Manager proxy from the server
+		remoteCacheManager = getRemoteCacheManager();
+		remoteCacheManager.start() ;
+
+		// get the default cache
+		defaultRemote = remoteCacheManager.getCache();
+		// get a named cache
+		remoteCache = remoteCacheManager.getCache(REPL_CACHE_NAME);
 	}
 
 	public void tearDown() throws Exception {
 		System.out.println("per test tearing down") ;
+		
+		remoteCacheManager.stop() ;
+		
 		super.tearDown();
 	}
 
 
 	protected void createCacheManager() throws Exception {
-		// get the Remote Cache Manager proxy from the server
-		remoteCacheManager = getRemoteCacheManager();
-		// get the default cache
-		// defaultRemote = remoteCacheManager.getCache();
-		// get a named cache
-		remoteCache = remoteCacheManager.getCache();
 	}
 
 	// this should be in a one time setup
 	protected RemoteCacheManager getRemoteCacheManager() {
 		Properties config = new Properties();
-		config.put("infinispan.client.hotrod.server_list", hotRodServerList);
-		return new RemoteCacheManager(config);
+	      // load balancing
+	      config.put("infinispan.client.hotrod.request_balancing_strategy", 
+			 "org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy");
+	      // list of HotRod servers available to connect to
+	      config.put("infinispan.client.hotrod.server_list", hotRodServerList);
+	      config.put("infinispan.client.hotrod.force_return_values", "false");
+	      // TCP stuff
+	      config.put("infinispan.client.hotrod.tcp_no_delay", "true");
+	      config.put("infinispan.client.hotrod.ping_on_startup", "true");
+	      config.put("infinispan.client.hotrod.transport_factory", 
+			 "org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory");
+	      // marshalling
+	      config.put("infinispan.client.hotrod.marshaller", "org.infinispan.marshall.jboss.GenericJBossMarshaller");
+	      // executors
+	      config.put("infinispan.client.hotrod.async_executor_factory", 
+			 "org.infinispan.client.hotrod.impl.async.DefaultAsyncExecutorFactory");
+	      config.put("infinispan.client.hotrod.default_executor_factory.pool_size", "10");
+	      config.put("infinispan.client.hotrod.default_executor_factory.queue_size", "100000");
+	      // hashing
+	      config.put("infinispan.client.hotrod.hash_function_impl.1", 
+			 "org.infinispan.client.hotrod.impl.consistenthash.ConsistentHashV1");
+	      config.put("infinispan.client.hotrod.key_size_estimate", "64");
+	      config.put("infinispan.client.hotrod.value_size_estimate", "512");
+
+		return new RemoteCacheManager(config, false);
 	}
 
-	/*
-	 *******************************
-	 * basic tests of the HotRod API 
-	 *******************************
-	 */
 
 	public void testPut() throws IOException {
 		assert null == remoteCache.put("aKey", "aValue");
-		//assert null == defaultRemote.put("otherKey", "otherValue");
+		assert null == defaultRemote.put("otherKey", "otherValue");
 		assert remoteCache.containsKey("aKey");
-		//assert defaultRemote.containsKey("otherKey");
+		assert defaultRemote.containsKey("otherKey");
 		assert remoteCache.get("aKey").equals("aValue");
-		//assert defaultRemote.get("otherKey").equals("otherValue");
+		assert defaultRemote.get("otherKey").equals("otherValue");
 	}
 
 	public void testRemove() throws IOException {
@@ -236,29 +259,33 @@
 		assert obj == null : msg ;
 	}
 
-	public static Test suite() throws Exception { 
-		
-		TestSuite suite= new TestSuite(); 
-		suite.addTest(new TestSuite(HotRodClientTestCase.class)); 
+//	public static Test suite() throws Exception { 
+//		
+//		TestSuite suite= new TestSuite(); 
+//		suite.addTest(new TestSuite(HotRodClientTestCase.class)); 
+//
+//		// Create an initializer for the test suite
+//		Test wrapper = new HotRodClientTestSetup(suite) ;
+//		return wrapper ;
+//	}
+//
+//	public static void main(String args[]) throws Exception { 
+//		junit.textui.TestRunner.run(suite());
+//	}
+	
+	class HotRodClientTestSetup extends JBossTestClusteredSetup {
 
-		// Create an initializer for the test suite
-		Test wrapper = new JBossTestClusteredSetup(suite) {
-			protected void setUp() throws Exception {
-				super.setUp();
-				// one time setup here
-				System.out.println("one time setup") ;				
-			}
+		public void setUp() throws Exception {
+			super.setUp();
+			// one time setup here
+			System.out.println("one time setup") ;				
+		}
 
-			protected void tearDown() throws Exception {
-				// one time tear down here
-				System.out.println("one time teardown") ;
-				super.tearDown();
-			}
-		};
-		return wrapper ;
-	}
+		public void tearDown() throws Exception {
+			// one time tear down here
+			System.out.println("one time teardown") ;
+			super.tearDown();
+		}
 
-	public static void main(String args[]) throws Exception { 
-		junit.textui.TestRunner.run(suite());
 	}
 }
\ No newline at end of file



More information about the jboss-cvs-commits mailing list