Commit 6702707 1 parent 4f4d758 commit 6702707 Copy full SHA for 6702707
File tree 1 file changed +28
-0
lines changed
server/src/test/java/org/opensearch/identity
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ */
8
+
9
+ package org .opensearch .identity ;
10
+
11
+ import org .opensearch .test .OpenSearchTestCase ;
12
+ import org .opensearch .threadpool .TestThreadPool ;
13
+ import org .opensearch .threadpool .ThreadPool ;
14
+
15
+ public class SystemSubjectTests extends OpenSearchTestCase {
16
+ public void testSystemSubject () {
17
+ ThreadPool threadPool = new TestThreadPool (getTestName ());
18
+ SystemSubject systemSubject = SystemSubject .getInstance ();
19
+ assertEquals ("system" , systemSubject .getPrincipal ().getName ());
20
+ systemSubject .initialize (threadPool );
21
+ assertFalse (threadPool .getThreadContext ().isSystemContext ());
22
+ systemSubject .runAs (() -> {
23
+ assertTrue (threadPool .getThreadContext ().isSystemContext ());
24
+ return false ;
25
+ });
26
+ terminate (threadPool );
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments