Skip to content

Commit 37591b1

Browse files
committed
fix mocks in broken tests
1 parent 9847b38 commit 37591b1

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,9 @@ public static RpcRetryingCallerFactory instantiate(Configuration configuration,
100100
if (rpcCallerFactoryClazz.equals(clazzName)) {
101101
factory = new RpcRetryingCallerFactory(configuration, connectionConf, interceptor, metrics);
102102
} else {
103-
try {
104-
factory = ReflectionUtils.instantiateWithCustomCtor(rpcCallerFactoryClazz,
105-
new Class[] { Configuration.class }, new Object[] { configuration, connectionConf });
106-
} catch (UnsupportedOperationException e) {
107-
factory = ReflectionUtils.instantiateWithCustomCtor(rpcCallerFactoryClazz,
108-
new Class[] { Configuration.class }, new Object[] { configuration });
109-
}
103+
factory = ReflectionUtils.instantiateWithCustomCtor(rpcCallerFactoryClazz,
104+
new Class[] { Configuration.class, ConnectionConfiguration.class },
105+
new Object[] { configuration, connectionConf });
110106
}
111107
return factory;
112108
}

hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestClientScanner.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public void setup() throws IOException {
8989
conf = new Configuration();
9090
connectionConfig = new ConnectionConfiguration(conf);
9191
Mockito.when(clusterConn.getConfiguration()).thenReturn(conf);
92+
Mockito.when(clusterConn.getConnectionConfiguration()).thenReturn(connectionConfig);
9293
}
9394

9495
@After

hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public static ClusterConnection getMockedConnectionAndDecorate(final Configurati
129129
RpcControllerFactory.instantiate(conf));
130130
Mockito.when(c.getAsyncProcess()).thenReturn(asyncProcess);
131131
Mockito.when(c.getNewRpcRetryingCallerFactory(conf))
132-
.thenReturn(RpcRetryingCallerFactory.instantiate(conf, c.getConnectionConfiguration(),
132+
.thenReturn(RpcRetryingCallerFactory.instantiate(conf, connectionConfiguration,
133133
RetryingCallerInterceptorFactory.NO_OP_INTERCEPTOR, null, null));
134134
Mockito.when(c.getRpcControllerFactory()).thenReturn(Mockito.mock(RpcControllerFactory.class));
135135
Table t = Mockito.mock(Table.class);

hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotaOnBulkLoad.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void testNoBulkLoadsWithNoWrites() throws Exception {
9999

100100
// The table is now in violation. Try to do a bulk load
101101
ClientServiceCallable<Void> callable = helper.generateFileToLoad(tableName, 1, 50);
102-
ClusterConnection conn = (ClusterConnection) TEST_UTIL.getConfiguration();
102+
ClusterConnection conn = (ClusterConnection) TEST_UTIL.getConnection();
103103
RpcRetryingCallerFactory factory =
104104
new RpcRetryingCallerFactory(TEST_UTIL.getConfiguration(), conn.getConnectionConfiguration());
105105
RpcRetryingCaller<Void> caller = factory.<Void> newCaller();

0 commit comments

Comments
 (0)