-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from alex268/develop
Use SecureRandom for avoiding the port conflicts
- Loading branch information
Showing
6 changed files
with
120 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 60 additions & 15 deletions
75
tests/common/src/test/java/tech/ydb/test/integration/YdbEnvironmentMock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,79 @@ | ||
package tech.ydb.test.integration; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* | ||
* @author Aleksandr Gorshenin | ||
*/ | ||
public class YdbEnvironmentMock extends YdbEnvironment { | ||
private final Map<String, String> params = new HashMap<>(); | ||
private String database = null; | ||
private String endpoint = null; | ||
private String pemCert = null; | ||
private String token = null; | ||
private boolean useTLS = false; | ||
private boolean dockerReuse = false; | ||
|
||
public YdbEnvironmentMock withDatabase(String value) { | ||
this.database = value; | ||
return this; | ||
} | ||
|
||
public YdbEnvironmentMock with(String key, String value) { | ||
params.put(key, value); | ||
public YdbEnvironmentMock withEndpoint(String value) { | ||
this.endpoint = value; | ||
return this; | ||
} | ||
|
||
public YdbEnvironmentMock withPemCert(String value) { | ||
this.pemCert = value; | ||
return this; | ||
} | ||
|
||
public YdbEnvironmentMock withToken(String value) { | ||
this.token = value; | ||
return this; | ||
} | ||
|
||
public YdbEnvironmentMock withUseTLS(boolean value) { | ||
this.useTLS = value; | ||
return this; | ||
} | ||
|
||
public YdbEnvironmentMock withDockerReuse(boolean value) { | ||
this.dockerReuse = value; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String ydbDatabase() { | ||
return database; | ||
} | ||
|
||
@Override | ||
public String ydbEndpoint() { | ||
return endpoint; | ||
} | ||
|
||
@Override | ||
String readParam(String key, String defaultValue) { | ||
return params.getOrDefault(key, defaultValue); | ||
public String ydbPemCert() { | ||
return pemCert; | ||
} | ||
|
||
@Override | ||
Boolean readParam(String key, boolean defaultValue) { | ||
if (params.containsKey(key)) { | ||
return Boolean.valueOf(params.get(key)); | ||
} | ||
return defaultValue; | ||
public String ydbAuthToken() { | ||
return token; | ||
} | ||
|
||
public static YdbEnvironmentMock create() { | ||
return new YdbEnvironmentMock(); | ||
@Override | ||
public boolean ydbUseTls() { | ||
return useTLS; | ||
} | ||
|
||
@Override | ||
public boolean dockerReuse() { | ||
return dockerReuse; | ||
} | ||
|
||
@Override | ||
public boolean disableIntegrationTests() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters