]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 8 Dec 2014 16:17:28 +0000 (17:17 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 8 Dec 2014 16:19:19 +0000 (17:19 +0100)
server/sonar-server/src/main/java/org/sonar/server/search/request/ProxySearchScrollRequestBuilder.java
server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStateRequestBuilderTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStateRequestBuilderText.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStatsRequestBuilderTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStatsRequestBuilderText.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyCreateIndexRequestBuilderTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyCreateIndexRequestBuilderText.java [deleted file]

index f8d996a9444f906b2556aff42a45a8aba22f2a89..a54edfb126ad03f273b7e8cc5ffccf2cddea8801 100644 (file)
@@ -39,7 +39,7 @@ public class ProxySearchScrollRequestBuilder extends SearchScrollRequestBuilder
 
   @Override
   public SearchResponse get() {
-    StopWatch fullProfile = profiling.start("search", Profiling.Level.FULL);
+    StopWatch fullProfile = profiling.start("search scroll", Profiling.Level.FULL);
     try {
       return super.execute().actionGet();
     } catch (Exception e) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStateRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStateRequestBuilderTest.java
new file mode 100644 (file)
index 0000000..671eef9
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.search.request;
+
+import org.elasticsearch.action.admin.cluster.state.ClusterStateRequestBuilder;
+import org.elasticsearch.common.unit.TimeValue;
+import org.junit.After;
+import org.junit.Test;
+import org.sonar.api.config.Settings;
+import org.sonar.core.profiling.Profiling;
+import org.sonar.server.search.SearchClient;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.fest.assertions.Fail.fail;
+
+public class ProxyClusterStateRequestBuilderTest {
+
+  Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.FULL.name()));
+  SearchClient searchClient = new SearchClient(new Settings(), profiling);
+
+  @After
+  public void tearDown() throws Exception {
+    searchClient.stop();
+  }
+
+  @Test
+  public void state() {
+    try {
+      ClusterStateRequestBuilder requestBuilder = searchClient.prepareState();
+      requestBuilder.get();
+
+      // expected to fail because elasticsearch is not correctly configured, but that does not matter
+      fail();
+    } catch (IllegalStateException e) {
+      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster state request");
+    }
+  }
+
+  @Test
+  public void to_string() {
+    assertThat(searchClient.prepareState().setIndices("rules").toString()).isEqualTo("ES cluster state request on indices 'rules'");
+    assertThat(searchClient.prepareState().toString()).isEqualTo("ES cluster state request");
+  }
+
+  @Test
+  public void with_profiling_basic() {
+    Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.BASIC.name()));
+    SearchClient searchClient = new SearchClient(new Settings(), profiling);
+    try {
+
+      ClusterStateRequestBuilder requestBuilder = searchClient.prepareState();
+      requestBuilder.get();
+
+      // expected to fail because elasticsearch is not correctly configured, but that does not matter
+      fail();
+    } catch (IllegalStateException e) {
+      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster state request");
+    }
+
+    // TODO assert profiling
+    searchClient.stop();
+  }
+
+  @Test
+  public void get_with_string_timeout_is_not_yet_implemented() throws Exception {
+    try {
+      searchClient.prepareState().get("1");
+      fail();
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
+    }
+  }
+
+  @Test
+  public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception {
+    try {
+      searchClient.prepareState().get(TimeValue.timeValueMinutes(1));
+      fail();
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
+    }
+  }
+
+  @Test
+  public void execute_should_throw_an_unsupported_operation_exception() throws Exception {
+    try {
+      searchClient.prepareState().execute();
+      fail();
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(UnsupportedOperationException.class).hasMessage("execute() should not be called as it's used for asynchronous");
+    }
+  }
+
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStateRequestBuilderText.java b/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStateRequestBuilderText.java
deleted file mode 100644 (file)
index b6b4b70..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package org.sonar.server.search.request;
-
-import org.elasticsearch.action.admin.cluster.state.ClusterStateRequestBuilder;
-import org.elasticsearch.common.unit.TimeValue;
-import org.junit.After;
-import org.junit.Test;
-import org.sonar.api.config.Settings;
-import org.sonar.core.profiling.Profiling;
-import org.sonar.server.search.SearchClient;
-
-import static org.fest.assertions.Assertions.assertThat;
-import static org.fest.assertions.Fail.fail;
-
-public class ProxyClusterStateRequestBuilderText {
-
-  Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.FULL.name()));
-  SearchClient searchClient = new SearchClient(new Settings(), profiling);
-
-  @After
-  public void tearDown() throws Exception {
-    searchClient.stop();
-  }
-
-  @Test
-  public void state() {
-    try {
-      ClusterStateRequestBuilder requestBuilder = searchClient.prepareState();
-      requestBuilder.get();
-
-      // expected to fail because elasticsearch is not correctly configured, but that does not matter
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster state request");
-    }
-  }
-
-  @Test
-  public void to_string() {
-    assertThat(searchClient.prepareState().setIndices("rules").toString()).isEqualTo("ES cluster state request on indices 'rules'");
-    assertThat(searchClient.prepareState().toString()).isEqualTo("ES cluster state request");
-  }
-
-  @Test
-  public void with_profiling_basic() {
-    Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.BASIC.name()));
-    SearchClient searchClient = new SearchClient(new Settings(), profiling);
-    try {
-
-      ClusterStateRequestBuilder requestBuilder = searchClient.prepareState();
-      requestBuilder.get();
-
-      // expected to fail because elasticsearch is not correctly configured, but that does not matter
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster state request");
-    }
-
-    // TODO assert profiling
-    searchClient.stop();
-  }
-
-  @Test
-  public void get_with_string_timeout_is_not_yet_implemented() throws Exception {
-    try {
-      searchClient.prepareState().get("1");
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
-    }
-  }
-
-  @Test
-  public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception {
-    try {
-      searchClient.prepareState().get(TimeValue.timeValueMinutes(1));
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
-    }
-  }
-
-  @Test
-  public void execute_should_throw_an_unsupported_operation_exception() throws Exception {
-    try {
-      searchClient.prepareState().execute();
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(UnsupportedOperationException.class).hasMessage("execute() should not be called as it's used for asynchronous");
-    }
-  }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStatsRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStatsRequestBuilderTest.java
new file mode 100644 (file)
index 0000000..814a8e5
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.search.request;
+
+import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequestBuilder;
+import org.elasticsearch.common.unit.TimeValue;
+import org.junit.After;
+import org.junit.Test;
+import org.sonar.api.config.Settings;
+import org.sonar.core.profiling.Profiling;
+import org.sonar.server.search.SearchClient;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.fest.assertions.Fail.fail;
+
+public class ProxyClusterStatsRequestBuilderTest {
+
+  Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.FULL.name()));
+  SearchClient searchClient = new SearchClient(new Settings(), profiling);
+
+  @After
+  public void tearDown() throws Exception {
+    searchClient.stop();
+  }
+
+  @Test
+  public void stats() {
+    try {
+      ClusterStatsRequestBuilder requestBuilder = searchClient.prepareClusterStats();
+      requestBuilder.get();
+
+      // expected to fail because elasticsearch is not correctly configured, but that does not matter
+      fail();
+    } catch (IllegalStateException e) {
+      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster stats request");
+    }
+  }
+
+  @Test
+  public void to_string() {
+    assertThat(searchClient.prepareClusterStats().setNodesIds("node1").toString()).isEqualTo("ES cluster stats request on nodes 'node1'");
+    assertThat(searchClient.prepareClusterStats().toString()).isEqualTo("ES cluster stats request");
+  }
+
+  @Test
+  public void with_profiling_basic() {
+    Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.BASIC.name()));
+    SearchClient searchClient = new SearchClient(new Settings(), profiling);
+
+    try {
+      ClusterStatsRequestBuilder requestBuilder = searchClient.prepareClusterStats();
+      requestBuilder.get();
+
+      // expected to fail because elasticsearch is not correctly configured, but that does not matter
+      fail();
+    } catch (IllegalStateException e) {
+      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster stats request");
+    }
+
+    // TODO assert profiling
+    searchClient.stop();
+  }
+
+  @Test
+  public void get_with_string_timeout_is_not_yet_implemented() throws Exception {
+    try {
+      searchClient.prepareClusterStats().get("1");
+      fail();
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
+    }
+  }
+
+  @Test
+  public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception {
+    try {
+      searchClient.prepareClusterStats().get(TimeValue.timeValueMinutes(1));
+      fail();
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
+    }
+  }
+
+  @Test
+  public void execute_should_throw_an_unsupported_operation_exception() throws Exception {
+    try {
+      searchClient.prepareClusterStats().execute();
+      fail();
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(UnsupportedOperationException.class).hasMessage("execute() should not be called as it's used for asynchronous");
+    }
+  }
+
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStatsRequestBuilderText.java b/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyClusterStatsRequestBuilderText.java
deleted file mode 100644 (file)
index f130a7f..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package org.sonar.server.search.request;
-
-import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequestBuilder;
-import org.elasticsearch.common.unit.TimeValue;
-import org.junit.After;
-import org.junit.Test;
-import org.sonar.api.config.Settings;
-import org.sonar.core.profiling.Profiling;
-import org.sonar.server.search.SearchClient;
-
-import static org.fest.assertions.Assertions.assertThat;
-import static org.fest.assertions.Fail.fail;
-
-public class ProxyClusterStatsRequestBuilderText {
-
-  Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.FULL.name()));
-  SearchClient searchClient = new SearchClient(new Settings(), profiling);
-
-  @After
-  public void tearDown() throws Exception {
-    searchClient.stop();
-  }
-
-  @Test
-  public void stats() {
-    try {
-      ClusterStatsRequestBuilder requestBuilder = searchClient.prepareClusterStats();
-      requestBuilder.get();
-
-      // expected to fail because elasticsearch is not correctly configured, but that does not matter
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster stats request");
-    }
-  }
-
-  @Test
-  public void to_string() {
-    assertThat(searchClient.prepareClusterStats().setNodesIds("node1").toString()).isEqualTo("ES cluster stats request on nodes 'node1'");
-    assertThat(searchClient.prepareClusterStats().toString()).isEqualTo("ES cluster stats request");
-  }
-
-  @Test
-  public void with_profiling_basic() {
-    Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.BASIC.name()));
-    SearchClient searchClient = new SearchClient(new Settings(), profiling);
-
-    try {
-      ClusterStatsRequestBuilder requestBuilder = searchClient.prepareClusterStats();
-      requestBuilder.get();
-
-      // expected to fail because elasticsearch is not correctly configured, but that does not matter
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster stats request");
-    }
-
-    // TODO assert profiling
-    searchClient.stop();
-  }
-
-  @Test
-  public void get_with_string_timeout_is_not_yet_implemented() throws Exception {
-    try {
-      searchClient.prepareClusterStats().get("1");
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
-    }
-  }
-
-  @Test
-  public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception {
-    try {
-      searchClient.prepareClusterStats().get(TimeValue.timeValueMinutes(1));
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
-    }
-  }
-
-  @Test
-  public void execute_should_throw_an_unsupported_operation_exception() throws Exception {
-    try {
-      searchClient.prepareClusterStats().execute();
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(UnsupportedOperationException.class).hasMessage("execute() should not be called as it's used for asynchronous");
-    }
-  }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyCreateIndexRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyCreateIndexRequestBuilderTest.java
new file mode 100644 (file)
index 0000000..054d0c9
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.search.request;
+
+import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
+import org.elasticsearch.common.unit.TimeValue;
+import org.junit.After;
+import org.junit.Test;
+import org.sonar.api.config.Settings;
+import org.sonar.core.profiling.Profiling;
+import org.sonar.server.search.SearchClient;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.fest.assertions.Fail.fail;
+
+public class ProxyCreateIndexRequestBuilderTest {
+
+  Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.FULL.name()));
+  SearchClient searchClient = new SearchClient(new Settings(), profiling);
+
+  @After
+  public void tearDown() throws Exception {
+    searchClient.stop();
+  }
+
+  @Test
+  public void create_index() {
+    try {
+      CreateIndexRequestBuilder requestBuilder = searchClient.prepareCreate("new");
+      requestBuilder.get();
+
+      // expected to fail because elasticsearch is not correctly configured, but that does not matter
+      fail();
+    } catch (IllegalStateException e) {
+      assertThat(e.getMessage()).isEqualTo("Fail to execute ES create index 'new'");
+    }
+  }
+
+  @Test
+  public void to_string() {
+    assertThat(searchClient.prepareCreate("new").toString()).isEqualTo("ES create index 'new'");
+  }
+
+  @Test
+  public void with_profiling_basic() {
+    Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.BASIC.name()));
+    SearchClient searchClient = new SearchClient(new Settings(), profiling);
+
+    try {
+      CreateIndexRequestBuilder requestBuilder = searchClient.prepareCreate("new");
+      requestBuilder.get();
+
+      // expected to fail because elasticsearch is not correctly configured, but that does not matter
+      fail();
+    } catch (IllegalStateException e) {
+      assertThat(e.getMessage()).isEqualTo("Fail to execute ES create index 'new'");
+    }
+
+    // TODO assert profiling
+    searchClient.stop();
+  }
+
+  @Test
+  public void get_with_string_timeout_is_not_yet_implemented() throws Exception {
+    try {
+      searchClient.prepareCreate("new").get("1");
+      fail();
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
+    }
+  }
+
+  @Test
+  public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception {
+    try {
+      searchClient.prepareCreate("new").get(TimeValue.timeValueMinutes(1));
+      fail();
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
+    }
+  }
+
+  @Test
+  public void execute_should_throw_an_unsupported_operation_exception() throws Exception {
+    try {
+      searchClient.prepareCreate("new").execute();
+      fail();
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(UnsupportedOperationException.class).hasMessage("execute() should not be called as it's used for asynchronous");
+    }
+  }
+
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyCreateIndexRequestBuilderText.java b/server/sonar-server/src/test/java/org/sonar/server/search/request/ProxyCreateIndexRequestBuilderText.java
deleted file mode 100644 (file)
index 14260a0..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package org.sonar.server.search.request;
-
-import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
-import org.elasticsearch.common.unit.TimeValue;
-import org.junit.After;
-import org.junit.Test;
-import org.sonar.api.config.Settings;
-import org.sonar.core.profiling.Profiling;
-import org.sonar.server.search.SearchClient;
-
-import static org.fest.assertions.Assertions.assertThat;
-import static org.fest.assertions.Fail.fail;
-
-public class ProxyCreateIndexRequestBuilderText {
-
-  Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.FULL.name()));
-  SearchClient searchClient = new SearchClient(new Settings(), profiling);
-
-  @After
-  public void tearDown() throws Exception {
-    searchClient.stop();
-  }
-
-  @Test
-  public void create_index() {
-    try {
-      CreateIndexRequestBuilder requestBuilder = searchClient.prepareCreate("new");
-      requestBuilder.get();
-
-      // expected to fail because elasticsearch is not correctly configured, but that does not matter
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e.getMessage()).isEqualTo("Fail to execute ES create index 'new'");
-    }
-  }
-
-  @Test
-  public void to_string() {
-    assertThat(searchClient.prepareCreate("new").toString()).isEqualTo("ES create index 'new'");
-  }
-
-  @Test
-  public void with_profiling_basic() {
-    Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.BASIC.name()));
-    SearchClient searchClient = new SearchClient(new Settings(), profiling);
-
-    try {
-      CreateIndexRequestBuilder requestBuilder = searchClient.prepareCreate("new");
-      requestBuilder.get();
-
-      // expected to fail because elasticsearch is not correctly configured, but that does not matter
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e.getMessage()).isEqualTo("Fail to execute ES create index 'new'");
-    }
-
-    // TODO assert profiling
-    searchClient.stop();
-  }
-
-  @Test
-  public void get_with_string_timeout_is_not_yet_implemented() throws Exception {
-    try {
-      searchClient.prepareCreate("new").get("1");
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
-    }
-  }
-
-  @Test
-  public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception {
-    try {
-      searchClient.prepareCreate("new").get(TimeValue.timeValueMinutes(1));
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Not yet implemented");
-    }
-  }
-
-  @Test
-  public void execute_should_throw_an_unsupported_operation_exception() throws Exception {
-    try {
-      searchClient.prepareCreate("new").execute();
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(UnsupportedOperationException.class).hasMessage("execute() should not be called as it's used for asynchronous");
-    }
-  }
-
-}