HBASE-15975 logic in TestHTableDescriptor#testAddCoprocessorWithSpecStr is wrong (Huaxiang Sun)
This commit is contained in:
parent
031b745001
commit
41cc215544
|
@ -55,35 +55,36 @@ public class TestHTableDescriptor {
|
||||||
public void testAddCoprocessorWithSpecStr() throws IOException {
|
public void testAddCoprocessorWithSpecStr() throws IOException {
|
||||||
HTableDescriptor htd = new HTableDescriptor(TableName.META_TABLE_NAME);
|
HTableDescriptor htd = new HTableDescriptor(TableName.META_TABLE_NAME);
|
||||||
String cpName = "a.b.c.d";
|
String cpName = "a.b.c.d";
|
||||||
boolean expected = false;
|
|
||||||
try {
|
try {
|
||||||
htd.addCoprocessorWithSpec(cpName);
|
htd.addCoprocessorWithSpec(cpName);
|
||||||
|
fail();
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
expected = true;
|
// Expected as cpName is invalid
|
||||||
}
|
}
|
||||||
if (!expected) fail();
|
|
||||||
// Try minimal spec.
|
// Try minimal spec.
|
||||||
try {
|
try {
|
||||||
htd.addCoprocessorWithSpec("file:///some/path" + "|" + cpName);
|
htd.addCoprocessorWithSpec("file:///some/path" + "|" + cpName);
|
||||||
|
fail();
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
expected = false;
|
// Expected to be invalid
|
||||||
}
|
}
|
||||||
if (expected) fail();
|
|
||||||
// Try more spec.
|
// Try more spec.
|
||||||
String spec = "hdfs:///foo.jar|com.foo.FooRegionObserver|1001|arg1=1,arg2=2";
|
String spec = "hdfs:///foo.jar|com.foo.FooRegionObserver|1001|arg1=1,arg2=2";
|
||||||
try {
|
try {
|
||||||
htd.addCoprocessorWithSpec(spec);
|
htd.addCoprocessorWithSpec(spec);
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
expected = false;
|
fail();
|
||||||
}
|
}
|
||||||
if (expected) fail();
|
|
||||||
// Try double add of same coprocessor
|
// Try double add of same coprocessor
|
||||||
try {
|
try {
|
||||||
htd.addCoprocessorWithSpec(spec);
|
htd.addCoprocessorWithSpec(spec);
|
||||||
|
fail();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
expected = true;
|
// Expect that the coprocessor already exists
|
||||||
}
|
}
|
||||||
if (!expected) fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue