Skip to content

Commit

Permalink
[Rename] refactor modules/kibana. (#334)
Browse files Browse the repository at this point in the history
Refactor the the module `modules/kibana` to

- rename package names`org.elasticsearch.kibana` to `org.opensearch.dashboards` in package names and references.
- rename other instances of Kibana to OpenSearchDashboards

Signed-off-by: Rabi Panda <adnapibar@gmail.com>
  • Loading branch information
adnapibar authored and nknize committed Mar 22, 2021
1 parent d99bbfe commit 3954c65
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 96 deletions.
10 changes: 5 additions & 5 deletions modules/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/

configure(subprojects.findAll { it.parent.path == project.path }) {
group = 'org.elasticsearch.plugin' // for modules which publish client jars
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.esplugin'
group = 'org.opensearch.plugin' // for modules which publish client jars
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.opensearchplugin'

esplugin {
// for local ES plugins, the name of the plugin is the same as the directory
opensearchplugin {
// for local OpenSearch plugins, the name of the plugin is the same as the directory
name project.name
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
apply plugin: 'elasticsearch.java-rest-test'
apply plugin: 'opensearch.java-rest-test'

esplugin {
description 'Plugin exposing APIs for Kibana system indices'
classname 'org.elasticsearch.kibana.KibanaPlugin'
description 'Plugin exposing APIs for OpenSearch Dashboards system indices'
classname 'org.opensearch.dashboards.OpenSearchDashboardsPlugin'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.elasticsearch.kibana;
package org.opensearch.dashboards;

import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
Expand All @@ -35,90 +35,90 @@
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;

public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
public class OpenSearchDashboardsSystemIndexIT extends OpenSearchRestTestCase {

private final String indexName;

public KibanaSystemIndexIT(@Name("indexName") String indexName) {
public OpenSearchDashboardsSystemIndexIT(@Name("indexName") String indexName) {
this.indexName = indexName;
}

@ParametersFactory
public static Iterable<Object[]> data() {
return Arrays.asList(
new Object[] { ".kibana" },
new Object[] { ".kibana_1" },
new Object[] { ".opensearch_dashboards" },
new Object[] { ".opensearch_dashboards_1" },
new Object[] { ".reporting-1" },
new Object[] { ".apm-agent-configuration" },
new Object[] { ".apm-custom-link" }
);
}

public void testCreateIndex() throws IOException {
Request request = new Request("PUT", "/_kibana/" + indexName);
Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName);
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));
}

public void testAliases() throws IOException {
assumeFalse("In this test, .kibana is the alias name", ".kibana".equals(indexName));
Request request = new Request("PUT", "/_kibana/" + indexName);
assumeFalse("In this test, .opensearch_dashboards is the alias name", ".opensearch_dashboards".equals(indexName));
Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName);
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

request = new Request("PUT", "/_kibana/" + indexName + "/_alias/.kibana");
request = new Request("PUT", "/_opensearch_dashboards/" + indexName + "/_alias/.opensearch_dashboards");
response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

request = new Request("GET", "/_kibana/_aliases");
request = new Request("GET", "/_opensearch_dashboards/_aliases");
response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));
assertThat(EntityUtils.toString(response.getEntity()), containsString(".kibana"));
assertThat(EntityUtils.toString(response.getEntity()), containsString(".opensearch_dashboards"));
}

public void testBulkToKibanaIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk");
public void testBulkToOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity("{ \"index\" : { \"_index\" : \"" + indexName + "\", \"_id\" : \"1\" } }\n{ \"foo\" : \"bar\" }\n");
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));
}

public void testRefresh() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk");
Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity("{ \"index\" : { \"_index\" : \"" + indexName + "\", \"_id\" : \"1\" } }\n{ \"foo\" : \"bar\" }\n");
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

request = new Request("GET", "/_kibana/" + indexName + "/_refresh");
request = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_refresh");
response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

Request getRequest = new Request("GET", "/_kibana/" + indexName + "/_doc/1");
Request getRequest = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_doc/1");
Response getResponse = client().performRequest(getRequest);
assertThat(getResponse.getStatusLine().getStatusCode(), is(200));
String responseBody = EntityUtils.toString(getResponse.getEntity());
assertThat(responseBody, containsString("foo"));
assertThat(responseBody, containsString("bar"));
}

public void testGetFromKibanaIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk");
public void testGetFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity("{ \"index\" : { \"_index\" : \"" + indexName + "\", \"_id\" : \"1\" } }\n{ \"foo\" : \"bar\" }\n");
request.addParameter("refresh", "true");

Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

Request getRequest = new Request("GET", "/_kibana/" + indexName + "/_doc/1");
Request getRequest = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_doc/1");
Response getResponse = client().performRequest(getRequest);
assertThat(getResponse.getStatusLine().getStatusCode(), is(200));
String responseBody = EntityUtils.toString(getResponse.getEntity());
assertThat(responseBody, containsString("foo"));
assertThat(responseBody, containsString("bar"));
}

public void testMultiGetFromKibanaIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk");
public void testMultiGetFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity(
"{ \"index\" : { \"_index\" : \""
+ indexName
Expand All @@ -132,7 +132,7 @@ public void testMultiGetFromKibanaIndex() throws IOException {
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

Request getRequest = new Request("GET", "/_kibana/_mget");
Request getRequest = new Request("GET", "/_opensearch_dashboards/_mget");
getRequest.setJsonEntity(
"{ \"docs\" : [ { \"_index\" : \""
+ indexName
Expand All @@ -150,8 +150,8 @@ public void testMultiGetFromKibanaIndex() throws IOException {
assertThat(responseBody, containsString("tag"));
}

public void testSearchFromKibanaIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk");
public void testSearchFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity(
"{ \"index\" : { \"_index\" : \""
+ indexName
Expand All @@ -165,7 +165,7 @@ public void testSearchFromKibanaIndex() throws IOException {
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

Request searchRequest = new Request("GET", "/_kibana/" + indexName + "/_search");
Request searchRequest = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_search");
searchRequest.setJsonEntity("{ \"query\" : { \"match_all\" : {} } }\n");
Response getResponse = client().performRequest(searchRequest);
assertThat(getResponse.getStatusLine().getStatusCode(), is(200));
Expand All @@ -176,8 +176,8 @@ public void testSearchFromKibanaIndex() throws IOException {
assertThat(responseBody, containsString("tag"));
}

public void testDeleteFromKibanaIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk");
public void testDeleteFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity(
"{ \"index\" : { \"_index\" : \""
+ indexName
Expand All @@ -191,13 +191,13 @@ public void testDeleteFromKibanaIndex() throws IOException {
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

Request deleteRequest = new Request("DELETE", "/_kibana/" + indexName + "/_doc/1");
Request deleteRequest = new Request("DELETE", "/_opensearch_dashboards/" + indexName + "/_doc/1");
Response deleteResponse = client().performRequest(deleteRequest);
assertThat(deleteResponse.getStatusLine().getStatusCode(), is(200));
}

public void testDeleteByQueryFromKibanaIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk");
public void testDeleteByQueryFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity(
"{ \"index\" : { \"_index\" : \""
+ indexName
Expand All @@ -211,62 +211,62 @@ public void testDeleteByQueryFromKibanaIndex() throws IOException {
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

Request dbqRequest = new Request("POST", "/_kibana/" + indexName + "/_delete_by_query");
Request dbqRequest = new Request("POST", "/_opensearch_dashboards/" + indexName + "/_delete_by_query");
dbqRequest.setJsonEntity("{ \"query\" : { \"match_all\" : {} } }\n");
Response dbqResponse = client().performRequest(dbqRequest);
assertThat(dbqResponse.getStatusLine().getStatusCode(), is(200));
}

public void testUpdateIndexSettings() throws IOException {
Request request = new Request("PUT", "/_kibana/" + indexName);
Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName);
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

request = new Request("PUT", "/_kibana/" + indexName + "/_settings");
request = new Request("PUT", "/_opensearch_dashboards/" + indexName + "/_settings");
request.setJsonEntity("{ \"index.blocks.read_only\" : false }");
response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));
}

public void testGetIndex() throws IOException {
Request request = new Request("PUT", "/_kibana/" + indexName);
Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName);
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

request = new Request("GET", "/_kibana/" + indexName);
request = new Request("GET", "/_opensearch_dashboards/" + indexName);
response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));
assertThat(EntityUtils.toString(response.getEntity()), containsString(indexName));
}

public void testIndexingAndUpdatingDocs() throws IOException {
Request request = new Request("PUT", "/_kibana/" + indexName + "/_doc/1");
Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName + "/_doc/1");
request.setJsonEntity("{ \"foo\" : \"bar\" }");
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(201));

request = new Request("PUT", "/_kibana/" + indexName + "/_create/2");
request = new Request("PUT", "/_opensearch_dashboards/" + indexName + "/_create/2");
request.setJsonEntity("{ \"foo\" : \"bar\" }");
response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(201));

request = new Request("POST", "/_kibana/" + indexName + "/_doc");
request = new Request("POST", "/_opensearch_dashboards/" + indexName + "/_doc");
request.setJsonEntity("{ \"foo\" : \"bar\" }");
response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(201));

request = new Request("GET", "/_kibana/" + indexName + "/_refresh");
request = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_refresh");
response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

request = new Request("POST", "/_kibana/" + indexName + "/_update/1");
request = new Request("POST", "/_opensearch_dashboards/" + indexName + "/_update/1");
request.setJsonEntity("{ \"doc\" : { \"foo\" : \"baz\" } }");
response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));
}

public void testScrollingDocs() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk");
Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity(
"{ \"index\" : { \"_index\" : \""
+ indexName
Expand All @@ -282,7 +282,7 @@ public void testScrollingDocs() throws IOException {
Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200));

Request searchRequest = new Request("GET", "/_kibana/" + indexName + "/_search");
Request searchRequest = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_search");
searchRequest.setJsonEntity("{ \"size\" : 1,\n\"query\" : { \"match_all\" : {} } }\n");
searchRequest.addParameter("scroll", "1m");
response = client().performRequest(searchRequest);
Expand All @@ -291,7 +291,7 @@ public void testScrollingDocs() throws IOException {
assertNotNull(map.get("_scroll_id"));
String scrollId = (String) map.get("_scroll_id");

Request scrollRequest = new Request("POST", "/_kibana/_search/scroll");
Request scrollRequest = new Request("POST", "/_opensearch_dashboards/_search/scroll");
scrollRequest.addParameter("scroll_id", scrollId);
scrollRequest.addParameter("scroll", "1m");
response = client().performRequest(scrollRequest);
Expand All @@ -300,7 +300,7 @@ public void testScrollingDocs() throws IOException {
assertNotNull(map.get("_scroll_id"));
scrollId = (String) map.get("_scroll_id");

Request clearScrollRequest = new Request("DELETE", "/_kibana/_search/scroll");
Request clearScrollRequest = new Request("DELETE", "/_opensearch_dashboards/_search/scroll");
clearScrollRequest.addParameter("scroll_id", scrollId);
response = client().performRequest(clearScrollRequest);
assertThat(response.getStatusLine().getStatusCode(), is(200));
Expand Down
Loading

0 comments on commit 3954c65

Please sign in to comment.