Skip to content

Commit a5e48b4

Browse files
authored
Merge branch 'main' into rlamb/debug-flaky-test
2 parents 0cef811 + 568c177 commit a5e48b4

11 files changed

Lines changed: 244 additions & 52 deletions

File tree

.github/actions/ci/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ runs:
3636
if: steps.build.outcome == 'success' && inputs.run_tests == 'true'
3737
shell: bash
3838
run: ./gradlew test
39+
40+
- name: Build Documentation
41+
shell: bash
42+
run: ./gradlew javadoc

.github/workflows/publish-docs.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Manual Publish Documentation
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
build-and-publish:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
id-token: read # No OIDC needed.
10+
contents: write # For publishing documentation.
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: CI check
15+
uses: ./.github/actions/ci
16+
with:
17+
run_tests: 'false'
18+
java_version: '11'
19+
20+
- uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.1
21+
name: 'Publish to Github pages'
22+
with:
23+
docs_path: build/docs/javadoc
24+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ubuntu-latest
3636
permissions:
3737
id-token: write
38-
contents: read
38+
contents: write # For publishing documentation.
3939
steps:
4040
- uses: actions/checkout@v4
4141

@@ -64,3 +64,15 @@ jobs:
6464
code_signing_keyring: 'code-signing-keyring.gpg'
6565
sonatype_username: ${{ env.SONATYPE_USER_NAME }}
6666
sonatype_password: ${{ env.SONATYPE_PASSWORD }}
67+
68+
- uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.1
69+
name: 'Publish to Github pages'
70+
if: ${{ inputs.dry_run == 'false' }}
71+
with:
72+
docs_path: build/docs/javadoc
73+
github_token: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Dry Run Publish Docs
76+
shell: bash
77+
if: ${{ inputs.dry_run == 'true' }}
78+
run: echo "Dry run. Not publishing docs."

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.2.3"
2+
".": "1.1.2"
33
}

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22

33
All notable changes to the LaunchDarkly OpenFeature provider for the Server-Side SDK for Java will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
44

