HBASE-1502 Aftermath; fix up of broke tests. Fix TestCatalogTracker. Signature changed and mock'd method wasn't triggering

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1097318 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-04-28 04:41:31 +00:00
parent 52033a212f
commit de72e77f10
2 changed files with 9 additions and 9 deletions

View File

@ -1018,7 +1018,7 @@ public class ZKUtil {
LOG.debug(zkw.prefix("Retrieved " + ((data == null)? 0: data.length) +
" byte(s) of data from znode " + znode +
(watcherSet? " and set watcher; ": "; data=") +
(data == null? "null": (
(data == null? "null": data.length == 0? "empty": (
znode.startsWith(zkw.assignmentZNode) ?
RegionTransitionData.fromBytes(data).toString()
: StringUtils.abbreviate(Bytes.toString(data), 32)))));

View File

@ -63,7 +63,7 @@ import org.mockito.Mockito;
public class TestCatalogTracker {
private static final Log LOG = LogFactory.getLog(TestCatalogTracker.class);
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
private static final ServerName HSA =
private static final ServerName SN =
new ServerName("example.org", 1234, System.currentTimeMillis());
private ZooKeeperWatcher watcher;
private Abortable abortable;
@ -247,8 +247,8 @@ public class TestCatalogTracker {
}
private ServerName setRootLocation() throws KeeperException {
RootLocationEditor.setRootLocation(this.watcher, HSA);
return HSA;
RootLocationEditor.setRootLocation(this.watcher, SN);
return SN;
}
/**
@ -266,8 +266,8 @@ public class TestCatalogTracker {
HRegionInterface mockHRI = Mockito.mock(HRegionInterface.class);
// Make the HRI return an answer no matter how Get is called. Same for
// getHRegionInfo. Thats enough for this test.
Mockito.when(connection.getHRegionConnection((HServerAddress)Mockito.any(), Mockito.anyBoolean())).
thenReturn(mockHRI);
Mockito.when(connection.getHRegionConnection((String)Mockito.any(),
Matchers.anyInt())).thenReturn(mockHRI);
final CatalogTracker ct = constructAndStartCatalogTracker(connection);
ServerName hsa = ct.getMetaLocation();
@ -289,7 +289,7 @@ public class TestCatalogTracker {
List<KeyValue> kvs = new ArrayList<KeyValue>();
kvs.add(new KeyValue(HConstants.EMPTY_BYTE_ARRAY,
HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
Bytes.toBytes(HSA.toString())));
Bytes.toBytes(SN.toString())));
final Result result = new Result(kvs);
Mockito.when(mockHRI.get((byte [])Mockito.any(), (Get)Mockito.any())).
thenReturn(result);
@ -300,12 +300,12 @@ public class TestCatalogTracker {
// been assigned.
String node = ct.getMetaNodeTracker().getNode();
ZKUtil.createAndFailSilent(this.watcher, node);
MetaEditor.updateMetaLocation(ct, HRegionInfo.FIRST_META_REGIONINFO, HSA);
MetaEditor.updateMetaLocation(ct, HRegionInfo.FIRST_META_REGIONINFO, SN);
ZKUtil.deleteNode(this.watcher, node);
// Join the thread... should exit shortly.
t.join();
// Now meta is available.
Assert.assertTrue(ct.getMetaLocation().equals(HSA));
Assert.assertTrue(ct.getMetaLocation().equals(SN));
}
private void startWaitAliveThenWaitItLives(final Thread t, final int ms) {