001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.security; 019 020import java.util.ArrayList; 021import java.util.Arrays; 022import java.util.Collection; 023import java.util.List; 024import org.apache.hadoop.hbase.HBaseClassTestRule; 025import org.apache.hadoop.hbase.ipc.BlockingRpcClient; 026import org.apache.hadoop.hbase.ipc.NettyRpcClient; 027import org.apache.hadoop.hbase.ipc.NettyRpcServer; 028import org.apache.hadoop.hbase.ipc.RpcClientFactory; 029import org.apache.hadoop.hbase.ipc.RpcServerFactory; 030import org.apache.hadoop.hbase.ipc.SimpleRpcServer; 031import org.apache.hadoop.hbase.testclassification.LargeTests; 032import org.apache.hadoop.hbase.testclassification.SecurityTests; 033import org.junit.AfterClass; 034import org.junit.Before; 035import org.junit.BeforeClass; 036import org.junit.ClassRule; 037import org.junit.experimental.categories.Category; 038import org.junit.runner.RunWith; 039import org.junit.runners.Parameterized; 040import org.junit.runners.Parameterized.Parameter; 041import org.junit.runners.Parameterized.Parameters; 042 043@RunWith(Parameterized.class) 044@Category({ SecurityTests.class, LargeTests.class }) 045public class TestSecureIPC extends AbstractTestSecureIPC { 046 047 @ClassRule 048 public static final HBaseClassTestRule CLASS_RULE = 049 HBaseClassTestRule.forClass(TestSecureIPC.class); 050 051 @Parameters(name = "{index}: rpcClientImpl={0}, rpcServerImpl={1}") 052 public static Collection<Object[]> parameters() { 053 List<Object[]> params = new ArrayList<>(); 054 List<String> rpcClientImpls = 055 Arrays.asList(BlockingRpcClient.class.getName(), NettyRpcClient.class.getName()); 056 List<String> rpcServerImpls = 057 Arrays.asList(SimpleRpcServer.class.getName(), NettyRpcServer.class.getName()); 058 for (String rpcClientImpl : rpcClientImpls) { 059 for (String rpcServerImpl : rpcServerImpls) { 060 params.add(new Object[] { rpcClientImpl, rpcServerImpl }); 061 } 062 } 063 return params; 064 } 065 066 @Parameter(0) 067 public String rpcClientImpl; 068 069 @Parameter(1) 070 public String rpcServerImpl; 071 072 @BeforeClass 073 public static void setUp() throws Exception { 074 initKDCAndConf(); 075 } 076 077 @AfterClass 078 public static void tearDown() throws Exception { 079 stopKDC(); 080 TEST_UTIL.cleanupTestDir(); 081 } 082 083 @Before 084 public void setUpTest() throws Exception { 085 setUpPrincipalAndConf(); 086 clientConf.set(RpcClientFactory.CUSTOM_RPC_CLIENT_IMPL_CONF_KEY, rpcClientImpl); 087 serverConf.set(RpcServerFactory.CUSTOM_RPC_SERVER_IMPL_CONF_KEY, rpcServerImpl); 088 } 089}