Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 7069f5d

Browse files
LaunchDarklyReleaseBoteli-darklyLaunchDarklyReleaseBotaengelberg
authored
prepare 6.0.0 release (#285)
* javadoc fixes * fix test code * fix test code some more * move component APIs to new subsystems package * javadoc fixes * fix benchmarks * use streaming JSON parsing for incoming LD data * fix tests * rm unused * rm unused * use okhttp-eventsource 2.6.0 * update eventsource to 2.6.1 to fix pom/manifest problem * increase efficiency of summary event data structures (#335) * make reusable EvaluationDetail instances as part of flag preprocessing (#336) * make evaluator result object immutable and reuse instances * comment * avoid creating List iterators during evaluations * remove unnecessary copy * update data model for U2C schema changes, without using contexts yet * more model updates + tests * update benchmark code * more model updates * use LDContext in Evaluator; add per-kind targets logic * rm redundant test * skip inapplicable contract tests * implement new context kind logic for clauses * implement new context kind logic for rollouts * skip inapplicable contract tests * add context kind logic for regular segments and big segments * allow segments to reference other segments * guard against prerequisite cycles * implement event context redaction logic * misc fixes * implement the rest of U2C event logic * misc fixes * fix benchmarks * add contextKinds to summary + misc fixes * events schema 4 * update client API to use contexts; enable v2 contract tests * misc fixes * javadoc & test app fixes * javadoc fix * javadoc fix * unskip some tests since the behavior was fixed in java-sdk-common * bad attribute in clause should be reported as an error * update TestData to be context-aware * misc fixes + javadoc * fix allFlagsState to not generate prereq eval events * factor context deduplication logic out of DefaultEventProcessor * fix JSON serialization test * refactor diagnostic events logic to abstract out server-side-specific info * separate inner events implementation from public interface, don't expose event types * fix benchmarks * fix benchmarks * rm unused * rm unused * separate Java-SDK-specific HTTP functionality from events logic * fix tests * don't close the underlying Writer when we stop using the JsonWriter * rm unused * remove references to Java 8 types and Guava from shared event/HTTP code * fix benchmarks * also try not to use java.time.Duration in the event tests * also avoid using lambdas in event test code * move shared code into internal packages before splitting it off * add "...ForAll" TestData methods to replace "...ForAllUsers" * replace all component factory interfaces with a single generic one * change HttpConfiguration and LoggingConfiguration to concrete classes * bump okhttp & okhttp-eventsource dependencies * update comment to clarify that level() doesn't apply to SLF4J * update readme to mention different logging examples in hello-java * switch to use snapshot build of java-logging, pending next release * level setting does not apply to SLF4J and JUL * use java-logging 1.1.0 release * make sure META-INF files are never mistaken for classes and relocated * update shared data store test logic to pass ClientContext with logger * enable external javadoc links for com.launchdarkly.logging types * use variable for dependency version * remove another Guava usage * make events test code independent of server-side data model * fix flaky big segment status polling tests * fix benchmark code * update benchmarks * javadoc formatting * javadocs * undo accidental reversion * remove some more stray references to java-server-sdk test helper code * more efficient equals() and hashCode() for Operator * method can be static * clarify comment * typo * remove event logic, migrate to using java-sdk-internal * adjust for API change * use constant * fix packaging tests * remove inapplicable benchmarks * add error message if makefile can't run * force result to be "not in experiment" if bucketing calculation failed due to context kind not found * use newer HTTP/TCP test helpers * Update Windows orb, fix Windows JDK install in CI (#372) * update snakeyaml for CVE-CVE-2022-25857 * latest snakeyaml is 1.31 * bump snakeyaml version for CVE-2022-38752 * disable Windows Java 11 build * minor test updates for java-sdk-internal API changes * fix packaging of com.launchdarkly.logging classes * rm debugging * reconsidered - let's include the logging classes in the jars * fix packaging test logic * correct documentation * remove secondary meta-attribute * rm obsolete references to UserAttribute * support passing LDUser instead of LDContext in all SDK methods (#379) * support passing LDUser instead of LDContext in all SDK methods * actually we should use default methods * rm unused * enable test capability for user type * update java-sdk-common dependency * use okhttp-eventsource 3.0.0-SNAPSHOT * use non-snapshot okhttp-eventsource * include nested segment references in dependency update checks * use java-sdk-internal 1.0.0 * remove SLF4J dependency, remove "all" jar, simplify build (#381) * don't generate evaluation events for invalid context Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Alex Engelberg <[email protected]>
1 parent 1267e77 commit 7069f5d

File tree

195 files changed

+6696
-10327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+6696
-10327
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ test:
1010

1111
TEMP_TEST_OUTPUT=/tmp/sdk-test-service.log
1212

13+
# Add any extra sdk-test-harness parameters here, such as -skip for tests that are
14+
# temporarily not working.
15+
TEST_HARNESS_PARAMS=
16+
1317
build-contract-tests:
1418
@cd contract-tests && ../gradlew installDist
1519

@@ -21,8 +25,8 @@ start-contract-test-service-bg:
2125
@make start-contract-test-service >$(TEMP_TEST_OUTPUT) 2>&1 &
2226

2327
run-contract-tests:
24-
@curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/v1.0.0/downloader/run.sh \
25-
| VERSION=v1 PARAMS="-url http://localhost:8000 -debug -stop-service-at-end $(TEST_HARNESS_PARAMS)" sh
28+
@curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/v2/downloader/run.sh \
29+
| VERSION=v2 PARAMS="-url http://localhost:8000 -debug -stop-service-at-end $(TEST_HARNESS_PARAMS)" sh
2630

2731
contract-tests: build-contract-tests start-contract-test-service-bg run-contract-tests
2832

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,24 @@ This version of the LaunchDarkly SDK works with Java 8 and above.
1515

1616
## Distributions
1717

18-
Three variants of the SDK jar are published to Maven:
18+
Two variants of the SDK jar are published to Maven:
1919

20-
* The default uberjar - this is accessible as `com.launchdarkly:launchdarkly-java-server-sdk:jar` and is the dependency used in the "[Getting started](https://docs.launchdarkly.com/sdk/server-side/java#getting-started)" section of the SDK reference guide as well as in the [`hello-java`](https://github.com/launchdarkly/hello-java) sample app. This variant contains the SDK classes, and all of the SDK's dependencies except for SLF4J (the SLF4J API is assumed to be brought in automatically as Maven dependencies, or otherwise made available in the classpath of the host application). All third-party bundled dependencies have shaded package names (and are not exported in OSGi), so they will not interfere with any other versions of the same packages.
21-
* The extended uberjar - add `<classifier>all</classifier>` in Maven, or `:all` in Gradle. This is the same as the default uberjar except that SLF4J is also bundled, without shading (and is exported in OSGi).
22-
* The "thin" jar - add `<classifier>thin</classifier>` in Maven, or `:thin` in Gradle. This contains _only_ the SDK classes. Applications using this jar must provide all of the dependencies that are in the SDK's `build.gradle`, so it is intended for use only in special cases.
20+
* The default uberjar - this is accessible as `com.launchdarkly:launchdarkly-java-server-sdk:jar` and is the dependency used in the "[Getting started](https://docs.launchdarkly.com/sdk/server-side/java#getting-started)" section of the SDK reference guide as well as in the [`hello-java`](https://github.com/launchdarkly/hello-java) sample app. This variant contains the SDK classes and all of its required dependencies. All bundled dependencies that are not surfaced in the public API have shaded package names (and are not exported in OSGi), so they will not interfere with any other versions of the same packages.
21+
* The "thin" jar - add `<classifier>thin</classifier>` in Maven, or `:thin` in Gradle. This contains only the SDK classes, without its dependencies. Applications using this jar must provide all of the dependencies that are in the SDK's `build.gradle`, so it is intended for use only in special cases.
22+
23+
Previous SDK versions also included a third classifier, `all`, which was the same as the default uberjar but also contained the SLF4J API. This no longer exists because the SDK no longer requires the SLF4J API to be in the classpath.
2324

2425
## Getting started
2526

2627
Refer to the [SDK reference guide](https://docs.launchdarkly.com/sdk/server-side/java#getting-started) for instructions on getting started with using the SDK.
2728

2829
## Logging
2930

30-
By default, the LaunchDarkly SDK uses [SLF4J](https://www.slf4j.org/). SLF4J has its own configuration mechanisms for determining where output will go, and filtering by level and/or logger name.
31+
By default, the LaunchDarkly SDK uses [SLF4J](https://www.slf4j.org/) _if_ the SLF4J API is present in the classpath. SLF4J has its own configuration mechanisms for determining where output will go, and filtering by level and/or logger name.
32+
33+
If SLF4J is not in the classpath, the SDK's default logging destination is `System.err`.
3134

32-
The SDK can also be configured to use other adapters from the [com.launchdarkly.logging](https://github.com/launchdarkly/java-logging) facade instead of SLF4J. See `LoggingConfigurationBuilder`. This allows the logging behavior to be completely determined by the application, rather than by external SLF4J configuration.
35+
The SDK can also be configured to use other adapters from the [com.launchdarkly.logging](https://github.com/launchdarkly/java-logging) facade. See `LoggingConfigurationBuilder`. This allows the logging behavior to be completely determined by the application, rather than by external SLF4J configuration.
3336

3437
For an example of using the default SLF4J behavior with a simple console logging configuration, check out the [`slf4j-logging` branch](https://github.com/launchdarkly/hello-java/tree/slf4j-logging) of the [`hello-java`](https://github.com/launchdarkly/hello-java) project. The [main branch](https://github.com/launchdarkly/hello-java) of `hello-java` uses console logging that is programmatically configured without SLF4J.
3538

benchmarks/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ BASE_DIR:=$(shell pwd)
44
PROJECT_DIR=$(shell cd .. && pwd)
55
SDK_VERSION=$(shell grep "version=" $(PROJECT_DIR)/gradle.properties | cut -d '=' -f 2)
66

7-
BENCHMARK_ALL_JAR=lib/launchdarkly-java-server-sdk-all.jar
7+
BENCHMARK_SDK_JAR=lib/launchdarkly-java-server-sdk.jar
88
BENCHMARK_TEST_JAR=lib/launchdarkly-java-server-sdk-test.jar
99
SDK_JARS_DIR=$(PROJECT_DIR)/build/libs
10-
SDK_ALL_JAR=$(SDK_JARS_DIR)/launchdarkly-java-server-sdk-$(SDK_VERSION)-all.jar
10+
SDK_JAR=$(SDK_JARS_DIR)/launchdarkly-java-server-sdk-$(SDK_VERSION).jar
1111
SDK_TEST_JAR=$(SDK_JARS_DIR)/launchdarkly-java-server-sdk-$(SDK_VERSION)-test.jar
1212

13-
benchmark: $(BENCHMARK_ALL_JAR) $(BENCHMARK_TEST_JAR)
13+
benchmark: $(BENCHMARK_SDK_JAR) $(BENCHMARK_TEST_JAR)
1414
rm -rf build/tmp
1515
../gradlew jmh
1616
cat build/reports/jmh/human.txt
@@ -21,16 +21,16 @@ clean:
2121

2222
sdk: $(BENCHMARK_ALL_JAR) $(BENCHMARK_TEST_JAR)
2323

24-
$(BENCHMARK_ALL_JAR): $(SDK_ALL_JAR)
24+
$(BENCHMARK_SDK_JAR): $(SDK_JAR)
2525
mkdir -p lib
2626
cp $< $@
2727

2828
$(BENCHMARK_TEST_JAR): $(SDK_TEST_JAR)
2929
mkdir -p lib
3030
cp $< $@
3131

32-
$(SDK_ALL_JAR):
33-
cd .. && ./gradlew shadowJarAll
32+
$(SDK_JAR):
33+
cd .. && ./gradlew shadowJar
3434

3535
$(SDK_TEST_JAR):
3636
cd .. && ./gradlew testJar

benchmarks/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ext.versions = [
2020
]
2121

2222
dependencies {
23-
implementation files("lib/launchdarkly-java-server-sdk-all.jar")
23+
implementation files("lib/launchdarkly-java-server-sdk.jar")
2424
implementation files("lib/launchdarkly-java-server-sdk-test.jar")
2525
implementation "com.google.code.gson:gson:2.8.9"
2626
implementation "com.google.guava:guava:${versions.guava}" // required by SDK test code

benchmarks/src/jmh/java/com/launchdarkly/sdk/server/EventProcessorBenchmarks.java

Lines changed: 0 additions & 148 deletions
This file was deleted.

benchmarks/src/jmh/java/com/launchdarkly/sdk/server/LDClientEvaluationBenchmarks.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.launchdarkly.sdk.server;
22

3-
import com.launchdarkly.sdk.LDUser;
3+
import com.launchdarkly.sdk.LDContext;
44
import com.launchdarkly.sdk.LDValue;
55
import com.launchdarkly.sdk.server.DataModel.FeatureFlag;
6-
import com.launchdarkly.sdk.server.interfaces.DataStore;
76
import com.launchdarkly.sdk.server.interfaces.LDClientInterface;
7+
import com.launchdarkly.sdk.server.subsystems.DataStore;
88

99
import org.openjdk.jmh.annotations.Benchmark;
1010
import org.openjdk.jmh.annotations.Scope;
@@ -13,7 +13,7 @@
1313
import java.util.Random;
1414

1515
import static com.launchdarkly.sdk.server.TestComponents.initedDataStore;
16-
import static com.launchdarkly.sdk.server.TestComponents.specificDataStore;
16+
import static com.launchdarkly.sdk.server.TestComponents.specificComponent;
1717
import static com.launchdarkly.sdk.server.TestUtil.upsertFlag;
1818
import static com.launchdarkly.sdk.server.TestValues.BOOLEAN_FLAG_KEY;
1919
import static com.launchdarkly.sdk.server.TestValues.CLAUSE_MATCH_VALUE_COUNT;
@@ -22,8 +22,8 @@
2222
import static com.launchdarkly.sdk.server.TestValues.FLAG_WITH_TARGET_LIST_KEY;
2323
import static com.launchdarkly.sdk.server.TestValues.INT_FLAG_KEY;
2424
import static com.launchdarkly.sdk.server.TestValues.JSON_FLAG_KEY;
25-
import static com.launchdarkly.sdk.server.TestValues.NOT_MATCHED_VALUE_USER;
26-
import static com.launchdarkly.sdk.server.TestValues.NOT_TARGETED_USER_KEY;
25+
import static com.launchdarkly.sdk.server.TestValues.NOT_MATCHED_VALUE_CONTEXT;
26+
import static com.launchdarkly.sdk.server.TestValues.NOT_TARGETED_CONTEXT_KEY;
2727
import static com.launchdarkly.sdk.server.TestValues.SDK_KEY;
2828
import static com.launchdarkly.sdk.server.TestValues.STRING_FLAG_KEY;
2929
import static com.launchdarkly.sdk.server.TestValues.TARGETED_USER_KEYS;
@@ -41,7 +41,7 @@ public class LDClientEvaluationBenchmarks {
4141
public static class BenchmarkInputs {
4242
// Initialization of the things in BenchmarkInputs does not count as part of a benchmark.
4343
final LDClientInterface client;
44-
final LDUser basicUser;
44+
final LDContext basicUser;
4545
final Random random;
4646

4747
public BenchmarkInputs() {
@@ -51,14 +51,14 @@ public BenchmarkInputs() {
5151
}
5252

5353
LDConfig config = new LDConfig.Builder()
54-
.dataStore(specificDataStore(dataStore))
54+
.dataStore(specificComponent(dataStore))
5555
.events(Components.noEvents())
5656
.dataSource(Components.externalUpdatesOnly())
5757
.logging(Components.noLogging())
5858
.build();
5959
client = new LDClient(SDK_KEY, config);
6060

61-
basicUser = new LDUser("userkey");
61+
basicUser = LDContext.create("userkey");
6262

6363
random = new Random();
6464
}
@@ -127,13 +127,13 @@ public void jsonVariationForUnknownFlag(BenchmarkInputs inputs) throws Exception
127127
@Benchmark
128128
public void userFoundInTargetList(BenchmarkInputs inputs) throws Exception {
129129
String userKey = TARGETED_USER_KEYS.get(inputs.random.nextInt(TARGETED_USER_KEYS.size()));
130-
boolean result = inputs.client.boolVariation(FLAG_WITH_TARGET_LIST_KEY, new LDUser(userKey), false);
130+
boolean result = inputs.client.boolVariation(FLAG_WITH_TARGET_LIST_KEY, LDContext.create(userKey), false);
131131
assertTrue(result);
132132
}
133133

134134
@Benchmark
135135
public void userNotFoundInTargetList(BenchmarkInputs inputs) throws Exception {
136-
boolean result = inputs.client.boolVariation(FLAG_WITH_TARGET_LIST_KEY, new LDUser(NOT_TARGETED_USER_KEY), false);
136+
boolean result = inputs.client.boolVariation(FLAG_WITH_TARGET_LIST_KEY, LDContext.create(NOT_TARGETED_CONTEXT_KEY), false);
137137
assertFalse(result);
138138
}
139139

@@ -146,14 +146,14 @@ public void flagWithPrerequisite(BenchmarkInputs inputs) throws Exception {
146146
@Benchmark
147147
public void userValueFoundInClauseList(BenchmarkInputs inputs) throws Exception {
148148
int i = inputs.random.nextInt(CLAUSE_MATCH_VALUE_COUNT);
149-
LDUser user = TestValues.CLAUSE_MATCH_VALUE_USERS.get(i);
150-
boolean result = inputs.client.boolVariation(FLAG_WITH_MULTI_VALUE_CLAUSE_KEY, user, false);
149+
LDContext context = TestValues.CLAUSE_MATCH_VALUE_CONTEXTS.get(i);
150+
boolean result = inputs.client.boolVariation(FLAG_WITH_MULTI_VALUE_CLAUSE_KEY, context, false);
151151
assertTrue(result);
152152
}
153153

154154
@Benchmark
155155
public void userValueNotFoundInClauseList(BenchmarkInputs inputs) throws Exception {
156-
boolean result = inputs.client.boolVariation(FLAG_WITH_MULTI_VALUE_CLAUSE_KEY, NOT_MATCHED_VALUE_USER, false);
156+
boolean result = inputs.client.boolVariation(FLAG_WITH_MULTI_VALUE_CLAUSE_KEY, NOT_MATCHED_VALUE_CONTEXT, false);
157157
assertFalse(result);
158158
}
159159
}

0 commit comments

Comments
 (0)