8000 chore: update cli example to most recent gradle · Unleash/unleash-client-java@27f6735 · GitHub
[go: up one dir, main page]

Skip to content

Commit 27f6735

Browse files
committed
chore: update cli example to most recent gradle
1 parent 1a4fd77 commit 27f6735

File tree

3 files changed

+15
-33
lines changed

3 files changed

+15
-33
lines changed

examples/cli-example/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ repositories {
1313
}
1414

1515
dependencies {
16-
implementation("io.getunleash:unleash-client-java:7.1.0")
17-
implementation("ch.qos.logback:logback-classic:1.4.6")
16+
implementation("io.getunleash:unleash-client-java:10.0.2")
17+
implementation("ch.qos.logback:logback-classic:1.4.12")
1818
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

examples/cli-example/src/main/java/io/getunleash/example/AdvancedConstraints.java

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import io.getunleash.DefaultUnleash;
44
import io.getunleash.Unleash;
55
import io.getunleash.UnleashContext;
6-
import io.getunleash.event.UnleashSubscriber;
7-
import io.getunleash.repository.FeatureToggleResponse;
86
import io.getunleash.util.UnleashConfig;
97

108
public class AdvancedConstraints {
@@ -15,38 +13,22 @@ public static void main(String[] args) throws InterruptedException {
1513
.customHttpHeader(
1614
"Authorization",
1715
getOrElse("UNLEASH_API_TOKEN",
18-
"default:default.a45fede67f99b17f67312c93e00f448340e7af4ace2b0de2650f5a99"))
19-
.unleashAPI(getOrElse("UNLEASH_API_URL", "http://localhost:3063/api"))
16+
"*:development.25a06b75248528f8ca93ce179dcdd141aedfb632231e0d21fd8ff349"))
17+
.unleashAPI(getOrElse("UNLEASH_API_URL", "https://app.unleash-hosted.com/demo/api"))
2018
.instanceId("java-example")
2119
.synchronousFetchOnInitialisation(true)
22-
.sendMetricsInterval(30)
23-
.subscriber(
24-
new UnleashSubscriber() {
25-
@Override
26-
public void togglesFetched(
27-
FeatureToggleResponse toggleResponse) {
28-
System.out.println(toggleResponse);
29-
System.out.println(
30-
toggleResponse
31-
.getToggleCollection()
32-
.getFeatures()
33-
.size());
34-
}
35-
})
36-
.build();
20+
.sendMetricsInterval(30).build();
21+
3722
Unleash unleash = new DefaultUnleash(config);
23+
UnleashContext context = UnleashContext.builder()
24+
.addProperty("semver", "1.5.2")
25+
.build();
26+
UnleashContext smallerSemver = UnleashContext.builder()
27+
.addProperty("semver", "1.1.0")
28+
.build();
3829
while (true) {
39-
Thread.sleep(2000);
40-
UnleashContext context = UnleashContext.builder()
41-
.addProperty("semver", "1.5.2")
42-
.build();
43-
System.out.println(
44-
unleash.isEnabled("advanced.constraints", context)); // expect this to be true
45-
UnleashContext smallerSemver = UnleashContext.builder()
46-
.addProperty("semver", "1.1.0")
47-
.build();
48-
System.out.println(
49-
unleash.isEnabled("advanced.constraints", smallerSemver)); // expect this to be false
30+
unleash.isEnabled("advanced.constraints", context); // expect this to be true
31+
unleash.isEnabled("advanced.constraints", smallerSemver); // expect this to be false
5032
}
5133
}
5234

0 commit comments

Comments
 (0)
0