Skip to content

Commit

Permalink
Solution clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko committed Feb 22, 2024
1 parent 261e3d6 commit f679cce
Show file tree
Hide file tree
Showing 29 changed files with 45 additions and 52 deletions.
2 changes: 1 addition & 1 deletion src/ReportPortal.Client/Abstractions/IClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface IClientService
/// <summary>
/// Gets the resource for managing asynchronous log items.
/// </summary>
IAsyncLogItemResource AsyncLogItem { get; }
IAsyncLogItemResource AsyncLogItem { get; }

/// <summary>
/// Gets the resource for managing users.
Expand Down
4 changes: 2 additions & 2 deletions src/ReportPortal.Client/Abstractions/Models/AnalyzerMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public enum AnalyzerMode
/// </summary>
[JsonPropertyName("ALL")]
All,

/// <summary>
/// Analyzes the current launch.
/// </summary>
[JsonPropertyName("CURRENT_LAUNCH")]
CurrentLaunch,

/// <summary>
/// Analyzes launches by launch name.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Text.Json.Serialization;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace ReportPortal.Client.Converters
{
Expand Down
2 changes: 1 addition & 1 deletion src/ReportPortal.Client/Extensions/UriExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static Uri Normalize(this Uri uri)

for (int i = 0; i < uri.Segments.Length; i++)
{
if (!uri.Segments[i].Equals("v1/", StringComparison.OrdinalIgnoreCase) &&
if (!uri.Segments[i].Equals("v1/", StringComparison.OrdinalIgnoreCase) &&
!uri.Segments[i].Equals("v1", StringComparison.OrdinalIgnoreCase))
{
normalizedUriString += uri.Segments[i];
Expand Down
2 changes: 1 addition & 1 deletion src/ReportPortal.Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using System.Runtime.CompilerServices;

[assembly:InternalsVisibleTo("ReportPortal.Client.IntegrationTests")]
[assembly: InternalsVisibleTo("ReportPortal.Client.IntegrationTests")]
2 changes: 1 addition & 1 deletion src/ReportPortal.Client/ServiceException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ServiceException(string message, HttpStatusCode httpStatusCode, Uri reque
/// Gets response body.
/// </summary>
public string ResponseBody { get; }

/// <inheritdoc/>
public override string Message => _message;
}
Expand Down
10 changes: 5 additions & 5 deletions src/ReportPortal.Shared/Execution/Logging/LogMessageLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ public enum LogMessageLevel
/// Trace level log message.
/// </summary>
Trace,

/// <summary>
/// Debug level log message.
/// </summary>
Debug,

/// <summary>
/// Information level log message.
/// </summary>
Info,

/// <summary>
/// Warning level log message.
/// </summary>
Warning,

/// <summary>
/// Error level log message.
/// </summary>
Error,

/// <summary>
/// Fatal level log message.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private void ReportEventsSource_OnBeforeLaunchStarting(Reporter.ILaunchReporter
}

var stringContent = new StringContent(content, Encoding.UTF8, "application/json");

try
{
using (var response = await httpClient.PostAsync(requestUri, stringContent))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Initialize(IReportEventsSource reportEventsSource)
private void ReportEventsSource_OnBeforeLaunchStarting(ILaunchReporter launchReporter, BeforeLaunchStartingEventArgs args)
{
args.StartLaunchRequest.Name = StringTrimmer.Trim(args.StartLaunchRequest.Name, MAX_LAUNCH_NAME_LENGTH);

NormalizeAttributes(args.StartLaunchRequest.Attributes);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ExponentialRetryRequestExecuter(uint maxRetryAttempts, uint baseIndex, IR
public HttpStatusCode[] HttpStatusCodes { get; private set; }

/// <inheritdoc/>
public override async Task<T> ExecuteAsync<T>(Func<Task<T>> func, Action<Exception> beforeNextAttempt = null, IStatisticsCounter statisticsCounter = null, [CallerMemberName]string logicalOperationName = null)
public override async Task<T> ExecuteAsync<T>(Func<Task<T>> func, Action<Exception> beforeNextAttempt = null, IStatisticsCounter statisticsCounter = null, [CallerMemberName] string logicalOperationName = null)
{
T result = default;
List<Exception> exceptions = new List<Exception>();
Expand Down
2 changes: 1 addition & 1 deletion src/ReportPortal.Shared/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using System.Runtime.CompilerServices;

[assembly:InternalsVisibleTo("ReportPortal.Shared.Tests")]
[assembly: InternalsVisibleTo("ReportPortal.Shared.Tests")]
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public virtual HttpClientHandler Create()
httpClientHandler.Proxy = GetProxy();

var ignoreSslErrors = Configuration.GetValue<bool>("Server:IgnoreSslErrors", false);

#if NET462
if (ignoreSslErrors)
{
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
}
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
#else
if (ignoreSslErrors)
if (ignoreSslErrors)
{
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
}
Expand Down
2 changes: 1 addition & 1 deletion src/ReportPortal.Shared/Reporter/ITestReporterInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
/// </summary>
public interface ITestReporterInfo : IReporterInfo
{

}
}
10 changes: 5 additions & 5 deletions src/ReportPortal.Shared/Reporter/LaunchReporter.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ReportPortal.Client.Abstractions;
using ReportPortal.Client.Abstractions;
using ReportPortal.Client.Abstractions.Requests;
using ReportPortal.Shared.Configuration;
using ReportPortal.Shared.Extensibility;
using ReportPortal.Shared.Extensibility.ReportEvents.EventArgs;
using ReportPortal.Shared.Internal.Delegating;
using ReportPortal.Shared.Reporter.Statistics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ReportPortal.Shared.Reporter
{
Expand Down
10 changes: 5 additions & 5 deletions src/ReportPortal.Shared/Reporter/TestReporter.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ReportPortal.Client.Abstractions;
using ReportPortal.Client.Abstractions;
using ReportPortal.Client.Abstractions.Requests;
using ReportPortal.Shared.Configuration;
using ReportPortal.Shared.Extensibility;
using ReportPortal.Shared.Extensibility.ReportEvents.EventArgs;
using ReportPortal.Shared.Internal.Delegating;
using ReportPortal.Shared.Internal.Logging;
using ReportPortal.Shared.Reporter.Statistics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ReportPortal.Shared.Reporter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task StartFinishDeleteLaunch()
// wait until async launch will be processed
Func<Task> getLaunchAction = async () => gotLaunch = await Service.Launch.GetAsync(launch.Uuid);
await getLaunchAction.Should().NotThrowAfterAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(1));

Assert.NotNull(gotLaunch);
Assert.Equal("StartFinishDeleteAsyncLaunch", gotLaunch.Name);
gotLaunch.StartTime.Should().BeCloseTo(startLaunchRequest.StartTime, precision: TimeSpan.FromMilliseconds(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public async Task GetLaunchesSortedByDescendingDate()

[Fact]
public async Task GetInProgressLaunch()
{
{
var launch = await Service.Launch.StartAsync(new StartLaunchRequest
{
Name = "StartForceFinishIncompleteLaunch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task CreateLogWithAttach()
Level = LogLevel.Info,
Attach = new LogItemAttach("application/octet-stream", data)
});

Assert.NotNull(log.Uuid);
}

Expand Down
1 change: 0 additions & 1 deletion test/ReportPortal.Shared.Benchmark/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using BenchmarkDotNet.Running;
using ReportPortal.Shared.Benchmark.Reporter;
using System;

namespace ReportPortal.Shared.Benchmark
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using FluentAssertions;
using Moq;
using ReportPortal.Client.Abstractions.Models;
using ReportPortal.Shared.Execution;
using ReportPortal.Shared.Execution.Logging;
using ReportPortal.Shared.Extensibility;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using FluentAssertions;
using Newtonsoft.Json.Linq;
using ReportPortal.Client.Abstractions.Models;
using ReportPortal.Shared.Execution.Metadata;
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
using ReportPortal.Shared.Reporter;
using ReportPortal.Shared.Tests.Helpers;
using RichardSzalay.MockHttp;
using RichardSzalay.MockHttp.Matchers;
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using FluentAssertions;
using Moq;
using ReportPortal.Client.Abstractions.Models;
using ReportPortal.Client.Abstractions.Requests;
using ReportPortal.Shared.Extensibility;
Expand Down Expand Up @@ -50,11 +49,11 @@ public void ShouldTrimLaunchAttributesDuringStarting()
Attributes = new[]
{
new ItemAttribute
{
{
Key = new string('a', RequestNormalizer.MAX_ATTRIBUTE_KEY_LENGTH + 1),
Value = new string('b', RequestNormalizer.MAX_ATTRIBUTE_VALUE_LENGTH + 1)
},
new ItemAttribute
new ItemAttribute
{
Key = new string('a', RequestNormalizer.MAX_ATTRIBUTE_KEY_LENGTH * 2),
Value = new string('b', RequestNormalizer.MAX_ATTRIBUTE_VALUE_LENGTH * 2)
Expand All @@ -81,7 +80,7 @@ public void ShouldTrimTestItemNameDuringStarting()
var launchReporter = new LaunchReporter(service, null, null, _extensionManager);
launchReporter.Start(new StartLaunchRequest());

var request = new StartTestItemRequest
var request = new StartTestItemRequest
{
Name = new string('a', RequestNormalizer.MAX_TEST_ITEM_NAME_LENGTH + 1)
};
Expand Down Expand Up @@ -109,9 +108,9 @@ public void ShouldTrimTestItemAttributesDuringStarting()
new ItemAttribute
{
Key = new string('a', RequestNormalizer.MAX_ATTRIBUTE_KEY_LENGTH + 1),
Value = new string('b', RequestNormalizer.MAX_ATTRIBUTE_VALUE_LENGTH + 1)
Value = new string('b', RequestNormalizer.MAX_ATTRIBUTE_VALUE_LENGTH + 1)
},
new ItemAttribute
new ItemAttribute
{
Key = new string('a', RequestNormalizer.MAX_ATTRIBUTE_KEY_LENGTH * 2),
Value = new string('b', RequestNormalizer.MAX_ATTRIBUTE_VALUE_LENGTH * 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Mock<IClientService> Build()
service.Setup(s => s.TestItem.FinishAsync(It.IsAny<string>(), It.IsAny<FinishTestItemRequest>(), default)).Returns(() => Task.FromResult(new MessageResponse()));
service.Setup(s => s.AsyncTestItem.FinishAsync(It.IsAny<string>(), It.IsAny<FinishTestItemRequest>(), default)).Returns(() => Task.FromResult(new MessageResponse()));

service.Setup(s => s.Launch.FinishAsync(It.IsAny<string>(), It.IsAny<FinishLaunchRequest>(), default)).Returns(() => Task.FromResult(new LaunchFinishedResponse { Link = "http://server:80/path/to/launch"}));
service.Setup(s => s.Launch.FinishAsync(It.IsAny<string>(), It.IsAny<FinishLaunchRequest>(), default)).Returns(() => Task.FromResult(new LaunchFinishedResponse { Link = "http://server:80/path/to/launch" }));
service.Setup(s => s.AsyncLaunch.FinishAsync(It.IsAny<string>(), It.IsAny<FinishLaunchRequest>(), default)).Returns(() => Task.FromResult(new LaunchFinishedResponse { Link = "http://server:80/path/to/launch" }));

return service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public async Task ShouldRetryServiceExceptionAction()
var action = new Mock<Func<Task<string>>>();
action.Setup(a => a()).Throws(() => new ServiceException("", HttpStatusCode.BadGateway, new Uri("https://example.com"), HttpMethod.Post, ""));

var executer = new LinearRetryRequestExecuter(3, 0, null, new HttpStatusCode[] { HttpStatusCode.BadGateway} );
var executer = new LinearRetryRequestExecuter(3, 0, null, new HttpStatusCode[] { HttpStatusCode.BadGateway });
await executer.Awaiting(e => e.ExecuteAsync(action.Object)).Should().ThrowAsync<RetryExecutionException>();

action.Verify(a => a(), Times.Exactly(3));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void ConfigurableLinearRetry()

executer.MaxRetryAttemps.Should().Be(5);
executer.Delay.Should().Be(6000);
executer.HttpStatusCodes.Should().BeEquivalentTo(new HttpStatusCode[] { HttpStatusCode.InternalServerError});
executer.HttpStatusCodes.Should().BeEquivalentTo(new HttpStatusCode[] { HttpStatusCode.InternalServerError });
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void ShouldSendBatchedRequests()
_extensionManager,
_requestExecuter,
_logRequestAmender.Object,
_reportEventsSource,
_reportEventsSource,
20);

for (int i = 0; i < 60; i++)
Expand Down Expand Up @@ -172,8 +172,8 @@ public void ShouldSendAsSeparateRequestPerLogWithAttachmentIncludingWithoutAttac
var logsReporter = new LogsReporter(
_testReporter.Object,
service.Object,
_configuration,
_extensionManager,
_configuration,
_extensionManager,
_requestExecuter,
_logRequestAmender.Object,
_reportEventsSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public void ShouldNotRerunOfLaunchOnlyIfRerunIsSet()
.Callback<StartLaunchRequest, CancellationToken>((r, t) => startLaunchRequest = r);

var config = new ConfigurationBuilder().Build();

config.Properties[ConfigurationPath.AsyncReporting] = true;
config.Properties["Launch:Rerun"] = "false";
config.Properties["Launch:RerunOf"] = "any_uuid_of_existing_launch";
Expand Down
2 changes: 1 addition & 1 deletion test/ReportPortal.Shared.Tests/Reporter/ReporterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public void ShouldRerunOfLaunchOnlyIfRerunIsSet()

service.Setup(s => s.Launch.StartAsync(It.IsAny<StartLaunchRequest>(), default))
.Returns(() => Task.FromResult(new LaunchCreatedResponse { Uuid = Guid.NewGuid().ToString() }))
.Callback<StartLaunchRequest, CancellationToken>((r,t) => startLaunchRequest = r);
.Callback<StartLaunchRequest, CancellationToken>((r, t) => startLaunchRequest = r);

var config = new Shared.Configuration.ConfigurationBuilder().Build();
config.Properties["Launch:Rerun"] = "true";
Expand Down

0 comments on commit f679cce

Please sign in to comment.