11package io .split .client ;
22
3- import io .split .client .dtos .Condition ;
4- import io .split .client .dtos .ConditionType ;
5- import io .split .client .dtos .Split ;
6- import io .split .client .dtos .SplitChange ;
7- import io .split .client .dtos .Status ;
3+ import io .split .client .dtos .*;
84import io .split .client .utils .InputStreamProvider ;
95import io .split .client .utils .LocalhostConstants ;
106import io .split .engine .common .FetchOptions ;
@@ -37,20 +33,22 @@ public SplitChange fetch(long since, long sinceRBS, FetchOptions options) {
3733 Yaml yaml = new Yaml ();
3834 List <Map <String , Map <String , Object >>> yamlSplits = yaml .load (_inputStreamProvider .get ());
3935 SplitChange splitChange = new SplitChange ();
40- splitChange .splits = new ArrayList <>();
36+ splitChange .featureFlags = new ChangeDto <>();
37+ splitChange .featureFlags .d = new ArrayList <>();
4138 for (Map <String , Map <String , Object >> aSplit : yamlSplits ) {
4239 // The outter map is a map with one key, the split name
4340 Map .Entry <String , Map <String , Object >> splitAndValues = aSplit .entrySet ().iterator ().next ();
4441
45- Optional <Split > splitOptional = splitChange .splits .stream ().filter (split -> split .name .equals (splitAndValues .getKey ())).findFirst ();
42+ Optional <Split > splitOptional = splitChange .featureFlags .d .stream ().
43+ filter (split -> split .name .equals (splitAndValues .getKey ())).findFirst ();
4644 Split split = splitOptional .orElse (null );
4745 if (split == null ) {
4846 split = new Split ();
4947 split .name = splitAndValues .getKey ();
5048 split .configurations = new HashMap <>();
5149 split .conditions = new ArrayList <>();
5250 } else {
53- splitChange .splits .remove (split );
51+ splitChange .featureFlags . d .remove (split );
5452 }
5553 String treatment = (String ) splitAndValues .getValue ().get ("treatment" );
5654 String configurations = splitAndValues .getValue ().get ("config" ) != null ? (String ) splitAndValues .getValue ().get ("config" ) : null ;
@@ -68,14 +66,14 @@ public SplitChange fetch(long since, long sinceRBS, FetchOptions options) {
6866 split .trafficTypeName = LocalhostConstants .USER ;
6967 split .trafficAllocation = LocalhostConstants .SIZE_100 ;
7068 split .trafficAllocationSeed = LocalhostConstants .SIZE_1 ;
71-
72- splitChange .splits .add (split );
69+ splitChange .featureFlags .d .add (split );
7370 }
74- splitChange .till = since ;
75- splitChange .since = since ;
76- splitChange .sinceRBS = -1 ;
77- splitChange .tillRBS = -1 ;
78- splitChange .ruleBasedSegments = new ArrayList <>();
71+ splitChange .featureFlags .t = since ;
72+ splitChange .featureFlags .s = since ;
73+ splitChange .ruleBasedSegments = new ChangeDto <>();
74+ splitChange .ruleBasedSegments .s = -1 ;
75+ splitChange .ruleBasedSegments .t = -1 ;
76+ splitChange .ruleBasedSegments .d = new ArrayList <>();
7977 return splitChange ;
8078 } catch (Exception e ) {
8179 throw new IllegalStateException ("Problem fetching splitChanges using a yaml file: " + e .getMessage (), e );
0 commit comments