File tree 2 files changed +13
-25
lines changed
2 files changed +13
-25
lines changed Original file line number Diff line number Diff line change 11
11
using System . Linq ;
12
12
using Akka . Configuration ;
13
13
using Akka . Actor ;
14
+ using Akka . Actor . Dsl ;
14
15
using Akka . Dispatch ;
15
16
using Akka . Routing ;
16
17
using Akka . TestKit ;
@@ -293,27 +294,20 @@ public void Routers_in_general_must_set_supplied_supervisorStrategy_for_FromConf
293
294
}
294
295
295
296
[ Fact ]
296
- public void Routers_in_general_must_default_to_all_for_one_always_escalate_strategy ( )
297
+ public void Routers_in_general_must_default_to_all_for_one_restart_strategy ( )
297
298
{
298
- var restarter = new OneForOneStrategy ( e =>
299
- {
300
- TestActor . Tell ( e ) ;
301
- return Directive . Restart ;
302
- } ) ;
303
-
304
- var supervisor = Sys . ActorOf ( Props . Create ( ( ) => new Supervisor ( restarter ) ) ) ;
299
+ var router = Sys . ActorOf ( new RoundRobinPool ( 3 ) . Props ( Props . Create ( ( ) => new RestartActor ( TestActor ) ) ) ) ;
300
+ var restarted = new HashSet < string > ( ) ;
305
301
306
- supervisor . Tell ( new RoundRobinPool ( 3 ) . Props ( Props . Create ( ( ) => new RestartActor ( TestActor ) ) ) ) ;
307
-
308
- var router = ExpectMsg < IActorRef > ( ) ;
309
- EventFilter . Exception < ArgumentException > ( "die" ) . ExpectOne ( ( ) =>
302
+ for ( var i = 0 ; i < 3 ; i ++ )
310
303
{
311
304
router . Tell ( "die" ) ;
312
- } ) ;
313
- ExpectMsg < ArgumentException > ( ) . Message . Should ( ) . Be ( "die" ) ;
314
- ExpectMsg ( "restarted" ) ;
315
- ExpectMsg ( "restarted" ) ;
316
- ExpectMsg ( "restarted" ) ;
305
+ ExpectMsg ( "restarted" ) ;
306
+ restarted . Add ( LastSender . Path . Name ) ;
307
+ }
308
+
309
+ restarted . Count . Should ( ) . Be ( 3 ) ;
310
+ restarted . Should ( ) . BeEquivalentTo ( ( ( RoutedActorRef ) router ) . Children . Select ( c => c . Path . Name ) ) ;
317
311
}
318
312
319
313
[ Fact ]
Original file line number Diff line number Diff line change @@ -354,15 +354,9 @@ public override ActorBase CreateRouterActor()
354
354
/// <summary>
355
355
/// TBD
356
356
/// </summary>
357
- public static SupervisorStrategy DefaultSupervisorStrategy
358
- {
359
- get
360
- {
361
- return new OneForOneStrategy ( Decider . From ( Directive . Escalate ) ) ;
362
- }
363
- }
357
+ public static SupervisorStrategy DefaultSupervisorStrategy => SupervisorStrategy . DefaultStrategy ;
358
+
364
359
365
-
366
360
public bool Equals ( Pool other )
367
361
{
368
362
if ( ReferenceEquals ( null , other ) ) return false ;
You can’t perform that action at this time.
0 commit comments