cleanup test

This commit is contained in:
Shay Banon 2011-12-22 23:24:12 +02:00
parent 52e6327467
commit 73b74847aa
2 changed files with 9 additions and 13 deletions

View File

@ -23,13 +23,14 @@ import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType; import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.test.integration.AbstractNodesTests; import org.elasticsearch.test.integration.AbstractNodesTests;
import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.util.Arrays; import java.util.Arrays;
import static org.elasticsearch.client.Requests.*; import static org.elasticsearch.client.Requests.*;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.index.query.FilterBuilders.termFilter; import static org.elasticsearch.index.query.FilterBuilders.termFilter;
import static org.elasticsearch.index.query.QueryBuilders.*; import static org.elasticsearch.index.query.QueryBuilders.*;
@ -46,27 +47,27 @@ public class CustomScoreSearchTests extends AbstractNodesTests {
private Client client; private Client client;
@BeforeMethod @BeforeClass
public void createNodes() throws Exception { public void createNodes() throws Exception {
startNode("server1"); startNode("node1");
client = getClient(); client = getClient();
} }
@AfterMethod @AfterClass
public void closeNodes() { public void closeNodes() {
client.close(); client.close();
closeAllNodes(); closeAllNodes();
} }
protected Client getClient() { protected Client getClient() {
return client("server1"); return client("node1");
} }
@Test @Test
public void testCustomScriptBoost() throws Exception { public void testCustomScriptBoost() throws Exception {
client.admin().indices().prepareDelete().execute().actionGet(); client.admin().indices().prepareDelete().execute().actionGet();
client.admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet();
client.admin().indices().create(createIndexRequest("test")).actionGet();
client.index(indexRequest("test").type("type1").id("1") client.index(indexRequest("test").type("type1").id("1")
.source(jsonBuilder().startObject().field("test", "value beck").field("num1", 1.0f).endObject())).actionGet(); .source(jsonBuilder().startObject().field("test", "value beck").field("num1", 1.0f).endObject())).actionGet();
client.index(indexRequest("test").type("type1").id("2") client.index(indexRequest("test").type("type1").id("2")
@ -152,6 +153,7 @@ public class CustomScoreSearchTests extends AbstractNodesTests {
@Test @Test
public void testCustomFiltersScore() throws Exception { public void testCustomFiltersScore() throws Exception {
client.admin().indices().prepareDelete().execute().actionGet(); client.admin().indices().prepareDelete().execute().actionGet();
client.admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet();
client.prepareIndex("test", "type", "1").setSource("field", "value1", "color", "red").execute().actionGet(); client.prepareIndex("test", "type", "1").setSource("field", "value1", "color", "red").execute().actionGet();
client.prepareIndex("test", "type", "2").setSource("field", "value2", "color", "blue").execute().actionGet(); client.prepareIndex("test", "type", "2").setSource("field", "value2", "color", "blue").execute().actionGet();

View File

@ -1,6 +0,0 @@
cluster:
routing:
schedule: 100ms
index:
number_of_shards: 1
number_of_replicas: 0