Esempio n. 1
0
        public void Cancel_ShouldCancelAllWorkItems()
        {
            var command     = AutoFixture.Create <AddJobRequest>();
            var addResponse = ServerChannel.SendRequest <CreateEntityResponse <int> >(UriFactory.Create(EndPoint.QueueJob),
                                                                                      command);

            addResponse.Succeeded.Should().BeTrue();

            var cancelcommand = new CancelJobRequest()
            {
                JobId = addResponse.EntityIdentifier
            };
            var cancelResponse = ServerChannel.SendRequest <Response>(UriFactory.Create(EndPoint.CancelJob),
                                                                      cancelcommand);

            cancelResponse.Succeeded.Should().BeTrue();

            using (var session = DocumentStore.OpenSession())
            {
                var job = session.Load <Job>(addResponse.EntityIdentifier);

                job.Should().NotBeNull();
                var workItems = session.Query <WorkItem>().Where(w => w.Job.Id.Equals(job.Id)).ToList();

                workItems.All(t => t.Status.Equals(WorkItemStatus.Cancelled)).Should().BeTrue();
            }
        }
Esempio n. 2
0
        private void btnSubmitCommand_Click(object sender, EventArgs e)
        {
            var bytes   = File.ReadAllBytes(@"C:\Code\RedGate.BuildTools\AcceptanceTests\bin\Debug.zip");
            var command = new AddJobRequest()
            {
                Arguments = txtArguments.Text, InitiatedBy = "Me", Runner = txtRunner.Text, WorkDirectoryArchive = bytes
            };
            var uriFactory = this.checkBox1.Checked ? new UriFactoryForTesting(Settings.Default) : new UriFactory(Settings.Default);
            var response   = ServerChannel.SendRequest <CreateEntityResponse <int> >(uriFactory.Create(EndPoint.QueueJob), command);

            MessageBox.Show(@"Job added " + response.EntityIdentifier);
        }
Esempio n. 3
0
        private void AddJob(Action <Job, AddJobRequest> assertAction)
        {
            var command  = AutoFixture.Create <AddJobRequest>();
            var response = ServerChannel.SendRequest <CreateEntityResponse <int> >(UriFactory.Create(EndPoint.QueueJob),
                                                                                   command);

            response.Succeeded.Should().BeTrue();
            using (var session = DocumentStore.OpenSession())
            {
                var job = session.Load <Job>(response.EntityIdentifier);

                assertAction(job, command);
            }
        }
Esempio n. 4
0
        public void Agent_ShouldExecuteTestsAndReturnArtifacts()
        {
            const string runner    = @"C:\Program Files (x86)\NUnit-2.6.2\bin\nunit-console-x86.exe";
            string       arguments = string.Format(@"{0} ", FullAssemblyName);


            var workDirectoryArchive = CreateWorkDirectoryArchive(@"..\..\..\..\Delen.Test.NUnitSample\bin\Debug\");
            var command = new AddJobRequest
            {
                Arguments            = arguments,
                InitiatedBy          = "Me",
                Runner               = runner,
                WorkDirectoryArchive = File.ReadAllBytes(workDirectoryArchive),
                ArtifactSearchFilter = "TestResult.xml"
            };
            var response =
                ServerChannel.SendRequest <CreateEntityResponse <int> >(
                    new UriFactoryForTesting(Settings.Default).Create(EndPoint.QueueJob), command);

            var jobProcessed = false;

            DocumentStore.Changes().ForDocumentsStartingWith("workitem").Subscribe(
                new DocumentObserver(a =>
            {
                using (var session = DocumentStore.OpenSession())
                {
                    var workItem = session.Query <WorkItem>().First(w => w.Job.Id.Equals(response.EntityIdentifier));
                    if (workItem.Status == WorkItemStatus.Successful)
                    {
                        jobProcessed = true;
                    }
                }
            }));

            DocumentStore.Changes().WaitForAllPendingSubscriptions();
            StartAgent();

            WaitUntil(() => jobProcessed == false, () => AgentHasBeenRunningFor > TimeSpan.FromSeconds(15));

            using (var session = DocumentStore.OpenSession())
            {
                var workitem = session.Query <WorkItem>().First(s => s.Job.Id.Equals(response.EntityIdentifier));
                AssertArtifactIsCorrect(workitem);
            }
        }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            const string runner    = @"C:\Program Files (x86)\NUnit-2.6.2\bin\nunit-console-x86.exe";
            string       arguments = string.Format(@"{0} ", BaseFixture.AssemblyName + ".dll");

            var workDirectoryArchive = WorkFixture.CreateWorkDirectoryArchive(@"..\..\..\..\..\Tests\Delen.Test.NUnitSample\bin\Debug\");
            var command = new AddJobRequest
            {
                Arguments            = arguments,
                InitiatedBy          = "Me",
                Runner               = runner,
                WorkDirectoryArchive = File.ReadAllBytes(workDirectoryArchive),
                ArtifactSearchFilter = "TestResult.xml"
            };

            ServerChannel.SendRequest <CreateEntityResponse <int> >(
                new UriFactory(Settings.Default).Create(EndPoint.QueueJob), command);
            MessageBox.Show(@"Done.");
        }