66import picocli .CommandLine .Parameters ;
77
88import com .featurevisor .sdk .Featurevisor ;
9- import com .featurevisor .sdk .Instance ;
109import com .featurevisor .sdk .Logger ;
1110import com .featurevisor .sdk .DatafileReader ;
1211import com .featurevisor .types .DatafileContent ;
@@ -250,9 +249,9 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
250249 Map <String , Object > sticky = (Map <String , Object >) assertion .getOrDefault ("sticky" , new HashMap <>());
251250
252251 // 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 );
252+ if (f instanceof Featurevisor ) {
253+ ((Featurevisor ) f ).setContext (context , true );
254+ ((Featurevisor ) f ).setSticky (sticky , true );
256255 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
257256 ((com .featurevisor .sdk .ChildInstance ) f ).setContext (context , true );
258257 ((com .featurevisor .sdk .ChildInstance ) f ).setSticky (sticky , true );
@@ -274,7 +273,7 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
274273
275274 // Test expectedVariation
276275 if (assertion .containsKey ("expectedVariation" )) {
277- Instance .OverrideOptions options = new Instance .OverrideOptions ();
276+ Featurevisor .OverrideOptions options = new Featurevisor .OverrideOptions ();
278277 if (assertion .containsKey ("defaultVariationValue" )) {
279278 options .setDefaultVariationValue (assertion .get ("defaultVariationValue" ).toString ());
280279 }
@@ -308,7 +307,7 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
308307 }
309308 }
310309
311- Instance .OverrideOptions options = new Instance .OverrideOptions ();
310+ Featurevisor .OverrideOptions options = new Featurevisor .OverrideOptions ();
312311 if (defaultVariableValues .containsKey (variableKey )) {
313312 options .setDefaultVariableValue (defaultVariableValues .get (variableKey ));
314313 }
@@ -347,7 +346,7 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
347346 if (expectedEvaluations .containsKey ("variation" )) {
348347 @ SuppressWarnings ("unchecked" )
349348 Map <String , Object > variationEvaluation = (Map <String , Object >) expectedEvaluations .get ("variation" );
350- Instance .OverrideOptions options = new Instance .OverrideOptions ();
349+ Featurevisor .OverrideOptions options = new Featurevisor .OverrideOptions ();
351350 if (assertion .containsKey ("defaultVariationValue" )) {
352351 options .setDefaultVariationValue (assertion .get ("defaultVariationValue" ).toString ());
353352 }
@@ -378,7 +377,7 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
378377 @ SuppressWarnings ("unchecked" )
379378 Map <String , Object > expectedEvaluation = (Map <String , Object >) entry .getValue ();
380379
381- Instance .OverrideOptions options = new Instance .OverrideOptions ();
380+ Featurevisor .OverrideOptions options = new Featurevisor .OverrideOptions ();
382381 if (defaultVariableValues .containsKey (variableKey )) {
383382 options .setDefaultVariableValue (defaultVariableValues .get (variableKey ));
384383 }
@@ -427,55 +426,55 @@ private TestResult testFeature(Map<String, Object> assertion, String featureKey,
427426 * Helper methods to work with both Instance and ChildInstance
428427 */
429428 private boolean isEnabled (Object f , String featureKey , Map <String , Object > context ) {
430- if (f instanceof Instance ) {
431- return ((Instance ) f ).isEnabled (featureKey , context );
429+ if (f instanceof Featurevisor ) {
430+ return ((Featurevisor ) f ).isEnabled (featureKey , context );
432431 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
433432 return ((com .featurevisor .sdk .ChildInstance ) f ).isEnabled (featureKey , context );
434433 }
435434 return false ;
436435 }
437436
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 );
437+ private Object getVariation (Object f , String featureKey , Map <String , Object > context , Featurevisor .OverrideOptions options ) {
438+ if (f instanceof Featurevisor ) {
439+ return ((Featurevisor ) f ).getVariation (featureKey , context , options );
441440 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
442441 return ((com .featurevisor .sdk .ChildInstance ) f ).getVariation (featureKey , context , options );
443442 }
444443 return null ;
445444 }
446445
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 );
446+ private Object getVariable (Object f , String featureKey , String variableKey , Map <String , Object > context , Featurevisor .OverrideOptions options ) {
447+ if (f instanceof Featurevisor ) {
448+ return ((Featurevisor ) f ).getVariable (featureKey , variableKey , context , options );
450449 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
451450 return ((com .featurevisor .sdk .ChildInstance ) f ).getVariable (featureKey , variableKey , context , options );
452451 }
453452 return null ;
454453 }
455454
456455 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 );
456+ if (f instanceof Featurevisor ) {
457+ return ((Featurevisor ) f ).evaluateFlag (featureKey , context );
459458 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
460459 // ChildInstance doesn't have evaluateFlag, so we'll skip this test for child instances
461460 return null ;
462461 }
463462 return null ;
464463 }
465464
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 );
465+ private com .featurevisor .sdk .Evaluation evaluateVariation (Object f , String featureKey , Map <String , Object > context , Featurevisor .OverrideOptions options ) {
466+ if (f instanceof Featurevisor ) {
467+ return ((Featurevisor ) f ).evaluateVariation (featureKey , context , options );
469468 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
470469 // ChildInstance doesn't have evaluateVariation, so we'll skip this test for child instances
471470 return null ;
472471 }
473472 return null ;
474473 }
475474
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 );
475+ private com .featurevisor .sdk .Evaluation evaluateVariable (Object f , String featureKey , String variableKey , Map <String , Object > context , Featurevisor .OverrideOptions options ) {
476+ if (f instanceof Featurevisor ) {
477+ return ((Featurevisor ) f ).evaluateVariable (featureKey , variableKey , context , options );
479478 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
480479 // ChildInstance doesn't have evaluateVariable, so we'll skip this test for child instances
481480 return null ;
@@ -484,8 +483,8 @@ private com.featurevisor.sdk.Evaluation evaluateVariable(Object f, String featur
484483 }
485484
486485 private com .featurevisor .sdk .ChildInstance spawn (Object f , Map <String , Object > context ) {
487- if (f instanceof Instance ) {
488- return ((Instance ) f ).spawn (context );
486+ if (f instanceof Featurevisor ) {
487+ return ((Featurevisor ) f ).spawn (context );
489488 } else if (f instanceof com .featurevisor .sdk .ChildInstance ) {
490489 // ChildInstance doesn't have spawn, so we'll return null
491490 return null ;
@@ -577,11 +576,11 @@ private void test() {
577576 return ;
578577 }
579578
580- // Create SDK instances for each environment
581- Map <String , Instance > sdkInstancesByEnvironment = new HashMap <>();
579+ // Create SDK instances for each environment
580+ Map <String , Featurevisor > sdkInstancesByEnvironment = new HashMap <>();
582581 for (String environment : environments ) {
583582 DatafileContent datafile = datafilesByEnvironment .get (environment );
584- Instance instance = Featurevisor .createInstance (new Instance . InstanceOptions ()
583+ Featurevisor instance = Featurevisor .createInstance (new Featurevisor . Options ()
585584 .datafile (datafile )
586585 .logLevel (level ));
587586 sdkInstancesByEnvironment .put (environment , instance );
@@ -610,7 +609,7 @@ private void test() {
610609
611610 if (test .containsKey ("feature" )) {
612611 String environment = (String ) assertion .get ("environment" );
613- Instance f = sdkInstancesByEnvironment .get (environment );
612+ Featurevisor f = sdkInstancesByEnvironment .get (environment );
614613
615614 // If "at" parameter is provided, create a new SDK instance with the specific hook
616615 if (assertion .containsKey ("at" )) {
@@ -631,7 +630,7 @@ private void test() {
631630 hooksManager .add (new HooksManager .Hook ("at-parameter" )
632631 .bucketValue ((options ) -> (int ) (atValue * 1000 )));
633632
634- f = Featurevisor .createInstance (new Instance . InstanceOptions ()
633+ f = Featurevisor .createInstance (new Featurevisor . Options ()
635634 .datafile (datafile )
636635 .logLevel (level )
637636 .hooks (hooksManager .getAll ()));
@@ -710,7 +709,7 @@ private void benchmark() {
710709 Logger .LogLevel level = getLoggerLevel ();
711710 Map <String , DatafileContent > datafilesByEnvironment = buildDatafiles (rootDirectoryPath , Arrays .asList (environment ));
712711
713- Instance f = Featurevisor .createInstance (new Instance . InstanceOptions ()
712+ Featurevisor f = Featurevisor .createInstance (new Featurevisor . Options ()
714713 .datafile (datafilesByEnvironment .get (environment ))
715714 .logLevel (level ));
716715
@@ -773,7 +772,7 @@ private void assessDistribution() {
773772
774773 Map <String , DatafileContent > datafilesByEnvironment = buildDatafiles (rootDirectoryPath , Arrays .asList (environment ));
775774
776- Instance f = Featurevisor .createInstance (new Instance . InstanceOptions ()
775+ Featurevisor f = Featurevisor .createInstance (new Featurevisor . Options ()
777776 .datafile (datafilesByEnvironment .get (environment ))
778777 .logLevel (getLoggerLevel ()));
779778
0 commit comments