1313import org .elasticsearch .common .settings .Settings ;
1414import org .elasticsearch .core .Strings ;
1515import org .elasticsearch .entitlement .runtime .policy .PolicyManager .ModuleEntitlements ;
16- import org .elasticsearch .entitlement .runtime .policy .PolicyManager .ScopeInfo ;
16+ import org .elasticsearch .entitlement .runtime .policy .PolicyManager .PolicyScope ;
1717import org .elasticsearch .entitlement .runtime .policy .agent .TestAgent ;
1818import org .elasticsearch .entitlement .runtime .policy .agent .inner .TestInnerAgent ;
1919import org .elasticsearch .entitlement .runtime .policy .entitlements .CreateClassLoaderEntitlement ;
@@ -91,7 +91,7 @@ public void testGetEntitlementsThrowsOnMissingPluginUnnamedModule() {
9191 createEmptyTestServerPolicy (),
9292 List .of (),
9393 Map .of ("plugin1" , createPluginPolicy ("plugin.module" )),
94- c -> new ScopeInfo ("plugin1" , moduleName (c )),
94+ c -> new PolicyScope ("plugin1" , moduleName (c )),
9595 Map .of ("plugin1" , plugin1SourcePath ),
9696 NO_ENTITLEMENTS_MODULE ,
9797 TEST_PATH_LOOKUP ,
@@ -120,7 +120,7 @@ public void testGetEntitlementsThrowsOnMissingPolicyForPlugin() {
120120 createEmptyTestServerPolicy (),
121121 List .of (),
122122 Map .of (),
123- c -> new ScopeInfo ("plugin1" , moduleName (c )),
123+ c -> new PolicyScope ("plugin1" , moduleName (c )),
124124 Map .of ("plugin1" , plugin1SourcePath ),
125125 NO_ENTITLEMENTS_MODULE ,
126126 TEST_PATH_LOOKUP ,
@@ -149,7 +149,7 @@ public void testGetEntitlementsFailureIsCached() {
149149 createEmptyTestServerPolicy (),
150150 List .of (),
151151 Map .of (),
152- c -> new ScopeInfo ("plugin1" , moduleName (c )),
152+ c -> new PolicyScope ("plugin1" , moduleName (c )),
153153 Map .of ("plugin1" , plugin1SourcePath ),
154154 NO_ENTITLEMENTS_MODULE ,
155155 TEST_PATH_LOOKUP ,
@@ -187,7 +187,7 @@ public void testGetEntitlementsReturnsEntitlementsForPluginUnnamedModule() {
187187 createEmptyTestServerPolicy (),
188188 List .of (),
189189 Map .ofEntries (entry ("plugin2" , createPluginPolicy (ALL_UNNAMED ))),
190- c -> new ScopeInfo ("plugin2" , moduleName (c )),
190+ c -> new PolicyScope ("plugin2" , moduleName (c )),
191191 Map .of ("plugin2" , Path .of ("modules" , "plugin2" )),
192192 NO_ENTITLEMENTS_MODULE ,
193193 TEST_PATH_LOOKUP ,
@@ -206,7 +206,7 @@ public void testGetEntitlementsReturnsDefaultOnMissingPolicyForServer() throws C
206206 createTestServerPolicy ("example" ),
207207 List .of (),
208208 Map .of (),
209- c -> new ScopeInfo (SERVER_COMPONENT_NAME , moduleName (c )),
209+ c -> new PolicyScope (SERVER_COMPONENT_NAME , moduleName (c )),
210210 Map .of (),
211211 NO_ENTITLEMENTS_MODULE ,
212212 TEST_PATH_LOOKUP ,
@@ -238,7 +238,7 @@ public void testGetEntitlementsReturnsEntitlementsForServerModule() throws Class
238238 createTestServerPolicy (httpserverModuleName ),
239239 List .of (),
240240 Map .of (),
241- c -> new ScopeInfo (SERVER_COMPONENT_NAME , moduleName (c )),
241+ c -> new PolicyScope (SERVER_COMPONENT_NAME , moduleName (c )),
242242 Map .of (),
243243 NO_ENTITLEMENTS_MODULE ,
244244 TEST_PATH_LOOKUP ,
@@ -263,7 +263,7 @@ public void testGetEntitlementsReturnsEntitlementsForPluginModule() throws IOExc
263263 createEmptyTestServerPolicy (),
264264 List .of (),
265265 Map .of ("mock-plugin" , createPluginPolicy ("org.example.plugin" )),
266- c -> new ScopeInfo ("mock-plugin" , moduleName (c )),
266+ c -> new PolicyScope ("mock-plugin" , moduleName (c )),
267267 Map .of ("mock-plugin" , Path .of ("modules" , "mock-plugin" )),
268268 NO_ENTITLEMENTS_MODULE ,
269269 TEST_PATH_LOOKUP ,
@@ -283,7 +283,7 @@ public void testGetEntitlementsResultIsCached() {
283283 createEmptyTestServerPolicy (),
284284 List .of (),
285285 Map .ofEntries (entry ("plugin2" , createPluginPolicy (ALL_UNNAMED ))),
286- c -> new ScopeInfo ("plugin2" , moduleName (c )),
286+ c -> new PolicyScope ("plugin2" , moduleName (c )),
287287 Map .of ("plugin2" , Path .of ("modules" , "plugin2" )),
288288 NO_ENTITLEMENTS_MODULE ,
289289 TEST_PATH_LOOKUP ,
@@ -347,8 +347,8 @@ public void testAgentsEntitlements() throws IOException, ClassNotFoundException
347347 List .of (new CreateClassLoaderEntitlement ()),
348348 Map .of (),
349349 c -> c .getPackageName ().startsWith (TEST_AGENTS_PACKAGE_NAME )
350- ? new ScopeInfo (APM_AGENT_COMPONENT_NAME , "test.agent.module" )
351- : new ScopeInfo ("test" , "test.plugin.module" ),
350+ ? new PolicyScope (APM_AGENT_COMPONENT_NAME , "test.agent.module" )
351+ : new PolicyScope ("test" , "test.plugin.module" ),
352352 Map .of (),
353353 NO_ENTITLEMENTS_MODULE ,
354354 TEST_PATH_LOOKUP ,
@@ -377,7 +377,7 @@ public void testDuplicateEntitlements() {
377377 ),
378378 List .of (),
379379 Map .of (),
380- c -> new ScopeInfo ("test" , moduleName (c )),
380+ c -> new PolicyScope ("test" , moduleName (c )),
381381 Map .of (),
382382 NO_ENTITLEMENTS_MODULE ,
383383 TEST_PATH_LOOKUP ,
@@ -395,7 +395,7 @@ public void testDuplicateEntitlements() {
395395 createEmptyTestServerPolicy (),
396396 List .of (new CreateClassLoaderEntitlement (), new CreateClassLoaderEntitlement ()),
397397 Map .of (),
398- c -> new ScopeInfo ("test" , moduleName (c )),
398+ c -> new PolicyScope ("test" , moduleName (c )),
399399 Map .of (),
400400 NO_ENTITLEMENTS_MODULE ,
401401 TEST_PATH_LOOKUP ,
@@ -433,7 +433,7 @@ public void testDuplicateEntitlements() {
433433 )
434434 )
435435 ),
436- c -> new ScopeInfo ("plugin1" , moduleName (c )),
436+ c -> new PolicyScope ("plugin1" , moduleName (c )),
437437 Map .of ("plugin1" , Path .of ("modules" , "plugin1" )),
438438 NO_ENTITLEMENTS_MODULE ,
439439 TEST_PATH_LOOKUP ,
@@ -485,7 +485,7 @@ public void testFilesEntitlementsWithExclusive() {
485485 )
486486 )
487487 ),
488- c -> new ScopeInfo ("" , moduleName (c )),
488+ c -> new PolicyScope ("" , moduleName (c )),
489489 Map .of ("plugin1" , Path .of ("modules" , "plugin1" ), "plugin2" , Path .of ("modules" , "plugin2" )),
490490 NO_ENTITLEMENTS_MODULE ,
491491 TEST_PATH_LOOKUP ,
@@ -538,7 +538,7 @@ public void testFilesEntitlementsWithExclusive() {
538538 )
539539 )
540540 ),
541- c -> new ScopeInfo ("" , moduleName (c )),
541+ c -> new PolicyScope ("" , moduleName (c )),
542542 Map .of (),
543543 NO_ENTITLEMENTS_MODULE ,
544544 TEST_PATH_LOOKUP ,
@@ -564,7 +564,7 @@ public void testPluginResolverOverridesAgents() {
564564 createEmptyTestServerPolicy (),
565565 List .of (new CreateClassLoaderEntitlement ()),
566566 Map .of (),
567- c -> new ScopeInfo ("test" , moduleName (c )), // Insist that the class is in a plugin
567+ c -> new PolicyScope ("test" , moduleName (c )), // Insist that the class is in a plugin
568568 Map .of (),
569569 NO_ENTITLEMENTS_MODULE ,
570570 TEST_PATH_LOOKUP ,
@@ -586,7 +586,7 @@ private static PolicyManager policyManager(Module entitlementsModule) {
586586 createEmptyTestServerPolicy (),
587587 List .of (),
588588 Map .of (),
589- c -> new ScopeInfo ("test" , moduleName (c )),
589+ c -> new PolicyScope ("test" , moduleName (c )),
590590 Map .of (),
591591 entitlementsModule ,
592592 TEST_PATH_LOOKUP ,
0 commit comments