Skip to content

Commit

Permalink
[KYUUBI #2478][FOLLOWUP] Fix bin/beeline without -u exits unexpectedly
Browse files Browse the repository at this point in the history
### _Why are the changes needed?_

fix #3030

### _How was this patch tested?_
- [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [x] Add screenshots for manual tests if appropriate
![image](https://user-images.githubusercontent.com/14961757/177953720-029882e5-2454-4091-aa75-d008e15ee1a0.png)

- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #3031 from jiaoqingbo/kyuubi-3030.

Closes #2478

58ba011 [jiaoqingbo] change junit location
a4130da [jiaoqingbo] add license
9ff1366 [jiaoqingbo] [KYUUBI #3030] fix bin/beeline without -u exits unexpectedly

Authored-by: jiaoqingbo <1178404354@qq.com>
Signed-off-by: Fei Wang <fwang12@ebay.com>
  • Loading branch information
jiaoqingbo authored and turboFei committed Jul 9, 2022
1 parent 7762a02 commit f3bd137
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
6 changes: 6 additions & 0 deletions kyuubi-hive-beeline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ int initArgs(String[] args) {
if (!connSuccessful && !exit) {
try {
Method defaultBeelineConnectMethod =
BeeLine.class.getDeclaredMethod("defaultBeelineConnect");
BeeLine.class.getDeclaredMethod("defaultBeelineConnect", CommandLine.class);
defaultBeelineConnectMethod.setAccessible(true);
connSuccessful = (boolean) defaultBeelineConnectMethod.invoke(this);
connSuccessful = (boolean) defaultBeelineConnectMethod.invoke(this, cl);

} catch (Exception t) {
error(t.getMessage());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.hive.beeline;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class KyuubiBeeLineTest {
@Test
public void testKyuubiBeelineWithoutArgs() {
KyuubiBeeLine kyuubiBeeLine = new KyuubiBeeLine();
int result = kyuubiBeeLine.initArgs(new String[0]);
assertEquals(0, result);
}
}

0 comments on commit f3bd137

Please sign in to comment.