[Rename] refactor modules/kibana. (#334)

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>
This commit is contained in:
Rabi Panda 2021-03-18 13:15:29 -07:00 committed by Nick Knize
parent d99bbfe2f2
commit 3954c658dc
5 changed files with 96 additions and 96 deletions

View File

@ -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
}

View File

@ -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 {

View File

@ -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;
@ -35,19 +35,19 @@ import java.util.Map;
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" }
@ -55,45 +55,45 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
}
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());
@ -101,15 +101,15 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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());
@ -117,8 +117,8 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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
@ -132,7 +132,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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
@ -150,8 +150,8 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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
@ -165,7 +165,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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));
@ -176,8 +176,8 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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
@ -191,13 +191,13 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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
@ -211,62 +211,62 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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
@ -282,7 +282,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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);
@ -291,7 +291,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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);
@ -300,7 +300,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
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));

View File

@ -7,7 +7,7 @@
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.kibana;
package org.opensearch.dashboards;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.node.DiscoveryNodes;
@ -28,7 +28,7 @@ import org.opensearch.common.settings.Setting.Property;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.settings.SettingsFilter;
import org.opensearch.index.reindex.RestDeleteByQueryAction;
import org.elasticsearch.indices.SystemIndexDescriptor;
import org.opensearch.indices.SystemIndexDescriptor;
import org.opensearch.plugins.Plugin;
import org.opensearch.plugins.SystemIndexPlugin;
import org.opensearch.rest.BaseRestHandler;
@ -62,11 +62,11 @@ import java.util.stream.Collectors;
import static java.util.Collections.unmodifiableList;
public class KibanaPlugin extends Plugin implements SystemIndexPlugin {
public class OpenSearchDashboardsPlugin extends Plugin implements SystemIndexPlugin {
public static final Setting<List<String>> KIBANA_INDEX_NAMES_SETTING = Setting.listSetting(
"kibana.system_indices",
unmodifiableList(Arrays.asList(".kibana", ".kibana_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link")),
public static final Setting<List<String>> OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING = Setting.listSetting(
"opensearch_dashboards.system_indices",
unmodifiableList(Arrays.asList(".opensearch_dashboards", ".opensearch_dashboards_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link")),
Function.identity(),
Property.NodeScope
);
@ -74,9 +74,9 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin {
@Override
public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings settings) {
return unmodifiableList(
KIBANA_INDEX_NAMES_SETTING.get(settings)
OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING.get(settings)
.stream()
.map(pattern -> new SystemIndexDescriptor(pattern, "System index used by kibana"))
.map(pattern -> new SystemIndexDescriptor(pattern, "System index used by OpenSearch Dashboards"))
.collect(Collectors.toList())
);
}
@ -91,35 +91,35 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin {
IndexNameExpressionResolver indexNameExpressionResolver,
Supplier<DiscoveryNodes> nodesInCluster
) {
// TODO need to figure out what subset of system indices Kibana should have access to via these APIs
// TODO need to figure out what subset of system indices OpenSearch Dashboards should have access to via these APIs
return unmodifiableList(
Arrays.asList(
// Based on https://github.com/elastic/kibana/issues/49764
// apis needed to perform migrations... ideally these will go away
new KibanaWrappedRestHandler(new RestCreateIndexAction()),
new KibanaWrappedRestHandler(new RestGetAliasesAction()),
new KibanaWrappedRestHandler(new RestIndexPutAliasAction()),
new KibanaWrappedRestHandler(new RestRefreshAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestCreateIndexAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestGetAliasesAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestIndexPutAliasAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestRefreshAction()),
// apis needed to access saved objects
new KibanaWrappedRestHandler(new RestGetAction()),
new KibanaWrappedRestHandler(new RestMultiGetAction(settings)),
new KibanaWrappedRestHandler(new RestSearchAction()),
new KibanaWrappedRestHandler(new RestBulkAction(settings)),
new KibanaWrappedRestHandler(new RestDeleteAction()),
new KibanaWrappedRestHandler(new RestDeleteByQueryAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestGetAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestMultiGetAction(settings)),
new OpenSearchDashboardsWrappedRestHandler(new RestSearchAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestBulkAction(settings)),
new OpenSearchDashboardsWrappedRestHandler(new RestDeleteAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestDeleteByQueryAction()),
// api used for testing
new KibanaWrappedRestHandler(new RestUpdateSettingsAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestUpdateSettingsAction()),
// apis used specifically by reporting
new KibanaWrappedRestHandler(new RestGetIndicesAction()),
new KibanaWrappedRestHandler(new RestIndexAction()),
new KibanaWrappedRestHandler(new CreateHandler()),
new KibanaWrappedRestHandler(new AutoIdHandler(nodesInCluster)),
new KibanaWrappedRestHandler(new RestUpdateAction()),
new KibanaWrappedRestHandler(new RestSearchScrollAction()),
new KibanaWrappedRestHandler(new RestClearScrollAction())
new OpenSearchDashboardsWrappedRestHandler(new RestGetIndicesAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestIndexAction()),
new OpenSearchDashboardsWrappedRestHandler(new CreateHandler()),
new OpenSearchDashboardsWrappedRestHandler(new AutoIdHandler(nodesInCluster)),
new OpenSearchDashboardsWrappedRestHandler(new RestUpdateAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestSearchScrollAction()),
new OpenSearchDashboardsWrappedRestHandler(new RestClearScrollAction())
)
);
@ -127,18 +127,18 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin {
@Override
public List<Setting<?>> getSettings() {
return Collections.singletonList(KIBANA_INDEX_NAMES_SETTING);
return Collections.singletonList(OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING);
}
static class KibanaWrappedRestHandler extends BaseRestHandler.Wrapper {
static class OpenSearchDashboardsWrappedRestHandler extends BaseRestHandler.Wrapper {
KibanaWrappedRestHandler(BaseRestHandler delegate) {
OpenSearchDashboardsWrappedRestHandler(BaseRestHandler delegate) {
super(delegate);
}
@Override
public String getName() {
return "kibana_" + super.getName();
return "opensearch_dashboards_" + super.getName();
}
@Override
@ -150,7 +150,7 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin {
public List<Route> routes() {
return unmodifiableList(
super.routes().stream()
.map(route -> new Route(route.getMethod(), "/_kibana" + route.getPath()))
.map(route -> new Route(route.getMethod(), "/_opensearch_dashboards" + route.getPath()))
.collect(Collectors.toList())
);
}

View File

@ -17,10 +17,10 @@
* under the License.
*/
package org.elasticsearch.kibana;
package org.opensearch.dashboards;
import org.opensearch.common.settings.Settings;
import org.elasticsearch.indices.SystemIndexDescriptor;
import org.opensearch.indices.SystemIndexDescriptor;
import org.opensearch.test.OpenSearchTestCase;
import java.util.Arrays;
@ -31,27 +31,27 @@ import java.util.stream.Collectors;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is;
public class KibanaPluginTests extends OpenSearchTestCase {
public class OpenSearchDashboardsPluginTests extends OpenSearchTestCase {
public void testKibanaIndexNames() {
assertThat(new KibanaPlugin().getSettings(), contains(KibanaPlugin.KIBANA_INDEX_NAMES_SETTING));
public void testOpenSearchDashboardsIndexNames() {
assertThat(new OpenSearchDashboardsPlugin().getSettings(), contains(OpenSearchDashboardsPlugin.OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING));
assertThat(
new KibanaPlugin().getSystemIndexDescriptors(Settings.EMPTY)
new OpenSearchDashboardsPlugin().getSystemIndexDescriptors(Settings.EMPTY)
.stream()
.map(SystemIndexDescriptor::getIndexPattern)
.collect(Collectors.toList()),
contains(".kibana", ".kibana_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link")
contains(".opensearch_dashboards", ".opensearch_dashboards_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link")
);
final List<String> names = Collections.unmodifiableList(Arrays.asList("." + randomAlphaOfLength(4), "." + randomAlphaOfLength(5)));
final List<String> namesFromDescriptors = new KibanaPlugin().getSystemIndexDescriptors(
Settings.builder().putList(KibanaPlugin.KIBANA_INDEX_NAMES_SETTING.getKey(), names).build()
final List<String> namesFromDescriptors = new OpenSearchDashboardsPlugin().getSystemIndexDescriptors(
Settings.builder().putList(OpenSearchDashboardsPlugin.OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING.getKey(), names).build()
).stream().map(SystemIndexDescriptor::getIndexPattern).collect(Collectors.toList());
assertThat(namesFromDescriptors, is(names));
assertThat(
new KibanaPlugin().getSystemIndexDescriptors(Settings.EMPTY)
new OpenSearchDashboardsPlugin().getSystemIndexDescriptors(Settings.EMPTY)
.stream()
.anyMatch(systemIndexDescriptor -> systemIndexDescriptor.matchesIndexPattern(".kibana-event-log-7-1")),
.anyMatch(systemIndexDescriptor -> systemIndexDescriptor.matchesIndexPattern(".opensearch_dashboards-event-log-7-1")),
is(false)
);
}