diff --git a/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/NonDefaultResourceAccessControlPluginIT.java b/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/NonDefaultResourceAccessControlPluginIT.java new file mode 100644 index 0000000000000..a69935e753d4f --- /dev/null +++ b/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/NonDefaultResourceAccessControlPluginIT.java @@ -0,0 +1,32 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.accesscontrol.resources; + +import org.opensearch.accesscontrol.resources.testplugins.TestRACPlugin; +import org.opensearch.accesscontrol.resources.testplugins.TestResourcePlugin; +import org.opensearch.plugins.Plugin; +import org.opensearch.plugins.ResourceAccessControlPlugin; +import org.opensearch.test.OpenSearchIntegTestCase; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; + +import java.util.Collection; +import java.util.List; + +public class NonDefaultResourceAccessControlPluginIT extends OpenSearchIntegTestCase { + @Override + protected Collection> nodePlugins() { + return List.of(TestResourcePlugin.class, TestRACPlugin.class); + } + + public void testSampleResourcePluginCallsTestRACPluginToManageResourceAccess() { + ResourceAccessControlPlugin racPlugin = TestResourcePlugin.GuiceHolder.getResourceService().getResourceAccessControlPlugin(); + MatcherAssert.assertThat(racPlugin.getClass(), Matchers.is(TestRACPlugin.class)); + } +} diff --git a/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/fallback/DefaultResourceAccessControlPluginIT.java b/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/fallback/DefaultResourceAccessControlPluginIT.java index 25957a4c1add7..9f2b4a5589323 100644 --- a/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/fallback/DefaultResourceAccessControlPluginIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/fallback/DefaultResourceAccessControlPluginIT.java @@ -12,6 +12,7 @@ import org.opensearch.accesscontrol.resources.ResourceSharing; import org.opensearch.accesscontrol.resources.ShareWith; import org.opensearch.accesscontrol.resources.SharedWithScope; +import org.opensearch.accesscontrol.resources.testplugins.TestResourcePlugin; import org.opensearch.client.Client; import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.plugins.Plugin; @@ -26,7 +27,7 @@ import java.util.Map; import java.util.Set; -import static org.opensearch.accesscontrol.resources.fallback.TestResourcePlugin.SAMPLE_TEST_INDEX; +import static org.opensearch.accesscontrol.resources.testplugins.TestResourcePlugin.SAMPLE_TEST_INDEX; import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasProperty; diff --git a/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/testplugins/TestRACPlugin.java b/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/testplugins/TestRACPlugin.java new file mode 100644 index 0000000000000..e9cde63cc6aa5 --- /dev/null +++ b/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/testplugins/TestRACPlugin.java @@ -0,0 +1,14 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.accesscontrol.resources.testplugins; + +import org.opensearch.plugins.Plugin; +import org.opensearch.plugins.ResourceAccessControlPlugin; + +public class TestRACPlugin extends Plugin implements ResourceAccessControlPlugin {} diff --git a/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/fallback/TestResourcePlugin.java b/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/testplugins/TestResourcePlugin.java similarity index 97% rename from server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/fallback/TestResourcePlugin.java rename to server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/testplugins/TestResourcePlugin.java index bf2e0859f8f8b..f340f6d56e221 100644 --- a/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/fallback/TestResourcePlugin.java +++ b/server/src/internalClusterTest/java/org/opensearch/accesscontrol/resources/testplugins/TestResourcePlugin.java @@ -6,7 +6,7 @@ * compatible open source license. */ -package org.opensearch.accesscontrol.resources.fallback; +package org.opensearch.accesscontrol.resources.testplugins; import org.opensearch.accesscontrol.resources.ResourceService; import org.opensearch.common.inject.Inject;