Skip to content
Open
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
6 changes: 4 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@
"detok",
"qhdmceurtnlz",
"ngrok",
"obac"
"obac",
"siom",
"recordss"
],
"languageSettings": [
{
Expand All @@ -119,7 +121,7 @@
"**/target/**",
"*.lock",
"Rule/**",
"src/main/java/com/skyflow/generated/**",
"**/generated/**",
"**/*.ts",
"**/processed-*",
"samples/src/main/java/com/example/credentials.json",
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/endorlabsScan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ jobs:
name: "credentials.json"
json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }}

- name: Distribute test fixtures to modules
run: |
# Surefire runs each module's tests with the module directory as the working
# directory, so dotenv and ./credentials.json lookups miss the repo-root copies.
for module in common v2 flowvault; do
cp .env "$module/.env"
cp credentials.json "$module/credentials.json"
done

- name: Compile Package
run: mvn -B package -f pom.xml -Dmaven.javadoc.skip=true

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ jobs:
echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env
echo TEST_REUSABLE_TOKEN=${{ secrets.TEST_REUSABLE_TOKEN }} >> .env
- name: Distribute test fixtures to modules
run: |
# Surefire runs each module's tests with the module directory as the working
# directory, so dotenv and ./credentials.json lookups miss the repo-root copies.
for module in common v2 flowvault; do
cp .env "$module/.env"
cp credentials.json "$module/credentials.json"
done
- name: Build & Run tests with Maven
run: mvn -B package -f pom.xml -Dmaven.javadoc.skip=true

Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,27 @@ jobs:
echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env
echo TEST_REUSABLE_TOKEN=${{ secrets.TEST_REUSABLE_TOKEN }} >> .env

- name: Distribute test fixtures to modules
run: |
# Surefire runs each module's tests with the module directory as the working
# directory, so dotenv and ./credentials.json lookups miss the repo-root copies.
for module in common v2 flowvault; do
cp .env "$module/.env"
cp credentials.json "$module/credentials.json"
done

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

# JaCoCo writes one report per module. The root pom is <packaging>pom</packaging>
# with no sources, so target/site/jacoco/jacoco.xml - correct when this was a
# single-module build - is never generated post common/v2/flowvault split, and
# codecov was silently uploading nothing.
- name: Codecov
uses: codecov/codecov-action@v2.1.0
with:
token: ${{ secrets.CODECOV_REPO_UPLOAD_TOKEN }}
files: target/site/jacoco/jacoco.xml
files: common/target/site/jacoco/jacoco.xml,v2/target/site/jacoco/jacoco.xml,flowvault/target/site/jacoco/jacoco.xml
name: codecov-skyflow-java
verbose: true

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/shared-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ jobs:
name: "credentials.json"
json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }}

- name: Distribute test fixtures to modules
run: |
# Surefire runs each module's tests with the module directory as the working
# directory, so dotenv and ./credentials.json lookups miss the repo-root copies.
for module in common v2 flowvault; do
cp .env "$module/.env"
cp credentials.json "$module/credentials.json"
done

- name: Publish package
run: |
if [[ "${{ inputs.tag }}" == "internal" ]]; then
Expand Down
27 changes: 16 additions & 11 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
comment: false

