1414 * See the License for the specific language governing permissions and
1515 * limitations under the License.
1616 */
17- package org .apache .spark .sql .hive .service .cli .session
17+ package org .apache .spark .sql .hive .thriftserver
18+
19+ import scala .collection .JavaConverters ._
1820
1921import org .apache .hadoop .hive .conf .HiveConf
22+ import org .apache .hive .service .cli .OperationHandle
2023import org .apache .hive .service .cli .operation .{GetCatalogsOperation , OperationManager }
2124import org .apache .hive .service .cli .session .{HiveSessionImpl , SessionManager }
22- import org .apache .hive .service .rpc .thrift .TProtocolVersion
2325import org .mockito .Mockito .{mock , verify , when }
2426import org .mockito .invocation .InvocationOnMock
25- import scala .collection .JavaConverters ._
2627
2728import org .apache .spark .SparkFunSuite
2829
@@ -34,7 +35,7 @@ class HiveSessionImplSuite extends SparkFunSuite {
3435 super .beforeAll()
3536
3637 session = new HiveSessionImpl (
37- TProtocolVersion . HIVE_CLI_SERVICE_PROTOCOL_V1 ,
38+ ThriftserverShimUtils .testedProtocolVersions.head ,
3839 " " ,
3940 " " ,
4041 new HiveConf (),
@@ -45,7 +46,11 @@ class HiveSessionImplSuite extends SparkFunSuite {
4546 operationManager = mock(classOf [OperationManager ])
4647 session.setOperationManager(operationManager)
4748 when(operationManager.newGetCatalogsOperation(session)).thenAnswer(
48- (_ : InvocationOnMock ) => mock(classOf [GetCatalogsOperation ])
49+ (_ : InvocationOnMock ) => {
50+ val operation = mock(classOf [GetCatalogsOperation ])
51+ when(operation.getHandle).thenReturn(mock(classOf [OperationHandle ]))
52+ operation
53+ }
4954 )
5055
5156 session.open(Map .empty[String , String ].asJava)
0 commit comments