diff --git a/.github/workflows/cflite_batch.yml b/.github/workflows/cflite_batch.yml index c4bceed0..790f7497 100644 --- a/.github/workflows/cflite_batch.yml +++ b/.github/workflows/cflite_batch.yml @@ -24,13 +24,13 @@ jobs: steps: - name: Build Fuzzers (${{ matrix.sanitizer }}) id: build - uses: google/clusterfuzzlite/actions/build_fuzzers@1e163f06cba7820da5154ac9fe1a32d7fe6f73a3 # v1 + uses: google/clusterfuzzlite/actions/build_fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1 with: language: jvm sanitizer: ${{ matrix.sanitizer }} - name: Run Fuzzers (${{ matrix.sanitizer }}) id: run - uses: google/clusterfuzzlite/actions/run_fuzzers@1e163f06cba7820da5154ac9fe1a32d7fe6f73a3 # v1 + uses: google/clusterfuzzlite/actions/run_fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} fuzz-seconds: 3600 diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 04b20128..d82baeb3 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 - name: Set up JDK 8 - uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 + uses: actions/setup-java@b943a4ed876ec91f6d0cde2181d88d24e8e348de with: java-version: '8' distribution: 'temurin' @@ -32,7 +32,7 @@ jobs: server-password: ${{ secrets.OSSRH_PASSWORD }} - name: Cache local Maven repository - uses: actions/cache@67b839edb68371cc5014f6cea11c9aa77238de78 + uses: actions/cache@f7ebb81a3f195b4fb88dab7c14e2f7aff52045aa with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -49,7 +49,7 @@ jobs: run: mvn --batch-mode --update-snapshots verify - name: Upload coverage to Codecov - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d + uses: codecov/codecov-action@e1dd05cde2ed37d100f658b34ea423728ba1812e with: token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos flags: unittests # optional diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 3c3ae95f..51d62680 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -8,6 +8,7 @@ permissions: jobs: build: runs-on: ubuntu-latest + # TODO: this can be removed with https://github.com/open-feature/java-sdk/issues/523 services: flagd: image: ghcr.io/open-feature/flagd-testbed:latest @@ -19,19 +20,19 @@ jobs: uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 - name: Set up JDK 8 - uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 + uses: actions/setup-java@b943a4ed876ec91f6d0cde2181d88d24e8e348de with: java-version: '8' distribution: 'temurin' cache: maven - name: Initialize CodeQL - uses: github/codeql-action/init@7b6664fa89524ee6e3c3e9749402d5afd69b3cd8 + uses: github/codeql-action/init@9e4932e2919d7a061a0cb982d1f9d841120ea6df with: languages: java - name: Cache local Maven repository - uses: actions/cache@67b839edb68371cc5014f6cea11c9aa77238de78 + uses: actions/cache@f7ebb81a3f195b4fb88dab7c14e2f7aff52045aa with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -39,10 +40,10 @@ jobs: ${{ runner.os }}-maven- - name: Verify with Maven - run: mvn --batch-mode --update-snapshots verify -P e2e-test + run: mvn --batch-mode --update-snapshots --activate-profiles e2e-test verify - name: Upload coverage to Codecov - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d + uses: codecov/codecov-action@e1dd05cde2ed37d100f658b34ea423728ba1812e with: token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos flags: unittests # optional @@ -51,4 +52,4 @@ jobs: verbose: true # optional (default = false) - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@7b6664fa89524ee6e3c3e9749402d5afd69b3cd8 + uses: github/codeql-action/analyze@9e4932e2919d7a061a0cb982d1f9d841120ea6df diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c9bef90..a8b9d79d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 - name: Set up JDK 8 if: ${{ steps.release.outputs.releases_created }} - uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 + uses: actions/setup-java@b943a4ed876ec91f6d0cde2181d88d24e8e348de with: java-version: '8' distribution: 'temurin' diff --git a/.github/workflows/static-code-scanning.yaml b/.github/workflows/static-code-scanning.yaml index 114343a6..a6f3761f 100644 --- a/.github/workflows/static-code-scanning.yaml +++ b/.github/workflows/static-code-scanning.yaml @@ -33,12 +33,12 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@7b6664fa89524ee6e3c3e9749402d5afd69b3cd8 + uses: github/codeql-action/init@9e4932e2919d7a061a0cb982d1f9d841120ea6df with: languages: java - name: Autobuild - uses: github/codeql-action/autobuild@7b6664fa89524ee6e3c3e9749402d5afd69b3cd8 + uses: github/codeql-action/autobuild@9e4932e2919d7a061a0cb982d1f9d841120ea6df - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@7b6664fa89524ee6e3c3e9749402d5afd69b3cd8 + uses: github/codeql-action/analyze@9e4932e2919d7a061a0cb982d1f9d841120ea6df diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c9735194..9b090798 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{".":"1.4.1"} \ No newline at end of file +{".":"1.4.2"} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 64cba4e5..c5d0238b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## [1.4.2](https://github.com/open-feature/java-sdk/compare/v1.4.1...v1.4.2) (2023-08-10) + + +### ๐Ÿ› Bug Fixes + +* getState now mandatory on EventProvider ([#531](https://github.com/open-feature/java-sdk/issues/531)) ([37fd2be](https://github.com/open-feature/java-sdk/commit/37fd2be673e1316ae05e5f36b49613cb61209fbc)) + + +### ๐Ÿงน Chore + +* add todos, fix submodule pull ([#543](https://github.com/open-feature/java-sdk/issues/543)) ([4972291](https://github.com/open-feature/java-sdk/commit/497229127668bd433ae0bd9e9bed3e75a4ef0d7d)) +* **deps:** update actions/cache digest to f7ebb81 ([#549](https://github.com/open-feature/java-sdk/issues/549)) ([a73083d](https://github.com/open-feature/java-sdk/commit/a73083def4cc49a328d122b36323341e1f64d1cc)) +* **deps:** update actions/setup-java digest to b943a4e ([#536](https://github.com/open-feature/java-sdk/issues/536)) ([90c931a](https://github.com/open-feature/java-sdk/commit/90c931acd9aab1f2b7c0cd85d851d82219852cb7)) +* **deps:** update actions/setup-java digest to c16064d ([#533](https://github.com/open-feature/java-sdk/issues/533)) ([fc034c3](https://github.com/open-feature/java-sdk/commit/fc034c328483735e7dbd973d2897af6f2ce8ef4a)) +* **deps:** update codecov/codecov-action digest to e1dd05c ([#540](https://github.com/open-feature/java-sdk/issues/540)) ([7d4981f](https://github.com/open-feature/java-sdk/commit/7d4981f429bc0107082fb84eec068c575d2645f6)) +* **deps:** update dependency com.google.guava:guava to v32.1.2-jre ([#538](https://github.com/open-feature/java-sdk/issues/538)) ([0676f4d](https://github.com/open-feature/java-sdk/commit/0676f4d24bcbde4ebcd0b284db00853778b1c892)) +* **deps:** update github/codeql-action digest to 055b396 ([#530](https://github.com/open-feature/java-sdk/issues/530)) ([5c4bc86](https://github.com/open-feature/java-sdk/commit/5c4bc86139f04a124b2d279def2348023188feac)) +* **deps:** update github/codeql-action digest to 1a48007 ([#529](https://github.com/open-feature/java-sdk/issues/529)) ([b8194ec](https://github.com/open-feature/java-sdk/commit/b8194ec13e09cfe71f01cb23de7e6a7f5b8ca262)) +* **deps:** update github/codeql-action digest to 1f63aba ([#544](https://github.com/open-feature/java-sdk/issues/544)) ([9f03c0e](https://github.com/open-feature/java-sdk/commit/9f03c0ea32513e3559c18f346b4e7b56d9659501)) +* **deps:** update github/codeql-action digest to 2192e34 ([#542](https://github.com/open-feature/java-sdk/issues/542)) ([c545ed5](https://github.com/open-feature/java-sdk/commit/c545ed568071348ab1826383059d2d6c925c846f)) +* **deps:** update github/codeql-action digest to 4e9f8a2 ([#548](https://github.com/open-feature/java-sdk/issues/548)) ([5985005](https://github.com/open-feature/java-sdk/commit/5985005ddad9d8cbd24a09c720f5ae9973508897)) +* **deps:** update github/codeql-action digest to 57a11be ([#526](https://github.com/open-feature/java-sdk/issues/526)) ([6590d84](https://github.com/open-feature/java-sdk/commit/6590d84f6e14ba82d137ad56d730fc3243ff0e4b)) +* **deps:** update github/codeql-action digest to 6276217 ([#532](https://github.com/open-feature/java-sdk/issues/532)) ([6ccefbb](https://github.com/open-feature/java-sdk/commit/6ccefbb8bc622b257e4701006ccfcc67f81bcea3)) +* **deps:** update github/codeql-action digest to 7b79062 ([#541](https://github.com/open-feature/java-sdk/issues/541)) ([0ecf7b5](https://github.com/open-feature/java-sdk/commit/0ecf7b598462b5bc068a228ce678a758f9461fe3)) +* **deps:** update github/codeql-action digest to 81ae676 ([#534](https://github.com/open-feature/java-sdk/issues/534)) ([323083d](https://github.com/open-feature/java-sdk/commit/323083d7e9789761ce18ac8c500346a8f632d235)) +* **deps:** update github/codeql-action digest to 878ae4a ([#547](https://github.com/open-feature/java-sdk/issues/547)) ([0336c02](https://github.com/open-feature/java-sdk/commit/0336c02eeba1df03182ebedca3ac2d19cb4ef77b)) +* **deps:** update github/codeql-action digest to 9e4932e ([#550](https://github.com/open-feature/java-sdk/issues/550)) ([6ce68de](https://github.com/open-feature/java-sdk/commit/6ce68de437e40bc0098480fb1f1900c5c3850a1e)) +* **deps:** update github/codeql-action digest to a6b0ced ([#537](https://github.com/open-feature/java-sdk/issues/537)) ([f012604](https://github.com/open-feature/java-sdk/commit/f0126043f20541af40d73b8a9b755a774358d4e8)) +* **deps:** update github/codeql-action digest to c57b27e ([#528](https://github.com/open-feature/java-sdk/issues/528)) ([3a8e262](https://github.com/open-feature/java-sdk/commit/3a8e262da4ecc08a377e69634b01d821abdd4fdc)) +* **deps:** update github/codeql-action digest to e7e35ba ([#539](https://github.com/open-feature/java-sdk/issues/539)) ([18b4fc0](https://github.com/open-feature/java-sdk/commit/18b4fc095851efb5351c1283f52a3d8f4407c5d2)) +* **deps:** update google/clusterfuzzlite digest to 884713a ([#551](https://github.com/open-feature/java-sdk/issues/551)) ([4d04996](https://github.com/open-feature/java-sdk/commit/4d049965716cef005f96146eaa909e50fc2fe73e)) +* fix race with events tests ([#545](https://github.com/open-feature/java-sdk/issues/545)) ([8789f90](https://github.com/open-feature/java-sdk/commit/8789f90d337bddd9c330a7291565d0f2dfc2761c)) + ## [1.4.1](https://github.com/open-feature/java-sdk/compare/v1.4.0...v1.4.1) (2023-07-24) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7ffa9a7..63c9d533 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,6 +18,8 @@ If you're adding tests to cover something in the spec, use the `@Specification` ## End-to-End Tests + + The continuous integration runs a set of [gherkin e2e tests](https://github.com/open-feature/test-harness/blob/main/features/evaluation.feature) using [`flagd`](https://github.com/open-feature/flagd). These tests do not run with the default maven profile. If you'd like to run them locally, you can start the flagd testbed with ``` diff --git a/README.md b/README.md index bc6dcd8c..3a48562a 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Note that this library is intended to be used in server-side contexts and has no dev.openfeature sdk - 1.4.1 + 1.4.2 ``` @@ -67,7 +67,7 @@ If you would like snapshot builds, this is the relevant repository information: ```groovy dependencies { - implementation 'dev.openfeature:sdk:1.4.1' + implementation 'dev.openfeature:sdk:1.4.2' } ``` diff --git a/pom.xml b/pom.xml index e8761b9d..79d142df 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ dev.openfeature sdk - 1.4.1 + 1.4.2 UTF-8 @@ -135,7 +135,7 @@ com.google.guava guava - 32.1.1-jre + 32.1.2-jre test @@ -497,6 +497,8 @@ + + e2e-test @@ -523,7 +525,7 @@ submodule update --init - --recursive + test-harness diff --git a/src/main/java/dev/openfeature/sdk/EventProvider.java b/src/main/java/dev/openfeature/sdk/EventProvider.java index de12b077..928b96f4 100644 --- a/src/main/java/dev/openfeature/sdk/EventProvider.java +++ b/src/main/java/dev/openfeature/sdk/EventProvider.java @@ -16,6 +16,12 @@ */ public abstract class EventProvider implements FeatureProvider { + /** + * {@inheritDoc} + */ + @Override + public abstract ProviderState getState(); + private TriConsumer onEmit = null; /** diff --git a/src/main/java/dev/openfeature/sdk/EventSupport.java b/src/main/java/dev/openfeature/sdk/EventSupport.java index 6558f969..3a55f298 100644 --- a/src/main/java/dev/openfeature/sdk/EventSupport.java +++ b/src/main/java/dev/openfeature/sdk/EventSupport.java @@ -23,7 +23,7 @@ class EventSupport { // we use a v4 uuid as a "placeholder" for anonymous clients, since // ConcurrentHashMap doesn't support nulls private static final String defaultClientUuid = UUID.randomUUID().toString(); - private static final ExecutorService taskExecutor = Executors.newCachedThreadPool(); + private final ExecutorService taskExecutor = Executors.newCachedThreadPool(); private final Map handlerStores = new ConcurrentHashMap<>(); private final HandlerStore globalHandlerStore = new HandlerStore(); diff --git a/src/main/java/dev/openfeature/sdk/FeatureProvider.java b/src/main/java/dev/openfeature/sdk/FeatureProvider.java index 933166fa..e1e06d0a 100644 --- a/src/main/java/dev/openfeature/sdk/FeatureProvider.java +++ b/src/main/java/dev/openfeature/sdk/FeatureProvider.java @@ -31,7 +31,7 @@ default List getProviderHooks() { * if they have special initialization needed prior being called for flag * evaluation. *

