Skip to content

Commit

Permalink
Remove strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
gastonfournier committed Nov 17, 2023
1 parent 43cb73e commit 91e74c5
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 314 deletions.
66 changes: 0 additions & 66 deletions src/main/java/io/getunleash/strategy/FlexibleRolloutStrategy.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

54 changes: 0 additions & 54 deletions src/main/java/io/getunleash/strategy/RemoteAddressStrategy.java

This file was deleted.

18 changes: 0 additions & 18 deletions src/main/java/io/getunleash/strategy/UnknownStrategy.java

This file was deleted.

36 changes: 0 additions & 36 deletions src/main/java/io/getunleash/strategy/UserWithIdStrategy.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,14 @@ protected int checkRandomLoginIDs(int numberOfIDs, int percentage) {
UnleashContext context =
UnleashContext.builder().sessionId(sessionId.toString()).build();

GradualRolloutSessionIdStrategy gradualRolloutStrategy =
new GradualRolloutSessionIdStrategy();

Map<String, String> params = buildParams(percentage, "");
boolean enabled = gradualRolloutStrategy.isEnabled(params, context);
stateHandler.setState(new FeatureToggle(
"test",
true,
ImmutableList.of(new ActivationStrategy("gradualRolloutSessionId", params))
));
boolean enabled = engine.isEnabled("test", context);
if (enabled) {
numberOfEnabledUsers++;
}
Expand All @@ -195,8 +198,8 @@ protected int checkRandomLoginIDs(int numberOfIDs, int percentage) {

private Map<String, String> buildParams(int percentage, String groupId) {
Map<String, String> params = new HashMap();
params.put(GradualRolloutSessionIdStrategy.PERCENTAGE, String.valueOf(percentage));
params.put(GradualRolloutSessionIdStrategy.GROUP_ID, groupId);
params.put("percentage", String.valueOf(percentage));
params.put("groupId", groupId);

return params;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,14 @@ protected int checkRandomLoginIDs(int numberOfIDs, int percentage) {
Long userId = getRandomLoginId();
UnleashContext context = UnleashContext.builder().userId(userId.toString()).build();

GradualRolloutUserIdStrategy gradualRolloutStrategy =
new GradualRolloutUserIdStrategy();

Map<String, String> params = buildParams(percentage, "");
boolean enabled = gradualRolloutStrategy.isEnabled(params, context);
stateHandler.setState(new FeatureToggle(
"test",
true,
ImmutableList.of(new ActivationStrategy("gradualRolloutUserId", params))
));
boolean enabled = engine.isEnabled("test", context);
if (enabled) {
numberOfEnabledUsers++;
}
Expand All @@ -218,8 +221,8 @@ protected int checkRandomLoginIDs(int numberOfIDs, int percentage) {

private Map<String, String> buildParams(int percentage, String groupId) {
Map<String, String> params = new HashMap();
params.put(GradualRolloutUserIdStrategy.PERCENTAGE, String.valueOf(percentage));
params.put(GradualRolloutUserIdStrategy.GROUP_ID, groupId);
params.put("percentage", String.valueOf(percentage));
params.put("groupId", groupId);

return params;
}
Expand Down

0 comments on commit 91e74c5

Please sign in to comment.