77
88package  org .elasticsearch .xpack .esql .spatial ;
99
10+ import  org .elasticsearch .license .License ;
11+ import  org .elasticsearch .license .XPackLicenseState ;
12+ import  org .elasticsearch .license .internal .XPackLicenseStatus ;
1013import  org .elasticsearch .plugins .Plugin ;
11- import  org .elasticsearch .xpack .esql .action . EsqlPluginWithNonEnterpriseOrExpiredLicense ;
14+ import  org .elasticsearch .xpack .esql .plugin . EsqlPlugin ;
1215import  org .elasticsearch .xpack .spatial .SpatialPlugin ;
1316
1417import  java .util .Collection ;
@@ -18,11 +21,45 @@ public class SpatialExtentAggregationNoLicenseIT extends SpatialExtentAggregatio
1821
1922    @ Override 
2023    protected  Collection <Class <? extends  Plugin >> nodePlugins () {
21-         return  List .of (SpatialPlugin .class , EsqlPluginWithNonEnterpriseOrExpiredLicense .class );
24+         return  List .of (TestSpatialPlugin .class , TestEsqlPlugin .class );
2225    }
2326
2427    @ Override 
2528    public  void  testStExtentAggregationWithShapes () {
2629        assertStExtentFailsWith ("index_geo_shape" );
2730    }
31+ 
32+     private  static  XPackLicenseState  getLicenseState () {
33+         License .OperationMode  operationMode ;
34+         boolean  active ;
35+         if  (randomBoolean ()) {
36+             operationMode  = randomFrom (
37+                 License .OperationMode .GOLD ,
38+                 License .OperationMode .BASIC ,
39+                 License .OperationMode .MISSING ,
40+                 License .OperationMode .STANDARD 
41+             );
42+             active  = true ;
43+         } else  {
44+             operationMode  = randomFrom (License .OperationMode .PLATINUM , License .OperationMode .ENTERPRISE , License .OperationMode .TRIAL );
45+             active  = false ;  // expired 
46+         }
47+ 
48+         return  new  XPackLicenseState (
49+             () -> System .currentTimeMillis (),
50+             new  XPackLicenseStatus (operationMode , active , "Test license expired" )
51+         );
52+     }
53+ 
54+     public  static  class  TestEsqlPlugin  extends  EsqlPlugin  {
55+         protected  XPackLicenseState  getLicenseState () {
56+             return  SpatialExtentAggregationNoLicenseIT .getLicenseState ();
57+         }
58+     }
59+ 
60+     public  static  class  TestSpatialPlugin  extends  SpatialPlugin  {
61+         protected  XPackLicenseState  getLicenseState () {
62+             return  SpatialExtentAggregationNoLicenseIT .getLicenseState ();
63+         }
64+     }
2865}
0 commit comments