66import picocli .CommandLine .Parameters ;
77
88import com .featurevisor .sdk .Featurevisor ;
9- import com .featurevisor .sdk .Instance ;
9+ import com .featurevisor .sdk .FeaturevisorInstance ;
1010import com .featurevisor .sdk .Logger ;
1111import com .featurevisor .sdk .DatafileReader ;
1212import com .featurevisor .types .DatafileContent ;
@@ -250,9 +250,9 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
250250 Map <String , Object > sticky = (Map <String , Object >) assertion .getOrDefault ("sticky" , new HashMap <>());
251251
252252 // Update the SDK instance context and sticky values for this assertion
253- if (f instanceof Instance ) {
254- ((Instance ) f ).setContext (context , true );
255- ((Instance ) f ).setSticky (sticky , true );
253+ if (f instanceof FeaturevisorInstance ) {
254+ ((FeaturevisorInstance ) f ).setContext (context , true );
255+ ((FeaturevisorInstance ) f ).setSticky (sticky , true );
256256 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
257257 ((com .featurevisor .sdk .ChildInstance ) f ).setContext (context , true );
258258 ((com .featurevisor .sdk .ChildInstance ) f ).setSticky (sticky , true );
@@ -274,7 +274,7 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
274274
275275 // Test expectedVariation
276276 if (assertion .containsKey ("expectedVariation" )) {
277- Instance .OverrideOptions options = new Instance .OverrideOptions ();
277+ FeaturevisorInstance .OverrideOptions options = new FeaturevisorInstance .OverrideOptions ();
278278 if (assertion .containsKey ("defaultVariationValue" )) {
279279 options .setDefaultVariationValue (assertion .get ("defaultVariationValue" ).toString ());
280280 }
@@ -308,7 +308,7 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
308308 }
309309 }
310310
311- Instance .OverrideOptions options = new Instance .OverrideOptions ();
311+ FeaturevisorInstance .OverrideOptions options = new FeaturevisorInstance .OverrideOptions ();
312312 if (defaultVariableValues .containsKey (variableKey )) {
313313 options .setDefaultVariableValue (defaultVariableValues .get (variableKey ));
314314 }
@@ -347,7 +347,7 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
347347 if (expectedEvaluations .containsKey ("variation" )) {
348348 @ SuppressWarnings ("unchecked" )
349349 Map <String , Object > variationEvaluation = (Map <String , Object >) expectedEvaluations .get ("variation" );
350- Instance .OverrideOptions options = new Instance .OverrideOptions ();
350+ FeaturevisorInstance .OverrideOptions options = new FeaturevisorInstance .OverrideOptions ();
351351 if (assertion .containsKey ("defaultVariationValue" )) {
352352 options .setDefaultVariationValue (assertion .get ("defaultVariationValue" ).toString ());
353353 }
@@ -378,7 +378,7 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
378378 @ SuppressWarnings ("unchecked" )
379379 Map <String , Object > expectedEvaluation = (Map <String , Object >) entry .getValue ();
380380
381- Instance .OverrideOptions options = new Instance .OverrideOptions ();
381+ FeaturevisorInstance .OverrideOptions options = new FeaturevisorInstance .OverrideOptions ();
382382 if (defaultVariableValues .containsKey (variableKey )) {
383383 options .setDefaultVariableValue (defaultVariableValues .get (variableKey ));
384384 }
@@ -427,55 +427,55 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
427427 * Helper methods to work with both Instance and ChildInstance
428428 */
429429 private boolean isEnabled (Object f , String featureKey , Map <String , Object > context ) {
430- if (f instanceof Instance ) {
431- return ((Instance ) f ).isEnabled (featureKey , context );
430+ if (f instanceof FeaturevisorInstance ) {
431+ return ((FeaturevisorInstance ) f ).isEnabled (featureKey , context );
432432 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
433433 return ((com .featurevisor .sdk .ChildInstance ) f ).isEnabled (featureKey , context );
434434 }
435435 return false ;
436436 }
437437
438- private Object getVariation (Object f , String featureKey , Map <String , Object > context , Instance .OverrideOptions options ) {
439- if (f instanceof Instance ) {
440- return ((Instance ) f ).getVariation (featureKey , context , options );
438+ private Object getVariation (Object f , String featureKey , Map <String , Object > context , FeaturevisorInstance .OverrideOptions options ) {
439+ if (f instanceof FeaturevisorInstance ) {
440+ return ((FeaturevisorInstance ) f ).getVariation (featureKey , context , options );
441441 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
442442 return ((com .featurevisor .sdk .ChildInstance ) f ).getVariation (featureKey , context , options );
443443 }
444444 return null ;
445445 }
446446
447- private Object getVariable (Object f , String featureKey , String variableKey , Map <String , Object > context , Instance .OverrideOptions options ) {
448- if (f instanceof Instance ) {
449- return ((Instance ) f ).getVariable (featureKey , variableKey , context , options );
447+ private Object getVariable (Object f , String featureKey , String variableKey , Map <String , Object > context , FeaturevisorInstance .OverrideOptions options ) {
448+ if (f instanceof FeaturevisorInstance ) {
449+ return ((FeaturevisorInstance ) f ).getVariable (featureKey , variableKey , context , options );
450450 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
451451 return ((com .featurevisor .sdk .ChildInstance ) f ).getVariable (featureKey , variableKey , context , options );
452452 }
453453 return null ;
454454 }
455455
456456 private com .featurevisor .sdk .Evaluation evaluateFlag (Object f , String featureKey , Map <String , Object > context ) {
457- if (f instanceof Instance ) {
458- return ((Instance ) f ).evaluateFlag (featureKey , context );
457+ if (f instanceof FeaturevisorInstance ) {
458+ return ((FeaturevisorInstance ) f ).evaluateFlag (featureKey , context );
459459 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
460460 // ChildInstance doesn't have evaluateFlag, so we'll skip this test for child instances
461461 return null ;
462462 }
463463 return null ;
464464 }
465465
466- private com .featurevisor .sdk .Evaluation evaluateVariation (Object f , String featureKey , Map <String , Object > context , Instance .OverrideOptions options ) {
467- if (f instanceof Instance ) {
468- return ((Instance ) f ).evaluateVariation (featureKey , context , options );
466+ private com .featurevisor .sdk .Evaluation evaluateVariation (Object f , String featureKey , Map <String , Object > context , FeaturevisorInstance .OverrideOptions options ) {
467+ if (f instanceof FeaturevisorInstance ) {
468+ return ((FeaturevisorInstance ) f ).evaluateVariation (featureKey , context , options );
469469 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
470470 // ChildInstance doesn't have evaluateVariation, so we'll skip this test for child instances
471471 return null ;
472472 }
473473 return null ;
474474 }
475475
476- private com .featurevisor .sdk .Evaluation evaluateVariable (Object f , String featureKey , String variableKey , Map <String , Object > context , Instance .OverrideOptions options ) {
477- if (f instanceof Instance ) {
478- return ((Instance ) f ).evaluateVariable (featureKey , variableKey , context , options );
476+ private com .featurevisor .sdk .Evaluation evaluateVariable (Object f , String featureKey , String variableKey , Map <String , Object > context , FeaturevisorInstance .OverrideOptions options ) {
477+ if (f instanceof FeaturevisorInstance ) {
478+ return ((FeaturevisorInstance ) f ).evaluateVariable (featureKey , variableKey , context , options );
479479 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
480480 // ChildInstance doesn't have evaluateVariable, so we'll skip this test for child instances
481481 return null ;
@@ -484,8 +484,8 @@ private com.featurevisor.sdk.Evaluation evaluateVariable(Object f, String featur
484484 }
485485
486486 private com .featurevisor .sdk .ChildInstance spawn (Object f , Map <String , Object > context ) {
487- if (f instanceof Instance ) {
488- return ((Instance ) f ).spawn (context );
487+ if (f instanceof FeaturevisorInstance ) {
488+ return ((FeaturevisorInstance ) f ).spawn (context );
489489 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
490490 // ChildInstance doesn't have spawn, so we'll return null
491491 return null ;
@@ -577,11 +577,11 @@ private void test() {
577577 return ;
578578 }
579579
580- // Create SDK instances for each environment
581- Map <String , Instance > sdkInstancesByEnvironment = new HashMap <>();
580+ // Create SDK instances for each environment
581+ Map <String , FeaturevisorInstance > sdkInstancesByEnvironment = new HashMap <>();
582582 for (String environment : environments ) {
583583 DatafileContent datafile = datafilesByEnvironment .get (environment );
584- Instance instance = Featurevisor .createInstance (new Instance .InstanceOptions ()
584+ FeaturevisorInstance instance = Featurevisor .createInstance (new FeaturevisorInstance .InstanceOptions ()
585585 .datafile (datafile )
586586 .logLevel (level ));
587587 sdkInstancesByEnvironment .put (environment , instance );
@@ -610,7 +610,7 @@ private void test() {
610610
611611 if (test .containsKey ("feature" )) {
612612 String environment = (String ) assertion .get ("environment" );
613- Instance f = sdkInstancesByEnvironment .get (environment );
613+ FeaturevisorInstance f = sdkInstancesByEnvironment .get (environment );
614614
615615 // If "at" parameter is provided, create a new SDK instance with the specific hook
616616 if (assertion .containsKey ("at" )) {
@@ -631,7 +631,7 @@ private void test() {
631631 hooksManager .add (new HooksManager .Hook ("at-parameter" )
632632 .bucketValue ((options ) -> (int ) (atValue * 1000 )));
633633
634- f = Featurevisor .createInstance (new Instance .InstanceOptions ()
634+ f = Featurevisor .createInstance (new FeaturevisorInstance .InstanceOptions ()
635635 .datafile (datafile )
636636 .logLevel (level )
637637 .hooks (hooksManager .getAll ()));
@@ -710,7 +710,7 @@ private void benchmark() {
710710 Logger .LogLevel level = getLoggerLevel ();
711711 Map <String , DatafileContent > datafilesByEnvironment = buildDatafiles (rootDirectoryPath , Arrays .asList (environment ));
712712
713- Instance f = Featurevisor .createInstance (new Instance .InstanceOptions ()
713+ FeaturevisorInstance f = Featurevisor .createInstance (new FeaturevisorInstance .InstanceOptions ()
714714 .datafile (datafilesByEnvironment .get (environment ))
715715 .logLevel (level ));
716716
@@ -773,7 +773,7 @@ private void assessDistribution() {
773773
774774 Map <String , DatafileContent > datafilesByEnvironment = buildDatafiles (rootDirectoryPath , Arrays .asList (environment ));
775775
776- Instance f = Featurevisor .createInstance (new Instance .InstanceOptions ()
776+ FeaturevisorInstance f = Featurevisor .createInstance (new FeaturevisorInstance .InstanceOptions ()
777777 .datafile (datafilesByEnvironment .get (environment ))
778778 .logLevel (getLoggerLevel ()));
779779
0 commit comments