public void it_returns_the_builds_queued_compatible_agents()
        {
            AgentField            agentField            = AgentField.WithFields(id: true);
            CompatibleAgentsField compatibleAgentsField = CompatibleAgentsField.WithFields(agent: agentField);
            BuildField            buildField            = BuildField.WithFields(compatibleAgents: compatibleAgentsField, id: true);
            BuildsField           buildsField           = BuildsField.WithFields(buildField: buildField);
            var result = m_client.BuildQueue.GetFields(buildsField.ToString()).All();

            Assert.IsNotEmpty(result);
        }
Exemple #2
0
        public void it_returns_full_build_field_2()
        {
            var                            tempBuildConfig                = m_client.BuildConfigs.All().First();
            ItemsField                     itemsField                     = ItemsField.WithFields(item: true);
            BuildsField                    buildsField                    = BuildsField.WithFields();
            RelatedField                   relatedField                   = RelatedField.WithFields(builds: buildsField);
            RelatedIssuesField             relatedIssuesField             = RelatedIssuesField.WithFields(href: true);
            ArtifactDependenciesField      artifactDependenciesField      = ArtifactDependenciesField.WithFields();
            BuildArtifactDependenciesField buildArtifactDependenciesField = BuildArtifactDependenciesField.WithFields();
            BuildSnapshotDependenciesField buildSnapshotDependenciesField = BuildSnapshotDependenciesField.WithFields();
            DatasField                     datasField                     = DatasField.WithFields();
            StatisticsField                statisticsField                = StatisticsField.WithFields();
            EntriesField                   entriesField                   = EntriesField.WithFields();
            PropertiesField                propertiesField                = PropertiesField.WithFields();
            ArtifactsField                 artifactsField                 = ArtifactsField.WithFields(href: true);
            ProblemOccurrencesField        problemOccurrences             = ProblemOccurrencesField.WithFields();
            TestOccurrencesField           testOccurrencesField           = TestOccurrencesField.WithFields();
            AgentField                     agentField                     = AgentField.WithFields(id: true);
            CompatibleAgentsField          compatibleAgentsField          = CompatibleAgentsField.WithFields(agent: agentField, href: true);
            BuildField                     buildField1                    = BuildField.WithFields(id: true);
            BuildChangeField               buildChangeField               = BuildChangeField.WithFields(nextBuild: buildField1, prevBuild: buildField1);
            BuildChangesField              buildChangesField              = BuildChangesField.WithFields(buildChange: buildChangeField);
            RevisionField                  revisionField                  = RevisionField.WithFields(version: true);
            RevisionsField                 revisionsField                 = RevisionsField.WithFields();
            LastChangesField               lastChangesField               = LastChangesField.WithFields();
            ChangesField                   changesField                   = ChangesField.WithFields();
            TriggeredField                 triggeredField                 = TriggeredField.WithFields(type: true);
            ProgressInfoField              progressInfoField              = ProgressInfoField.WithFields(currentStageText: true);
            TagsField                      tagsField             = TagsField.WithFields();
            UserField                      userField             = UserField.WithFields(id: true);
            CommentField                   commentField          = CommentField.WithFields(text: true);
            BuildTypeField                 buildTypeField        = BuildTypeField.WithFields(id: true);
            BuildTypeWrapperField          buildTypeWrapperField = BuildTypeWrapperField.WithFields(buildType: buildTypeField);
            LinkField                      linkField             = LinkField.WithFields(type: true);
            LinksField                     linksField            = LinksField.WithFields(link: linkField);
            var                            buildField            = BuildField.WithFields(links: linksField, buildType: buildTypeField, comment: commentField,
                                                                                         tags: tagsField, pinInfo: commentField, user: userField, running_info: progressInfoField,
                                                                                         canceledInfo: commentField, triggered: triggeredField, lastChanges: lastChangesField, changes: changesField,
                                                                                         revisions: revisionsField, versionedSettingsRevision: revisionField,
                                                                                         artifactDependencyChanges: buildChangesField, agent: agentField, compatibleAgents: compatibleAgentsField,
                                                                                         testOccurrences: testOccurrencesField, problemOccurrences: problemOccurrences, artifacts: artifactsField,
                                                                                         properties: propertiesField, resultingProperties: propertiesField, attributes: entriesField,
                                                                                         statistics: statisticsField, metadata: datasField, snapshotDependencies: buildSnapshotDependenciesField,
                                                                                         artifactDependencies: buildArtifactDependenciesField, customArtifactDependencies: artifactDependenciesField,
                                                                                         statusChangeComment: commentField, relatedIssues: relatedIssuesField, replacementIds: itemsField,
                                                                                         related: relatedField);

            var tempBuild = m_client.Builds.LastBuildByBuildConfigId(tempBuildConfig.Id);
            var build     = m_client.Builds.GetFields(buildField.ToString()).ById(tempBuild.Id);

            Assert.IsNotNull(build);
        }
        private BuildStatus GetStatus(string buildTypeId)
        {
            var pendingChanges = this.teamCityClient.Changes.ByBuildConfigId(buildTypeId).FirstOrDefault();
            var queuedBuild    = this.teamCityClient.BuildQueue.ByBuildTypeLocator(BuildTypeLocator.WithId(buildTypeId)).FirstOrDefault();
            var runningBuild   = this.teamCityClient.Builds.ByBuildLocator(BuildLocator.WithDimensions(BuildTypeLocator.WithId(buildTypeId), running: true)).FirstOrDefault();
            var lastBuild      = this.teamCityClient.Builds
                                 .GetFields(BuildsField
                                            .WithFields(BuildField.WithFields(
                                                            true,
                                                            true,
                                                            changes: ChangesField.WithFields(ChangeField.WithFields(true)),
                                                            status: true))
                                            .ToString()).ByBuildConfigId(buildTypeId).OrderByDescending(x => x.Number).FirstOrDefault();

            if (lastBuild != null)
            {
                return(new BuildStatus(queuedBuild != null | runningBuild != null | GetHasPendingChanges(pendingChanges, lastBuild), lastBuild.Status));
            }

            return(new BuildStatus(false, "None"));
        }