# Component paths are prefixed with **/ (quoted - a bare leading * is a YAML
# alias) so they match every Maven module. Before the common/v2/flowvault
# split sources lived at src/main/java/...; they are now
# <module>/src/main/java/..., so the unprefixed globs matched zero files and
# every component reported no coverage data.
component_management:
default_rules:
statuses:
Expand All @@ -9,44 +14,44 @@ component_management:
- component_id: service_account
name: Service Account
paths:
- src/main/java/com/skyflow/serviceaccount/**
- "**/src/main/java/com/skyflow/serviceaccount/**"
- component_id: vault_data
name: Vault Data
paths:
- src/main/java/com/skyflow/vault/data/**
- "**/src/main/java/com/skyflow/vault/data/**"
- component_id: vault_tokens
name: Vault Tokens
paths:
- src/main/java/com/skyflow/vault/tokens/**
- "**/src/main/java/com/skyflow/vault/tokens/**"
- component_id: vault_connection
name: Vault Connection
paths:
- src/main/java/com/skyflow/vault/connection/**
- "**/src/main/java/com/skyflow/vault/connection/**"
- component_id: vault_controller
name: Vault Controller
paths:
- src/main/java/com/skyflow/vault/controller/**
- "**/src/main/java/com/skyflow/vault/controller/**"
- component_id: vault_detect
name: Detect
paths:
- src/main/java/com/skyflow/vault/detect/**
- "**/src/main/java/com/skyflow/vault/detect/**"
- component_id: vault_audit
name: Audit
paths:
- src/main/java/com/skyflow/vault/audit/**
- "**/src/main/java/com/skyflow/vault/audit/**"
- component_id: vault_bin
name: BIN Lookup
paths:
- src/main/java/com/skyflow/vault/bin/**
- "**/src/main/java/com/skyflow/vault/bin/**"
- component_id: config
name: Config
paths:
- src/main/java/com/skyflow/config/**
- "**/src/main/java/com/skyflow/config/**"
- component_id: utils
name: Utils
paths:
- src/main/java/com/skyflow/utils/**
- "**/src/main/java/com/skyflow/utils/**"
- component_id: errors
name: Errors
paths:
- src/main/java/com/skyflow/errors/**
- "**/src/main/java/com/skyflow/errors/**"
4 changes: 2 additions & 2 deletions common/src/main/java/com/skyflow/enums/CustomHeaderKey.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.skyflow.enums;

public enum CustomHeaderKey {
SkyflowAccountID("x-skyflow-account-id"),
SkyflowAccountId("x-skyflow-account-id"),
SkyflowAccountName("x-skyflow-account-name"),
RequestIDHeader("x-request-id");
RequestIdHeader("x-request-id");

private final String value;

Expand Down
1 change: 1 addition & 0 deletions common/src/main/java/com/skyflow/errors/ErrorMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public enum ErrorMessage {
EmptyKeyInTokens("%s0 Validation error. Invalid key tokens. Specify a valid key."),
EmptyValueInTokens("%s0 Validation error. Invalid value in tokens. Specify a valid value."),
EmptyUpsert("%s0 Validation error. 'upsert' key can't be empty. Specify an upsert column."),
InvalidUpsertUpdateType("%s0 Validation error. Invalid upsert updateType. Specify either 'UPDATE' or 'REPLACE'."),
EmptyUpsertValues("%s0 Validation error. Upsert column values can't be empty. Specify at least one upsert column."),
HomogenousNotSupportedWithUpsert("%s0 Validation error. 'homogenous' is not supported with 'upsert'. Specify either 'homogenous' or 'upsert'."),
TokensPassedForTokenModeDisable("%s0 Validation error. 'tokenMode' wasn't specified. Set 'tokenMode' to 'ENABLE' to insert tokens."),
Expand Down
1 change: 1 addition & 0 deletions common/src/main/java/com/skyflow/logs/ErrorLogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public enum ErrorLogs {
EMPTY_OR_NULL_VALUE_IN_VALUES("Invalid %s1 request. Value can not be null or empty in values for key \"%s2\"."),
EMPTY_OR_NULL_KEY_IN_VALUES("Invalid %s1 request. Key can not be null or empty in values"),
EMPTY_UPSERT("Invalid %s1 request. Upsert can not be empty."),
INVALID_UPSERT_UPDATE_TYPE("Invalid %s1 request. Upsert updateType must be either UPDATE or REPLACE."),
EMPTY_UPSERT_VALUES("Invalid %s1 request. Upsert values can not be empty."),
HOMOGENOUS_NOT_SUPPORTED_WITH_UPSERT("Invalid %s1 request. Homogenous is not supported when upsert is passed."),
TOKENS_NOT_ALLOWED_WITH_TOKEN_MODE_DISABLE("Invalid %s1 request. Tokens are not allowed when tokenMode is DISABLE."),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package com.skyflow.vault.data;

// Shared extension point for module-specific detokenize request data. Intentionally empty:
// v2 and flowvault no longer have any field in common here, so each owns its own state.
// Retained so the modules keep a shared supertype for future use.
public class BaseDetokenizeData {
private final String token;

public BaseDetokenizeData(String token) {
this.token = token;
}

public String getToken() {
return this.token;
}

}
26 changes: 4 additions & 22 deletions common/src/main/java/com/skyflow/vault/data/BaseInsertRequest.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
package com.skyflow.vault.data;

class BaseInsertRequest {
private final BaseInsertRequestBuilder builder;

protected BaseInsertRequest(BaseInsertRequestBuilder builder) {
this.builder = builder;
}

public String getTable() {
return this.builder.table;
}

static class BaseInsertRequestBuilder {
protected String table;
protected BaseInsertRequestBuilder() {
}

public BaseInsertRequestBuilder table(String table) {
this.table = table;
return this;
}

}
// Shared extension point for module-specific insert requests. Intentionally empty:
// v2 and flowvault insert requests no longer have any field in common, so each owns
// its own state. Retained so the modules keep a shared supertype for future use.
public class BaseInsertRequest {
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
package com.skyflow.vault.data;

import com.google.gson.Gson;

import java.util.ArrayList;
import java.util.HashMap;

// Shared extension point for module-specific insert responses. Intentionally empty:
// v2 and flowvault insert responses no longer have any field in common, so each owns
// its own state. Retained so the modules keep a shared supertype for future use.
public class BaseInsertResponse {
private final ArrayList<HashMap<String, Object>> insertedFields;
private final ArrayList<HashMap<String, Object>> errors;

public BaseInsertResponse(ArrayList<HashMap<String, Object>> insertedFields, ArrayList<HashMap<String, Object>> errors) {
this.insertedFields = insertedFields;
this.errors = errors;
}

public ArrayList<HashMap<String, Object>> getInsertedFields() {
return insertedFields;
}

public ArrayList<HashMap<String, Object>> getErrors() {
return errors;
}

@Override
public String toString() {
Gson gson = new Gson().newBuilder().serializeNulls().create();
return gson.toJson(this);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@
public class BaseDetokenizeDataTests {

@Test
public void testGetTokenReturnsConstructorValue() {
BaseDetokenizeData data = new BaseDetokenizeData("token-value");
public void testInstantiationDoesNotThrow() {
BaseDetokenizeData data = new BaseDetokenizeData();

Assert.assertEquals("token-value", data.getToken());
Assert.assertNotNull(data);
}

@Test
public void testNullToken() {
BaseDetokenizeData data = new BaseDetokenizeData(null);
public void testUsableAsExtensionPointForSubclasses() {
// BaseDetokenizeData carries no state of its own; it exists purely so module-specific
// classes (v2's DetokenizeData, flowvault's TokenGroupRedactions) share a supertype.
BaseDetokenizeData data = new BaseDetokenizeData() {
};

Assert.assertNull(data.getToken());
}

@Test
public void testEmptyToken() {
BaseDetokenizeData data = new BaseDetokenizeData("");

Assert.assertEquals("", data.getToken());
Assert.assertTrue(data instanceof BaseDetokenizeData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,19 @@
public class BaseInsertRequestTests {

@Test
public void testBuilderSetsTable() {
BaseInsertRequest.BaseInsertRequestBuilder builder = new BaseInsertRequest.BaseInsertRequestBuilder();
builder.table("test_table");
BaseInsertRequest request = new BaseInsertRequest(builder);
public void testInstantiationDoesNotThrow() {
BaseInsertRequest request = new BaseInsertRequest();

Assert.assertEquals("test_table", request.getTable());
Assert.assertNotNull(request);
}

@Test
public void testBuilderTableMethodReturnsSameBuilderInstance() {
BaseInsertRequest.BaseInsertRequestBuilder builder = new BaseInsertRequest.BaseInsertRequestBuilder();
BaseInsertRequest.BaseInsertRequestBuilder returned = builder.table("test_table");
public void testUsableAsExtensionPointForSubclasses() {
// BaseInsertRequest carries no state of its own; it exists purely so module-specific
// InsertRequest classes (v2's and flowvault's) share a supertype. Verify the subtype relationship holds.
BaseInsertRequest request = new BaseInsertRequest() {
};

Assert.assertSame(builder, returned);
}

@Test
public void testNullTableWhenNeverSet() {
BaseInsertRequest.BaseInsertRequestBuilder builder = new BaseInsertRequest.BaseInsertRequestBuilder();
BaseInsertRequest request = new BaseInsertRequest(builder);

Assert.assertNull(request.getTable());
}

@Test
public void testEmptyTable() {
BaseInsertRequest.BaseInsertRequestBuilder builder = new BaseInsertRequest.BaseInsertRequestBuilder();
builder.table("");
BaseInsertRequest request = new BaseInsertRequest(builder);

Assert.assertEquals("", request.getTable());
Assert.assertTrue(request instanceof BaseInsertRequest);
}
}
Loading
Loading