Skip to content

Commit

Permalink
Update import
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Aug 15, 2024
1 parent 17b4444 commit 247fd59
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;

import static org.opensearch.plugins.PluginSubject.PLUGIN_EXECUTION_CONTEXT;
import static org.opensearch.identity.AbstractSubject.SUBJECT_HEADER;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
Expand Down Expand Up @@ -952,10 +952,10 @@ public void testInitializePlugins() throws Exception {
PluginSubject testPluginSubject = new PluginSubject(testPlugin.getClass(), threadPool);
assertThat(testPluginSubject.getPrincipal().getName(), equalTo(TestPlugin.class.getCanonicalName()));
testPluginSubject.runAs(() -> {
assertThat(TestPlugin.class.getCanonicalName(), equalTo(threadPool.getThreadContext().getHeader(PLUGIN_EXECUTION_CONTEXT)));
assertThat(TestPlugin.class.getCanonicalName(), equalTo(threadPool.getThreadContext().getHeader(SUBJECT_HEADER)));
return null;
});
assertNull(threadPool.getThreadContext().getHeader(PLUGIN_EXECUTION_CONTEXT));
assertNull(threadPool.getThreadContext().getHeader(SUBJECT_HEADER));
// pluginSubject should have previously been set in service.initializePlugins
IllegalStateException e = expectThrows(IllegalStateException.class, () -> testPlugin.setPluginSubject(testPluginSubject));
assertThat(e.getMessage(), containsString("pluginSubject can only be set once"));
Expand Down

0 comments on commit 247fd59

Please sign in to comment.