File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -327,15 +327,15 @@ def enable(table_name)
327327 def enable_all ( regex )
328328 pattern = Pattern . compile ( regex . to_s )
329329 failed = java . util . ArrayList . new
330- admin . listTableNames ( pattern ) . each do |table_name |
330+ @ admin. listTableNames ( pattern ) . each do |table_name |
331331 begin
332- admin . enableTable ( table_name )
332+ @ admin. enableTable ( table_name )
333333 rescue java . io . IOException => e
334334 puts "table:#{ table_name } , error:#{ e . toString } "
335335 failed . add ( table_name )
336336 end
337337 end
338- @ failed
338+ failed
339339 end
340340
341341 #----------------------------------------------------------------------------------------------
@@ -351,15 +351,15 @@ def disable(table_name)
351351 def disable_all ( regex )
352352 pattern = Pattern . compile ( regex . to_s )
353353 failed = java . util . ArrayList . new
354- admin . listTableNames ( pattern ) . each do |table_name |
354+ @ admin. listTableNames ( pattern ) . each do |table_name |
355355 begin
356- admin . disableTable ( table_name )
356+ @ admin. disableTable ( table_name )
357357 rescue java . io . IOException => e
358358 puts "table:#{ table_name } , error:#{ e . toString } "
359359 failed . add ( table_name )
360360 end
361361 end
362- @ failed
362+ failed
363363 end
364364
365365 #---------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -418,6 +418,22 @@ def teardown
418418
419419 #-------------------------------------------------------------------------------
420420
421+ define_test 'enable and disable tables by regex' do
422+ @t1 = 't1'
423+ @t2 = 't11'
424+ @regex = 't1.*'
425+ command ( :create , @t1 , 'f' )
426+ command ( :create , @t2 , 'f' )
427+ admin . disable_all ( @regex )
428+ assert ( command ( :is_disabled , @t1 ) )
429+ assert ( command ( :is_disabled , @t2 ) )
430+ admin . enable_all ( @regex )
431+ assert ( command ( :is_enabled , @t1 ) )
432+ assert ( command ( :is_enabled , @t2 ) )
433+ end
434+
435+ #-------------------------------------------------------------------------------
436+
421437 define_test "list_regions should fail for disabled table" do
422438 drop_test_table ( @create_test_name )
423439 admin . create ( @create_test_name , 'a' )
You can’t perform that action at this time.
0 commit comments