Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilal Al committed Aug 30, 2024
1 parent f0e9d22 commit a96c19e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
60 changes: 35 additions & 25 deletions client/src/main/java/io/split/client/SplitClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,18 @@ private void verifyEndPoints() {
}
}

public SplitClientConfig build() {
verifyRates();
private void verifyAuthScheme() {
if (_authScheme == HttpAuthScheme.KERBEROS) {
if (proxy() == null) {
throw new IllegalStateException("Kerberos mode require Proxy parameters.");
}
if (_kerberosPrincipalName == null) {
throw new IllegalStateException("Kerberos mode require Kerberos Principal Name.");
}
}
}

private void verifyAllModes() {
switch (_impressionsMode) {
case OPTIMIZED:
_impressionsRefreshRate = (_impressionsRefreshRate <= 0) ? 300 : Math.max(60, _impressionsRefreshRate);
Expand All @@ -1068,21 +1077,26 @@ public SplitClientConfig build() {
if (_impressionsQueueSize <=0 ) {
throw new IllegalArgumentException("impressionsQueueSize must be > 0: " + _impressionsQueueSize);
}
if(_storageMode == null) {
_storageMode = StorageMode.MEMORY;
}

if(OperationMode.CONSUMER.equals(_operationMode)){
if(_customStorageWrapper == null) {
throw new IllegalStateException("Custom Storage must not be null on Consumer mode.");
}
_storageMode = StorageMode.PLUGGABLE;
}
}

private void verifyNetworkParams() {
if (_connectionTimeout <= 0) {
throw new IllegalArgumentException("connectionTimeOutInMs must be > 0: " + _connectionTimeout);
}

if (_readTimeout <= 0) {
throw new IllegalArgumentException("readTimeout must be > 0: " + _readTimeout);
}

verifyEndPoints();

if (_numThreadsForSegmentFetch <= 0) {
throw new IllegalArgumentException("Number of threads for fetching segments MUST be greater than zero");
}

if (_authRetryBackoffBase <= 0) {
throw new IllegalArgumentException("authRetryBackoffBase: must be >= 1");
}
Expand All @@ -1098,27 +1112,23 @@ public SplitClientConfig build() {
if(_onDemandFetchMaxRetries <= 0) {
throw new IllegalStateException("_onDemandFetchMaxRetries must be > 0");
}
}
public SplitClientConfig build() {

if(_storageMode == null) {
_storageMode = StorageMode.MEMORY;
}
verifyRates();

if(OperationMode.CONSUMER.equals(_operationMode)){
if(_customStorageWrapper == null) {
throw new IllegalStateException("Custom Storage must not be null on Consumer mode.");
}
_storageMode = StorageMode.PLUGGABLE;
}
verifyAllModes();

if (_authScheme == HttpAuthScheme.KERBEROS) {
if (proxy() == null) {
throw new IllegalStateException("Kerberos mode require Proxy parameters.");
}
if (_kerberosPrincipalName == null) {
throw new IllegalStateException("Kerberos mode require Kerberos Principal Name.");
}
verifyEndPoints();

verifyNetworkParams();

if (_numThreadsForSegmentFetch <= 0) {
throw new IllegalArgumentException("Number of threads for fetching segments MUST be greater than zero");
}

verifyAuthScheme();

return new SplitClientConfig(
_endpoint,
_eventsEndpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ private static class CreateAuthorizationHeaderAction implements PrivilegedAction
String clientPrincipalName;
String serverPrincipalName;

// private StringBuffer outputToken = new StringBuffer();
private StringBuilder outputToken = new StringBuilder();

private CreateAuthorizationHeaderAction(final String clientPrincipalName, final String serverPrincipalName) {
Expand Down

0 comments on commit a96c19e

Please sign in to comment.