Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some improvements that we used in our workflow #33

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions TeamCitySharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{263F35DD
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamCitySharp.IntegrationTests", "src\Tests\IntegrationTests\TeamCitySharp.IntegrationTests.csproj", "{BA409A09-CC7B-4A71-A3D4-FE27234A721B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamCitySharp.UnitTests", "src\Tests\UnitTests\TeamCitySharp.UnitTests.csproj", "{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamCitySharp", "src\TeamCitySharp\TeamCitySharp.csproj", "{419C8D24-ED8A-47BE-87BB-8790534FEF09}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamCitySharp", "src\TeamCitySharp\TeamCitySharp.csproj", "{419C8D24-ED8A-47BE-87BB-8790534FEF09}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documentation", "Documentation", "{E947C127-1479-451D-994A-0E6935999466}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamCitySharp.UnitTests", "src\Tests\UnitTests\TeamCitySharp.UnitTests.csproj", "{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -36,16 +36,6 @@ Global
{BA409A09-CC7B-4A71-A3D4-FE27234A721B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BA409A09-CC7B-4A71-A3D4-FE27234A721B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BA409A09-CC7B-4A71-A3D4-FE27234A721B}.Release|x86.ActiveCfg = Release|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Debug|x86.ActiveCfg = Debug|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Release|Any CPU.Build.0 = Release|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9}.Release|x86.ActiveCfg = Release|Any CPU
{419C8D24-ED8A-47BE-87BB-8790534FEF09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{419C8D24-ED8A-47BE-87BB-8790534FEF09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{419C8D24-ED8A-47BE-87BB-8790534FEF09}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
Expand All @@ -58,13 +48,25 @@ Global
{419C8D24-ED8A-47BE-87BB-8790534FEF09}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{419C8D24-ED8A-47BE-87BB-8790534FEF09}.Release|x86.ActiveCfg = Release|Any CPU
{419C8D24-ED8A-47BE-87BB-8790534FEF09}.Release|x86.Build.0 = Release|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Debug|x86.ActiveCfg = Debug|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Debug|x86.Build.0 = Debug|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Release|Any CPU.Build.0 = Release|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Release|x86.ActiveCfg = Release|Any CPU
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BA409A09-CC7B-4A71-A3D4-FE27234A721B} = {263F35DD-20C1-4209-B121-E962C9328C70}
{1DA175C4-2A6F-4B52-A9B4-87D382150AE9} = {263F35DD-20C1-4209-B121-E962C9328C70}
{031165E3-0EC4-4E0D-BF8E-E63C732A1D6F} = {263F35DD-20C1-4209-B121-E962C9328C70}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {81D02472-9664-494C-B6A4-0D6ABBD44EC7}
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 49 additions & 49 deletions src/TeamCitySharp/ActionTypes/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,66 @@

namespace TeamCitySharp.ActionTypes
{
public class Tests : ITests
{
#region Attributes
public class Tests : ITests
{
#region Attributes

private ITeamCityCaller m_caller;
private ITeamCityCaller m_caller;

#endregion
#endregion

#region Constructor
#region Constructor

internal Tests(ITeamCityCaller caller)
{
m_caller = caller;
}
internal Tests(ITeamCityCaller caller)
{
m_caller = caller;
}

#endregion
#endregion

#region Public Methods
#region Public Methods

public TestOccurrences ByBuildLocator(BuildLocator locator)
{
return m_caller.Get<TestOccurrences>($"/testOccurrences?locator=build:({locator})");
}
public TestOccurrences ByBuildLocator(BuildLocator locator)
{
return m_caller.Get<TestOccurrences>($"/testOccurrences?locator=currentlyFailing:true&build:({locator})&fields=testOccurrence(id,name,status,href,details,duration,newFailure,metadata)");
}

public TestOccurrences ByProjectLocator(ProjectLocator locator)
{
return m_caller.Get<TestOccurrences>($"/testOccurrences?locator=currentlyFailing:true,affectedProject:({locator})");
}
public TestOccurrences ByProjectLocator(ProjectLocator locator)
{
return m_caller.Get<TestOccurrences>($"/testOccurrences?locator=currentlyFailing:true,affectedProject:({locator})&fields=testOccurrence(id,name,status,href,details,duration,newFailure,metadata,build)");
}

public TestOccurrences ByTestLocator(TestLocator locator)
{
return m_caller.Get<TestOccurrences>($"/testOccurrences?locator=test:({locator})");
}
public TestOccurrences ByTestLocator(TestLocator locator)
{
return m_caller.Get<TestOccurrences>($"/testOccurrences?locator=test:({locator})");
}

public List<TestOccurrences> All(BuildLocator locator)
{
return AllResults(ByBuildLocator(locator));
}
public List<TestOccurrences> All(BuildLocator locator)
{
return AllResults(ByBuildLocator(locator));
}

public List<TestOccurrences> All(ProjectLocator locator)
{
return AllResults(ByProjectLocator(locator));
}
public List<TestOccurrences> All(ProjectLocator locator)
{
return AllResults(ByProjectLocator(locator));
}

public List<TestOccurrences> All(TestLocator locator)
{
return AllResults(ByTestLocator(locator));
}
#endregion
#region Private Method
private List<TestOccurrences> AllResults(TestOccurrences firstPageResult)
{
var result = new List<TestOccurrences>() { firstPageResult };
while (!(string.IsNullOrEmpty(result.Last().NextHref)))
{
var response = m_caller.GetNextHref<TestOccurrences>(result.Last().NextHref);
result.Add(response);
}
return result;
public List<TestOccurrences> All(TestLocator locator)
{
return AllResults(ByTestLocator(locator));
}
#endregion
#region Private Method
private List<TestOccurrences> AllResults(TestOccurrences firstPageResult)
{
var result = new List<TestOccurrences>() { firstPageResult };
while (!(string.IsNullOrEmpty(result.Last().NextHref)))
{
var response = m_caller.GetNextHref<TestOccurrences>(result.Last().NextHref);
result.Add(response);
}
return result;
}
#endregion
}
#endregion
}
}
4 changes: 4 additions & 0 deletions src/TeamCitySharp/DomainEntities/BuildConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System.Linq;

namespace TeamCitySharp.DomainEntities
{
Expand All @@ -9,6 +10,9 @@ public override string ToString()
return Name;
}

[JsonIgnore]
public string BuildName => Id?.Split('_')?.ElementAtOrDefault(1);

[JsonProperty("id")]
public string Id { get; set; }

Expand Down
112 changes: 71 additions & 41 deletions src/TeamCitySharp/DomainEntities/TestOccurrence.cs
Original file line number Diff line number Diff line change
@@ -1,66 +1,96 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;

namespace TeamCitySharp.DomainEntities
{
public class TestOccurrence
{
public override string ToString()
public class TestMetadata
{
return "testOccurrence";
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("value")]
public string Value { get; set; }
}
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("name")]
public string Name { get; set; }
public class TestMetadataContainer
{
[JsonProperty("count")]
public int Count { get; set; }

[JsonProperty("typedValues")]
public List<TestMetadata> Metadata { get; set; }
}

public class TestOccurrence
{
public override string ToString()
{
return "testOccurrence";
}


[JsonProperty("status")]
public string Status { get; set; }
[JsonIgnore]
public string BuildName => Name?.Split(':')?.ElementAtOrDefault(0)?.Replace(".dll", "")?.Replace(".", "");

[JsonProperty("ignored")]
public bool Ignored { get; set; }
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("duration")]
public int Duration { get; set; }
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("runOrder")]
public string RunOrder { get; set; }
[JsonProperty("status")]
public string Status { get; set; }

[JsonProperty("muted")]
public bool Muted { get; set; }
[JsonProperty("ignored")]
public bool Ignored { get; set; }

[JsonProperty("currentlyMuted")]
public bool CurrentlyMuted { get; set; }
[JsonProperty("duration")]
public int Duration { get; set; }

[JsonProperty("currentlyInvestigated")]
public bool CurrentlyInvestigated { get; set; }
[JsonProperty("runOrder")]
public string RunOrder { get; set; }

[JsonProperty("href")]
public string Href { get; set; }
[JsonProperty("muted")]
public bool Muted { get; set; }

[JsonProperty("ignoreDetails")]
public string IgnoreDetails { get; set; }
[JsonProperty("currentlyMuted")]
public bool CurrentlyMuted { get; set; }

[JsonProperty("details")]
public string Details { get; set; }
[JsonProperty("currentlyInvestigated")]
public bool CurrentlyInvestigated { get; set; }

[JsonProperty("test")]
public Test Test { get; set; }
[JsonProperty("href")]
public string Href { get; set; }

[JsonProperty("mute")]
public Mute Mute { get; set; }
[JsonProperty("ignoreDetails")]
public string IgnoreDetails { get; set; }

[JsonProperty("build")]
public Build Build { get; set; }
[JsonProperty("details")]
public string Details { get; set; }

[JsonProperty("firstFailed")]
public Build FirstFailed { get; set; }
[JsonProperty("test")]
public Test Test { get; set; }

[JsonProperty("nextFixed")]
public Build NextFixed { get; set; }
[JsonProperty("mute")]
public Mute Mute { get; set; }

[JsonProperty("logAnchor")]
public string LogAnchor { get; set; }
}
[JsonProperty("build")]
public Build Build { get; set; }

[JsonProperty("firstFailed")]
public Build FirstFailed { get; set; }

[JsonProperty("nextFixed")]
public Build NextFixed { get; set; }

[JsonProperty("logAnchor")]
public string LogAnchor { get; set; }

[JsonProperty("newFailure")]
public bool? NewFailure { get; set; }

[JsonProperty("metadata")]
public TestMetadataContainer Metadata { get; set; }
}
}
44 changes: 21 additions & 23 deletions src/TeamCitySharp/TeamCitySharp.csproj
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<Version>2.0.12</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<Product>MvsTelecom.Teamcity.Api</Product>
<Company>MVS Telecom</Company>
<Authors>MVS Telecom</Authors>
<Version>0.0.0.3</Version>
<PackageProjectUrl>https://github.com/MVS-Telecom/mvstelecom-teamcity-api</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
<Description>C# API client for TeamCity</Description>
<PackageId>MvsTelecom.Teamcity.Api</PackageId>
</PropertyGroup>
<!-- .NET Standard 2.0 references, compilation flags and build options -->


<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>NETCORE;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>
<!-- .NET 4.5 references, compilation flags and build options -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Drawing" />
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45'">
<DefineConstants>NET45;NETFULL</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net45'">
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />

<ItemGroup>
<None Include="..\..\icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
Loading