HBASE-15865 Move TestTableDeleteFamilyHandler and TestTableDescriptorModification handler tests to procedure

This commit is contained in:
Matteo Bertozzi 2016-05-20 07:03:11 -07:00
parent 7a84ee262f
commit d34f5d4b96
2 changed files with 8 additions and 11 deletions

View File

@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.hbase.master.handler; package org.apache.hadoop.hbase.master.procedure;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
@ -51,9 +51,9 @@ import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
@Category({MasterTests.class, LargeTests.class}) @Category({MasterTests.class, LargeTests.class})
public class TestTableDeleteFamilyHandler { public class TestDeleteColumnFamilyProcedureFromClient {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final TableName TABLENAME = private static final TableName TABLENAME =
TableName.valueOf("column_family_handlers"); TableName.valueOf("column_family_handlers");
private static final byte[][] FAMILIES = new byte[][] { Bytes.toBytes("cf1"), private static final byte[][] FAMILIES = new byte[][] { Bytes.toBytes("cf1"),
@ -177,7 +177,6 @@ public class TestTableDeleteFamilyHandler {
@Test @Test
public void deleteColumnFamilyTwice() throws Exception { public void deleteColumnFamilyTwice() throws Exception {
Admin admin = TEST_UTIL.getHBaseAdmin(); Admin admin = TEST_UTIL.getHBaseAdmin();
HTableDescriptor beforehtd = admin.getTableDescriptor(TABLENAME); HTableDescriptor beforehtd = admin.getTableDescriptor(TABLENAME);
String cfToDelete = "cf1"; String cfToDelete = "cf1";
@ -190,8 +189,7 @@ public class TestTableDeleteFamilyHandler {
// 2 - Check if all the target column family exist in descriptor // 2 - Check if all the target column family exist in descriptor
HColumnDescriptor[] families = beforehtd.getColumnFamilies(); HColumnDescriptor[] families = beforehtd.getColumnFamilies();
Boolean foundCF = false; Boolean foundCF = false;
int i; for (int i = 0; i < families.length; i++) {
for (i = 0; i < families.length; i++) {
if (families[i].getNameAsString().equals(cfToDelete)) { if (families[i].getNameAsString().equals(cfToDelete)) {
foundCF = true; foundCF = true;
break; break;
@ -206,7 +204,7 @@ public class TestTableDeleteFamilyHandler {
// 4 - Check if all the target column family exist in FS // 4 - Check if all the target column family exist in FS
FileStatus[] fileStatus = fs.listStatus(tableDir); FileStatus[] fileStatus = fs.listStatus(tableDir);
foundCF = false; foundCF = false;
for (i = 0; i < fileStatus.length; i++) { for (int i = 0; i < fileStatus.length; i++) {
if (fileStatus[i].isDirectory() == true) { if (fileStatus[i].isDirectory() == true) {
FileStatus[] cf = fs.listStatus(fileStatus[i].getPath(), new PathFilter() { FileStatus[] cf = fs.listStatus(fileStatus[i].getPath(), new PathFilter() {
@Override @Override
@ -238,7 +236,7 @@ public class TestTableDeleteFamilyHandler {
// 5 - Check if the target column family is gone from the FS // 5 - Check if the target column family is gone from the FS
fileStatus = fs.listStatus(tableDir); fileStatus = fs.listStatus(tableDir);
for (i = 0; i < fileStatus.length; i++) { for (int i = 0; i < fileStatus.length; i++) {
if (fileStatus[i].isDirectory() == true) { if (fileStatus[i].isDirectory() == true) {
FileStatus[] cf = fs.listStatus(fileStatus[i].getPath(), new PathFilter() { FileStatus[] cf = fs.listStatus(fileStatus[i].getPath(), new PathFilter() {
@Override @Override
@ -265,5 +263,4 @@ public class TestTableDeleteFamilyHandler {
// Expected. // Expected.
} }
} }
} }

View File

@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.hbase.master.handler; package org.apache.hadoop.hbase.master.procedure;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -53,7 +53,7 @@ import org.junit.rules.TestName;
* addColumn(), deleteColumn() and modifyTable() operations. * addColumn(), deleteColumn() and modifyTable() operations.
*/ */
@Category({MasterTests.class, LargeTests.class}) @Category({MasterTests.class, LargeTests.class})
public class TestTableDescriptorModification { public class TestTableDescriptorModificationFromClient {
@Rule public TestName name = new TestName(); @Rule public TestName name = new TestName();
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();