diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9e31981 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @splitio/sdk diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2eeb3fc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +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: + - '11' + - '17' + - '21' + env: + 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 + + - name: Setup JDK ${{ matrix.jdk }} + uses: actions/setup-java@v5 + with: + distribution: 'adopt' + java-version: ${{ matrix.jdk }} + cache: 'maven' + + - name: Test + run: mvn --batch-mode -T 2C 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/.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..a94da51 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,10 +1,9 @@ 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 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 + + + + + + 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); 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."); }