예제 #1
0
        public Test_FixtureNoConnect(CadenceFixture fixture)
        {
            var settings = new CadenceSettings()
            {
                DefaultDomain          = CadenceFixture.DefaultDomain,
                LogLevel               = CadenceTestHelper.LogLevel,
                CreateDomain           = true,
                Debug                  = CadenceTestHelper.Debug,
                DebugPrelaunched       = CadenceTestHelper.DebugPrelaunched,
                DebugDisableHeartbeats = CadenceTestHelper.DebugDisableHeartbeats
            };

            if (fixture.Start(settings, keepConnection: true, keepOpen: CadenceTestHelper.KeepCadenceServerOpen, noClient: true) == TestFixtureStatus.Started)
            {
                this.fixture = fixture;
                this.client  = fixture.Client = CadenceClient.ConnectAsync(fixture.Settings).Result;

                // Auto register the test workflow and activity implementations.

                client.RegisterAssemblyAsync(Assembly.GetExecutingAssembly()).Wait();

                // Start the worker.

                client.StartWorkerAsync(CadenceTestHelper.TaskList).Wait();
            }
            else
            {
                this.fixture = fixture;
                this.client  = fixture.Client;
            }
        }
예제 #2
0
        public Test_Replay(CadenceFixture fixture)
        {
            TestHelper.ResetDocker(this.GetType());

            var settings = new CadenceSettings()
            {
                DefaultDomain          = CadenceFixture.DefaultDomain,
                LogLevel               = CadenceTestHelper.LogLevel,
                CreateDomain           = true,
                Debug                  = CadenceTestHelper.Debug,
                DebugPrelaunched       = CadenceTestHelper.DebugPrelaunched,
                DebugDisableHeartbeats = CadenceTestHelper.DebugDisableHeartbeats,
                ClientIdentity         = CadenceTestHelper.ClientIdentity
            };

            if (fixture.Start(settings, reconnect: true, keepRunning: CadenceTestHelper.KeepCadenceServerOpen) == TestFixtureStatus.Started)
            {
                this.fixture = fixture;
                this.client  = fixture.Client;

                // Auto register the test workflow and activity implementations.

                client.RegisterAssemblyAsync(Assembly.GetExecutingAssembly()).WaitWithoutAggregate();

                // Start the worker.

                client.StartWorkerAsync(CadenceTestHelper.TaskList).WaitWithoutAggregate();
            }
            else
            {
                this.fixture = fixture;
                this.client  = fixture.Client;
            }
        }
예제 #3
0
        public Test_EndToEnd(CadenceFixture fixture, ITestOutputHelper outputHelper)
        {
            TestHelper.ResetDocker(this.GetType());

            testWriter = new TestOutputWriter(outputHelper);

            // Initialize the Cadence fixture.

            var settings = new CadenceSettings()
            {
                DefaultDomain          = CadenceFixture.DefaultDomain,
                LogLevel               = CadenceTestHelper.LogLevel,
                CreateDomain           = true,
                Debug                  = CadenceTestHelper.Debug,
                DebugPrelaunched       = CadenceTestHelper.DebugPrelaunched,
                DebugDisableHeartbeats = CadenceTestHelper.DebugDisableHeartbeats,
                ClientIdentity         = CadenceTestHelper.ClientIdentity
            };

            if (fixture.Start(settings, reconnect: true, keepRunning: CadenceTestHelper.KeepCadenceServerOpen) == TestFixtureStatus.Started)
            {
                this.fixture     = fixture;
                this.client      = fixture.Client;
                this.proxyClient = new HttpClient()
                {
                    BaseAddress = client.ProxyUri
                };

                // Setup a service for activity dependency injection testing if it doesn't
                // already exist.

                if (NeonHelper.ServiceContainer.GetService <ActivityDependency>() == null)
                {
                    NeonHelper.ServiceContainer.AddSingleton(typeof(ActivityDependency), new ActivityDependency()
                    {
                        Hello = "World!"
                    });
                }

                // Auto register the test workflow and activity implementations.

                client.RegisterAssemblyAsync(Assembly.GetExecutingAssembly()).WaitWithoutAggregate();

                // Start the worker.

                client.StartWorkerAsync(CadenceTestHelper.TaskList).WaitWithoutAggregate();
            }
            else
            {
                this.fixture     = fixture;
                this.client      = fixture.Client;
                this.proxyClient = new HttpClient()
                {
                    BaseAddress = client.ProxyUri
                };
            }
        }
예제 #4
0
        public CadenceTests(CadenceFixture fixture)
        {
            TestHelper.ResetDocker(this.GetType());

            var settings = new CadenceSettings()
            {
                DefaultDomain = "test-domain",
                LogLevel      = LogLevel.Info,
                CreateDomain  = true            // <-- this ensures that the default domain exists
            };

            // This starts/restarts the [nforgeio/cadence-dev] container for the first test
            // run in this class.  Subsequent tests run from the class will use the existing
            // container instance, saving time by not having to wait for Cadence and Cassandra
            // to spin up and be ready for business.
            //
            // The [keepOpen=true] parameter tells the fixture to let the container continue running
            // after all of the tests have completed.  This is useful for examining workflow histories
            // via the Cadence UX after the tests have completed.  You can view the Cadence portal at
            //
            //      http://localhost:8088
            //
            // You can pass [keepOpen=false] to have the fixture remove the container after the
            // test run if you wish.

            if (fixture.Start(settings, reconnect: true, keepRunning: true) == TestFixtureStatus.Started)
            {
                this.fixture = fixture;
                this.client  = fixture.Client;

                // Register the test workflow and activity implementations
                // from this assembly and start the worker.

                client.RegisterAssemblyAsync(Assembly.GetExecutingAssembly()).WaitWithoutAggregate();
                client.StartWorkerAsync("test-tasks").WaitWithoutAggregate();
            }
            else
            {
                this.fixture = fixture;
                this.client  = fixture.Client;
            }
        }