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

Commit

Permalink
Update Changelog. Add test for allFlags() in offline mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Richelson committed Dec 21, 2016
1 parent f3e4e19 commit a4a1a7a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@


All notable changes to the LaunchDarkly Java SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
## [2.0.7] - 2016-12-21
### Changed
- allFlags() method on client no longer returns null when client is in offline mode.

## [2.0.6] - 2016-11-21
### Changed
- RedisFeatureStore: Update Jedis dependency. Improved thread/memory management.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Quick setup
<dependency>
<groupId>com.launchdarkly</groupId>
<artifactId>launchdarkly-client</artifactId>
<version>2.0.6</version>
<version>2.0.7</version>
</dependency>

1. Import the LaunchDarkly package:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repositories {

allprojects {
group = 'com.launchdarkly'
version = "2.0.6"
version = "2.0.7-SNAPSHOT"
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
Expand Down
23 changes: 20 additions & 3 deletions src/test/java/com/launchdarkly/client/LDClientTest.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package com.launchdarkly.client;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import org.easymock.EasyMockSupport;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.expect;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;

public class LDClientTest extends EasyMockSupport {
private FeatureRequestor requestor;
Expand Down Expand Up @@ -71,6 +71,23 @@ public void testTestFeatureStoreSetFeatureTrue() throws IOException, Interrupted
verifyAll();
}

@Test
public void testTestOfflineModeAllFlags() throws IOException, InterruptedException, ExecutionException, TimeoutException {
TestFeatureStore testFeatureStore = new TestFeatureStore();
LDConfig config = new LDConfig.Builder()
.startWaitMillis(10L)
.offline(true)
.featureStore(testFeatureStore)
.build();

client = new LDClient("", config);//createMockClient(config);
testFeatureStore.setFeatureTrue("key");
Map<String, JsonElement> allFlags = client.allFlags(new LDUser("user"));
assertNotNull("Expected non-nil response from allFlags() when offline mode is set to true", allFlags);
assertEquals("Didn't get expected flag count from allFlags() in offline mode", 1, allFlags.size());
assertTrue("Test flag should be true, but was not.", allFlags.get("key").getAsBoolean());
}

@Test
public void testTestFeatureStoreSetFalse() throws IOException, InterruptedException, ExecutionException, TimeoutException {
TestFeatureStore testFeatureStore = new TestFeatureStore();
Expand Down

0 comments on commit a4a1a7a

Please sign in to comment.