Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove version key #98

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading