Skip to content

Commit

Permalink
Remove items marked with Obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmurillo committed Jul 27, 2017
1 parent f029ffb commit 0e97912
Show file tree
Hide file tree
Showing 41 changed files with 202 additions and 532 deletions.
2 changes: 0 additions & 2 deletions src/Qwiq.Core.Rest/WorkItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ public override int RelatedLinkCount

public override int Rev => _item.Rev.GetValueOrDefault(0);

public override Uri Uri => _uri ?? (_uri = new Uri(_item.Url, UriKind.Absolute));

public override string Url { get; }

protected override object GetValue(string name)
Expand Down
6 changes: 0 additions & 6 deletions src/Qwiq.Core.Rest/WorkItemStoreFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ private WorkItemStoreFactory()
{
}

[Obsolete("This method is deprecated and will be removed in a future release. See property Default instead.", false)]
public static IWorkItemStoreFactory GetInstance()
{
return Default;
}

public override IWorkItemStore Create(AuthenticationOptions options)
{
if (options == null) throw new ArgumentNullException(nameof(options));
Expand Down
12 changes: 0 additions & 12 deletions src/Qwiq.Core.Soap/WorkItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ public override string Title
set => _item.Title = value;
}

/// <summary>
/// Gets the uniform resource identifier (System.Uri) of this work item.
/// </summary>
public override Uri Uri => _item.Uri;

public override string Url { get; }

public override void ApplyRules(bool doNotUpdateChangedBy = false)
Expand Down Expand Up @@ -224,13 +219,6 @@ public override IHyperlink CreateHyperlink(string location)
return ExceptionHandlingDynamicProxyFactory.Create<IHyperlink>(new Hyperlink(new Tfs.Hyperlink(location)));
}

public override IRelatedLink CreateRelatedLink(IWorkItemLinkTypeEnd linkTypeEnd, IWorkItem relatedWorkItem)
{
var rawLinkTypeEnd = LinkTypeEndMapper.Map(_item.Store, linkTypeEnd);
return ExceptionHandlingDynamicProxyFactory.Create<IRelatedLink>(
new RelatedLink(new Tfs.RelatedLink(rawLinkTypeEnd, relatedWorkItem.Id)));
}

/// <summary>
/// Validates the fields of this work item.
/// </summary>
Expand Down
14 changes: 5 additions & 9 deletions src/Qwiq.Core.Soap/WorkItemLinkInfo.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
using System;

using JetBrains.Annotations;
#pragma warning disable 618
using JetBrains.Annotations;

namespace Microsoft.Qwiq.Client.Soap
{
public class WorkItemLinkInfo : Qwiq.WorkItemLinkInfo
public class WorkItemLinkInfo : Qwiq.WorkItemLinkInfo, IIdentifiable<int>
{
/// <inheritdoc />
internal WorkItemLinkInfo(int sourceId, int targetId, int linkTypeId, [CanBeNull] IWorkItemLinkTypeEnd linkTypeEnd)
: base(sourceId, targetId, linkTypeEnd)
{
LinkTypeId = linkTypeId;
Id = linkTypeId;
}

[Obsolete("This property is deprecated and will be removed in a future release.")]
public int LinkTypeId { get; }
public int Id { get; }
}
}
}
6 changes: 0 additions & 6 deletions src/Qwiq.Core.Soap/WorkItemStoreFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ private WorkItemStoreFactory()
{
}

[Obsolete("This method is deprecated and will be removed in a future release. See property Default instead.", false)]
public static IWorkItemStoreFactory GetInstance()
{
return Default;
}