5+
## [1.1.2](https://github.com/launchdarkly/openfeature-java-server/compare/1.1.1...1.1.2) (2026-03-20)
6+
7+
8+
### Bug Fixes
9+
10+
* Update OpenFeature SDK dependency lower bound from 1.13.0 to 1.16.0 ([0db9fb0](https://github.com/launchdarkly/openfeature-java-server/commit/0db9fb05ef207aa7532d22129a6ba8be12d59d74))
11+
12+
## [1.1.1](https://github.com/launchdarkly/openfeature-java-server/compare/1.1.0...1.1.1) (2025-04-15)
13+
14+
15+
### Bug Fixes
16+
17+
* Reduce openfeature lower bound to 1.13 instead of 1.14 ([#38](https://github.com/launchdarkly/openfeature-java-server/issues/38)) ([1152e46](https://github.com/launchdarkly/openfeature-java-server/commit/1152e46b27aafee837f0cf9443bbac07966ec4b4))
18+
19+
## [1.1.0](https://github.com/launchdarkly/openfeature-java-server/compare/1.0.1...1.1.0) (2025-04-14)
20+
21+
22+
### Features
23+
24+
* add tracking support ([#36](https://github.com/launchdarkly/openfeature-java-server/issues/36)) ([13ad91f](https://github.com/launchdarkly/openfeature-java-server/commit/13ad91ffa2622c21fb6e84a22f152697ba3f0d8f))
25+
* support tracking ([fa69598](https://github.com/launchdarkly/openfeature-java-server/commit/fa695985956f295a47f7a0f9a9a91ac2352bbf93))
26+
27+
## [1.0.1](https://github.com/launchdarkly/openfeature-java-server/compare/1.0.0...1.0.1) (2024-09-16)
28+
29+
30+
### Bug Fixes
31+
32+
* Remove unused dependencies. ([#34](https://github.com/launchdarkly/openfeature-java-server/issues/34)) ([e6cff17](https://github.com/launchdarkly/openfeature-java-server/commit/e6cff17639fb560b1871a7be59ab8d2b7d204b0a))
33+
34+
## [1.0.0](https://github.com/launchdarkly/openfeature-java-server/compare/0.2.3...1.0.0) (2024-06-07)
35+
36+
37+
### ⚠ BREAKING CHANGES
38+
39+
* 1.0.0 release ([#29](https://github.com/launchdarkly/openfeature-java-server/issues/29))
40+
41+
### Features
42+
43+
* 1.0.0 release ([#29](https://github.com/launchdarkly/openfeature-java-server/issues/29)) ([bf51e20](https://github.com/launchdarkly/openfeature-java-server/commit/bf51e201dd48603a40ffcdbc72753751d70b3a5a))
44+
545
## [0.2.3](https://github.com/launchdarkly/openfeature-java-server/compare/0.2.2...0.2.3) (2024-06-06)
646

747

build.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,16 @@ nexusPublishing {
105105
}
106106

107107
dependencies {
108-
// This dependency is exported to consumers, that is to say found on their compile classpath.
109-
api 'org.apache.commons:commons-math3:3.6.1'
110-
111-
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
112-
implementation 'com.google.guava:guava:23.0'
113-
114108
implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '[7.1.0, 8.0.0)'
115109

116-
implementation 'dev.openfeature:sdk:[1.7.0,2.0.0)'
110+
implementation 'dev.openfeature:sdk:[1.16.0,2.0.0)'
117111

118112
// Use JUnit test framework
119113
testImplementation(platform('org.junit:junit-bom:5.10.0'))
120114
testImplementation('org.junit.jupiter:junit-jupiter')
121115
testImplementation "org.mockito:mockito-core:3.+"
116+
117+
testImplementation 'org.awaitility:awaitility:4.2.0'
122118
}
123119

124120
test {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
group = com.launchdarkly
22
#x-release-please-start-version
3-
version=0.2.3
3+
version=1.1.2
44
# x-release-please-version

src/main/java/com/launchdarkly/openfeature/serverprovider/Provider.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,38 @@ public void shutdown() {
222222
}
223223
}
224224

225+
@Override
226+
public void track(String eventName, EvaluationContext ctx, TrackingEventDetails details) {
227+
if (ctx == null) {
228+
logger.info(
229+
"The 'track' method was called with a null EvaluationContext. " +
230+
"No 'track' event will be sent to LaunchDarkly. " +
231+
"The LaunchDarkly SDK requires a non-null EvaluationContext.");
232+
return;
233+
}
234+
235+
if (details != null) {
236+
Double metricValue = null;
237+
if (details.getValue().isPresent()) {
238+
metricValue = (Double) details.getValue().get();
239+
}
240+
// Convert the Structure portion of the TrackingEventDetails into a key value
241+
// map.
242+
// This will not put the metricValue extracted above into the map.
243+
LDValue data = valueConverter.toLdValue(new Value(details));
244+
245+
if (metricValue != null) {
246+
client.trackMetric(eventName, evaluationContextConverter.toLdContext(ctx), data, metricValue);
247+
} else if (!data.isNull() && data.size() > 0) {
248+
client.trackData(eventName, evaluationContextConverter.toLdContext(ctx), data);
249+
} else {
250+
client.track(eventName, evaluationContextConverter.toLdContext(ctx));
251+
}
252+
} else {
253+
client.track(eventName, evaluationContextConverter.toLdContext(ctx));
254+
}
255+
}
256+
225257
/**
226258
* Get the LaunchDarkly client associated with this provider.
227259
* <p>

src/main/java/com/launchdarkly/openfeature/serverprovider/Version.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ abstract class Version {
44
private Version() {}
55

66
// This constant is updated automatically by our Gradle script during a release, if the project version has changed
7-
static final String SDK_VERSION = "0.2.0";
7+
static final String SDK_VERSION = "1.0.1";
88
}

src/test/java/com/launchdarkly/openfeature/serverprovider/LifeCycleTest.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import dev.openfeature.sdk.ProviderEvent;
1313
import dev.openfeature.sdk.ProviderState;
1414
import dev.openfeature.sdk.exceptions.GeneralError;
15+
import org.junit.jupiter.api.AfterEach;
1516
import org.junit.jupiter.api.Test;
1617

1718
import java.io.IOException;
@@ -103,6 +104,11 @@ public DataSource build(ClientContext clientContext) {
103104
* Detailed provider tests use a mock client to test specific result and context conversions.
104105
*/
105106
public class LifeCycleTest {
107+
@AfterEach
108+
public void tearDown() {
109+
OpenFeatureAPI.getInstance().shutdown();
110+
}
111+
106112
@Test
107113
public void canCallThePublicConstructor() {
108114
assertDoesNotThrow(() -> {
@@ -130,10 +136,6 @@ public void canShutdownAnOfflineClient() {
130136
.offline(true).build());
131137
provider.initialize(new ImmutableContext("context-key"));
132138
provider.shutdown();
133-
// Currently this does not check the provider state as the OF spec doesn't yet have a terminal
134-
// shutdown state.
135-
var ldClient = provider.getLdClient();
136-
assertEquals(DataSourceStatusProvider.State.OFF, ldClient.getDataSourceStatusProvider().getStatus().getState());
137139
});
138140
}
139141

@@ -170,8 +172,6 @@ public void itEmitsReadyEvents() throws ExecutionException, InterruptedException
170172
assertEquals(1, readyCount.get());
171173
assertEquals(0, staleCount.get());
172174
assertEquals(0, errorCount.get());
173-
174-
OpenFeatureAPI.getInstance().shutdown();
175175
}
176176

177177
@Test
@@ -192,8 +192,6 @@ public void itCanHandleClientThatIsNotInitializedImmediately() throws Exception
192192

193193
OpenFeatureAPI.getInstance().setProviderAndWait(provider);
194194

195-
OpenFeatureAPI.getInstance().shutdown();
196-
197195
assertEquals(ProviderState.READY, provider.getState());
198196
assertEquals(1, readyCount.get());
199197
}
@@ -226,7 +224,5 @@ public void itCanHandleClientThatIsNotInitializedImmediatelyAndErrors() throws E
226224
assertEquals(ProviderState.ERROR, provider.getState());
227225

228226
assertTrue(gotErrorEvent.get(1000, TimeUnit.MILLISECONDS));
229-
230-
OpenFeatureAPI.getInstance().shutdown();
231227
}
232228
}

0 commit comments

Comments
 (0)