/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ package org.opensearch.securityanalytics; import org.junit.Assert; import org.opensearch.client.Request; import org.opensearch.client.Response; import org.opensearch.common.xcontent.LoggingDeprecationHandler; import org.opensearch.common.xcontent.json.JsonXContent; import org.opensearch.core.xcontent.NamedXContentRegistry; import java.io.IOException; import java.util.List; import java.util.Map; public class SecurityAnalyticsPluginRestApiIT extends SecurityAnalyticsRestTestCase { @SuppressWarnings("unchecked") public void testPluginsAreInstalled() throws IOException { Request request = new Request("GET", "/_cat/plugins?s=component&h=name,component,version,description&format=json"); Response response = client().performRequest(request); List pluginsList = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, response.getEntity().getContent()).list(); Assert.assertTrue(pluginsList.stream().map(o -> (Map) o).anyMatch(plugin -> plugin.get("component") .equals("opensearch-security-analytics"))); } }