Beispiel #1
17
        private TestKitBase(TestKitAssertions assertions, ActorSystem system, Config config, string actorSystemName, string testActorName)
        {
            if(assertions == null) throw new ArgumentNullException("assertions");
            if(system == null)
            {
                var configWithDefaultFallback = config.SafeWithFallback(_defaultConfig);
                system = ActorSystem.Create(actorSystemName ?? "test", configWithDefaultFallback);
            }

            _assertions = assertions;
            _system = system;
            system.RegisterExtension(new TestKitExtension());
            system.RegisterExtension(new TestKitAssertionsExtension(assertions));
            _testKitSettings = TestKitExtension.For(_system);
            _queue = new BlockingQueue<MessageEnvelope>();
            _log = Logging.GetLogger(system, GetType());
            _eventFilterFactory = new EventFilterFactory(this);
            if (string.IsNullOrEmpty(testActorName))
                testActorName = "testActor" + _testActorId.IncrementAndGet();

            var testActor = CreateTestActor(system, testActorName);
            //Wait for the testactor to start
            AwaitCondition(() =>
            {
                var repRef = testActor as RepointableRef;
                return repRef == null || repRef.IsStarted;
            }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(10));

            if(!(this is NoImplicitSender))
            {
                InternalCurrentActorCellKeeper.Current = (ActorCell)((ActorRefWithCell)testActor).Underlying;
            }
            _testActor = testActor;

        }
Beispiel #2
0
        private TestKitBase(TestKitAssertions assertions, ActorSystem system, Config config, string actorSystemName = null)
        {
            if (assertions == null)
            {
                throw new ArgumentNullException("assertions");
            }
            if (system == null)
            {
                var configWithDefaultFallback = config.SafeWithFallback(_defaultConfig);
                system = ActorSystem.Create(actorSystemName ?? "test", configWithDefaultFallback);
            }

            _assertions = assertions;
            _system     = system;
            system.RegisterExtension(new TestKitExtension());
            system.RegisterExtension(new TestKitAssertionsExtension(assertions));
            _testKitSettings = TestKitExtension.For(_system);
            _queue           = new BlockingQueue <MessageEnvelope>();
            _log             = Logging.GetLogger(system, GetType());


            var testActor = CreateTestActor(system, "testActor" + _testActorId.IncrementAndGet());

            _testActor = testActor;
            //Wait for the testactor to start
            AwaitCondition(() =>
            {
                var repRef = _testActor as RepointableRef;
                return(repRef == null || repRef.IsStarted);
            }, TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(10));
        }
Beispiel #3
0
        private TestKitBase(TestKitAssertions assertions, ActorSystem system, Config config, string actorSystemName = null)
        {
            if(assertions == null) throw new ArgumentNullException("assertions");
            if(system == null)
            {
                var configWithDefaultFallback = config.SafeWithFallback(_defaultConfig);
                system = ActorSystem.Create(actorSystemName ?? "test", configWithDefaultFallback);
            }

            _assertions = assertions;
            _system = system;
            system.RegisterExtension(new TestKitExtension());
            system.RegisterExtension(new TestKitAssertionsExtension(assertions));
            _testKitSettings = TestKitExtension.For(_system);
            _queue = new BlockingQueue<MessageEnvelope>();
            _log = Logging.GetLogger(system, GetType());


            var testActor = CreateTestActor(system, "testActor" + _testActorId.IncrementAndGet());
            _testActor = testActor;
            //Wait for the testactor to start
            AwaitCondition(() =>
            {
                var repRef = _testActor as RepointableRef;
                return repRef == null || repRef.IsStarted;
            }, TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(10));
        }
Beispiel #4
0
        private TestKitBase(TestKitAssertions assertions, ActorSystem system, Config config, string actorSystemName, string testActorName)
        {
            if (assertions == null)
            {
                throw new ArgumentNullException("assertions");
            }
            if (system == null)
            {
                var configWithDefaultFallback = config.SafeWithFallback(_defaultConfig);
                system = ActorSystem.Create(actorSystemName ?? "test", configWithDefaultFallback);
            }

            _assertions = assertions;
            _system     = system;
            system.RegisterExtension(new TestKitExtension());
            system.RegisterExtension(new TestKitAssertionsExtension(assertions));
            _testKitSettings    = TestKitExtension.For(_system);
            _queue              = new BlockingQueue <MessageEnvelope>();
            _log                = Logging.GetLogger(system, GetType());
            _eventFilterFactory = new EventFilterFactory(this);
            if (string.IsNullOrEmpty(testActorName))
            {
                testActorName = "testActor" + _testActorId.IncrementAndGet();
            }

            var testActor = CreateTestActor(system, testActorName);

            //Wait for the testactor to start
            AwaitCondition(() =>
            {
                var repRef = testActor as RepointableRef;
                return(repRef == null || repRef.IsStarted);
            }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(10));

            if (!(this is NoImplicitSender))
            {
                InternalCurrentActorCellKeeper.Current = (ActorCell)((ActorRefWithCell)testActor).Underlying;
            }
            _testActor = testActor;
        }
