@@ -82,7 +82,7 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
8282
8383    @ Before 
8484    public  void  resetLicense () throws  Exception  {
85-         setLicense ("trial" );
85+         setLicense (License . LicenseType . TRIAL );
8686    }
8787
8888    @ After 
@@ -117,7 +117,7 @@ public void testValidateIndexOptionsWithBasicLicense() throws Exception {
117117        createInferenceEndpoint (TaskType .TEXT_EMBEDDING , inferenceId , BBQ_COMPATIBLE_SERVICE_SETTINGS );
118118
119119        // Downgrade the license and restart the cluster to force the model registry to rebuild 
120-         setLicense ("basic" );
120+         setLicense (License . LicenseType . BASIC );
121121        internalCluster ().fullRestart (new  InternalTestCluster .RestartCallback ());
122122        ensureGreen (InferenceIndex .INDEX_NAME );
123123        assertLicense (License .LicenseType .BASIC );
@@ -145,7 +145,7 @@ public void testSetDefaultBBQIndexOptionsWithBasicLicense() throws Exception {
145145        createInferenceEndpoint (TaskType .TEXT_EMBEDDING , inferenceId , BBQ_COMPATIBLE_SERVICE_SETTINGS );
146146
147147        // Downgrade the license and restart the cluster to force the model registry to rebuild 
148-         setLicense ("basic" );
148+         setLicense (License . LicenseType . BASIC );
149149        internalCluster ().fullRestart (new  InternalTestCluster .RestartCallback ());
150150        ensureGreen (InferenceIndex .INDEX_NAME );
151151        assertLicense (License .LicenseType .BASIC );
@@ -269,9 +269,8 @@ private static Map<String, Object> filterNullOrEmptyValues(Map<String, Object> m
269269        return  filteredMap ;
270270    }
271271
272-     // TODO: Pass LicenseType to this method 
273-     private  static  void  setLicense (String  type ) throws  Exception  {
274-         if  (type .equals ("basic" )) {
272+     private  static  void  setLicense (License .LicenseType  type ) throws  Exception  {
273+         if  (type  == License .LicenseType .BASIC ) {
275274            assertAcked (
276275                safeGet (
277276                    client ().execute (
@@ -281,7 +280,12 @@ private static void setLicense(String type) throws Exception {
281280                )
282281            );
283282        } else  {
284-             License  license  = TestUtils .generateSignedLicense (type , License .VERSION_CURRENT , -1 , TimeValue .timeValueHours (24 ));
283+             License  license  = TestUtils .generateSignedLicense (
284+                 type .getTypeName (),
285+                 License .VERSION_CURRENT ,
286+                 -1 ,
287+                 TimeValue .timeValueHours (24 )
288+             );
285289            assertAcked (
286290                safeGet (
287291                    client ().execute (
0 commit comments