Skip to content

Commit 825dfa4

Browse files
author
Max Klyga
committed
Fix feed ranking option constructor throwing on non-empty strings. Fix activity to targets update operation
1 parent 45ea5d2 commit 825dfa4

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Add the following dependency to your pom.xml:
1919
or in your build.gradle:
2020

2121
```gradle
22-
compile 'io.getstream.client:stream-java:3.1.8'
22+
compile 'io.getstream.client:stream-java:3.1.9'
2323
```
2424

2525
In case you want to download the artifact and put it manually into your project,

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010
}
1111

1212
group 'io.getstream.client'
13-
version = '3.1.8'
13+
version = '3.1.9'
1414

1515
dependencies {
1616
sourceCompatibility = 1.8

src/main/java/io/getstream/core/options/Ranking.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public final class Ranking implements RequestOption {
1010

1111
public Ranking(String ranking) {
1212
checkNotNull(ranking, "Ranking can't be empty");
13-
checkArgument(ranking.isEmpty(), "Ranking can't be empty");
13+
checkArgument(!ranking.isEmpty(), "Ranking can't be empty");
1414
this.ranking = ranking;
1515
}
1616

src/main/java/io/getstream/core/utils/Routes.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static URL buildEnrichedFeedURL(URL baseURL, FeedID feed, String path) th
3838
}
3939

4040
public static URL buildToTargetUpdateURL(URL baseURL, FeedID feed) throws MalformedURLException {
41-
return new URL(baseURL, basePath + feedPath(feed) + toTargetUpdatePath);
41+
return new URL(baseURL, basePath + feedTargetsPath(feed) + toTargetUpdatePath);
4242
}
4343

4444
public static URL buildActivitiesURL(URL baseURL) throws MalformedURLException {
@@ -131,6 +131,10 @@ private static String feedPath(FeedID feed) {
131131
return String.format("feed/%s/%s", feed.getSlug(), feed.getUserID());
132132
}
133133

134+
private static String feedTargetsPath(FeedID feed) {
135+
return String.format("feed_targets/%s/%s", feed.getSlug(), feed.getUserID());
136+
}
137+
134138
private static String enrichedFeedPath(FeedID feed) {
135139
return String.format("enrich/feed/%s/%s", feed.getSlug(), feed.getUserID());
136140
}

src/test/java/io/getstream/client/BatchClientTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ public void addToMany() throws Exception {
3131
@Test
3232
public void followMany() throws Exception {
3333
BatchClient client = Client.builder(apiKey, secret).build().batch();
34-
34+
/*
3535
client.followMany(0, new FollowRelation[]{
3636
new FollowRelation("flat:1", "flat:2"),
3737
new FollowRelation("aggregated:1", "flat:1")
3838
}).join();
39+
*/
40+
List<FollowRelation> follows = new ArrayList<>();
41+
follows.add(new FollowRelation("flat:1", "flat:2"));
42+
client.followMany(follows.toArray(new FollowRelation[0])).join();
3943
}
4044

4145
@Test

src/test/java/io/getstream/client/FeedTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,18 @@ public void updateActivityToTargets() throws Exception {
140140
.httpClient(new OKHTTPClientAdapter(new OkHttpClient()))
141141
.build();
142142

143-
FlatFeed feed = client.flatFeed("flat", "1");
143+
FlatFeed feed = client.flatFeed("flat", "bob");
144144
Activity activity = Activity.builder()
145-
.actor("test")
145+
.actor("shmest")
146146
.verb("test")
147147
.object("test")
148-
.foreignID("foreignID")
148+
.foreignID("foreignID-1-2-3-4")
149149
.time(new Date())
150-
.to(Lists.newArrayList(new FeedID("feed:2")))
150+
.to(Lists.newArrayList(new FeedID("flat:alice")))
151151
.build();
152-
feed.updateActivityToTargets(activity, new FeedID[]{new FeedID("feed:3")}, new FeedID[]{new FeedID("feed:2")});
152+
Activity result = feed.addActivity(activity).join();
153+
feed.updateActivityToTargets(result, new FeedID[]{new FeedID("flat", "claire")}, new FeedID[]{});
154+
List<Activity> after = feed.getActivities().join();
153155
}
154156

155157
@Test

0 commit comments

Comments
 (0)