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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .github/workflows/internal-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
tags-ignore:
- '*.*'
paths-ignore:
- "pom.xml"
- "*.md"
branches:
- release/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
echo TEST_REUSABLE_TOKEN=${{ secrets.TEST_REUSABLE_TOKEN }} >> .env

- name: Build & Run tests with Maven
run: mvn -B package -f pom.xml
run: mvn -B package -f pom.xml -Dmaven.javadoc.skip=true

- name: Codecov
uses: codecov/codecov-action@v2.1.0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/shared-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:

- name: Publish package
run: mvn --batch-mode deploy -P ${{ inputs.profile }}

env:
SERVER_USERNAME: ${{ secrets.server-username }}
SERVER_PASSWORD: ${{ secrets.server-password }}
Expand Down
38 changes: 32 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.skyflow</groupId>
<artifactId>skyflow-java</artifactId>
<version>2.0.0-beta.1-dev.ec349a9</version>
<version>2.0.0-beta.1-dev.e14bd74</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down Expand Up @@ -45,6 +45,30 @@
</properties>

<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>2.17.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.17.2</version>
<scope>compile</scope>
</dependency>
<!-- newly added v2 dependencies -->
<dependency>
<groupId>io.github.cdimascio</groupId>
Expand Down Expand Up @@ -117,6 +141,12 @@
<version>2.0.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.13.2</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -140,10 +170,7 @@
<version>3.2.0</version>
<configuration>
<excludePackageNames>
:com.skyflow.generated.rest
:com.skyflow.generated.rest.api
:com.skyflow.generated.rest.auth
:com.skyflow.generated.rest.models
com.skyflow.generated.rest.*
</excludePackageNames>
</configuration>
<executions>
Expand Down Expand Up @@ -276,5 +303,4 @@
</distributionManagement>
</profile>
</profiles>

</project>
47 changes: 43 additions & 4 deletions src/main/java/com/skyflow/Skyflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.skyflow.utils.logger.LogUtil;
import com.skyflow.utils.validations.Validations;
import com.skyflow.vault.controller.ConnectionController;
import com.skyflow.vault.controller.DetectController;
import com.skyflow.vault.controller.VaultController;

import java.util.LinkedHashMap;
Expand Down Expand Up @@ -101,25 +102,57 @@
return controller;
}

public ConnectionController connection() {
String connectionId = (String) this.builder.connectionsMap.keySet().toArray()[0];

public ConnectionController connection() throws SkyflowException {
Object[] array = this.builder.connectionsMap.keySet().toArray();

Check warning on line 107 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L107

Added line #L107 was not covered by tests
if (array.length < 1) {
LogUtil.printErrorLog(ErrorLogs.CONNECTION_CONFIG_DOES_NOT_EXIST.getLog());
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.ConnectionIdNotInConfigList.getMessage());

Check warning on line 110 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L109-L110

Added lines #L109 - L110 were not covered by tests
}
String connectionId = (String) array[0];

Check warning on line 112 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L112

Added line #L112 was not covered by tests
return this.connection(connectionId);
}

public ConnectionController connection(String connectionId) {
return this.builder.connectionsMap.get(connectionId);
public ConnectionController connection(String connectionId) throws SkyflowException {
ConnectionController controller = this.builder.connectionsMap.get(connectionId);

Check warning on line 117 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L117

Added line #L117 was not covered by tests
if (controller == null) {
LogUtil.printErrorLog(ErrorLogs.CONNECTION_CONFIG_DOES_NOT_EXIST.getLog());
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.ConnectionIdNotInConfigList.getMessage());

Check warning on line 120 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L119-L120

Added lines #L119 - L120 were not covered by tests
}
return controller;

Check warning on line 122 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L122

Added line #L122 was not covered by tests
}

public DetectController detect() throws SkyflowException {
Object[] array = this.builder.detectClientsMap.keySet().toArray();

Check warning on line 126 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L126

Added line #L126 was not covered by tests
if (array.length < 1) {
LogUtil.printErrorLog(ErrorLogs.VAULT_CONFIG_DOES_NOT_EXIST.getLog());
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.VaultIdNotInConfigList.getMessage());

Check warning on line 129 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L128-L129

Added lines #L128 - L129 were not covered by tests
}
String detectId = (String) array[0];
return this.detect(detectId);

Check warning on line 132 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L131-L132

Added lines #L131 - L132 were not covered by tests
}

public DetectController detect(String vaultId) throws SkyflowException {
DetectController controller = this.builder.detectClientsMap.get(vaultId);

Check warning on line 136 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L136

Added line #L136 was not covered by tests
if (controller == null) {
LogUtil.printErrorLog(ErrorLogs.VAULT_CONFIG_DOES_NOT_EXIST.getLog());
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.VaultIdNotInConfigList.getMessage());

Check warning on line 139 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L138-L139

Added lines #L138 - L139 were not covered by tests
}
return controller;

Check warning on line 141 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L141

Added line #L141 was not covered by tests
}

public static final class SkyflowClientBuilder {
private final LinkedHashMap<String, ConnectionController> connectionsMap;
private final LinkedHashMap<String, VaultController> vaultClientsMap;
private final LinkedHashMap<String, DetectController> detectClientsMap;
private final LinkedHashMap<String, VaultConfig> vaultConfigMap;
private final LinkedHashMap<String, ConnectionConfig> connectionConfigMap;
private Credentials skyflowCredentials;
private LogLevel logLevel;

public SkyflowClientBuilder() {
this.vaultClientsMap = new LinkedHashMap<>();
this.detectClientsMap = new LinkedHashMap<>();

Check warning on line 155 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L155

Added line #L155 was not covered by tests
this.vaultConfigMap = new LinkedHashMap<>();
this.connectionsMap = new LinkedHashMap<>();
this.connectionConfigMap = new LinkedHashMap<>();
Expand All @@ -139,8 +172,11 @@
} else {
this.vaultConfigMap.put(vaultConfig.getVaultId(), vaultConfig);
this.vaultClientsMap.put(vaultConfig.getVaultId(), new VaultController(vaultConfig, this.skyflowCredentials));
this.detectClientsMap.put(vaultConfig.getVaultId(), new DetectController(vaultConfig, this.skyflowCredentials));

Check warning on line 175 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L175

Added line #L175 was not covered by tests
LogUtil.printInfoLog(Utils.parameterizedString(
InfoLogs.VAULT_CONTROLLER_INITIALIZED.getLog(), vaultConfig.getVaultId()));
LogUtil.printInfoLog(Utils.parameterizedString(
InfoLogs.DETECT_CONTROLLER_INITIALIZED.getLog(), vaultConfig.getVaultId()));

Check warning on line 179 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L178-L179

Added lines #L178 - L179 were not covered by tests
}
return this;
}
Expand Down Expand Up @@ -226,6 +262,9 @@
for (VaultController vault : this.vaultClientsMap.values()) {
vault.setCommonCredentials(this.skyflowCredentials);
}
for (DetectController detect : this.detectClientsMap.values()) {
detect.setCommonCredentials(this.skyflowCredentials);
}

Check warning on line 267 in src/main/java/com/skyflow/Skyflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/skyflow/Skyflow.java#L266-L267

Added lines #L266 - L267 were not covered by tests
for (ConnectionController connection : this.connectionsMap.values()) {
connection.setCommonCredentials(this.skyflowCredentials);
}
Expand Down
Loading
Loading