public override IWorkItemStore Create(AuthenticationOptions options)
{
if (options == null) throw new ArgumentNullException(nameof(options));
Expand Down
63 changes: 0 additions & 63 deletions src/Qwiq.Core/Credentials/CredentialsFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;

using Microsoft.VisualStudio.Services.Client;
Expand All @@ -20,67 +18,6 @@ namespace Microsoft.Qwiq.Credentials
/// </summary>
public static class CredentialsFactory
{
[Obsolete(
"This method is deprecated and will be removed in a future release. See AuthenticationOptions instead.",
false)]
public static IEnumerable<TfsCredentials> CreateCredentials(
string username = null,
string password = null,
string accessToken = null)
{
return CreateCredentials(
new Lazy<string>(() => username),
new Lazy<string>(() => password),
new Lazy<string>(() => accessToken));
}

[Obsolete(
"This method is deprecated and will be removed in a future release. See AuthenticationOptions instead.",
false)]
public static IEnumerable<TfsCredentials> CreateCredentials(
Lazy<string> username = null,
Lazy<string> password = null,
Lazy<string> accessToken = null)
{
if (username == null) username = new Lazy<string>(() => string.Empty);
if (password == null) password = new Lazy<string>(() => string.Empty);
if (accessToken == null) accessToken = new Lazy<string>(() => string.Empty);

return CreateCredentialsImpl(username, password, accessToken).Select(c => new TfsCredentials(c));
}

private static IEnumerable<VssCredentials> CreateCredentialsImpl(
Lazy<string> username,
Lazy<string> password,
Lazy<string> accessToken)
{
// First try OAuth, as this is our preferred method
foreach (var c in GetOAuthCredentials(accessToken.Value)) yield return c;

// Next try Username/Password combinations
foreach (var c in GetServiceIdentityCredentials(username.Value, password.Value)) yield return c;

// Next try PAT
foreach (var c in GetServiceIdentityPatCredentials(password.Value)) yield return c;

// Next try basic credentials
foreach (var c in GetBasicCredentials(username.Value, password.Value)) yield return c;

// User did not specify a username or a password, so use the process identity
yield return new VssClientCredentials(new WindowsCredential(false))
{
Storage = new VssClientCredentialStorage(),
PromptType = CredentialPromptType.DoNotPrompt
};

// Use the Windows identity of the logged on user
yield return new VssClientCredentials(true)
{
Storage = new VssClientCredentialStorage(),
PromptType = CredentialPromptType.PromptIfNeeded
};
}

internal static IEnumerable<VssCredentials> GetBasicCredentials(string username = null, string password = null)
{
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) yield break;
Expand Down
24 changes: 0 additions & 24 deletions src/Qwiq.Core/Credentials/TfsCredentials.cs

This file was deleted.

3 changes: 0 additions & 3 deletions src/Qwiq.Core/IRelatedLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ namespace Microsoft.Qwiq
{
public interface IRelatedLink : ILink, IEquatable<IRelatedLink>
{
[Obsolete("This property is deprecated and will be removed in a future release. Use LinkTypeEnd.Name instead.")]
string LinkSubType { get; }

IWorkItemLinkTypeEnd LinkTypeEnd { get; }

int RelatedWorkItemId { get; }
Expand Down
5 changes: 0 additions & 5 deletions src/Qwiq.Core/ITfsTeamProjectCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

namespace Microsoft.Qwiq
{
[Obsolete("This interface is deprecated and will be removed in a future version. Use ITeamProjectCollection instead.")]
public interface ITfsTeamProjectCollection : ITeamProjectCollection
{
}

public interface ITeamProjectCollection
{
/// <summary>Gets the credentials for this project collection.</summary>
Expand Down
9 changes: 0 additions & 9 deletions src/Qwiq.Core/IWorkItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ public interface IWorkItem : IWorkItemCommon, IIdentifiable<int>
/// </exception>
IWorkItemType Type { get; }

/// <summary>
/// Gets the uniform resource identifier (System.Uri) of this work item.
/// </summary>
[Obsolete("This property is deprecated and will be removed in a future release. See IWorkItemReference.Url instead.")]
Uri Uri { get; }

/// <summary>
/// Applies the server rules for validation and fix up to the work item.
/// </summary>
Expand All @@ -94,9 +88,6 @@ public interface IWorkItem : IWorkItemCommon, IIdentifiable<int>

IHyperlink CreateHyperlink(string location);

[Obsolete("This method is deprecated and will be removed in a future release.")]
IRelatedLink CreateRelatedLink(IWorkItemLinkTypeEnd linkTypeEnd, IWorkItem relatedWorkItem);

IRelatedLink CreateRelatedLink(int relatedWorkItemId, IWorkItemLinkTypeEnd linkTypeEnd = null);

/// <summary>
Expand Down
29 changes: 29 additions & 0 deletions src/Qwiq.Core/IWorkItemLinkInfo.Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace Microsoft.Qwiq
{
// ReSharper disable InconsistentNaming
public static class IWorkItemLinkInfoExtensions
// ReSharper restore InconsistentNaming
{
/// <summary>
/// Gets an Id for a <see cref="IWorkItemLinkTypeEnd"/>.
/// </summary>
/// <param name="item">A <see cref="IWorkItemLinkInfo"/> with a <see cref="IWorkItemLinkTypeEnd"/></param>
/// <returns>0 if no link or link type; otherwise, the link type id.</returns>
/// <remarks>
/// A true Id is only returned for SOAP instances of <paramref name="item"/>.
/// </remarks>
/// <seealso cref="IWorkItemLinkTypeEndExtensions"/>
public static int LinkTypeId(this IWorkItemLinkInfo item)
{
if (item == null) return 0;

// In SOAP, WorkItemLinkInfo is IIdentifiable<int>, where the Id is the LinkTypeId
if (item is IIdentifiable<int> i)
{
return i.Id;
}

return item.LinkType.LinkTypeId();
}
}
}
29 changes: 29 additions & 0 deletions src/Qwiq.Core/IWorkItemLinkType.Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace Microsoft.Qwiq
{
// ReSharper disable InconsistentNaming
public static class IWorkItemLinkTypeExtensions
// ReSharper restore InconsistentNaming
{
///<summary>
/// Gets the Id for the link type's forward end.
/// </summary>
/// <param name="item">An instance of <see cref="IWorkItemLinkType"/>.</param>
/// <returns>0 if no link or link type; otherwise, the link type id.</returns>
/// <seealso cref="IWorkItemLinkTypeEndExtensions"/>
public static int ForwardEndLinkTypeId(this IWorkItemLinkType item)
{
return item?.ForwardEnd.LinkTypeId() ?? 0;
}

///<summary>
/// Gets the Id for the link type's reverse end.
/// </summary>
/// <param name="item">An instance of <see cref="IWorkItemLinkType"/>.</param>
/// <returns>0 if no link or link type; otherwise, the link type id.</returns>
/// <seealso cref="IWorkItemLinkTypeEndExtensions"/>
public static int ReverseEndLinkTypeId(this IWorkItemLinkType item)
{
return item?.ReverseEnd.LinkTypeId() ?? 0;
}
}
}
54 changes: 54 additions & 0 deletions src/Qwiq.Core/IWorkItemLinkTypeEnd.Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;

namespace Microsoft.Qwiq
{
public static class IWorkItemLinkTypeEndExtensions
{
/// <summary>
/// Gets the Id from the specified <paramref name="item"/>.
/// </summary>
/// <param name="item">An instance of <see cref="IWorkItemLinkTypeEnd"/>.</param>
/// <returns>
/// 0 if <paramref name="item"/> is null or the <see cref="M:IWorkItemLinkTypeEnd.LinkType"/> is null; otherwise the link type id.
/// </returns>
/// <remarks>
/// A true Id is only returned for SOAP instances of <paramref name="item"/>
/// </remarks>
public static int LinkTypeId(this IWorkItemLinkTypeEnd item)
{
// No link type. In SOAP this is equivilent to SELF and has a constant id of 0
if (item == null)
{
return 0;
}

// In SOAP, the IWorkItemLinkTypeEnd is IIdentifiable<int>. Try to cast and return the Id
if (item is IIdentifiable<int> i)
{
return i.Id;
}

// Same as initial case--no link type.
if (item.LinkType == null)
{
return 0;
}

// Hack for REST: If there is an immutable name, get a case-insensitive hash
if (!string.IsNullOrEmpty(item.ImmutableName))
{
var hash = Math.Abs(StringComparer.OrdinalIgnoreCase.GetHashCode(item.ImmutableName));
// Forward links are ALWAYS a positive value
if (item.IsForwardLink)
{
return hash;
}

// Reverse links are ALWAYS a negative value
return hash * -1;
}

return 0;
}
}
}
15 changes: 0 additions & 15 deletions src/Qwiq.Core/IWorkItemStoreFactory.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
using System;
using System.Collections.Generic;

using Microsoft.Qwiq.Credentials;

namespace Microsoft.Qwiq
{
public interface IWorkItemStoreFactory
{
IWorkItemStore Create(AuthenticationOptions options);

[Obsolete(
"This method is deprecated and will be removed in a future release. See Create(AuthenticationOptions) instead.",
false)]
IWorkItemStore Create(Uri endpoint, TfsCredentials credentials);

[Obsolete(
"This method is deprecated and will be removed in a future release. See Create(AuthenticationOptions) instead.",
false)]
IWorkItemStore Create(
Uri endpoint,
IEnumerable<TfsCredentials> credentials);
}
}
Loading

0 comments on commit 0e97912

Please sign in to comment.