[jboss-cvs] JBossAS SVN: r109719 - 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
Mon Dec 6 06:11:10 EST 2010


Author: mlinhard
Date: 2010-12-06 06:11:09 -0500 (Mon, 06 Dec 2010)
New Revision: 109719

Modified:
   branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/MemcachedClientTestCase.java
Log:
fixed verbosity command tests, cas 64 bit value tests and stats args tests

Modified: branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/MemcachedClientTestCase.java
===================================================================
--- branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/MemcachedClientTestCase.java	2010-12-06 10:47:02 UTC (rev 109718)
+++ branches/JBPAPP_5_1_datagrid/testsuite/src/main/org/jboss/test/cluster/datagrid/test/MemcachedClientTestCase.java	2010-12-06 11:11:09 UTC (rev 109719)
@@ -323,19 +323,19 @@
 		assertEquals("A", mc.get(key250));
 		mc.writeln("set "+key251+" 0 0 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	public void testKeyLonger250Get() throws Exception {
 		mc.writeln("get " + key250() + "a");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}	
 	
 	public void testKeyLonger250Gets() throws Exception {
 		mc.writeln("gets " + key250() + "a");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}	
 	
 	public void testKeyLonger250Multiget() throws Exception {
@@ -348,7 +348,7 @@
 		assertEquals("A", mc.get(key250));
 		mc.writeln("get " + key250 + " " + key251);
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 		assertEquals("DELETED", mc.delete(key250));
 	}
 	
@@ -366,49 +366,49 @@
 		assertEquals("A", mc.get(key250));
 		mc.writeln("add "+key251+" 0 0 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	public void testKeyLonger250Replace() throws Exception {
 		mc.writeln("replace "+key250()+"a 0 0 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	public void testKeyLonger250Append() throws Exception {
 		mc.writeln("append "+key250()+"a 0 0 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	public void testKeyLonger250Prepend() throws Exception {
 		mc.writeln("prepend "+key250()+"a 0 0 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 
 	public void testKeyLonger250Cas() throws Exception {
 		mc.writeln("prepend "+key250()+"a 0 0 1 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 
 	public void testKeyLonger250Incr() throws Exception {
 		mc.writeln("incr "+key250()+"a 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 
 	public void testKeyLonger250Decr() throws Exception {
 		mc.writeln("decr "+key250()+"a 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	public void testKeyLonger250Delete() throws Exception {
 		mc.writeln("delete "+key250()+"a");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	public void testDelete() throws Exception {
@@ -635,13 +635,13 @@
 	public void testBogusCommand() throws Exception {
 		mc.writeln("boguscommand");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("ERROR"));
+		assertStartsWith(mc.readln(), "ERROR");
 	}
 	
 	public void testBogusCommandArgs() throws Exception {
 		mc.writeln("boguscommand arg1 arg2 arg3");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("ERROR"));
+		assertStartsWith(mc.readln(), "ERROR");
 	}
 	
 	//https://jira.jboss.org/browse/JBPAPP-5473
@@ -649,56 +649,53 @@
 		mc.writeln("boguscommand");
 		mc.writeln("delete " + KEY_A);
 		mc.flush();
-		assertTrue(mc.readln().startsWith("ERROR"));
+		assertStartsWith(mc.readln(), "ERROR");
 		assertEquals("NOT_FOUND", mc.readln());
 	}
 	
 	public void testCasParsing1() throws Exception {
 		mc.writeln("cas bad blah 0 0 0");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	public void testCasParsing2() throws Exception {
 		mc.writeln("cas bad 0 blah 0 0");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	public void testCasParsing3() throws Exception {
 		mc.writeln("cas bad 0 0 blah 0");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	public void testCasParsing4() throws Exception {
 		mc.writeln("cas bad 0 0 0 blah");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
-//	public void testCasParsing5() throws Exception {
-//		mc.writeln("cas bad 0 0 0 0 0");
-//		mc.flush();
-//		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
-//	}
-	
 	// missing cas unique value
 	public void testCasParsing6() throws Exception {
 		mc.writeln("cas bad 0 0 6");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
+	// https://jira.jboss.org/browse/JBPAPP-5447
 	public void testCasUniqueIs64Bit() throws Exception {
-		mc.writeln("cas a 0 0 1 18446744073709551615");
+		// casid should be 64 bit value, in our case signed
+		// ie. should have range Long.MIN_VALUE .. Long.MAX_VALUE 
+		mc.writeln("cas a 0 0 1 " + Long.MAX_VALUE);
 		mc.writeln("a");
 		mc.flush();
 		assertEquals("NOT_FOUND", mc.readln());
-		mc.writeln("cas a 0 0 1 -1");
+		mc.writeln("cas a 0 0 1 " + Long.MIN_VALUE);
 		mc.writeln("a");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertEquals("NOT_FOUND", mc.readln());
 	}
 	
 	// https://jira.jboss.org/browse/JBPAPP-5446
@@ -713,17 +710,17 @@
 		assertEquals("STORED", mc.readln());
 		mc.writeln("set a -1 0 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 		mc.writeln("set a 4294967296 0 1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	// https://jira.jboss.org/browse/JBPAPP-5445
-	public void testVerbosity() throws Exception {
+	public void testVerbosityUnsupported() throws Exception {
 		mc.writeln("verbosity 0");
 		mc.flush();
-		assertEquals("OK", mc.readln());
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	// https://jira.jboss.org/browse/JBPAPP-5444
@@ -928,7 +925,7 @@
 		mc.writeln("verbosity 0");
 		mc.writeln("get " + KEY_B);
 		mc.flush();
-		assertEquals("OK", mc.readln());
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 		assertEquals("END", mc.readln());
 	}
 	
@@ -953,14 +950,14 @@
 	public void testStatsArgs() throws Exception {
 		mc.writeln("stats args");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("SERVER_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 	// https://jira.jboss.org/browse/JBPAPP-5425
 	public void testNegativeItemSize() throws Exception {
 		mc.writeln("set a 0 0 -1");
 		mc.flush();
-		assertTrue(mc.readln().startsWith("CLIENT_ERROR"));
+		assertStartsWith(mc.readln(), "CLIENT_ERROR");
 	}
 	
 
@@ -1037,14 +1034,6 @@
 		mc.flush();
 		assertEquals("END", mc.readln());
 	}
-		
-	// https://jira.jboss.org/browse/JBPAPP-5445
-	public void testNoReplyVerbosity() throws Exception {
-		mc.writeln("verbosity 0 noreply");
-		mc.writeln("get " + KEY_B);
-		mc.flush();
-		assertEquals("END", mc.readln());
-	}
 	
 	// https://jira.jboss.org/browse/JBPAPP-5439
 	public void testNoReplyFlushAll() throws Exception {
@@ -1060,5 +1049,8 @@
 		mc.flush();
 		assertEquals("END", mc.readln());
 	}
-	
+
+	private void assertStartsWith(String str, String prefix) {
+		assertTrue("String \"" + str + "\" doesn't start with expected prefix \"" + prefix + "\"", str.startsWith(prefix));
+	}
 }
\ No newline at end of file



More information about the jboss-cvs-commits mailing list