Exemple #4
0
        public void it_returns_correct_next_builds_with_filter()
        {
            const string buildId = "5726";
            var          client  = new TeamCityClient(m_server, m_useSsl);

            client.ConnectAsGuest();

            BuildField  buildField  = BuildField.WithFields(id: true, number: true, finishDate: true);
            BuildsField buildsField = BuildsField.WithFields(buildField);
            var         builds      = client.Builds.GetFields(buildsField.ToString()).NextBuilds(buildId, 10);

            Assert.That(builds != null);
            Assert.That(builds.Count == 10);
            int i = 0;

            foreach (var build in builds)
            {
                Assert.That(build.FinishDate != new DateTime());
                Console.WriteLine("{0} => BuildId => {1} FinishDate => {2}", i, build.Id, build.FinishDate);
                i++;
            }
        }
        public void it_returns_first_build_types_builds_investigations_compatible_agents_field_null()

        {
            var tempBuildConfig = m_client.BuildConfigs.All().First();
            // Section 1
            var buildTypeField = BuildTypeField.WithFields(id: true);
            var buildConfig    = m_client.BuildConfigs.GetFields(buildTypeField.ToString()).ByConfigurationId(tempBuildConfig.Id);

            Assert.IsNull(buildConfig.Builds, "No builds 1");
            Assert.IsNull(buildConfig.Investigations, "No Investigations 1");
            Assert.IsNull(buildConfig.CompatibleAgents, "No CompatibleAgents 1");

            // section 2
            var buildsField           = BuildsField.WithFields(count: true);
            var investigationsField   = InvestigationsField.WithFields();
            var compatibleAgentsField = CompatibleAgentsField.WithFields();

            buildTypeField = BuildTypeField.WithFields(id: true, builds: buildsField, investigations: investigationsField, compatibleAgents: compatibleAgentsField);
            buildConfig    = m_client.BuildConfigs.GetFields(buildTypeField.ToString()).ByConfigurationId(tempBuildConfig.Id);
            Assert.IsNotNull(buildConfig.Builds, "No builds 2");
            Assert.IsNull(buildConfig.Builds.Href, "No builds href 2");
            Assert.IsNotNull(buildConfig.Investigations, "No Investigations 2");
            Assert.IsNotNull(buildConfig.Investigations.Href, "No Investigations href 2");
            Assert.IsNotNull(buildConfig.CompatibleAgents, "No CompatibleAgents 2");
            Assert.IsNotNull(buildConfig.CompatibleAgents.Href, "No CompatibleAgents href 2");

            // section 3
            buildsField           = BuildsField.WithFields(count: true, href: true);
            investigationsField   = InvestigationsField.WithFields(href: true);
            compatibleAgentsField = CompatibleAgentsField.WithFields(href: true);
            buildTypeField        = BuildTypeField.WithFields(id: true, builds: buildsField, investigations: investigationsField, compatibleAgents: compatibleAgentsField);
            buildConfig           = m_client.BuildConfigs.GetFields(buildTypeField.ToString()).ByConfigurationId(tempBuildConfig.Id);
            Assert.IsNotNull(buildConfig.Builds, "No builds 3");
            Assert.IsNotNull(buildConfig.Builds.Href, "No builds href 3");
            Assert.IsNotNull(buildConfig.Investigations, "No Investigations 3");
            Assert.IsNotNull(buildConfig.Investigations.Href, "No Investigations href 3");
            Assert.IsNotNull(buildConfig.CompatibleAgents, "No CompatibleAgents 3");
            Assert.IsNotNull(buildConfig.CompatibleAgents.Href, "No CompatibleAgents href 3");
        }