Beispiel #5
0
 /// <summary>
 /// Create a new instance of the <see cref="TestKitBase"/> class.
 /// If no <paramref name="system"/> is passed in, a new system
 /// with <see cref="DefaultConfig"/> will be created.
 /// </summary>
 /// <param name="assertions"></param>
 /// <param name="system">Optional: The actor system.</param>
 /// <param name="testActorName">Optional: The name of the TestActor.</param>
 protected TestKitBase(TestKitAssertions assertions, ActorSystem system = null, string testActorName = null)
     : this(assertions, system, _defaultConfig, null, testActorName)
 {
 }
 public TestKitAssertionsProvider(TestKitAssertions assertions)
 {
     _assertions = assertions;
 }
Beispiel #7
0
 /// <summary>
 /// Create a new instance of the <see cref="TestKitBase"/> class.
 /// If no <paramref name="system"/> is passed in, a new system
 /// with <see cref="DefaultConfig"/> will be created.
 /// </summary>
 /// <param name="assertions"></param>
 /// <param name="system">Optional: The actor system.</param>
 protected TestKitBase(TestKitAssertions assertions, ActorSystem system = null)
     : this(assertions, system, _defaultConfig)
 {
 }
Beispiel #8
0
 protected MultiNodeClusterSpec(MultiNodeConfig config)
     : base(config)
 {
     _assertions       = new XunitAssertions();
     _roleNameComparer = new RoleNameComparer(this);
 }
Beispiel #9
0
 /// <summary>
 /// Create a new instance of the <see cref="TestKitBase"/> class.
 /// If no <paramref name="system"/> is passed in, a new system 
 /// with <see cref="DefaultConfig"/> will be created.
 /// </summary>
 /// <param name="assertions"></param>
 /// <param name="system">Optional: The actor system.</param>
 protected TestKitBase(TestKitAssertions assertions, ActorSystem system = null)
     : this(assertions, system, _defaultConfig)
 {
 }
Beispiel #10
0
 /// <summary>
 /// Create a new instance of the <see cref="TestKitBase"/> class.
 /// If no <paramref name="system"/> is passed in, a new system 
 /// with <see cref="DefaultConfig"/> will be created.
 /// </summary>
 /// <param name="assertions"></param>
 /// <param name="system">Optional: The actor system.</param>
 /// <param name="testActorName">Optional: The name of the TestActor.</param>
 protected TestKitBase(TestKitAssertions assertions, ActorSystem system = null, string testActorName=null)
     : this(assertions, system, _defaultConfig, null, testActorName)
 {
 }
 public TestKitAssertionsProvider(TestKitAssertions assertions)
 {
     _assertions = assertions;
 }
Beispiel #12
0
 public TestProbe(ActorSystem system, TestKitAssertions assertions)
     : base(assertions, system)
 {
 }
Beispiel #13
0
 public TestProbe(ActorSystem system, TestKitAssertions assertions, string testProbeName=null)
     : base(assertions, system, testProbeName)
 {
 }
Beispiel #14
0
 public TestProbe(ActorSystem system, TestKitAssertions assertions, string testProbeName = null)
     : base(assertions, system, testProbeName)
 {
 }
Beispiel #15
0
 public TestProbe(ActorSystem system, TestKitAssertions assertions)
     : base(assertions, system)
 {
 }
Beispiel #16
0
 /// <summary>
 /// Create a new instance of the <see cref="TestKitBase"/> class.
 /// A new system with the specified configuration will be created.
 /// </summary>
 /// <param name="config">The configuration to use for the system.</param>
 /// <param name="testActorName">Optional: The name of the TestActor.</param>
 /// <param name="assertions"></param>
 /// <param name="actorSystemName"></param>
 protected TestKitBase(TestKitAssertions assertions, Config config, string actorSystemName = null, string testActorName = null)
     : this(assertions, null, config ?? ConfigurationFactory.Empty, actorSystemName, testActorName)
 {
 }
Beispiel #17
0
 /// <summary>
 /// Create a new instance of the <see cref="TestKitBase"/> class.
 /// A new system with the specified configuration will be created.
 /// </summary>
 /// <param name="config">The configuration to use for the system.</param>
 /// <param name="testActorName">Optional: The name of the TestActor.</param>
 /// <param name="assertions"></param>
 /// <param name="actorSystemName"></param>
 protected TestKitBase(TestKitAssertions assertions, Config config, string actorSystemName = null, string testActorName = null)
     : this(assertions, null, config ?? ConfigurationFactory.Empty, actorSystemName, testActorName)
 {
 }
 public TestKitAssertionsExtension(TestKitAssertions assertions)
 {
     _assertions = assertions;
 }