Skip to content

Commit

Permalink
fix recovery test
Browse files Browse the repository at this point in the history
  • Loading branch information
ofir76 committed Apr 11, 2018
1 parent 8b40bd5 commit 7bcbe23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
16 changes: 2 additions & 14 deletions jest-common/src/main/java/io/searchbox/core/Cat.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ public Cat build() {
}

@Override
public String operationPath() {
return operationPath;
}
public String operationPath() { return operationPath; }
}

public static class RecoveryBuilder extends AbstractMultiIndexActionBuilder<Cat, RecoveryBuilder> implements CatBuilder {
Expand All @@ -117,23 +115,13 @@ public RecoveryBuilder() {
}

@Override
public Cat build() {
return new Cat(this);
}
public Cat build() { return new Cat(this); }

@Override
public String operationPath() {
return operationPath;
}

@Override
public String getJoinedIndices() {
if (indexNames.size() > 0) {
return Joiner.on(',').join(indexNames);
} else {
return null;
}
}
}

public static class ShardsBuilder extends AbstractMultiIndexActionBuilder<Cat, ShardsBuilder> implements CatBuilder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.searchbox.core;

import io.searchbox.client.config.ElasticsearchVersion;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
Expand All @@ -18,18 +19,18 @@ public void shouldSetApplicationJsonHeader() {
@Test
public void shouldGenerateValidUriWhenIndexNotGiven() {
Cat cat = new Cat.RecoveryBuilder().build();
assertEquals("_cat/recovery/_all", cat.getURI());
assertEquals("_cat/recovery/_all", cat.getURI(ElasticsearchVersion.UNKNOWN));
}

@Test
public void shouldGenerateValidUriWhenIndexGiven() {
Cat cat = new Cat.RecoveryBuilder().addIndex("testIndex").build();
assertEquals("_cat/recovery/testIndex", cat.getURI());
assertEquals("_cat/recovery/testIndex", cat.getURI(ElasticsearchVersion.UNKNOWN));
}

@Test
public void shouldGenerateValidUriWhenParameterGiven() {
Cat cat = new Cat.RecoveryBuilder().setParameter("v", "true").build();
assertEquals("_cat/recovery/_all?v=true", cat.getURI());
assertEquals("_cat/recovery/_all?v=true", cat.getURI(ElasticsearchVersion.UNKNOWN));
}
}

0 comments on commit 7bcbe23

Please sign in to comment.