From 1f194e4819e24e92a801966e74b3a8ad2cdff8c4 Mon Sep 17 00:00:00 2001 From: "Joel W. Reed" Date: Sun, 14 Oct 2007 23:08:38 -0400 Subject: [PATCH] add.Microsoft.TeamFoundation.WorkItemTracking.Common --- class/Makefile | 1 + .../ClientService.cs | 18 ++++++ .../Makefile | 2 +- ...t.TeamFoundation.WorkItemTracking.Client.csproj | 3 + .../Project.cs | 60 +++++++++++++++++++ .../ProjectCollection.cs | 70 ++++++++++++++++++++++ .../AssemblyInfo.cs | 34 +++++++++++ .../Makefile | 11 ++++ ...mFoundation.WorkItemTracking.Client.dll.sources | 1 + .../ReadOnlyList.cs | 55 +++++++++++++++++ tools/wit/ChangesetCommand.cs | 9 +-- .../{ChangesetCommand.cs => ProjectsCommand.cs} | 38 +++--------- .../wit/{ChangesetCommand.cs => QueriesCommand.cs} | 17 ++---- tools/wit/wit.exe.sources | 4 +- 14 files changed, 270 insertions(+), 53 deletions(-) create mode 100644 class/Microsoft.TeamFoundation.WorkItemTracking.Client/Project.cs create mode 100644 class/Microsoft.TeamFoundation.WorkItemTracking.Client/ProjectCollection.cs create mode 100644 class/Microsoft.TeamFoundation.WorkItemTracking.Common/AssemblyInfo.cs create mode 100644 class/Microsoft.TeamFoundation.WorkItemTracking.Common/Makefile create mode 100644 class/Microsoft.TeamFoundation.WorkItemTracking.Common/Microsoft.TeamFoundation.WorkItemTracking.Client.dll.sources create mode 100644 class/Microsoft.TeamFoundation.WorkItemTracking.Common/ReadOnlyList.cs copy tools/wit/{ChangesetCommand.cs => ProjectsCommand.cs} (55%) copy tools/wit/{ChangesetCommand.cs => QueriesCommand.cs} (86%) diff --git a/class/Makefile b/class/Makefile index 8599a71..d7b0d46 100644 --- a/class/Makefile +++ b/class/Makefile @@ -8,6 +8,7 @@ SUBDIRS = \ Microsoft.TeamFoundation.Client \ Microsoft.TeamFoundation.VersionControl.Common \ Microsoft.TeamFoundation.VersionControl.Client \ + Microsoft.TeamFoundation.WorkItemTracking.Common \ Microsoft.TeamFoundation.WorkItemTracking.Client DISTFILES = \ diff --git a/class/Microsoft.TeamFoundation.WorkItemTracking.Client/ClientService.cs b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/ClientService.cs index 875dc7b..5362873 100644 --- a/class/Microsoft.TeamFoundation.WorkItemTracking.Client/ClientService.cs +++ b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/ClientService.cs @@ -29,6 +29,7 @@ using System; using System.IO; using System.Collections.Generic; +using System.Data; using System.Net; using System.Reflection; using System.Text; @@ -110,5 +111,22 @@ namespace Microsoft.TeamFoundation.WorkItemTracking.Client.ClientService response.Close(); return msg; } + + public System.Data.DataSet GetStoredQuery(string queryId) { + object[] results = this.Invoke("GetStoredQuery", new object[] { + queryId}); + return ((System.Data.DataSet)(results[0])); + } + + [System.Web.Services.Protocols.SoapHeaderAttribute("RequestHeaderValue", Required=false)] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03/GetStoredQueries", RequestNamespace="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03", ResponseNamespace="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)] + [return: System.Xml.Serialization.XmlElementAttribute("queriesPayload")] + public System.Data.DataSet GetStoredQueries(long rowVersion, int projectId) { + object[] results = this.Invoke("GetStoredQueries", new object[] { + rowVersion, + projectId}); + return ((System.Data.DataSet)(results[0])); + } + } } diff --git a/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Makefile b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Makefile index 981d8c7..755dd22 100644 --- a/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Makefile +++ b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Makefile @@ -4,7 +4,7 @@ SUBDIRS = LIBRARY = Microsoft.TeamFoundation.WorkItemTracking.Client.dll -LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll /r:System.Xml.dll /r:System.Web.Services.dll /r:Microsoft.TeamFoundation.Common.dll /r:Microsoft.TeamFoundation.Client.dll +LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll /r:System.Data.dll /r:System.Xml.dll /r:System.Web.Services.dll /r:Microsoft.TeamFoundation.Common.dll /r:Microsoft.TeamFoundation.Client.dll TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) include ../../build/library.make diff --git a/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Microsoft.TeamFoundation.WorkItemTracking.Client.csproj b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Microsoft.TeamFoundation.WorkItemTracking.Client.csproj index 2fae162..d6a77c3 100644 --- a/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Microsoft.TeamFoundation.WorkItemTracking.Client.csproj +++ b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Microsoft.TeamFoundation.WorkItemTracking.Client.csproj @@ -23,6 +23,7 @@ + @@ -32,6 +33,8 @@ + + diff --git a/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Project.cs b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Project.cs new file mode 100644 index 0000000..c65604b --- /dev/null +++ b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/Project.cs @@ -0,0 +1,60 @@ +// +// Microsoft.TeamFoundation.WorkItemTracking.Client.Project +// +// Authors: +// Joel Reed (joelwreed@gmail.com) +// +// Copyright (C) 2007 Joel Reed +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Xml; +using System.Web.Services; + +namespace Microsoft.TeamFoundation.WorkItemTracking.Client +{ + public sealed class Project + { + private string name; + public string Name + { + get { return name; } + } + + private int id; + public int Id + { + get { return id; } + } + + private Uri uri; + public Uri Uri + { + get { return uri; } + } + + } +} diff --git a/class/Microsoft.TeamFoundation.WorkItemTracking.Client/ProjectCollection.cs b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/ProjectCollection.cs new file mode 100644 index 0000000..2bb6e98 --- /dev/null +++ b/class/Microsoft.TeamFoundation.WorkItemTracking.Client/ProjectCollection.cs @@ -0,0 +1,70 @@ +// +// Microsoft.TeamFoundation.WorkItemTracking.Client.ProjectCollection +// +// Authors: +// Joel Reed (joelwreed@gmail.com) +// +// Copyright (C) 2007 Joel Reed +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Xml; +using System.Web.Services; + +namespace Microsoft.TeamFoundation.WorkItemTracking.Client +{ + public sealed class ProjectCollection + { + public bool Contains(Project project) + { + return true; + } + + public bool Contains(string projectName) + { + return true; + } + + public Project GetById(int projectId) + { + } + + protected override object GetItem(int index) + { + } + + public int IndexOf(Project project) + { + return 0; + } + + public override int Count + { + get { return 0; } + } + + } +} diff --git a/class/Microsoft.TeamFoundation.WorkItemTracking.Common/AssemblyInfo.cs b/class/Microsoft.TeamFoundation.WorkItemTracking.Common/AssemblyInfo.cs new file mode 100644 index 0000000..7c80ca7 --- /dev/null +++ b/class/Microsoft.TeamFoundation.WorkItemTracking.Common/AssemblyInfo.cs @@ -0,0 +1,34 @@ +// +// AssemblyInfo.cs +// +// Author: +// Joel Reed (joelwreed@gmail.com) +// + +using System; +using System.Reflection; +using System.Resources; +using System.Security; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyVersion ("1.0.0")] +[assembly: SatelliteContractVersion ("1.0.0")] + +[assembly: AssemblyTitle("Microsoft.TeamFoundation.WorkItemTracking.Common.dll")] +[assembly: AssemblyDescription("Microsoft.TeamFoundation.WorkItemTracking.Common.dll")] +[assembly: AssemblyConfiguration("Development version")] +[assembly: AssemblyCompany("MONO development team")] +[assembly: AssemblyProduct("MONO CLI")] +[assembly: AssemblyCopyright("(c) 2006 Various Authors")] +[assembly: AssemblyTrademark("")] +#if TARGET_JVM +[assembly: CLSCompliant(false)] +#else +[assembly: CLSCompliant(true)] +#endif + +[assembly: ComVisible(false)] +[assembly: AssemblyDefaultAlias("Microsoft.TeamFoundation.WorkItemTracking.Common.dll")] +[assembly: AssemblyInformationalVersion("0.0.0.1")] +[assembly: NeutralResourcesLanguage("en-US")] diff --git a/class/Microsoft.TeamFoundation.WorkItemTracking.Common/Makefile b/class/Microsoft.TeamFoundation.WorkItemTracking.Common/Makefile new file mode 100644 index 0000000..c7a2b54 --- /dev/null +++ b/class/Microsoft.TeamFoundation.WorkItemTracking.Common/Makefile @@ -0,0 +1,11 @@ +thisdir = class/Microsoft.TeamFoundation.WorkItemTracking.Common +include ../../build/rules.make +SUBDIRS = + +LIBRARY = Microsoft.TeamFoundation.WorkItemTracking.Common.dll + +LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll /r:System.Data.dll /r:System.Xml.dll /r:System.Web.Services.dll /r:Microsoft.TeamFoundation.Common.dll /r:Microsoft.TeamFoundation.Client.dll +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) + +include ../../build/library.make + diff --git a/class/Microsoft.TeamFoundation.WorkItemTracking.Common/Microsoft.TeamFoundation.WorkItemTracking.Client.dll.sources b/class/Microsoft.TeamFoundation.WorkItemTracking.Common/Microsoft.TeamFoundation.WorkItemTracking.Client.dll.sources new file mode 100644 index 0000000..99c401e --- /dev/null +++ b/class/Microsoft.TeamFoundation.WorkItemTracking.Common/Microsoft.TeamFoundation.WorkItemTracking.Client.dll.sources @@ -0,0 +1 @@ +AssemblyInfo.cs ClientService.cs InternalMessage.cs Project.cs WorkItem.cs WorkItemStore.cs WorkItemType.cs \ No newline at end of file diff --git a/class/Microsoft.TeamFoundation.WorkItemTracking.Common/ReadOnlyList.cs b/class/Microsoft.TeamFoundation.WorkItemTracking.Common/ReadOnlyList.cs new file mode 100644 index 0000000..c20f3a6 --- /dev/null +++ b/class/Microsoft.TeamFoundation.WorkItemTracking.Common/ReadOnlyList.cs @@ -0,0 +1,55 @@ +// +// Microsoft.TeamFoundation.WorkItemTracking.Client.ReadOnlyList +// +// Authors: +// Joel Reed (joelwreed@gmail.com) +// +// Copyright (C) 2007 Joel Reed +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Xml; +using System.Web.Services; + +namespace Microsoft.TeamFoundation.WorkItemTracking.Common +{ + public abstract class ReadOnlyList + { + protected ReadOnlyList() + { + } + + protected abstract object GetItem(int index) + { + } + + public abstract int Count + { + get { return 0; } + } + + } +} diff --git a/tools/wit/ChangesetCommand.cs b/tools/wit/ChangesetCommand.cs index 094fca0..8c8409a 100644 --- a/tools/wit/ChangesetCommand.cs +++ b/tools/wit/ChangesetCommand.cs @@ -47,11 +47,8 @@ class ChangesetCommand : Command { WorkItemStore store = Driver.TeamFoundationServer.GetService(typeof(WorkItemStore)) as WorkItemStore; ILinking linking = Driver.TeamFoundationServer.GetService(typeof(ILinking)) as ILinking; - Console.WriteLine("1"); int changeSet = 1; - return; - // Get URI for changeset ArtifactId changeSetId = new ArtifactId(); changeSetId.Tool = "VersionControl"; @@ -59,16 +56,12 @@ class ChangesetCommand : Command changeSetId.ToolSpecificId = changeSet.ToString(); string changeSetUri = LinkingUtilities.EncodeUri(changeSetId); - Console.WriteLine("2:" + changeSetUri); - Console.WriteLine("linking: " + linking.ToString()); - // Get referencing artifacts for given changeset Artifact[] artifacts = linking.GetReferencingArtifacts(new string[] { changeSetUri }, null); - Console.WriteLine("3"); - foreach (Artifact artifact in artifacts) { + Console.WriteLine(artifact.ToString()); ArtifactId artifactId = LinkingUtilities.DecodeUri(artifact.Uri); if (String.Equals(artifactId.Tool, "WorkItemTracking", StringComparison.OrdinalIgnoreCase)) { diff --git a/tools/wit/ChangesetCommand.cs b/tools/wit/ProjectsCommand.cs similarity index 55% copy from tools/wit/ChangesetCommand.cs copy to tools/wit/ProjectsCommand.cs index 094fca0..d7afb23 100644 --- a/tools/wit/ChangesetCommand.cs +++ b/tools/wit/ProjectsCommand.cs @@ -1,5 +1,5 @@ // -// ChangesetCommand.cs +// ProjectsCommand.cs // // Authors: // Joel Reed (joelwreed@gmail.com) @@ -36,45 +36,21 @@ using Microsoft.TeamFoundation; using Microsoft.TeamFoundation.WorkItemTracking.Client; using Mono.GetOptions; -[Command("changeset", "Query the work items for a changeset", "")] -class ChangesetCommand : Command +[Command("projects", "List all known projects.", "")] +class ProjectsCommand : Command { - public ChangesetCommand(Driver driver, string[] args): base(driver, args) + public ProjectsCommand(Driver driver, string[] args): base(driver, args) { } public override void Run() { WorkItemStore store = Driver.TeamFoundationServer.GetService(typeof(WorkItemStore)) as WorkItemStore; - ILinking linking = Driver.TeamFoundationServer.GetService(typeof(ILinking)) as ILinking; - Console.WriteLine("1"); - int changeSet = 1; + ProjectCollection projects = stores.Projects; - return; - - // Get URI for changeset - ArtifactId changeSetId = new ArtifactId(); - changeSetId.Tool = "VersionControl"; - changeSetId.ArtifactType = "ChangeSet"; - changeSetId.ToolSpecificId = changeSet.ToString(); - string changeSetUri = LinkingUtilities.EncodeUri(changeSetId); - - Console.WriteLine("2:" + changeSetUri); - Console.WriteLine("linking: " + linking.ToString()); - - // Get referencing artifacts for given changeset - Artifact[] artifacts = linking.GetReferencingArtifacts(new string[] { changeSetUri }, null); - - Console.WriteLine("3"); - - foreach (Artifact artifact in artifacts) + foreach (Project project in projects) { - ArtifactId artifactId = LinkingUtilities.DecodeUri(artifact.Uri); - if (String.Equals(artifactId.Tool, "WorkItemTracking", StringComparison.OrdinalIgnoreCase)) - { - WorkItem wi = store.GetWorkItem(Convert.ToInt32(artifactId.ToolSpecificId)); - Console.WriteLine(wi); - } + Console.WriteLine(project); } } } \ No newline at end of file diff --git a/tools/wit/ChangesetCommand.cs b/tools/wit/QueriesCommand.cs similarity index 86% copy from tools/wit/ChangesetCommand.cs copy to tools/wit/QueriesCommand.cs index 094fca0..0b09a0f 100644 --- a/tools/wit/ChangesetCommand.cs +++ b/tools/wit/QueriesCommand.cs @@ -1,5 +1,5 @@ // -// ChangesetCommand.cs +// QueriesCommand.cs // // Authors: // Joel Reed (joelwreed@gmail.com) @@ -36,10 +36,10 @@ using Microsoft.TeamFoundation; using Microsoft.TeamFoundation.WorkItemTracking.Client; using Mono.GetOptions; -[Command("changeset", "Query the work items for a changeset", "")] -class ChangesetCommand : Command +[Command("queries", "Manage stored work item queries.", "")] +class QueriesCommand : Command { - public ChangesetCommand(Driver driver, string[] args): base(driver, args) + public QueriesCommand(Driver driver, string[] args): base(driver, args) { } @@ -47,11 +47,8 @@ class ChangesetCommand : Command { WorkItemStore store = Driver.TeamFoundationServer.GetService(typeof(WorkItemStore)) as WorkItemStore; ILinking linking = Driver.TeamFoundationServer.GetService(typeof(ILinking)) as ILinking; - Console.WriteLine("1"); int changeSet = 1; - return; - // Get URI for changeset ArtifactId changeSetId = new ArtifactId(); changeSetId.Tool = "VersionControl"; @@ -59,16 +56,12 @@ class ChangesetCommand : Command changeSetId.ToolSpecificId = changeSet.ToString(); string changeSetUri = LinkingUtilities.EncodeUri(changeSetId); - Console.WriteLine("2:" + changeSetUri); - Console.WriteLine("linking: " + linking.ToString()); - // Get referencing artifacts for given changeset Artifact[] artifacts = linking.GetReferencingArtifacts(new string[] { changeSetUri }, null); - Console.WriteLine("3"); - foreach (Artifact artifact in artifacts) { + Console.WriteLine(artifact.ToString()); ArtifactId artifactId = LinkingUtilities.DecodeUri(artifact.Uri); if (String.Equals(artifactId.Tool, "WorkItemTracking", StringComparison.OrdinalIgnoreCase)) { diff --git a/tools/wit/wit.exe.sources b/tools/wit/wit.exe.sources index 5051b02..5d459cb 100644 --- a/tools/wit/wit.exe.sources +++ b/tools/wit/wit.exe.sources @@ -7,4 +7,6 @@ CommandAttribute.cs CommandRegistry.cs HelpCommand.cs VersionCommand.cs -Settings.cs \ No newline at end of file +Settings.cs +ProjectsCommand.cs +QueriesCommand.cs \ No newline at end of file -- 2.11.4.GIT