From 4b682fb2622d96f39ad54cb17824e6890d75132e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 8 Oct 2019 11:12:01 +0300 Subject: [PATCH] Adjust namespace for Volo.Abp.AspNetCore.ExceptionHandling --- .../Pages/Error/Index.cshtml.cs | 2 +- .../Mvc/ExceptionHandling/AbpExceptionFilter.cs | 1 + .../Builder/AbpApplicationBuilderExtensions.cs | 2 +- .../AbpExceptionHandlingMiddleware.cs | 3 ++- .../DefaultExceptionToErrorInfoConverter.cs | 2 +- .../DefaultHttpExceptionStatusCodeFinder.cs | 3 +-- .../ExceptionHttpStatusCodeOptions.cs | 2 +- .../IExceptionToErrorInfoConverter.cs | 2 +- .../IHttpExceptionStatusCodeFinder.cs | 2 +- .../PersonAppServiceClientProxy_Tests.cs | 10 ++++++++++ .../Volo/Abp/TestApp/Application/IPeopleAppService.cs | 2 ++ .../Volo/Abp/TestApp/Application/PeopleAppService.cs | 7 +++++++ 12 files changed, 29 insertions(+), 9 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Error/Index.cshtml.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Error/Index.cshtml.cs index af779b4c0a..66ea202442 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Error/Index.cshtml.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Error/Index.cshtml.cs @@ -2,7 +2,7 @@ using System; using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Volo.Abp.AspNetCore.Mvc.ExceptionHandling; +using Volo.Abp.AspNetCore.ExceptionHandling; using Volo.Abp.Http; namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Error diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs index 8ff0846b74..28c1c18fda 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.AspNetCore.ExceptionHandling; using Volo.Abp.DependencyInjection; using Volo.Abp.Http; using Volo.Abp.Json; diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs index e2c930f39c..22c0079571 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.RequestLocalization; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.AspNetCore.Auditing; -using Volo.Abp.AspNetCore.Mvc.ExceptionHandling; +using Volo.Abp.AspNetCore.ExceptionHandling; using Volo.Abp.AspNetCore.Tracing; using Volo.Abp.AspNetCore.Uow; using Volo.Abp.DependencyInjection; diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs index e108a71b24..cdd921dae4 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs @@ -4,12 +4,13 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; +using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Uow; using Volo.Abp.DependencyInjection; using Volo.Abp.Http; using Volo.Abp.Json; -namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling +namespace Volo.Abp.AspNetCore.ExceptionHandling { public class AbpExceptionHandlingMiddleware : IMiddleware, ITransientDependency { diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs index af22ff2f7e..d1ae5dd59a 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs @@ -15,7 +15,7 @@ using Volo.Abp.Localization; using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Validation; -namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling +namespace Volo.Abp.AspNetCore.ExceptionHandling { public class DefaultExceptionToErrorInfoConverter : IExceptionToErrorInfoConverter, ITransientDependency { diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultHttpExceptionStatusCodeFinder.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultHttpExceptionStatusCodeFinder.cs index 7625fa1d63..d9079fc347 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultHttpExceptionStatusCodeFinder.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/DefaultHttpExceptionStatusCodeFinder.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Net; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; @@ -9,7 +8,7 @@ using Volo.Abp.Domain.Entities; using Volo.Abp.ExceptionHandling; using Volo.Abp.Validation; -namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling +namespace Volo.Abp.AspNetCore.ExceptionHandling { public class DefaultHttpExceptionStatusCodeFinder : IHttpExceptionStatusCodeFinder, ITransientDependency { diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/ExceptionHttpStatusCodeOptions.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/ExceptionHttpStatusCodeOptions.cs index b987eb4073..d8766219f8 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/ExceptionHttpStatusCodeOptions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/ExceptionHttpStatusCodeOptions.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Net; -namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling +namespace Volo.Abp.AspNetCore.ExceptionHandling { public class ExceptionHttpStatusCodeOptions { diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/IExceptionToErrorInfoConverter.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/IExceptionToErrorInfoConverter.cs index ad5e5fa1aa..a25206a918 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/IExceptionToErrorInfoConverter.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/IExceptionToErrorInfoConverter.cs @@ -1,7 +1,7 @@ using System; using Volo.Abp.Http; -namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling +namespace Volo.Abp.AspNetCore.ExceptionHandling { /// /// This interface can be implemented to convert an object to an object. diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/IHttpExceptionStatusCodeFinder.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/IHttpExceptionStatusCodeFinder.cs index 0566a247e1..726d738b7c 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/IHttpExceptionStatusCodeFinder.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/IHttpExceptionStatusCodeFinder.cs @@ -2,7 +2,7 @@ using System.Net; using Microsoft.AspNetCore.Http; -namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling +namespace Volo.Abp.AspNetCore.ExceptionHandling { public interface IHttpExceptionStatusCodeFinder { diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs index aeae7ef1b4..e8b6608e8d 100644 --- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Repositories; +using Volo.Abp.Http.Client; using Volo.Abp.Http.Modeling; using Volo.Abp.TestApp.Application; using Volo.Abp.TestApp.Application.Dto; @@ -103,6 +104,15 @@ namespace Volo.Abp.Http.DynamicProxying personInDb.Age.ShouldBe(person.Age); } + [Fact] + public async Task GetWithAuthorized() + { + (await Assert.ThrowsAsync(async () => + { + await _peopleAppService.GetWithAuthorized(); + })).Error.Message.ShouldContain("Authorization"); + } + [Fact] public async Task GetWithComplexType() { diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs index cf2393869d..38b0e87787 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/IPeopleAppService.cs @@ -14,6 +14,8 @@ namespace Volo.Abp.TestApp.Application Task RemovePhone(Guid id, string number); + Task GetWithAuthorized(); + Task GetWithComplexType(GetWithComplexTypeInput input); } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs index e21cc14d08..d7909542d4 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; using Volo.Abp.TestApp.Domain; using Volo.Abp.Domain.Repositories; @@ -46,6 +47,12 @@ namespace Volo.Abp.TestApp.Application Repository.Update(person); } + [Authorize] + public virtual Task GetWithAuthorized() + { + return Task.CompletedTask; + } + public Task GetWithComplexType(GetWithComplexTypeInput input) { return Task.FromResult(input);