@Override public RSGroupInfo getRSGroupInfoOfTable(TableName tableName) throws IOException { return wrapped.getRSGroupInfoOfTable(tableName); }
@Test public void testGetRSGroupInfoOfTableCPHookCalled() throws Exception { rsGroupAdmin.getRSGroupInfoOfTable(TableName.META_TABLE_NAME); assertTrue(observer.preGetRSGroupInfoOfTableCalled); assertTrue(observer.postGetRSGroupInfoOfTableCalled); }
RSGroupInfo tableGrpA = rsGroupAdmin.getRSGroupInfoOfTable(tableNameA); assertTrue(tableGrpA.getName().equals(RSGroupInfo.DEFAULT_GROUP)); RSGroupInfo tableGrpB = rsGroupAdmin.getRSGroupInfoOfTable(tableNameB); assertTrue(tableGrpB.getName().equals(RSGroupInfo.DEFAULT_GROUP)); rsGroupAdmin.getRSGroupInfoOfTable(tableNameA).getName()); rsGroupAdmin.getRSGroupInfoOfTable(tableNameB).getName());
@Test public void testDisabledTableMove() throws Exception { final byte[] familyNameBytes = Bytes.toBytes("f"); String newGroupName = getGroupName(name.getMethodName()); final RSGroupInfo newGroup = addGroup(newGroupName, 2); TEST_UTIL.createMultiRegionTable(tableName, familyNameBytes, 5); TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() { @Override public boolean evaluate() throws Exception { List<String> regions = getTableRegionMap().get(tableName); if (regions == null) { return false; } return getTableRegionMap().get(tableName).size() >= 5; } }); RSGroupInfo tableGrp = rsGroupAdmin.getRSGroupInfoOfTable(tableName); assertTrue(tableGrp.getName().equals(RSGroupInfo.DEFAULT_GROUP)); // test disable table admin.disableTable(tableName); // change table's group LOG.info("Moving table " + tableName + " to " + newGroup.getName()); rsGroupAdmin.moveTables(Sets.newHashSet(tableName), newGroup.getName()); // verify group change Assert.assertEquals(newGroup.getName(), rsGroupAdmin.getRSGroupInfoOfTable(tableName).getName()); }
@Test public void testNonExistentTableMove() throws Exception { TableName tableName = TableName.valueOf(tablePrefix + name.getMethodName()); RSGroupInfo tableGrp = rsGroupAdmin.getRSGroupInfoOfTable(tableName); assertNull(tableGrp); // test if table exists already. boolean exist = admin.tableExists(tableName); assertFalse(exist); LOG.info("Moving table " + tableName + " to " + RSGroupInfo.DEFAULT_GROUP); try { rsGroupAdmin.moveTables(Sets.newHashSet(tableName), RSGroupInfo.DEFAULT_GROUP); fail("Table " + tableName + " shouldn't have been successfully moved."); } catch (IOException ex) { assertTrue(ex instanceof TableNotFoundException); } try { rsGroupAdmin.moveServersAndTables(Sets.newHashSet(Address.fromParts("bogus", 123)), Sets.newHashSet(tableName), RSGroupInfo.DEFAULT_GROUP); fail("Table " + tableName + " shouldn't have been successfully moved."); } catch (IOException ex) { assertTrue(ex instanceof TableNotFoundException); } // verify group change assertNull(rsGroupAdmin.getRSGroupInfoOfTable(tableName)); }
rsGroupAdmin.getRSGroupInfoOfTable(tableName).getName());
RSGroupInfo tableGrp = rsGroupAdmin.getRSGroupInfoOfTable(tableName); assertTrue(tableGrp.getName().equals(RSGroupInfo.DEFAULT_GROUP)); rsGroupAdmin.getRSGroupInfoOfTable(tableName).getName());
@Test public void testBogusArgs() throws Exception { assertNull(rsGroupAdmin.getRSGroupInfoOfTable(TableName.valueOf("nonexistent"))); assertNull(rsGroupAdmin.getRSGroupOfServer(Address.fromParts("bogus", 123))); assertNull(rsGroupAdmin.getRSGroupInfo("bogus"));
@Override public RSGroupInfo getRSGroupInfoOfTable(TableName tableName) throws IOException { return wrapped.getRSGroupInfoOfTable(tableName); }
@Test public void testDisabledTableMove() throws Exception { final byte[] familyNameBytes = Bytes.toBytes("f"); String newGroupName = getGroupName(name.getMethodName()); final RSGroupInfo newGroup = addGroup(newGroupName, 2); TEST_UTIL.createMultiRegionTable(tableName, familyNameBytes, 5); TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() { @Override public boolean evaluate() throws Exception { List<String> regions = getTableRegionMap().get(tableName); if (regions == null) { return false; } return getTableRegionMap().get(tableName).size() >= 5; } }); RSGroupInfo tableGrp = rsGroupAdmin.getRSGroupInfoOfTable(tableName); assertTrue(tableGrp.getName().equals(RSGroupInfo.DEFAULT_GROUP)); //test disable table admin.disableTable(tableName); //change table's group LOG.info("Moving table "+ tableName + " to " + newGroup.getName()); rsGroupAdmin.moveTables(Sets.newHashSet(tableName), newGroup.getName()); //verify group change Assert.assertEquals(newGroup.getName(), rsGroupAdmin.getRSGroupInfoOfTable(tableName).getName()); }
RSGroupInfo tableGrpA = rsGroupAdmin.getRSGroupInfoOfTable(tableNameA); assertTrue(tableGrpA.getName().equals(RSGroupInfo.DEFAULT_GROUP)); RSGroupInfo tableGrpB = rsGroupAdmin.getRSGroupInfoOfTable(tableNameB); assertTrue(tableGrpB.getName().equals(RSGroupInfo.DEFAULT_GROUP)); rsGroupAdmin.getRSGroupInfoOfTable(tableNameA).getName()); rsGroupAdmin.getRSGroupInfoOfTable(tableNameB).getName());
RSGroupInfo tableGrp = rsGroupAdmin.getRSGroupInfoOfTable(tableName); assertTrue(tableGrp.getName().equals(RSGroupInfo.DEFAULT_GROUP)); rsGroupAdmin.getRSGroupInfoOfTable(tableName).getName());
rsGroupAdmin.getRSGroupInfoOfTable(tableName).getName());
@Test public void testBogusArgs() throws Exception { assertNull(rsGroupAdmin.getRSGroupInfoOfTable(TableName.valueOf("nonexistent"))); assertNull(rsGroupAdmin.getRSGroupOfServer(Address.fromParts("bogus",123))); assertNull(rsGroupAdmin.getRSGroupInfo("bogus"));