yields should be fine

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@789194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2009-06-29 02:46:02 +00:00
parent c88a9b2070
commit 5666134635
1 changed files with 38 additions and 65 deletions

View File

@ -97,11 +97,7 @@ public class TestRowResource extends MiniClusterTestCase {
path.append('/'); path.append('/');
path.append(row); path.append(row);
Response response = client.delete(path.toString()); Response response = client.delete(path.toString());
try { Thread.yield();
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
return response; return response;
} }
@ -115,11 +111,7 @@ public class TestRowResource extends MiniClusterTestCase {
path.append('/'); path.append('/');
path.append(column); path.append(column);
Response response = client.delete(path.toString()); Response response = client.delete(path.toString());
try { Thread.yield();
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
return response; return response;
} }
@ -133,11 +125,6 @@ public class TestRowResource extends MiniClusterTestCase {
path.append('/'); path.append('/');
path.append(column); path.append(column);
Response response = client.get(path.toString(), MIMETYPE_XML); Response response = client.get(path.toString(), MIMETYPE_XML);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
return response; return response;
} }
@ -151,11 +138,6 @@ public class TestRowResource extends MiniClusterTestCase {
path.append('/'); path.append('/');
path.append(column); path.append(column);
Response response = client.get(path.toString(), MIMETYPE_PROTOBUF); Response response = client.get(path.toString(), MIMETYPE_PROTOBUF);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
return response; return response;
} }
@ -176,11 +158,7 @@ public class TestRowResource extends MiniClusterTestCase {
marshaller.marshal(cellSetModel, writer); marshaller.marshal(cellSetModel, writer);
Response response = client.put(path.toString(), MIMETYPE_XML, Response response = client.put(path.toString(), MIMETYPE_XML,
Bytes.toBytes(writer.toString())); Bytes.toBytes(writer.toString()));
try { Thread.yield();
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
return response; return response;
} }
@ -211,11 +189,7 @@ public class TestRowResource extends MiniClusterTestCase {
cellSetModel.addRow(rowModel); cellSetModel.addRow(rowModel);
Response response = client.put(path.toString(), MIMETYPE_PROTOBUF, Response response = client.put(path.toString(), MIMETYPE_PROTOBUF,
cellSetModel.createProtobufOutput()); cellSetModel.createProtobufOutput());
try { Thread.yield();
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
return response; return response;
} }
@ -231,6 +205,30 @@ public class TestRowResource extends MiniClusterTestCase {
assertEquals(Bytes.toString(cell.getValue()), value); assertEquals(Bytes.toString(cell.getValue()), value);
} }
public void testDelete() throws IOException, JAXBException {
Response response;
response = putValueXML(TABLE, ROW_1, COLUMN_1, VALUE_1);
assertEquals(response.getCode(), 200);
response = putValueXML(TABLE, ROW_1, COLUMN_2, VALUE_2);
assertEquals(response.getCode(), 200);
checkValueXML(TABLE, ROW_1, COLUMN_1, VALUE_1);
checkValueXML(TABLE, ROW_1, COLUMN_2, VALUE_2);
response = deleteValue(TABLE, ROW_1, COLUMN_1);
assertEquals(response.getCode(), 200);
response = getValueXML(TABLE, ROW_1, COLUMN_1);
assertEquals(response.getCode(), 404);
checkValueXML(TABLE, ROW_1, COLUMN_2, VALUE_2);
response = deleteRow(TABLE, ROW_1);
assertEquals(response.getCode(), 200);
response = getValueXML(TABLE, ROW_1, COLUMN_1);
assertEquals(response.getCode(), 404);
response = getValueXML(TABLE, ROW_1, COLUMN_2);
assertEquals(response.getCode(), 404);
}
public void testSingleCellGetPutXML() throws IOException, JAXBException { public void testSingleCellGetPutXML() throws IOException, JAXBException {
Response response = getValueXML(TABLE, ROW_1, COLUMN_1); Response response = getValueXML(TABLE, ROW_1, COLUMN_1);
assertEquals(response.getCode(), 404); assertEquals(response.getCode(), 404);
@ -238,14 +236,9 @@ public class TestRowResource extends MiniClusterTestCase {
response = putValueXML(TABLE, ROW_1, COLUMN_1, VALUE_1); response = putValueXML(TABLE, ROW_1, COLUMN_1, VALUE_1);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
checkValueXML(TABLE, ROW_1, COLUMN_1, VALUE_1); checkValueXML(TABLE, ROW_1, COLUMN_1, VALUE_1);
response = putValueXML(TABLE, ROW_1, COLUMN_1, VALUE_2);
response = putValueXML(TABLE, ROW_1, COLUMN_2, VALUE_1);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
response = deleteValue(TABLE, ROW_1, COLUMN_1); checkValueXML(TABLE, ROW_1, COLUMN_1, VALUE_2);
assertEquals(response.getCode(), 200);
response = getValueXML(TABLE, ROW_1, COLUMN_1);
assertEquals(response.getCode(), 404);
checkValueXML(TABLE, ROW_1, COLUMN_2, VALUE_1);
response = deleteRow(TABLE, ROW_1); response = deleteRow(TABLE, ROW_1);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
@ -259,13 +252,12 @@ public class TestRowResource extends MiniClusterTestCase {
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
checkValuePB(TABLE, ROW_1, COLUMN_1, VALUE_1); checkValuePB(TABLE, ROW_1, COLUMN_1, VALUE_1);
response = putValuePB(TABLE, ROW_1, COLUMN_2, VALUE_1); response = putValuePB(TABLE, ROW_1, COLUMN_1, VALUE_1);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
response = deleteValue(TABLE, ROW_1, COLUMN_1); checkValuePB(TABLE, ROW_1, COLUMN_1, VALUE_1);
response = putValueXML(TABLE, ROW_1, COLUMN_1, VALUE_2);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
response = getValuePB(TABLE, ROW_1, COLUMN_1); checkValuePB(TABLE, ROW_1, COLUMN_1, VALUE_2);
assertEquals(response.getCode(), 404);
checkValuePB(TABLE, ROW_1, COLUMN_2, VALUE_1);
response = deleteRow(TABLE, ROW_1); response = deleteRow(TABLE, ROW_1);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
@ -274,14 +266,9 @@ public class TestRowResource extends MiniClusterTestCase {
public void testSingleCellGetPutBinary() throws IOException { public void testSingleCellGetPutBinary() throws IOException {
final String path = "/" + TABLE + "/" + ROW_3 + "/" + COLUMN_1; final String path = "/" + TABLE + "/" + ROW_3 + "/" + COLUMN_1;
final byte[] body = Bytes.toBytes(VALUE_3); final byte[] body = Bytes.toBytes(VALUE_3);
Response response = client.put(path, MIMETYPE_BINARY, body); Response response = client.put(path, MIMETYPE_BINARY, body);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
try { Thread.yield();
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
response = client.get(path, MIMETYPE_BINARY); response = client.get(path, MIMETYPE_BINARY);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
@ -301,18 +288,12 @@ public class TestRowResource extends MiniClusterTestCase {
public void testSingleCellGetJSON() throws IOException, JAXBException { public void testSingleCellGetJSON() throws IOException, JAXBException {
final String path = "/" + TABLE + "/" + ROW_4 + "/" + COLUMN_1; final String path = "/" + TABLE + "/" + ROW_4 + "/" + COLUMN_1;
Response response = client.put(path, MIMETYPE_BINARY, Response response = client.put(path, MIMETYPE_BINARY,
Bytes.toBytes(VALUE_4)); Bytes.toBytes(VALUE_4));
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
try { Thread.yield();
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
response = client.get(path, MIMETYPE_JSON); response = client.get(path, MIMETYPE_JSON);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
response = deleteRow(TABLE, ROW_4); response = deleteRow(TABLE, ROW_4);
assertEquals(response.getCode(), 200); assertEquals(response.getCode(), 200);
} }
@ -333,11 +314,7 @@ public class TestRowResource extends MiniClusterTestCase {
marshaller.marshal(cellSetModel, writer); marshaller.marshal(cellSetModel, writer);
Response response = client.put(path, MIMETYPE_XML, Response response = client.put(path, MIMETYPE_XML,
Bytes.toBytes(writer.toString())); Bytes.toBytes(writer.toString()));
try { Thread.yield();
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
// make sure the fake row was not actually created // make sure the fake row was not actually created
response = client.get(path); response = client.get(path);
@ -369,11 +346,7 @@ public class TestRowResource extends MiniClusterTestCase {
cellSetModel.addRow(rowModel); cellSetModel.addRow(rowModel);
Response response = client.put(path, MIMETYPE_PROTOBUF, Response response = client.put(path, MIMETYPE_PROTOBUF,
cellSetModel.createProtobufOutput()); cellSetModel.createProtobufOutput());
try { Thread.yield();
Thread.sleep(1000);
} catch (InterruptedException e) {
// ignore
}
// make sure the fake row was not actually created // make sure the fake row was not actually created
response = client.get(path); response = client.get(path);