You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2018/01/27 06:39:44 UTC
[02/14] hbase git commit: HBASE-19862 addendum: Checkstyle fixes,
remove unused imports and variables. Add @Rule for timeout.
HBASE-19862 addendum: Checkstyle fixes, remove unused imports and variables. Add @Rule for timeout.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1beb687f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1beb687f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1beb687f
Branch: refs/heads/HBASE-19064
Commit: 1beb687f4e489dff352a746d4544ff1a0a1ed829
Parents: 6135898
Author: Apekshit Sharma <ap...@apache.org>
Authored: Fri Jan 26 00:21:39 2018 -0800
Committer: Apekshit Sharma <ap...@apache.org>
Committed: Fri Jan 26 00:24:35 2018 -0800
----------------------------------------------------------------------
.../security/token/TestTokenAuthentication.java | 90 ++++++++++----------
1 file changed, 45 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/1beb687f/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
index 4b2332e..67887e6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
@@ -32,23 +32,20 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import java.util.concurrent.ConcurrentMap;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.hbase.CategoryBasedTimeout;
import org.apache.hadoop.hbase.ChoreService;
import org.apache.hadoop.hbase.ClusterId;
import org.apache.hadoop.hbase.CoordinatedStateManager;
import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.RawCellBuilder;
import org.apache.hadoop.hbase.Server;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.client.ClusterConnection;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.coprocessor.HasRegionServerServices;
-import org.apache.hadoop.hbase.coprocessor.RegionCoprocessor;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.ipc.FifoRpcScheduler;
import org.apache.hadoop.hbase.ipc.NettyRpcServer;
@@ -59,10 +56,7 @@ import org.apache.hadoop.hbase.ipc.RpcServerInterface;
import org.apache.hadoop.hbase.ipc.ServerRpcController;
import org.apache.hadoop.hbase.ipc.SimpleRpcServer;
import org.apache.hadoop.hbase.log.HBaseMarkers;
-import org.apache.hadoop.hbase.metrics.MetricRegistry;
import org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos;
-import org.apache.hadoop.hbase.regionserver.HRegion;
-import org.apache.hadoop.hbase.regionserver.OnlineRegions;
import org.apache.hadoop.hbase.regionserver.RegionServerServices;
import org.apache.hadoop.hbase.security.SecurityInfo;
import org.apache.hadoop.hbase.security.User;
@@ -85,8 +79,10 @@ import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.security.token.TokenIdentifier;
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestRule;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
@@ -120,9 +116,10 @@ public class TestTokenAuthentication {
System.setProperty("java.security.krb5.realm", "hbase");
System.setProperty("java.security.krb5.kdc", "blah");
}
- private static final Logger LOG = LoggerFactory.getLogger(TestTokenAuthentication.class);
- public interface AuthenticationServiceSecurityInfo {}
+ @Rule
+ public final TestRule timeout = CategoryBasedTimeout.builder().withTimeout(this.getClass())
+ .withLookingForStuckThread(true).build();
/**
* Basic server process for RPC authentication testing
@@ -141,8 +138,7 @@ public class TestTokenAuthentication {
private boolean stopped = false;
private long startcode;
- public TokenServer(Configuration conf, HBaseTestingUtility TEST_UTIL)
- throws IOException {
+ public TokenServer(Configuration conf, HBaseTestingUtility TEST_UTIL) throws IOException {
this.conf = conf;
this.TEST_UTIL = TEST_UTIL;
this.startcode = EnvironmentEdgeManager.currentTime();
@@ -163,42 +159,46 @@ public class TestTokenAuthentication {
final BlockingService service =
AuthenticationProtos.AuthenticationService.newReflectiveBlockingService(this);
final org.apache.hbase.thirdparty.com.google.protobuf.BlockingService proxy =
- new org.apache.hbase.thirdparty.com.google.protobuf.BlockingService() {
- @Override public Message callBlockingMethod(MethodDescriptor md,
- org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
- Message param)
- throws org.apache.hbase.thirdparty.com.google.protobuf.ServiceException {
- com.google.protobuf.Descriptors.MethodDescriptor methodDescriptor =
- service.getDescriptorForType().findMethodByName(md.getName());
- com.google.protobuf.Message request = service.getRequestPrototype(methodDescriptor);
- // TODO: Convert rpcController
- com.google.protobuf.Message response = null;
- try {
- response = service.callBlockingMethod(methodDescriptor, null, request);
- } catch (ServiceException e) {
- throw new org.apache.hbase.thirdparty.com.google.protobuf.ServiceException(e);
- }
- return null;// Convert 'response'.
+ new org.apache.hbase.thirdparty.com.google.protobuf.BlockingService() {
+ @Override
+ public Message callBlockingMethod(MethodDescriptor md,
+ org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
+ Message param)
+ throws org.apache.hbase.thirdparty.com.google.protobuf.ServiceException {
+ com.google.protobuf.Descriptors.MethodDescriptor methodDescriptor =
+ service.getDescriptorForType().findMethodByName(md.getName());
+ com.google.protobuf.Message request = service.getRequestPrototype(methodDescriptor);
+ // TODO: Convert rpcController
+ com.google.protobuf.Message response = null;
+ try {
+ response = service.callBlockingMethod(methodDescriptor, null, request);
+ } catch (ServiceException e) {
+ throw new org.apache.hbase.thirdparty.com.google.protobuf.ServiceException(e);
}
-
- @Override public ServiceDescriptor getDescriptorForType() {
- return null;
- }
-
- @Override public Message getRequestPrototype(MethodDescriptor arg0) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override public Message getResponsePrototype(MethodDescriptor arg0) {
- // TODO Auto-generated method stub
- return null;
- }
- };
+ return null;// Convert 'response'.
+ }
+
+ @Override
+ public ServiceDescriptor getDescriptorForType() {
+ return null;
+ }
+
+ @Override
+ public Message getRequestPrototype(MethodDescriptor arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Message getResponsePrototype(MethodDescriptor arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
sai.add(new BlockingServiceAndInterface(proxy,
AuthenticationProtos.AuthenticationService.BlockingInterface.class));
- this.rpcServer = RpcServerFactory.createRpcServer(this, "tokenServer", sai,
- initialIsa, conf, new FifoRpcScheduler(conf, 1));
+ this.rpcServer = RpcServerFactory.createRpcServer(this, "tokenServer", sai, initialIsa, conf,
+ new FifoRpcScheduler(conf, 1));
InetSocketAddress address = rpcServer.getListenerAddress();
if (address == null) {
throw new IOException("Listener channel is closed");
@@ -329,7 +329,7 @@ public class TestTokenAuthentication {
ServerRpcController serverController = new ServerRpcController();
final NonShadedBlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse>
callback = new NonShadedBlockingRpcCallback<>();
- getAuthenticationToken((RpcController)null, request, callback);
+ getAuthenticationToken(null, request, callback);
try {
serverController.checkFailed();
return callback.get();