[jboss-cvs] JBossAS SVN: r108955 - 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
Wed Oct 27 16:21:09 EDT 2010


Author: rachmatowicz at jboss.com
Date: 2010-10-27 16:21:09 -0400 (Wed, 27 Oct 2010)
New Revision: 108955

Modified:
   branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/HotRodClientTestCase.java
Log:
Update HotRod test case.

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-27 19:00:45 UTC (rev 108954)
+++ branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/HotRodClientTestCase.java	2010-10-27 20:21:09 UTC (rev 108955)
@@ -37,6 +37,7 @@
 import org.infinispan.util.logging.LogFactory;
 
 import org.jboss.test.JBossClusteredTestCase;
+import org.jboss.test.JBossTestSetup;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -55,12 +56,12 @@
 	private static final Log log = LogFactory.getLog(HotRodClientTestCase.class);
 	private static final String CACHE_NAME = "replSync";
 
-	RemoteCache defaultRemote;
-	RemoteCache remoteCache;
+	private RemoteCache defaultRemote;
+	private RemoteCache remoteCache;
 	private RemoteCacheManager remoteCacheManager;
 
-	String[] servers = null ;
-	String hotRodServerList = null ;
+	private String[] servers = null ;
+	private String hotRodServerList = null ;
 
 	public HotRodClientTestCase(String name) {
 		super(name) ;
@@ -69,7 +70,8 @@
 	public void setUp() throws Exception {
 		super.setUp();
 		
-		System.out.println("setting up ...") ;
+		System.out.println("per test set up") ;
+		
 		servers = getServers() ;
 		hotRodServerList = servers[0] + ":" + "11216" ;
 		System.out.println("datagrid host0 = " + servers[0]) ;
@@ -80,7 +82,7 @@
 	}
 
 	public void tearDown() throws Exception {
-		System.out.println("tearing down...") ;
+		System.out.println("per test tearing down") ;
 		super.tearDown();
 	}
 
@@ -89,9 +91,9 @@
 		// get the Remote Cache Manager proxy from the server
 		remoteCacheManager = getRemoteCacheManager();
 		// get the default cache
-		defaultRemote = remoteCacheManager.getCache();
+		// defaultRemote = remoteCacheManager.getCache();
 		// get a named cache
-		//remoteCache = remoteCacheManager.getCache(CACHE_NAME);
+		remoteCache = remoteCacheManager.getCache();
 	}
 
 	// this should be in a one time setup
@@ -108,12 +110,12 @@
 	 */
 
 	public void testPut() throws IOException {
-		//assert null == remoteCache.put("aKey", "aValue");
-		assert null == defaultRemote.put("otherKey", "otherValue");
-		//assert remoteCache.containsKey("aKey");
-		assert defaultRemote.containsKey("otherKey");
-		//assert remoteCache.get("aKey").equals("aValue");
-		assert defaultRemote.get("otherKey").equals("otherValue");
+		assert null == remoteCache.put("aKey", "aValue");
+		//assert null == defaultRemote.put("otherKey", "otherValue");
+		assert remoteCache.containsKey("aKey");
+		//assert defaultRemote.containsKey("otherKey");
+		assert remoteCache.get("aKey").equals("aValue");
+		//assert defaultRemote.get("otherKey").equals("otherValue");
 	}
 
 	public void testRemove() throws IOException {
@@ -233,13 +235,29 @@
 		assert obj == null : msg ;
 	}
 
-	public static Test suite() { 
+	public static Test suite() throws Exception { 
+		
 		TestSuite suite= new TestSuite(); 
-		suite.addTest(new HotRodClientTestCase("testPut")); 
-		return suite;
+		suite.addTest(new TestSuite(HotRodClientTestCase.class)); 
+
+		// 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") ;				
+			}
+
+			protected void tearDown() throws Exception {
+				// one time tear down here
+				System.out.println("one time teardown") ;
+				super.tearDown();
+			}
+		};
+		return wrapper ;
 	}
 
-	public static void main(String args[]) { 
+	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