File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1356,6 +1356,9 @@ public void setBearerToken(String value) {
1356
1356
1357
1357
1358
1358
public boolean enableV2SearchApi (){
1359
+ if (null == this .instanceType ){
1360
+ this .instanceType = this .getInfo ().getInstanceType ();
1361
+ }
1359
1362
if (this .instanceType .equalsIgnoreCase ("cloud" )) {
1360
1363
return versionIsAtLeast ("9.0.2209" );
1361
1364
}else {
@@ -1411,6 +1414,9 @@ boolean versionIsEarlierThan(String version) {
1411
1414
* or 1 if this version is greater than the given version.
1412
1415
*/
1413
1416
public int versionCompare (String otherVersion ) {
1417
+ if (null == this .version ){
1418
+ this .version = this .getInfo ().getVersion ();
1419
+ }
1414
1420
String [] components1 = this .version .split ("\\ ." );
1415
1421
String [] components2 = otherVersion .split ("\\ ." );
1416
1422
int numComponents = Math .max (components1 .length , components2 .length );
Original file line number Diff line number Diff line change @@ -735,4 +735,19 @@ public void testEnableV2Api(){
735
735
}
736
736
}
737
737
738
+ /*
739
+ Test when Service instance is created using token, it doesn't result in Null Pointer while accessing instanceType and version
740
+ */
741
+ @ Test
742
+ public void testServiceWithTokenAuth (){
743
+ Service newService = new Service (service .getHost ());
744
+ newService .setToken (service .getToken ());
745
+ try {
746
+ newService .enableV2SearchApi ();
747
+ newService .versionCompare ("9.0.2" );
748
+ }catch (Exception ex ){
749
+ Assert .assertNull (ex );
750
+ }
751
+ }
752
+
738
753
}
You can’t perform that action at this time.
0 commit comments