Skip to content

Commit

Permalink
Resolve ReadFrom.SLAVE_PREFERRED via ReadFrom.valueOf(…) #671
Browse files Browse the repository at this point in the history
  • Loading branch information
be-hase authored and mp911de committed Dec 18, 2017
1 parent 089b3c4 commit 0c96fcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/io/lettuce/core/ReadFrom.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public static ReadFrom valueOf(String name) {
return SLAVE;
}

if (name.equalsIgnoreCase("slavePreferred")) {
return SLAVE_PREFERRED;
}

if (name.equalsIgnoreCase("nearest")) {
return NEAREST;
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/io/lettuce/core/cluster/ReadFromTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ public void valueOfSlave() throws Exception {
assertThat(ReadFrom.valueOf("slave")).isEqualTo(ReadFrom.SLAVE);
}

@Test
public void valueOfSlavePreferred() throws Exception {
assertThat(ReadFrom.valueOf("slavePreferred")).isEqualTo(ReadFrom.SLAVE_PREFERRED);
}

private ReadFrom.Nodes getNodes() {
return new ReadFrom.Nodes() {
@Override
Expand Down

0 comments on commit 0c96fcd

Please sign in to comment.