- * It is ok, if the method is expensive as it is executed in the background. All + * It is ok if the method is expensive as it is executed in the background. All * runtime exceptions will be * caught and logged. *

@@ -46,7 +46,7 @@ default void initialize(EvaluationContext evaluationContext) throws Exception { * Providers can overwrite this method, if they have special shutdown actions * needed. *

- * It is ok, if the method is expensive as it is executed in the background. All + * It is ok if the method is expensive as it is executed in the background. All * runtime exceptions will be * caught and logged. *

@@ -57,7 +57,11 @@ default void shutdown() { /** * Returns a representation of the current readiness of the provider. - * Providers which do not implement this method are assumed to be ready immediately. + * If the provider needs to be initialized, it should return {@link ProviderState#NOT_READY}. + * If the provider is in an error state, it should return {@link ProviderState#ERROR}. + * If the provider is functioning normally, it should return {@link ProviderState#READY}. + * + *

Providers which do not implement this method are assumed to be ready immediately.

* * @return ProviderState */ diff --git a/src/test/java/dev/openfeature/sdk/EventProviderTest.java b/src/test/java/dev/openfeature/sdk/EventProviderTest.java index cb73b529..3744682b 100644 --- a/src/test/java/dev/openfeature/sdk/EventProviderTest.java +++ b/src/test/java/dev/openfeature/sdk/EventProviderTest.java @@ -121,6 +121,11 @@ public ProviderEvaluation getObjectEvaluation(String key, Value defaultVa // TODO Auto-generated method stub throw new UnsupportedOperationException("Unimplemented method 'getObjectEvaluation'"); } + + @Override + public ProviderState getState() { + return ProviderState.READY; + } } @SuppressWarnings("unchecked") diff --git a/version.txt b/version.txt index 347f5833..9df886c4 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.4.1 +1.4.2