From 3af24558416e42d38b14be73ed40dbe4cc4117a6 Mon Sep 17 00:00:00 2001 From: Emmanuel Zamora Date: Fri, 29 Aug 2025 11:18:38 -0300 Subject: [PATCH 1/7] Add github tests ci --- .github/CODEOWNERS | 1 + .github/workflows/test.yml | 46 +++++++++++++++++++ .../io/split/openfeature/SplitProvider.java | 2 +- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/test.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..ab53a7c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @splitio/sdk \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..20656d1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +name: test + +on: + pull_request: + branches: + - '*' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + jdk: + - '8' + - '11' + - '19' + env: + ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} + ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} + MAVEN_OPTS: "-XX:InitialHeapSize=2G -XX:MaxHeapSize=2G -XX:+PrintCommandLineFlags -XX:ThreadStackSize=65536 -XX:-TieredCompilation -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" + muteProps: "true" + + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Setup JDK ${{ matrix.jdk }} + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: ${{ matrix.jdk }} + + - name: Setup Maven + run: cp .ci.settings.xml ${HOME}/.m2/settings.xml + + - name: Test + if: matrix.jdk == '8' && github.event_name == 'pull_request' && github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' + run: mvn --batch-mode clean install diff --git a/src/main/java/io/split/openfeature/SplitProvider.java b/src/main/java/io/split/openfeature/SplitProvider.java index 91d0fd7..06982d3 100644 --- a/src/main/java/io/split/openfeature/SplitProvider.java +++ b/src/main/java/io/split/openfeature/SplitProvider.java @@ -113,7 +113,7 @@ private ProviderEvaluation getEvaluation( String treatment = evaluated.treatment(); String config = evaluated.config(); ImmutableMetadata metadata = ImmutableMetadata.builder().addString("config", config).build(); - System.out.println(metadata.getString("config")); + if (noTreatment(treatment)) { return constructProviderEvaluation( defaultValue, treatment, Reason.DEFAULT, ErrorCode.FLAG_NOT_FOUND, metadata); From 8c931dce792ae15606a28d9f708ebccfa432bb53 Mon Sep 17 00:00:00 2001 From: Emmanuel Zamora Date: Fri, 29 Aug 2025 11:24:58 -0300 Subject: [PATCH 2/7] Add precommit file and fix typo --- .ci.settings.xml | 41 +++++++++++++++++++++++++++++++++++++++++ .github/CODEOWNERS | 2 +- .pre-commit-config.yaml | 9 +++++++++ CHANGES.txt | 2 +- 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 .ci.settings.xml create mode 100644 .pre-commit-config.yaml diff --git a/.ci.settings.xml b/.ci.settings.xml new file mode 100644 index 0000000..cca4cef --- /dev/null +++ b/.ci.settings.xml @@ -0,0 +1,41 @@ + + + + + + maven-dev + ${env.ARTIFACTORY_USER} + ${env.ARTIFACTORY_TOKEN} + + + + maven-all-virtual + ${env.ARTIFACTORY_USER} + ${env.ARTIFACTORY_TOKEN} + + + + org.sonarsource.scanner.maven + + + + sonar + + true + + + java-client + https://sonarqube.split-internal.com + ${env.SONAR_TOKEN} + . + pom.xml,src/main/** + . + src/test/** + .csv + **/matchers/**/*.* + https://travis-ci.com/splitio/java-client + https://github.com/splitio/java-client + + + + \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ab53a7c..9e31981 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @splitio/sdk \ No newline at end of file +* @splitio/sdk diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..49239fa --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-added-large-files + - id: check-json + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace diff --git a/CHANGES.txt b/CHANGES.txt index 5433234..05656e5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,6 @@ 1.2.0 (August XX, 2025) - Updated `io.split.client` dependency to 4.16.1 - - Updated `dev.openfeature` dependency to 1.16.0 + - Updated `dev.openfeature` dependency to 1.17.0 1.1.0 - Up tp date with spec v0.5.0 and java sdk v0.3.1 From 94896ebc86ca8401f43c7206ac5246ee85f32d45 Mon Sep 17 00:00:00 2001 From: Emmanuel Zamora Date: Fri, 29 Aug 2025 11:27:05 -0300 Subject: [PATCH 3/7] Remove java 8 from tests --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20656d1..269e20f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,6 @@ jobs: fail-fast: false matrix: jdk: - - '8' - '11' - '19' env: From 79a1fbc7dc3973f345333e7cd9909ddfccd9a338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Fri, 29 Aug 2025 18:04:15 -0300 Subject: [PATCH 4/7] Fix --- .ci.settings.xml | 41 ----- .github/workflows/test.yml | 12 +- .gitignore | 20 +- CHANGES.txt | 1 - LICENSE | 2 +- README.md | 19 +- pom.xml | 368 ++++++++++++++++++------------------- 7 files changed, 212 insertions(+), 251 deletions(-) delete mode 100644 .ci.settings.xml diff --git a/.ci.settings.xml b/.ci.settings.xml deleted file mode 100644 index cca4cef..0000000 --- a/.ci.settings.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - maven-dev - ${env.ARTIFACTORY_USER} - ${env.ARTIFACTORY_TOKEN} - - - - maven-all-virtual - ${env.ARTIFACTORY_USER} - ${env.ARTIFACTORY_TOKEN} - - - - org.sonarsource.scanner.maven - - - - sonar - - true - - - java-client - https://sonarqube.split-internal.com - ${env.SONAR_TOKEN} - . - pom.xml,src/main/** - . - src/test/** - .csv - **/matchers/**/*.* - https://travis-ci.com/splitio/java-client - https://github.com/splitio/java-client - - - - \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 269e20f..03a90df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,11 +20,7 @@ jobs: - '11' - '19' env: - ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} - ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} MAVEN_OPTS: "-XX:InitialHeapSize=2G -XX:MaxHeapSize=2G -XX:+PrintCommandLineFlags -XX:ThreadStackSize=65536 -XX:-TieredCompilation -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" - muteProps: "true" - steps: - name: Checkout code uses: actions/checkout@v5 @@ -32,14 +28,10 @@ jobs: fetch-depth: 0 - name: Setup JDK ${{ matrix.jdk }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: distribution: 'adopt' java-version: ${{ matrix.jdk }} - - name: Setup Maven - run: cp .ci.settings.xml ${HOME}/.m2/settings.xml - - name: Test - if: matrix.jdk == '8' && github.event_name == 'pull_request' && github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' - run: mvn --batch-mode clean install + run: mvn --batch-mode -T 2C -U clean package diff --git a/.gitignore b/.gitignore index ec376bb..df059e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,20 @@ +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://maven.apache.org/wrapper/#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Idea .idea -target \ No newline at end of file diff --git a/CHANGES.txt b/CHANGES.txt index 05656e5..a94da51 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -7,4 +7,3 @@ 1.0.0 - First release. Up to date with java sdk v0.1.0 - diff --git a/LICENSE b/LICENSE index aebce89..051b5fd 100644 --- a/LICENSE +++ b/LICENSE @@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file +limitations under the License. diff --git a/README.md b/README.md index 1114f87..ed1dd96 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,12 @@ Client client = api.getClient("CLIENT_NAME"); EvaluationContext context = new MutableContext("TARGETING_KEY"); Boolean boolValue = client.getBooleanValue("boolFlag", false, context); ``` -If the same targeting key is used repeatedly, the evaluation context may be set at the client level +If the same targeting key is used repeatedly, the evaluation context may be set at the client level ```java EvaluationContext context = new MutableContext("TARGETING_KEY"); client.setEvaluationContext(context) ``` -or at the OpenFeatureAPI level +or at the OpenFeatureAPI level ```java EvaluationContext context = new MutableContext("TARGETING_KEY"); OpenFeatureAPI.getInstance().setEvaluationContext(context) @@ -68,7 +68,7 @@ OpenFeatureAPI.getInstance().setEvaluationContext(context) If the context was set at the client or api level, it is not required to provide it during flag evaluation. ## Submitting issues - + The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/split-openfeature-provider-java/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner. ## Contributing @@ -78,13 +78,13 @@ Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to s Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/). ## About Split - + Split is the leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay trust Split to power their feature delivery. - + To learn more about Split, contact hello@split.io, or get started with feature flags for free at https://www.split.io/signup. - + Split has built and maintains SDKs for: - + * .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK) * Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK) * Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities) @@ -105,8 +105,7 @@ Split has built and maintains SDKs for: * Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK) For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20). - + **Learn more about Split:** - -Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information. +Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information. diff --git a/pom.xml b/pom.xml index 601ffbd..b766653 100644 --- a/pom.xml +++ b/pom.xml @@ -1,190 +1,184 @@ - - - 4.0.0 - - io.split.openfeature - split-openfeature-provider - 1.2.0 - - split-openfeature-provider-java - Split OpenFeature Java Provider - www.split.io - - - scm:git:git@github.com:splitio/split-openfeature-provider-java.git - scm:git@github.com:splitio/split-openfeature-provider-java.git - git@github.com:splitio/split-openfeature-provider-java.git - - - - - Robert Grassian - robert.grassian@split.io - - - Emmanuel Zamora - emmanuel.zamora@harness.io - - - - - - Apache 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - - - - - UTF-8 - 11 - 5.10.2 - 3.2.5 - - - - - org.junit.jupiter - junit-jupiter - ${junit.jupiter.version} - test - - - io.split.client - java-client - 4.16.1 - - - org.apache.httpcomponents - httpclient - 4.5.14 - - - io.split.integrations.azure - impressions-listener - 0.9.1 - - - org.mockito - mockito-core - 3.4.6 - test - - - dev.openfeature - sdk - 1.17.0 - - - - - - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - maven-surefire-plugin - 2.22.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - maven-site-plugin - 3.7.1 - - - maven-project-info-reports-plugin - 3.0.0 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.13.0 - - 11 - 11 - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.11.3 - - - attach-javadocs - - jar - - - -Xdoclint:none - 11 - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 - true - - true - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.1 - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - + 4.0.0 + io.split.openfeature + split-openfeature-provider + 1.2.0 + split-openfeature-provider-java + Split OpenFeature Java Provider + www.split.io + + scm:git:git@github.com:splitio/split-openfeature-provider-java.git + scm:git@github.com:splitio/split-openfeature-provider-java.git + git@github.com:splitio/split-openfeature-provider-java.git + + + + Robert Grassian + robert.grassian@split.io + + + Emmanuel Zamora + emmanuel.zamora@harness.io + + + + + Apache 2.0 + http://www.apache.org/licenses/LICENSE-2.0 + + + + UTF-8 + 11 + 5.10.2 + 3.2.5 + + + + org.junit.jupiter + junit-jupiter + ${junit.jupiter.version} + test + + + io.split.client + java-client + 4.16.1 + + + org.apache.httpcomponents + httpclient + 4.5.14 + + + io.split.integrations.azure + impressions-listener + 0.9.1 + + + org.mockito + mockito-core + 3.4.6 + test + + + dev.openfeature + sdk + 1.17.0 + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 11 + 11 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.11.3 + + + attach-javadocs + + jar + + + -Xdoclint:none + 11 + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + true + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.1 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + From 472b242bd343302ffac07e7df78b2a4a4ae800ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Fri, 29 Aug 2025 18:29:59 -0300 Subject: [PATCH 5/7] Fix maven opts --- .github/workflows/test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03a90df..cf0a2a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,9 +18,10 @@ jobs: matrix: jdk: - '11' - - '19' + - '17' + - '21' env: - MAVEN_OPTS: "-XX:InitialHeapSize=2G -XX:MaxHeapSize=2G -XX:+PrintCommandLineFlags -XX:ThreadStackSize=65536 -XX:-TieredCompilation -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" + MAVEN_OPTS: "-Xms2g -Xmx2g -XX:+PrintCommandLineFlags -XX:ThreadStackSize=1024 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" steps: - name: Checkout code uses: actions/checkout@v5 @@ -32,6 +33,7 @@ jobs: with: distribution: 'adopt' java-version: ${{ matrix.jdk }} + cache: 'maven' - name: Test - run: mvn --batch-mode -T 2C -U clean package + run: mvn --batch-mode -T 2C clean package From 5e60470267512d15b659b597829277d813b811d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Fri, 29 Aug 2025 18:38:54 -0300 Subject: [PATCH 6/7] Fix git checkout --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf0a2a9..2eeb3fc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,8 +25,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v5 - with: - fetch-depth: 0 - name: Setup JDK ${{ matrix.jdk }} uses: actions/setup-java@v5 From e597ecd60d2c24d403c07a34abb83bbae3921d52 Mon Sep 17 00:00:00 2001 From: Emmanuel Zamora Date: Mon, 1 Sep 2025 10:47:36 -0300 Subject: [PATCH 7/7] wait for client readyness in tests --- src/test/java/io/split/openfeature/ClientTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/io/split/openfeature/ClientTest.java b/src/test/java/io/split/openfeature/ClientTest.java index 8856b89..a0ec342 100644 --- a/src/test/java/io/split/openfeature/ClientTest.java +++ b/src/test/java/io/split/openfeature/ClientTest.java @@ -37,7 +37,7 @@ public void init() { try { SplitClientConfig config = SplitClientConfig.builder().splitFile("src/test/resources/split.yaml").build(); SplitClient client = SplitFactoryBuilder.build("localhost", config).client(); - openFeatureAPI.setProvider(new SplitProvider(client)); + openFeatureAPI.setProviderAndWait(new SplitProvider(client)); } catch (URISyntaxException | IOException e) { System.out.println("Unexpected Exception occurred initializing Split Provider."); }