Skip to content

Commit

Permalink
Fix "SSL sign type" typo (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
linhr authored May 19, 2023
1 parent 6b3cad3 commit 3613a3c
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.flink.connector.nebula.utils.NebulaConstant;
import org.apache.flink.connector.nebula.utils.SSLSighType;
import org.apache.flink.connector.nebula.utils.SSLSignType;

public class NebulaClientOptions implements Serializable {

Expand All @@ -34,7 +34,7 @@ public class NebulaClientOptions implements Serializable {

private final boolean enableStorageSSL;

private final SSLSighType sslSighType;
private final SSLSignType sslSignType;

private final CASignParams caSignParams;

Expand All @@ -45,7 +45,7 @@ private NebulaClientOptions(String metaAddress, String graphAddress, String user
String password, int timeout, int connectRetry,
boolean enableGraphSSL, boolean enableMetaSSL,
boolean enableStorageSSL,
SSLSighType sslSighType, CASignParams caSignParams,
SSLSignType sslSignType, CASignParams caSignParams,
SelfSignParams selfSignParams) {
this.metaAddress = metaAddress;
this.graphAddress = graphAddress;
Expand All @@ -56,7 +56,7 @@ private NebulaClientOptions(String metaAddress, String graphAddress, String user
this.enableGraphSSL = enableGraphSSL;
this.enableMetaSSL = enableMetaSSL;
this.enableStorageSSL = enableStorageSSL;
this.sslSighType = sslSighType;
this.sslSignType = sslSignType;
this.caSignParams = caSignParams;
this.selfSignParams = selfSignParams;
}
Expand Down Expand Up @@ -106,8 +106,8 @@ public boolean isEnableStorageSSL() {
return enableStorageSSL;
}

public SSLSighType getSSLSighType() {
return sslSighType;
public SSLSignType getSSLSignType() {
return sslSignType;
}

public CASignParams getCaSignParam() {
Expand All @@ -133,7 +133,7 @@ public static class NebulaClientOptionsBuilder {
private boolean enableGraphSSL = false;
private boolean enableMetaSSL = false;
private boolean enableStorageSSL = false;
private SSLSighType sslSighType = null;
private SSLSignType sslSignType = null;
private CASignParams caSignParams = null;
private SelfSignParams selfSignParams = null;

Expand Down Expand Up @@ -183,8 +183,8 @@ public NebulaClientOptionsBuilder setEnableStorageSSL(boolean enableStorageSSL)
}


public NebulaClientOptionsBuilder setSSLSignType(SSLSighType sslSighType) {
this.sslSighType = sslSighType;
public NebulaClientOptionsBuilder setSSLSignType(SSLSignType sslSignType) {
this.sslSignType = sslSignType;
return this;
}

Expand All @@ -211,11 +211,11 @@ public NebulaClientOptions build() {
"storage ssl is enabled, meta ssl must be enabled.");
}

if (sslSighType == null) {
if (sslSignType == null) {
throw new IllegalArgumentException("ssl is enabled, ssl sign type must not be "
+ "null");
}
switch (sslSighType) {
switch (sslSignType) {
case CA:
if (caSignParams == null) {
throw new IllegalArgumentException("ssl is enabled and sign type is "
Expand Down Expand Up @@ -244,7 +244,7 @@ public NebulaClientOptions build() {
enableGraphSSL,
enableMetaSSL,
enableStorageSSL,
sslSighType,
sslSignType,
caSignParams,
selfSignParams);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public NebulaPool getNebulaPool() throws UnknownHostException {
poolConfig.setTimeout(nebulaClientOptions.getTimeout());
if (nebulaClientOptions.isEnableGraphSSL()) {
poolConfig.setEnableSsl(true);
switch (nebulaClientOptions.getSSLSighType()) {
switch (nebulaClientOptions.getSSLSignType()) {
case CA: {
CASignParams caSignParams = nebulaClientOptions.getCaSignParam();
SSLParam sslParam = new CASignedSSLParam(caSignParams.getCaCrtFilePath(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public MetaClient getMetaClient() throws TException, ClientServerIncompatibleExc
int retry = nebulaClientOptions.getConnectRetry();
MetaClient metaClient;
if (nebulaClientOptions.isEnableMetaSSL()) {
switch (nebulaClientOptions.getSSLSighType()) {
switch (nebulaClientOptions.getSSLSignType()) {
case CA: {
CASignParams caSignParams = nebulaClientOptions.getCaSignParam();
SSLParam sslParam = new CASignedSSLParam(caSignParams.getCaCrtFilePath(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public StorageClient getStorageClient() throws Exception {
int retry = nebulaClientOptions.getConnectRetry();
StorageClient storageClient;
if (nebulaClientOptions.isEnableStorageSSL()) {
switch (nebulaClientOptions.getSSLSighType()) {
switch (nebulaClientOptions.getSSLSignType()) {
case CA: {
CASignParams caSignParams = nebulaClientOptions.getCaSignParam();
SSLParam sslParam = new CASignedSSLParam(caSignParams.getCaCrtFilePath(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package org.apache.flink.connector.nebula.utils;

public enum SSLSighType {
public enum SSLSignType {
/**
* CA sign
*/
Expand All @@ -18,7 +18,7 @@ public enum SSLSighType {

private String type;

SSLSighType(String type) {
SSLSignType(String type) {
this.type = type;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package org.apache.flink.connector.nebula.connection;

import org.apache.flink.connector.nebula.utils.SSLSighType;
import org.apache.flink.connector.nebula.utils.SSLSignType;
import org.junit.Test;

public class NebulaClientOptionsTest {
Expand All @@ -22,7 +22,7 @@ public void testConfigAddress() {
.setTimeout(1000)
.setEnableGraphSSL(true)
.setEnableMetaSSL(true)
.setSSLSignType(SSLSighType.CA)
.setSSLSignType(SSLSignType.CA)
.setCaSignParam("caCrtFile", "crtFile", "keyFile")
.setSelfSignParam("crtFile", "keyFile", "password")
.build();
Expand Down Expand Up @@ -53,14 +53,14 @@ public void testIsEnableGraphSsl() {
.setMetaAddress("127.0.0.1:9559")
.setEnableMetaSSL(false)
.setEnableStorageSSL(true)
.setSSLSignType(SSLSighType.CA)
.setSSLSignType(SSLSignType.CA)
.setCaSignParam("caCrtFile", "crtFile", "keyFile")
.build();
}


@Test(expected = IllegalArgumentException.class)
public void testNullSslSighType() {
public void testNullSslSignType() {
NebulaClientOptions nebulaClientOptions = new NebulaClientOptions
.NebulaClientOptionsBuilder()
.setGraphAddress(null)
Expand All @@ -73,7 +73,7 @@ public void testNullSslSighType() {
}

@Test(expected = IllegalArgumentException.class)
public void testNoSslSighType() {
public void testNoSslSignType() {
NebulaClientOptions nebulaClientOptions = new NebulaClientOptions
.NebulaClientOptionsBuilder()
.setGraphAddress(null)
Expand All @@ -92,7 +92,7 @@ public void testGetCaSignParam() {
.setMetaAddress("127.0.0.1:9559")
.setEnableGraphSSL(false)
.setEnableMetaSSL(true)
.setSSLSignType(SSLSighType.CA)
.setSSLSignType(SSLSignType.CA)
.setSelfSignParam("crtFile", "keyFile", "password")
.build();

Expand All @@ -106,7 +106,7 @@ public void testGetSelfSignParam() {
.setMetaAddress("127.0.0.1:9559")
.setEnableGraphSSL(false)
.setEnableMetaSSL(true)
.setSSLSignType(SSLSighType.SELF)
.setSSLSignType(SSLSignType.SELF)
.setCaSignParam("caCrtFile", "crtFile", "keyFile")
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.vesoft.nebula.client.graph.exception.NotValidConnectionException;
import com.vesoft.nebula.client.graph.net.NebulaPool;
import java.net.UnknownHostException;
import org.apache.flink.connector.nebula.utils.SSLSighType;
import org.apache.flink.connector.nebula.utils.SSLSignType;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -67,7 +67,7 @@ public void getSessionWithSsl() throws NotValidConnectionException {
.setTimeout(1000)
.setEnableGraphSSL(true)
.setEnableMetaSSL(true)
.setSSLSignType(SSLSighType.CA)
.setSSLSignType(SSLSignType.CA)
.setCaSignParam("src/test/resources/ssl/casigned.pem",
"src/test/resources/ssl/casigned.crt",
"src/test/resources/ssl/casigned.key")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.apache.flink.connector.nebula.sink.NebulaVertexBatchOutputFormat;
import org.apache.flink.connector.nebula.statement.EdgeExecutionOptions;
import org.apache.flink.connector.nebula.statement.VertexExecutionOptions;
import org.apache.flink.connector.nebula.utils.SSLSighType;
import org.apache.flink.connector.nebula.utils.SSLSignType;
import org.apache.flink.connector.nebula.utils.WriteModeEnum;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
Expand Down Expand Up @@ -113,7 +113,7 @@ private static NebulaClientOptions getClientOptions() {
.setGraphAddress("127.0.0.1:9669")
.setMetaAddress("127.0.0.1:9559")
.setEnableGraphSSL(true)
.setSSLSignType(SSLSighType.CA)
.setSSLSignType(SSLSignType.CA)
.setCaSignParam("example/src/main/resources/ssl/casigned.pem",
"example/src/main/resources/ssl/casigned.crt",
"example/src/main/resources/ssl/casigned.key")
Expand All @@ -125,7 +125,7 @@ private static NebulaClientOptions getClientOptions() {
.setGraphAddress("127.0.0.1:9669")
.setMetaAddress("127.0.0.1:9559")
.setEnableGraphSSL(true)
.setSSLSignType(SSLSighType.SELF)
.setSSLSignType(SSLSignType.SELF)
.setSelfSignParam("example/src/main/resources/ssl/selfsigned.pem",
"example/src/main/resources/ssl/selfsigned.key",
"vesoft")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.flink.connector.nebula.statement.EdgeExecutionOptions;
import org.apache.flink.connector.nebula.statement.ExecutionOptions;
import org.apache.flink.connector.nebula.statement.VertexExecutionOptions;
import org.apache.flink.connector.nebula.utils.SSLSighType;
import org.apache.flink.connector.nebula.utils.SSLSignType;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.types.Row;
Expand Down Expand Up @@ -82,7 +82,7 @@ public static void initConfig() {
.setMetaAddress("127.0.0.1:9559")
.setEnableMetaSSL(true)
.setEnableStorageSSL(true)
.setSSLSignType(SSLSighType.CA)
.setSSLSignType(SSLSignType.CA)
.setCaSignParam("example/src/main/resources/ssl/casigned.pem",
"example/src/main/resources/ssl/casigned.crt",
"example/src/main/resources/ssl/casigned.key")
Expand All @@ -95,7 +95,7 @@ public static void initConfig() {
.setMetaAddress("127.0.0.1:9559")
.setEnableMetaSSL(true)
.setEnableStorageSSL(true)
.setSSLSignType(SSLSighType.SELF)
.setSSLSignType(SSLSignType.SELF)
.setSelfSignParam("example/src/main/resources/ssl/selfsigned.pem",
"example/src/main/resources/ssl/selfsigned.key",
"vesoft")
Expand Down

0 comments on commit 3613a3c

Please sign in to comment.