Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
2 changes: 1 addition & 1 deletion v3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>

<artifactId>skyflow-java</artifactId>
<version>2.0.0-beta.4-dev.f012079</version>
<version>2.0.0-beta.4-dev.4b56b3d</version>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>Skyflow V3 SDK for the Java programming language</description>
Expand Down
10 changes: 6 additions & 4 deletions v3/src/main/java/com/skyflow/VaultClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ private void prioritiseCredentials() throws SkyflowException {
} else if (this.commonCredentials != null) {
this.finalCredentials = this.commonCredentials;
} else {
Dotenv dotenv = Dotenv.load();
String sysCredentials = dotenv.get(Constants.ENV_CREDENTIALS_KEY_NAME);
String sysCredentials = System.getenv(Constants.ENV_CREDENTIALS_KEY_NAME);
if (sysCredentials == null) {
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(),
ErrorMessage.EmptyCredentials.getMessage());
Dotenv dotenv = Dotenv.load();
sysCredentials = dotenv.get(Constants.ENV_CREDENTIALS_KEY_NAME);
}
if (sysCredentials == null) {
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyCredentials.getMessage());
} else {
this.finalCredentials = new Credentials();
this.finalCredentials.setCredentialsString(sysCredentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


public class VaultControllerTests {
private static final String ENV_PATH = "/home/saib/skyflow3/skyflow-java/v3/.env";
private static final String ENV_PATH = "./.env";

private VaultConfig vaultConfig;
private Credentials credentials;
Expand All @@ -42,14 +42,28 @@ public void tearDown() {
}

private void writeEnv(String content) {
try (FileWriter writer = new FileWriter(ENV_PATH)) {
java.io.File envFile = new java.io.File(ENV_PATH);
java.io.File parentDir = envFile.getParentFile();
if (parentDir != null && !parentDir.exists()) {
parentDir.mkdirs(); // Create parent directory if it doesn't exist
}
try (FileWriter writer = new FileWriter(envFile)) {
writer.write(content);
} catch (IOException e) {
throw new RuntimeException(e);
}
// Print the contents of the .env file
try (Scanner scanner = new Scanner(envFile)) {
System.out.println("Current .env contents:");
while (scanner.hasNextLine()) {
System.out.println(scanner.nextLine());
}
} catch (IOException e) {
System.out.println("Could not read .env file: " + e.getMessage());
}
}

private VaultController createController() {
private VaultController createController() throws SkyflowException {
return new VaultController(vaultConfig, credentials);
}

Expand Down Expand Up @@ -354,7 +368,7 @@ public void testHighConcurrencyForLowRecords() throws Exception {
public void testFractionalLastBatch() throws Exception {
writeEnv("INSERT_BATCH_SIZE=100");
VaultController controller = createController();
InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(10050)).build();
InsertRequest insertRequest = InsertRequest.builder().table("table1").values(generateValues(9050)).build();

try {
controller.bulkInsert(insertRequest);
Expand Down
Loading