Skip to content

Commit

Permalink
remove version key (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole00 authored Jan 12, 2024
1 parent 6e00369 commit e027afd
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ public class NebulaClientOptions implements Serializable {

private final SelfSignParams selfSignParams;

private final String handshakeKey;

private NebulaClientOptions(String metaAddress, String graphAddress, String username,
String password, int timeout, int connectRetry,
boolean enableGraphSSL, boolean enableMetaSSL,
boolean enableStorageSSL,
SSLSignType sslSignType, CASignParams caSignParams,
SelfSignParams selfSignParams, String handshakeKey) {
SelfSignParams selfSignParams) {
this.metaAddress = metaAddress;
this.graphAddress = graphAddress;
this.username = username;
Expand All @@ -60,7 +58,6 @@ private NebulaClientOptions(String metaAddress, String graphAddress, String user
this.sslSignType = sslSignType;
this.caSignParams = caSignParams;
this.selfSignParams = selfSignParams;
this.handshakeKey = handshakeKey;
}

public List<HostAddress> getMetaAddress() {
Expand Down Expand Up @@ -120,10 +117,6 @@ public SelfSignParams getSelfSignParam() {
return selfSignParams;
}

public String getHandshakeKey() {
return handshakeKey;
}

/**
* Builder for {@link NebulaClientOptions}
*/
Expand All @@ -142,7 +135,6 @@ public static class NebulaClientOptionsBuilder {
private SSLSignType sslSignType = null;
private CASignParams caSignParams = null;
private SelfSignParams selfSignParams = null;
private String handshakeKey = null;

public NebulaClientOptionsBuilder setMetaAddress(String metaAddress) {
this.metaAddress = metaAddress;
Expand Down Expand Up @@ -207,11 +199,6 @@ public NebulaClientOptionsBuilder setSelfSignParam(String crtFilePath, String ke
return this;
}

public NebulaClientOptionsBuilder setHandshakeKey(String handshakeKey) {
this.handshakeKey = handshakeKey;
return this;
}

public NebulaClientOptions build() {
if (metaAddress == null || metaAddress.trim().isEmpty()) {
throw new IllegalArgumentException("meta address can not be empty.");
Expand Down Expand Up @@ -258,8 +245,7 @@ public NebulaClientOptions build() {
enableStorageSSL,
sslSignType,
caSignParams,
selfSignParams,
handshakeKey);
selfSignParams);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public NebulaPool getNebulaPool() throws UnknownHostException {
Collections.shuffle(addresses);
NebulaPoolConfig poolConfig = new NebulaPoolConfig();
poolConfig.setTimeout(nebulaClientOptions.getTimeout());
poolConfig.setHandshakeKey(nebulaClientOptions.getHandshakeKey());
if (nebulaClientOptions.isEnableGraphSSL()) {
poolConfig.setEnableSsl(true);
switch (nebulaClientOptions.getSSLSignType()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public MetaClient getMetaClient() throws TException, ClientServerIncompatibleExc
metaClient = new MetaClient(addresses, timeout, retry, retry);
}

metaClient.setHandshakeKey(nebulaClientOptions.getHandshakeKey());
metaClient.connect();
return metaClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public StorageClient getStorageClient() throws Exception {
storageClient = new StorageClient(addresses, timeout);
}

storageClient.setHandshakeKey(nebulaClientOptions.getHandshakeKey());
if (!storageClient.connect()) {
throw new Exception("failed to connect storaged.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public void getNebulaPool() {
.setPassword("nebula")
.setConnectRetry(1)
.setTimeout(1000)
.setHandshakeKey("test")
.build();
NebulaGraphConnectionProvider graphConnectionProvider =
new NebulaGraphConnectionProvider(nebulaClientOptions);
Expand All @@ -53,32 +52,6 @@ public void getNebulaPool() {
}
}

@Test
public void getNebulaPoolWithWrongVersion() {
NebulaClientOptions nebulaClientOptions =
new NebulaClientOptions.NebulaClientOptionsBuilder()
.setGraphAddress("127.0.0.1:9669")
.setMetaAddress("127.0.0.1:9559")
.setUsername("root")
.setPassword("nebula")
.setConnectRetry(1)
.setTimeout(1000)
.setHandshakeKey("INVALID_VERSION")
.build();
NebulaGraphConnectionProvider graphConnectionProvider =
new NebulaGraphConnectionProvider(nebulaClientOptions);
try {
NebulaPool nebulaPool = graphConnectionProvider.getNebulaPool();
nebulaPool.getSession("root", "nebula", true);
} catch (Exception e) {
LOG.info("get session failed", e);
if (e.getMessage().contains("NebulaPool init failed.")) {
assert true;
} else {
assert false;
}
}
}

/**
* nebula server does not enable ssl, the connection cannot be established correctly.
Expand Down

0 comments on commit e027afd

Please sign in to comment.