33import com .google .common .collect .Lists ;
44import io .split .client .interceptors .FlagSetsFilter ;
55import io .split .client .interceptors .FlagSetsFilterImpl ;
6- import io .split .storages .RuleBasedSegmentCacheProducer ;
6+ import io .split .storages .* ;
77import io .split .storages .memory .InMemoryCacheImp ;
8- import io .split .storages .SegmentCache ;
98import io .split .storages .memory .RuleBasedSegmentCacheInMemoryImp ;
109import io .split .storages .memory .SegmentCacheInMemoryImpl ;
11- import io .split .storages .SplitCache ;
1210import io .split .client .dtos .*;
1311import io .split .engine .ConditionsTestUtil ;
1412import io .split .engine .common .FetchOptions ;
@@ -157,14 +155,14 @@ public void whenParserFailsWeRemoveTheExperiment() throws InterruptedException {
157155
158156 SegmentCache segmentCache = new SegmentCacheInMemoryImpl ();
159157 SplitCache cache = new InMemoryCacheImp (-1 , FLAG_SETS_FILTER );
160- RuleBasedSegmentCacheProducer ruleBasedSegmentCacheProducer = new RuleBasedSegmentCacheInMemoryImp ();
158+ RuleBasedSegmentCache ruleBasedSegmentCache = new RuleBasedSegmentCacheInMemoryImp ();
161159 RuleBasedSegmentParser ruleBasedSegmentParser = new RuleBasedSegmentParser ();
162160
163161 SegmentChangeFetcher segmentChangeFetcher = mock (SegmentChangeFetcher .class );
164- SegmentSynchronizationTask segmentSynchronizationTask = new SegmentSynchronizationTaskImp (segmentChangeFetcher , 1 ,10 , segmentCache , TELEMETRY_STORAGE , cache , null );
162+ SegmentSynchronizationTask segmentSynchronizationTask = new SegmentSynchronizationTaskImp (segmentChangeFetcher , 1 ,10 , segmentCache , TELEMETRY_STORAGE , cache , null , ruleBasedSegmentCache );
165163 segmentSynchronizationTask .start ();
166164 SplitFetcherImp fetcher = new SplitFetcherImp (splitChangeFetcher , new SplitParser (), cache , TELEMETRY_STORAGE , FLAG_SETS_FILTER ,
167- ruleBasedSegmentParser , ruleBasedSegmentCacheProducer );
165+ ruleBasedSegmentParser , ruleBasedSegmentCache );
168166
169167
170168 // execute the fetcher for a little bit.
@@ -182,14 +180,14 @@ public void ifThereIsAProblemTalkingToSplitChangeCountDownLatchIsNotDecremented(
182180 SplitChangeFetcher splitChangeFetcher = mock (SplitChangeFetcher .class );
183181 when (splitChangeFetcher .fetch (-1L , -1 , new FetchOptions .Builder ().build ())).thenThrow (new RuntimeException ());
184182 SegmentCache segmentCache = new SegmentCacheInMemoryImpl ();
185- RuleBasedSegmentCacheProducer ruleBasedSegmentCacheProducer = new RuleBasedSegmentCacheInMemoryImp ();
183+ RuleBasedSegmentCache ruleBasedSegmentCache = new RuleBasedSegmentCacheInMemoryImp ();
186184 RuleBasedSegmentParser ruleBasedSegmentParser = new RuleBasedSegmentParser ();
187185
188186 SegmentChangeFetcher segmentChangeFetcher = mock (SegmentChangeFetcher .class );
189- SegmentSynchronizationTask segmentSynchronizationTask = new SegmentSynchronizationTaskImp (segmentChangeFetcher , 1 ,10 , segmentCache , TELEMETRY_STORAGE , cache , null );
187+ SegmentSynchronizationTask segmentSynchronizationTask = new SegmentSynchronizationTaskImp (segmentChangeFetcher , 1 ,10 , segmentCache , TELEMETRY_STORAGE , cache , null , ruleBasedSegmentCache );
190188 segmentSynchronizationTask .start ();
191189 SplitFetcherImp fetcher = new SplitFetcherImp (splitChangeFetcher , new SplitParser (), cache , TELEMETRY_STORAGE , FLAG_SETS_FILTER ,
192- ruleBasedSegmentParser , ruleBasedSegmentCacheProducer );
190+ ruleBasedSegmentParser , ruleBasedSegmentCache );
193191
194192 // execute the fetcher for a little bit.
195193 executeWaitAndTerminate (fetcher , 1 , 5 , TimeUnit .SECONDS );
@@ -224,11 +222,11 @@ public void addFeatureFlags() throws InterruptedException {
224222 SplitChangeFetcher splitChangeFetcher = mock (SplitChangeFetcher .class );
225223 when (splitChangeFetcher .fetch (Mockito .eq (-1L ), Mockito .eq (-1L ), Mockito .any ())).thenReturn (validReturn );
226224
227- RuleBasedSegmentCacheProducer ruleBasedSegmentCacheProducer = new RuleBasedSegmentCacheInMemoryImp ();
225+ RuleBasedSegmentCache ruleBasedSegmentCache = new RuleBasedSegmentCacheInMemoryImp ();
228226 RuleBasedSegmentParser ruleBasedSegmentParser = new RuleBasedSegmentParser ();
229227 FlagSetsFilter flagSetsFilter = new FlagSetsFilterImpl (new HashSet <>(Arrays .asList ("set_1" , "set_2" )));
230228 SplitFetcherImp fetcher = new SplitFetcherImp (splitChangeFetcher , new SplitParser (), cache , TELEMETRY_STORAGE , flagSetsFilter ,
231- ruleBasedSegmentParser , ruleBasedSegmentCacheProducer );
229+ ruleBasedSegmentParser , ruleBasedSegmentCache );
232230
233231 executeWaitAndTerminate (fetcher , 1 , 5 , TimeUnit .SECONDS );
234232
@@ -282,16 +280,16 @@ public void worksWithUserDefinedSegments() throws Exception {
282280 AChangePerCallSplitChangeFetcher experimentChangeFetcher = new AChangePerCallSplitChangeFetcher (segmentName );
283281 SplitCache cache = new InMemoryCacheImp (startingChangeNumber , FLAG_SETS_FILTER );
284282 SegmentCache segmentCache = new SegmentCacheInMemoryImpl ();
285- RuleBasedSegmentCacheProducer ruleBasedSegmentCacheProducer = new RuleBasedSegmentCacheInMemoryImp ();
283+ RuleBasedSegmentCache ruleBasedSegmentCache = new RuleBasedSegmentCacheInMemoryImp ();
286284 RuleBasedSegmentParser ruleBasedSegmentParser = new RuleBasedSegmentParser ();
287285
288286 SegmentChangeFetcher segmentChangeFetcher = mock (SegmentChangeFetcher .class );
289287 SegmentChange segmentChange = getSegmentChange (0L , 0L , segmentName );
290288 when (segmentChangeFetcher .fetch (anyString (), anyLong (), any ())).thenReturn (segmentChange );
291- SegmentSynchronizationTask segmentSynchronizationTask = new SegmentSynchronizationTaskImp (segmentChangeFetcher , 1 ,10 , segmentCache , Mockito .mock (TelemetryStorage .class ), cache , null );
289+ SegmentSynchronizationTask segmentSynchronizationTask = new SegmentSynchronizationTaskImp (segmentChangeFetcher , 1 ,10 , segmentCache , Mockito .mock (TelemetryStorage .class ), cache , null , ruleBasedSegmentCache );
292290 segmentSynchronizationTask .start ();
293291 SplitFetcherImp fetcher = new SplitFetcherImp (experimentChangeFetcher , new SplitParser (), cache , TELEMETRY_STORAGE , FLAG_SETS_FILTER ,
294- ruleBasedSegmentParser , ruleBasedSegmentCacheProducer );
292+ ruleBasedSegmentParser , ruleBasedSegmentCache );
295293
296294 // execute the fetcher for a little bit.
297295 executeWaitAndTerminate (fetcher , 1 , 5 , TimeUnit .SECONDS );
0 commit comments