Skip to content

Commit aacbe40

Browse files
committed
fix AOP related test running on Linux
1 parent ffc02c7 commit aacbe40

File tree

10 files changed

+82
-34
lines changed

10 files changed

+82
-34
lines changed

.gitattributes

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
11+
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain
23+
24+
# make sure *nix stays *nix
25+
*.sh eol=lf
26+
*.conf eol=lf
27+
dotnet-test-nunit eol=lf

build-support/nuke-build/Build.GitHubActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
public partial class Build
44
{
55
Target Ci => _ => _
6-
.DependsOn(Test, Pack)
6+
.DependsOn(Compile, Test, Pack)
77
.Executes();
88
}

build-support/nuke-build/Build.Test.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
public partial class Build
88
{
9-
109
[Parameter]
1110
readonly bool TestFull = false;
1211
[Parameter]
@@ -20,19 +19,25 @@ public partial class Build
2019

2120
Target Test => _ => _
2221
.DependsOn(Restore)
22+
.After(Compile)
2323
.Executes(() =>
2424
{
25-
var packTargets = GetActiveProjects()
25+
var testTargets = GetActiveProjects()
2626
.Where(x => x.Name.Contains(".Test"))
2727
.Where(x => !x.Name.Contains(".Integration") || TestFull)
2828
.Where(x => !x.Name.Contains("Spring.Web.Conversation.NHibernate5.Tests") || TestFull)
2929
.Where(x => !x.Name.Contains("Spring.Data.Integration.Tests") || TestIntegrationData)
3030
.Where(x => !x.Name.Contains("Spring.Messaging.Tests") || TestIntegrationMsMq || TestFull)
3131
.Where(x => !x.Name.Contains("Spring.Nms.Integration.Tests") || TestIntegrationNms || TestFull)
3232
.Where(x => !x.Name.Contains("Spring.Messaging.Ems.Integration.Tests") || TestIntegrationEms || TestFull)
33-
.Where(x => !x.Name.Contains("Spring.Services.Tests"));
34-
35-
foreach (var project in packTargets)
33+
.Where(x => !x.Name.Contains("Spring.Services.Tests"))
34+
.Where(x => !x.Name.Contains("Spring.Template.Velocity.Castle.Tests") || EnvironmentInfo.IsWin)
35+
.Where(x => !x.Name.Contains("Spring.Template.Velocity.Tests") || EnvironmentInfo.IsWin)
36+
.Where(x => !x.Name.Contains("Spring.Testing.Microsoft.Test") || EnvironmentInfo.IsWin)
37+
.Where(x => !x.Name.Contains("Spring.Web.Tests") || EnvironmentInfo.IsWin)
38+
.Where(x => !x.Name.Contains("Spring.Web.Mvc5.Tests") || EnvironmentInfo.IsWin);
39+
40+
foreach (var project in testTargets)
3641
{
3742
DotNetTest(s =>
3843
{

build-support/nuke-build/Build.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using Nuke.Common.CI;
77
using Nuke.Common.CI.AppVeyor;
88
using Nuke.Common.CI.GitHubActions;
9-
using Nuke.Common.Execution;
109
using Nuke.Common.Git;
1110
using Nuke.Common.IO;
1211
using Nuke.Common.ProjectModel;
@@ -19,7 +18,6 @@
1918
using static Nuke.Common.Tools.DotNet.DotNetTasks;
2019
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
2120

22-
[CheckBuildProjectConfigurations]
2321
[ShutdownDotNetAfterServerBuild]
2422
partial class Build : NukeBuild
2523
{

test/Spring/Spring.Aop.Tests/Aop/Framework/Adapter/AdvisorAdapterRegistrationTests.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#region License
22
/*
33
* Copyright 2002-2010 the original author or authors.
4-
*
4+
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at
8-
*
8+
*
99
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
10+
*
1111
* Unless required by applicable law or agreed to in writing, software
1212
* distributed under the License is distributed on an "AS IS" BASIS,
1313
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,47 +34,47 @@ namespace Spring.Aop.Framework.Adapter
3434
/// </summary>
3535
/// <author>Dmitriy Kopylenko</author>
3636
/// <author>Simon White (.NET)</author>
37-
[TestFixture]
37+
[Platform("Win")]
3838
public class AdvisorAdapterRegistrationTests
3939
{
4040
[Test]
41-
public void AdvisorAdapterRegistrationManagerNotPresentInContext()
41+
public void AdvisorAdapterRegistrationManagerNotPresentInContext()
4242
{
4343
string configLocation = ReadOnlyXmlTestResource.GetFilePath("withoutBPPContext.xml", typeof(AdvisorAdapterRegistrationTests));
4444
IApplicationContext ctx = new XmlApplicationContext(configLocation);
4545
ITestObject to = (ITestObject) ctx.GetObject("testObject");
4646
// just invoke any method to see if advice fired
47-
try
47+
try
4848
{
4949
to.ReturnsThis();
5050
Assert.Fail("Should throw UnknownAdviceTypeException");
5151
}
52-
catch (UnknownAdviceTypeException)
52+
catch (UnknownAdviceTypeException)
5353
{
5454
// expected
5555
Assert.AreEqual(0, GetAdviceImpl(to).InvocationCounter);
5656
}
5757
}
5858

5959
[Test]
60-
public void AdvisorAdapterRegistrationManagerPresentInContext()
60+
public void AdvisorAdapterRegistrationManagerPresentInContext()
6161
{
6262
string configLocation = ReadOnlyXmlTestResource.GetFilePath("withBPPContext.xml", typeof(AdvisorAdapterRegistrationTests));
6363
IApplicationContext ctx = new XmlApplicationContext(configLocation);
6464
ITestObject to = (ITestObject) ctx.GetObject("testObject");
6565
// just invoke any method to see if advice fired
66-
try
66+
try
6767
{
6868
to.ReturnsThis();
6969
Assert.AreEqual(1, GetAdviceImpl(to).InvocationCounter);
7070
}
71-
catch (UnknownAdviceTypeException)
71+
catch (UnknownAdviceTypeException)
7272
{
7373
Assert.Fail("Should not throw UnknownAdviceTypeException");
7474
}
7575
}
7676

77-
private SimpleBeforeAdviceImpl GetAdviceImpl(ITestObject to)
77+
private SimpleBeforeAdviceImpl GetAdviceImpl(ITestObject to)
7878
{
7979
IAdvised advised = (IAdvised) to;
8080
IAdvisor advisor = advised.Advisors[0];

test/Spring/Spring.Aop.Tests/Aop/Framework/AutoProxy/AbstractAutoProxyCreatorTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void ITestObject.Foo()
5151
public class ObjectWithoutInterface
5252
{
5353
public virtual void Foo()
54-
{ }
54+
{ }
5555
}
5656

5757
public class TransparentProxyFactory : IFactoryObject
@@ -162,12 +162,13 @@ public void ProxyObjectWithoutInterface()
162162
}
163163

164164
[Test]
165+
[Platform("Win")]
165166
public void ProxyTransparentProxy()
166167
{
167168
DefaultListableObjectFactory of = new DefaultListableObjectFactory();
168169

169170
ConstructorArgumentValues ctorArgs = new ConstructorArgumentValues();
170-
ctorArgs.AddNamedArgumentValue("objectType", typeof(ITestObject));
171+
ctorArgs.AddNamedArgumentValue("objectType", typeof(ITestObject));
171172
of.RegisterObjectDefinition("bar", new RootObjectDefinition(typeof(TransparentProxyFactory), ctorArgs, null));
172173

173174
TestAutoProxyCreator apc = new TestAutoProxyCreator(of);

test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/AbstractAopProxyTests.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2002-2011 the original author or authors.
2+
* Copyright © 2002-2011 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -532,6 +532,7 @@ public void GetHashCodeMethod()
532532
}
533533

534534
[Test]
535+
[Platform("Win")]
535536
public void ProxyMethodWithRefOutParametersWithDirectCall()
536537
{
537538
PublicRefOutTestObject target = new PublicRefOutTestObject();
@@ -547,6 +548,7 @@ public void ProxyMethodWithRefOutParametersWithDirectCall()
547548
}
548549

549550
[Test]
551+
[Platform("Win")]
550552
public void ProxyMethodWithRefOutParametersWithDynamicReflection()
551553
{
552554
PublicRefOutTestObject target = new PublicRefOutTestObject();
@@ -566,6 +568,7 @@ public void ProxyMethodWithRefOutParametersWithDynamicReflection()
566568
}
567569

568570
[Test]
571+
[Platform("Win")]
569572
public virtual void ProxyMethodWithRefOutParametersWithStandardReflection()
570573
{
571574
InternalRefOutTestObject target = new InternalRefOutTestObject();
@@ -660,6 +663,7 @@ internal class InternalRefOutTestObject : PublicRefOutTestObject
660663
}
661664

662665
[Test]
666+
[Platform("Win")]
663667
public void ProxyGenericMethodWithRefOutParametersWithDirectCall()
664668
{
665669
PublicRefOutGenericTestObject target = new PublicRefOutGenericTestObject();
@@ -675,6 +679,7 @@ public void ProxyGenericMethodWithRefOutParametersWithDirectCall()
675679
}
676680

677681
[Test]
682+
[Platform("Win")]
678683
public void ProxyGenericMethodWithRefOutParametersWithDynamicReflection()
679684
{
680685
PublicRefOutGenericTestObject target = new PublicRefOutGenericTestObject();
@@ -694,6 +699,7 @@ public void ProxyGenericMethodWithRefOutParametersWithDynamicReflection()
694699
}
695700

696701
[Test]
702+
[Platform("Win")]
697703
public virtual void ProxyGenericMethodWithRefOutParametersWithStandardReflection()
698704
{
699705
InternalRefOutGenericTestObject target = new InternalRefOutGenericTestObject();
@@ -844,6 +850,7 @@ public void InterceptGenericInterface()
844850
}
845851

846852
[Test(Description = "http://opensource.atlassian.com/projects/spring/browse/SPRNET-340")]
853+
[Platform("Win")]
847854
public void MultiThreadedProxyCreation()
848855
{
849856
MultiThreadedProxyCreation(5);

test/Spring/Spring.Aop.Tests/Aop/Support/RegularExpressionMethodPointcutAdvisorTests.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#region License
22
/*
33
* Copyright 2002-2010 the original author or authors.
4-
*
4+
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at
8-
*
8+
*
99
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
10+
*
1111
* Unless required by applicable law or agreed to in writing, software
1212
* distributed under the License is distributed on an "AS IS" BASIS,
1313
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,7 +55,7 @@ public void SinglePattern()
5555
// Interceptor behind regexp advisor
5656
NopInterceptor nop = (NopInterceptor) iof.GetObject("NopInterceptor");
5757
Assert.AreEqual(0, nop.Count);
58-
58+
5959
int newAge = 12;
6060
// Not advised
6161
advised.Exceptional(null);
@@ -74,20 +74,20 @@ public void MultiplePatterns()
7474
{
7575
IObjectFactory iof = new XmlObjectFactory(new ReadOnlyXmlTestResource("RegularExpressionSetterTests.xml", GetType()));
7676
IPerson advised = (IPerson) iof.GetObject("SettersAndReturnsThisAdvised");
77-
77+
7878
// Interceptor behind regexp advisor
7979
NopInterceptor nop = (NopInterceptor) iof.GetObject("NopInterceptor");
8080
Assert.AreEqual(0, nop.Count);
81-
81+
8282
int newAge = 12;
8383
// Not advised
8484
advised.Exceptional(null);
8585
Assert.AreEqual(0, nop.Count);
86-
86+
8787
// This is proxied
8888
advised.ReturnsThis();
8989
Assert.AreEqual(1, nop.Count);
90-
90+
9191
// Only setter is advised
9292
advised.SetAge(newAge);
9393
Assert.AreEqual(2, nop.Count);
@@ -97,27 +97,28 @@ public void MultiplePatterns()
9797
}
9898

9999
[Test]
100+
[Platform("Win")]
100101
public void Serialization()
101102
{
102103
IObjectFactory iof = new XmlObjectFactory(new ReadOnlyXmlTestResource("RegularExpressionSetterTests.xml", GetType()));
103104
IPerson p = (IPerson) iof.GetObject("SerializableSettersAdvised");
104105
// Interceptor behind regexp advisor
105106
NopInterceptor nop = (NopInterceptor) iof.GetObject("NopInterceptor");
106107
Assert.AreEqual(0, nop.Count);
107-
108+
108109
int newAge = 12;
109110
// Not advised
110111
Assert.AreEqual(0, p.GetAge());
111112
Assert.AreEqual(0, nop.Count);
112-
113+
113114
// This is proxied
114115
p.SetAge(newAge);
115116
Assert.AreEqual(1, nop.Count);
116117
p.SetAge(newAge);
117118
Assert.AreEqual(newAge, p.GetAge());
118119
// Only setter fired
119120
Assert.AreEqual(2, nop.Count);
120-
121+
121122
// Serialize and continue...
122123

123124
#if !NETCOREAPP // deep chains for Type serialization problems, not worth the effort at the moment

test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@
2525
<ItemGroup>
2626
<Compile Include="..\Spring.Core.Tests\TestAssemblySetup.cs" Link="TestAssemblySetup.cs" />
2727
<Content Include="App.config" CopyToOutputDirectory="PreserveNewest" />
28-
<Content Include="Data\**\*.xml" CopyToOutputDirectory="PreserveNewest" />
28+
<None Include="Data\**\*">
29+
<Link>Data\%(RecursiveDir)%(Filename)%(Extension)</Link>
30+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
31+
</None>
32+
<None Include="Data\**\*">
33+
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
34+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
35+
</None>
2936
<EmbeddedResource Include="Aop\Config\AopNamespaceParserTests.xml" />
3037
<EmbeddedResource Include="Data\Spring\Aop\Framework\adapter\withBPPContext.xml" />
3138
<EmbeddedResource Include="Data\Spring\Aop\Framework\adapter\withoutBPPContext.xml" />

test/Spring/Spring.Core.Tests/Objects/Factory/Xml/XmlObjectFactoryTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,7 @@ public void ClassNotFoundWithDefault()
13541354
}
13551355
}
13561356

1357+
#if !NETCOREAPP
13571358
[Test]
13581359
[Platform("Win")]
13591360
public void AnObjectCanBeIstantiatedWithANotFullySpecifiedAssemblyName()
@@ -1363,6 +1364,7 @@ public void AnObjectCanBeIstantiatedWithANotFullySpecifiedAssemblyName()
13631364
IDbConnection connection = (IDbConnection) xof.GetObject("connectionNotFullySpecified");
13641365
Assert.IsNotNull(connection);
13651366
}
1367+
#endif
13661368

13671369
[Test]
13681370
public void ResourceAndInputStream()

0 commit comments

Comments
 (0)