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

Commit

Permalink
prepare 4.14.4 release (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaunchDarklyCI authored Sep 28, 2020
1 parent a6777a8 commit cd60e6d
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 19 deletions.
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ workflows:
test:
jobs:
- build-linux
- test-linux-jdk7:
name: Java 7 - Linux - OpenJDK
- test-linux:
name: Java 8 - Linux - OpenJDK
docker-image: circleci/openjdk:8
Expand Down Expand Up @@ -76,6 +78,30 @@ jobs:
- store_artifacts:
path: ~/junit

test-linux-jdk7:
# This build uses LaunchDarkly's ld-jdk7-jdk8 image which has both OpenJDK 7 and
# OpenJDK 8 installed, with 8 being the default that is used to run Gradle.
# See: https://github.com/launchdarkly/sdks-ci-docker
docker:
- image: ldcircleci/ld-jdk7-jdk8
- image: redis
steps:
- checkout
- run: cp gradle.properties.example gradle.properties
- run:
name: Run tests
command: ./gradlew -i -Dorg.gradle.project.overrideJavaHome=$JDK7_HOME test sourcesJar javadocJar
- run:
name: Save test results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
- store_artifacts:
path: ~/junit

build-test-windows:
executor:
name: win/vs2019
Expand Down
35 changes: 33 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ ext.versions = [
"gson": "2.7",
"guava": "19.0",
"jodaTime": "2.9.3",
"okhttp": "3.14.9", // specify this for the SDK build instead of relying on the transitive dependency from okhttp-eventsource
"okhttpEventsource": "1.11.0",
"okhttp": "3.12.2", // specify this for the SDK build instead of relying on the transitive dependency from okhttp-eventsource
"okhttpEventsource": "1.11.2",
"slf4j": "1.7.21",
"snakeyaml": "1.26",
"jedis": "2.9.0"
Expand Down Expand Up @@ -445,3 +445,34 @@ gitPublish {
}
commitMessage = 'publishing javadocs'
}

// Overriding JAVA_HOME/executable paths allows us to build/test under Java 7 even though
// Gradle itself has to run in Java 8+.

tasks.withType(AbstractCompile) {
options.with {
if (overrideJavaHome != "") {
System.out.println("Building with JAVA_HOME=" + overrideJavaHome)
fork = true
forkOptions.javaHome = file(overrideJavaHome)
}
}
}

tasks.withType(Javadoc) {
if (overrideJavaHome != "") {
executable = new File(overrideJavaHome, "bin/javadoc")
}
}

tasks.withType(Test) {
if (overrideJavaHome != "") {
executable = new File(overrideJavaHome, "bin/java")
}
}

tasks.withType(JavaExec) {
if (overrideJavaHome != "") {
executable = new File(overrideJavaHome, "bin/java")
}
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ version=4.14.3
ossrhUsername=
ossrhPassword=

# See build.gradle
overrideJavaHome=

# See https://github.com/gradle/gradle/issues/11308 regarding the following property
systemProp.org.gradle.internal.publish.checksums.insecure=true
3 changes: 3 additions & 0 deletions gradle.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ signing.password = SIGNING_PASSWORD
signing.secretKeyRingFile = SECRET_RING_FILE
ossrhUsername = launchdarkly
ossrhPassword = OSSHR_PASSWORD

# See build.gradle
overrideJavaHome=
10 changes: 0 additions & 10 deletions src/main/java/com/launchdarkly/client/LDClientInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public interface LDClientInterface extends Closeable {

/**
* Tracks that a user performed an event, and provides an additional numeric value for custom metrics.
* <p>
* As of this version’s release date, the LaunchDarkly service does not support the {@code metricValue}
* parameter. As a result, calling this overload of {@code track} will not yet produce any different
* behavior from calling {@link #track(String, LDUser, JsonElement)} without a {@code metricValue}.
* Refer to the <a href="https://docs.launchdarkly.com/docs/java-sdk-reference#section-track">SDK reference guide</a> for the latest status.
*
* @param eventName the name of the event
* @param user the user that performed the event
Expand All @@ -70,11 +65,6 @@ public interface LDClientInterface extends Closeable {

/**
* Tracks that a user performed an event, and provides an additional numeric value for custom metrics.
* <p>
* As of this version’s release date, the LaunchDarkly service does not support the {@code metricValue}
* parameter. As a result, calling this overload of {@code track} will not yet produce any different
* behavior from calling {@link #trackData(String, LDUser, LDValue)} without a {@code metricValue}.
* Refer to the <a href="https://docs.launchdarkly.com/docs/java-sdk-reference#section-track">SDK reference guide</a> for the latest status.
*
* @param eventName the name of the event
* @param user the user that performed the event
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/launchdarkly/client/value/LDValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Ordering;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
Expand Down Expand Up @@ -468,7 +469,9 @@ public int hashCode() {
return ah;
case OBJECT:
int oh = 0;
for (String name: keys()) {
// We sort the keys here to guarantee ordering equivalence with LDValueJsonElement
// wrapping JsonObjects.
for (String name: Ordering.natural().immutableSortedCopy(keys())) {
oh = (oh * 31 + name.hashCode()) * 31 + get(name).hashCode();
}
return oh;
Expand Down
12 changes: 10 additions & 2 deletions src/test/java/com/launchdarkly/client/LDUserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.google.gson.reflect.TypeToken;
import com.launchdarkly.client.value.LDValue;

Expand All @@ -29,6 +30,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

@SuppressWarnings("javadoc")
public class LDUserTest {
Expand Down Expand Up @@ -344,8 +346,14 @@ private Map<LDUser, String> getUserPropertiesJsonMap() {
@Test
public void defaultJsonEncodingHasPrivateAttributeNames() {
LDUser user = new LDUser.Builder("userkey").privateName("x").privateEmail("y").build();
String expected = "{\"key\":\"userkey\",\"name\":\"x\",\"email\":\"y\",\"privateAttributeNames\":[\"name\",\"email\"]}";
assertEquals(defaultGson.fromJson(expected, JsonElement.class), defaultGson.toJsonTree(user));
JsonObject serialized = defaultGson.toJsonTree(user).getAsJsonObject();
assertEquals(serialized.get("key").getAsJsonPrimitive().getAsString(), "userkey");
assertEquals(serialized.get("name").getAsJsonPrimitive().getAsString(), "x");
assertEquals(serialized.get("email").getAsJsonPrimitive().getAsString(), "y");
JsonArray privateAttrs = serialized.get("privateAttributeNames").getAsJsonArray();
assertEquals(privateAttrs.size(), 2);
assertTrue(privateAttrs.contains(new JsonPrimitive("name")));
assertTrue(privateAttrs.contains(new JsonPrimitive("email")));
}

@Test
Expand Down
8 changes: 6 additions & 2 deletions src/test/java/com/launchdarkly/client/TestHttpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.tls.HandshakeCertificates;
import okhttp3.tls.HeldCertificate;
import okhttp3.tls.internal.TlsUtil;

class TestHttpUtil {
static MockWebServer makeStartedServer(MockResponse... responses) throws IOException {
Expand Down Expand Up @@ -72,9 +71,14 @@ public ServerWithCert() throws IOException, GeneralSecurityException {
.certificateAuthority(1)
.commonName(hostname)
.addSubjectAlternativeName(hostname)
.rsa2048()
.build();

HandshakeCertificates hc = TlsUtil.localhost();
HandshakeCertificates hc = new HandshakeCertificates.Builder()
.addPlatformTrustedCertificates()
.heldCertificate(cert)
.addTrustedCertificate(cert.certificate())
.build();
socketFactory = hc.sslSocketFactory();
trustManager = hc.trustManager();

Expand Down
5 changes: 3 additions & 2 deletions src/test/java/com/launchdarkly/client/value/LDValueTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -277,7 +278,7 @@ public void objectKeysCanBeEnumerated() {
for (String key: LDValue.buildObject().put("1", LDValue.of("x")).put("2", LDValue.of("y")).build().keys()) {
keys.add(key);
}
keys.sort(null);
Collections.sort(keys);
assertEquals(ImmutableList.of("1", "2"), keys);
}

Expand All @@ -287,7 +288,7 @@ public void objectValuesCanBeEnumerated() {
for (LDValue value: LDValue.buildObject().put("1", LDValue.of("x")).put("2", LDValue.of("y")).build().values()) {
values.add(value.stringValue());
}
values.sort(null);
Collections.sort(values);
assertEquals(ImmutableList.of("x", "y"), values);
}

Expand Down

0 comments on commit cd60e6d

Please sign in to comment.