UnitTest // Delphi 10.4 Sydney support

This commit is contained in:
Daniele Teti 2020-05-27 11:28:22 +02:00
parent 622d664989
commit 371d09194a
15 changed files with 220 additions and 230 deletions

View File

@ -60,12 +60,11 @@ begin
try
LServer.DefaultPort := APort;
LServer.Active := True;
SetMode(TConsoleMode.Bright);
TextColor(Red);
Writeln('DMVCFRAMEWORK VERSION: ', DMVCFRAMEWORK_VERSION);
ResetConsole;
Writeln('Press RETURN to stop the server');
ReadLn;
WaitForReturn;
Writeln('Stopping...');
finally
LServer.Free;

View File

@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{8CCDACDA-3FA5-486E-AD8E-63E4113177EE}</ProjectGuid>
<ProjectVersion>18.8</ProjectVersion>
<ProjectVersion>19.0</ProjectVersion>
<FrameworkType>None</FrameworkType>
<MainSource>renders.dpr</MainSource>
<Base>True</Base>
@ -13,16 +13,6 @@
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
<Base_Android>true</Base_Android>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android64' and '$(Base)'=='true') or '$(Base_Android64)'!=''">
<Base_Android64>true</Base_Android64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
@ -71,67 +61,6 @@
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
<AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE>
<AUP_READ_CALENDAR>true</AUP_READ_CALENDAR>
<AUP_CALL_PHONE>true</AUP_CALL_PHONE>
<AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE>
<AUP_CAMERA>true</AUP_CAMERA>
<Android_LauncherIcon72>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png</Android_LauncherIcon72>
<Android_SplashImage470>$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png</Android_SplashImage470>
<Android_LauncherIcon96>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png</Android_LauncherIcon96>
<AUP_ACCESS_FINE_LOCATION>true</AUP_ACCESS_FINE_LOCATION>
<EnabledSysJars>android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
<Android_LauncherIcon36>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png</Android_LauncherIcon36>
<VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
<AUP_WRITE_CALENDAR>true</AUP_WRITE_CALENDAR>
<BT_BuildType>Debug</BT_BuildType>
<Android_SplashImage960>$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png</Android_SplashImage960>
<Android_SplashImage426>$(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png</Android_SplashImage426>
<AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE>
<Android_SplashImage640>$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png</Android_SplashImage640>
<AUP_ACCESS_COARSE_LOCATION>true</AUP_ACCESS_COARSE_LOCATION>
<Android_LauncherIcon144>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png</Android_LauncherIcon144>
<AUP_INTERNET>true</AUP_INTERNET>
<Android_LauncherIcon48>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png</Android_LauncherIcon48>
<Android_NotificationIcon24>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png</Android_NotificationIcon24>
<Android_NotificationIcon36>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_36x36.png</Android_NotificationIcon36>
<Android_NotificationIcon48>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_48x48.png</Android_NotificationIcon48>
<Android_NotificationIcon72>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_72x72.png</Android_NotificationIcon72>
<Android_NotificationIcon96>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_96x96.png</Android_NotificationIcon96>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android64)'!=''">
<VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
<BT_BuildType>Debug</BT_BuildType>
<Base_Android>true</Base_Android>
<CfgParent>Base</CfgParent>
<Base>true</Base>
<AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE>
<AUP_READ_CALENDAR>true</AUP_READ_CALENDAR>
<AUP_CALL_PHONE>true</AUP_CALL_PHONE>
<AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE>
<AUP_CAMERA>true</AUP_CAMERA>
<Android_LauncherIcon72>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png</Android_LauncherIcon72>
<Android_SplashImage470>$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png</Android_SplashImage470>
<Android_LauncherIcon96>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png</Android_LauncherIcon96>
<AUP_ACCESS_FINE_LOCATION>true</AUP_ACCESS_FINE_LOCATION>
<EnabledSysJars>android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
<Android_LauncherIcon36>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png</Android_LauncherIcon36>
<AUP_WRITE_CALENDAR>true</AUP_WRITE_CALENDAR>
<Android_SplashImage960>$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png</Android_SplashImage960>
<Android_SplashImage426>$(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png</Android_SplashImage426>
<AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE>
<Android_SplashImage640>$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png</Android_SplashImage640>
<AUP_ACCESS_COARSE_LOCATION>true</AUP_ACCESS_COARSE_LOCATION>
<Android_LauncherIcon144>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png</Android_LauncherIcon144>
<AUP_INTERNET>true</AUP_INTERNET>
<Android_LauncherIcon48>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png</Android_LauncherIcon48>
<Android_NotificationIcon24>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png</Android_NotificationIcon24>
<Android_NotificationIcon36>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_36x36.png</Android_NotificationIcon36>
<Android_NotificationIcon48>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_48x48.png</Android_NotificationIcon48>
<Android_NotificationIcon72>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_72x72.png</Android_NotificationIcon72>
<Android_NotificationIcon96>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_96x96.png</Android_NotificationIcon96>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<Manifest_File>None</Manifest_File>
<VerInfo_Locale>1033</VerInfo_Locale>
@ -348,6 +277,11 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="ModelSupport_renders\RenderSampleControllerU\default.txaPackage" Configuration="Debug" Class="ProjectFile">
<Platform Name="Linux64">
<RemoteDir>.\</RemoteDir>
@ -372,12 +306,24 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="ModelSupport_renders\renders1\default.txvpck" Configuration="Release" Class="ProjectFile">
<Platform Name="Win32">
<RemoteDir>.\</RemoteDir>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="ModelSupport_renders\renders\default.txvpck" Configuration="Release" Class="ProjectFile">
<Platform Name="Win32">
<RemoteDir>.\</RemoteDir>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="bin\renders.exe" Configuration="Release" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>renders.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="ModelSupport_renders\renders\default.txvpck" Configuration="Debug" Class="ProjectFile">
<Platform Name="Linux64">
<RemoteDir>.\</RemoteDir>
@ -390,23 +336,6 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="bin\renders.exe" Configuration="Release" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>renders.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="ModelSupport_renders\renders1\default.txvpck" Configuration="Release" Class="ProjectFile">
<Platform Name="Win32">
<RemoteDir>.\</RemoteDir>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="ModelSupport_renders\renders1\default.txaPackage" Configuration="Debug" Class="ProjectFile">
<Platform Name="Win32">
<RemoteDir>.\</RemoteDir>
@ -1039,6 +968,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch768">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
@ -1061,6 +1000,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_LaunchDark2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch1125">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
@ -1160,6 +1109,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch320">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
@ -1171,6 +1130,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch3x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
@ -1215,6 +1184,26 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_LaunchDark2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_LaunchDark3x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
@ -1236,6 +1225,7 @@
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="ProjectiOSEntitlements"/>
<DeployClass Name="ProjectiOSInfoPList"/>
<DeployClass Name="ProjectiOSLaunchScreen"/>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
@ -1337,8 +1327,6 @@
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
</Deployment>
<Platforms>
<Platform value="Android">False</Platform>
<Platform value="Android64">False</Platform>
<Platform value="Linux64">True</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>

View File

@ -3105,6 +3105,9 @@ begin
FContext.Response.CustomHeaders.AddPair('location', Location);
end;
ResponseStatus(HTTP_STATUS.Created, Reason);
{$IF CompilerVersion >= 34}
Render(''); //in 10.4 INDY requires something on the content
{$ENDIF}
end;
procedure TMVCRenderer.Render204NoContent(const Location, Reason: string);

View File

@ -89,7 +89,7 @@ begin
);
FServerListener.Start;
FRESTClient := TRESTClient.Create(TEST_SERVER_ADDRESS, 3000);
FRESTClient := TRESTClient.Create('localhost', 3000);
FRESTAdapter := TRESTAdapter<IAppResource>.Create;
FRESTAdapter.Build(FRESTClient);

View File

@ -40,7 +40,8 @@ uses
MVCFramework.Tests.Serializer.EntitiesModule in '..\..\common\MVCFramework.Tests.Serializer.EntitiesModule.pas' {EntitiesModule: TDataModule},
MVCFramework.Tests.Serializer.Intf in '..\..\common\MVCFramework.Tests.Serializer.Intf.pas',
MVCFramework.Serializer.JsonDataObjects.OptionalCustomTypes in '..\..\..\sources\MVCFramework.Serializer.JsonDataObjects.OptionalCustomTypes.pas',
ActiveRecordTestsU in 'ActiveRecordTestsU.pas';
ActiveRecordTestsU in 'ActiveRecordTestsU.pas',
TestConstsU in 'TestConstsU.pas';
{$R *.RES}
{$IFDEF CONSOLE_TESTRUNNER}
@ -50,7 +51,7 @@ var
runner: ITestRunner;
results: IRunResults;
logger: ITestLogger;
nunitLogger: ITestLogger;
// nunitLogger: ITestLogger;
begin
try
// Check command line options, will exit if invalid

View File

@ -4,7 +4,7 @@
<ProjectVersion>19.0</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">LINUX</Config>
<Config Condition="'$(Config)'==''">CONSOLE</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Console</AppType>
@ -90,17 +90,6 @@
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_BplOutput>.\$(Platform)\$(Config)\pkg</DCC_BplOutput>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
@ -156,8 +145,10 @@
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_6_Win32)'!=''">
<PropertyGroup Condition="'$(Cfg_6)'!=''">
<DCC_Define>LINUX_SERVER;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_6_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
</PropertyGroup>
@ -170,17 +161,6 @@
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1046</VerInfo_Locale>
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
@ -219,21 +199,10 @@
<DCCReference Include="..\..\common\MVCFramework.Tests.Serializer.Intf.pas"/>
<DCCReference Include="..\..\..\sources\MVCFramework.Serializer.JsonDataObjects.OptionalCustomTypes.pas"/>
<DCCReference Include="ActiveRecordTestsU.pas"/>
<DCCReference Include="TestConstsU.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="GUI">
<Key>Cfg_3</Key>
<CfgParent>Cfg_1</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="LINUX">
<Key>Cfg_6</Key>
<CfgParent>Cfg_4</CfgParent>
@ -246,6 +215,14 @@
<Key>Cfg_5</Key>
<CfgParent>Cfg_4</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="GUI">
<Key>Cfg_3</Key>
<CfgParent>Cfg_1</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
@ -321,13 +298,13 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="Win32\GUI\DMVCFrameworkTests.exe" Configuration="GUI" Class="ProjectOutput">
<DeployFile LocalName="bin\DMVCFrameworkTests.exe" Configuration="GUI" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>DMVCFrameworkTests.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="Win32\GUI\DMVCFrameworkTests.rsm" Configuration="GUI" Class="DebugSymbols">
<DeployFile LocalName="bin\DMVCFrameworkTests.rsm" Configuration="GUI" Class="DebugSymbols">
<Platform Name="Win32">
<RemoteName>DMVCFrameworkTests.rsm</RemoteName>
<Overwrite>true</Overwrite>

View File

@ -33,16 +33,6 @@ uses
System.DateUtils,
System.Hash;
const
{$IFDEF LINUX_SERVER}
TEST_SERVER_ADDRESS = '192.168.56.1';
{$ELSE}
TEST_SERVER_ADDRESS = '127.0.0.1';
{$ENDIF}
type
@ -51,10 +41,9 @@ type
RESTClient: TRESTClient;
procedure DoLoginWith(UserName: string);
procedure DoLogout;
function GetServer: String;
public
[SetUp]
procedure SetUp; virtual;
[Setup]
procedure Setup; virtual;
[TearDown]
procedure TearDown;
@ -63,9 +52,6 @@ type
[TestFixture]
TServerTest = class(TBaseServerTest)
public
[Setup]
procedure Setup; override;
[Test]
[TestCase('request url /fault', '/exception/fault')]
[TestCase('request url /fault2', '/exception/fault2')]
@ -234,13 +220,13 @@ type
end;
[TestFixture]
TJSONRPCServerTest = class(TBaseServerTest)
TJSONRPCServerTest = class(TObject)
protected
FExecutor: IMVCJSONRPCExecutor;
FExecutor2: IMVCJSONRPCExecutor;
public
[Setup]
procedure SetUp; override;
procedure Setup;
[Test]
procedure TestRequestWithoutParams;
[Test]
@ -287,11 +273,15 @@ uses
MVCFramework.Serializer.Intf
{$IFDEF MSWINDOWS}
,
MVCFramework.Serializer.JsonDataObjects.OptionalCustomTypes
,
MVCFramework.Serializer.JsonDataObjects.OptionalCustomTypes,
Vcl.Graphics
{$ENDIF}
;
, TestConstsU;
function GetServer: String;
begin
Result := 'http://' + TEST_SERVER_ADDRESS + ':9999';
end;
{ TServerTest }
@ -303,12 +293,7 @@ begin
Assert.isTrue(res.ResponseCode = HTTP_STATUS.OK, 'Logout Failed');
end;
function TBaseServerTest.GetServer: String;
begin
Result := 'http://' + TEST_SERVER_ADDRESS + ':9999';
end;
procedure TBaseServerTest.SetUp;
procedure TBaseServerTest.Setup;
begin
inherited;
RESTClient := TRESTClient.Create(TEST_SERVER_ADDRESS, 9999);
@ -321,12 +306,6 @@ begin
RESTClient.Free;
end;
procedure TServerTest.Setup;
begin
inherited;
end;
procedure TServerTest.TestActionFiltersOnBeforeAction;
var
res: IRESTResponse;
@ -714,8 +693,7 @@ begin
lCustomer.Logo.SaveToFile('pippo_client_before_send.bmp');
lSer := GetDefaultSerializer;
RegisterOptionalCustomTypesSerializers(lSer);
r := RESTClient.Accept(TMVCMediaType.APPLICATION_JSON).doPOST('/customerecho', [],
lSer.SerializeObject(lCustomer));
r := RESTClient.Accept(TMVCMediaType.APPLICATION_JSON).doPOST('/customerecho', [], lSer.SerializeObject(lCustomer));
finally
lCustomer.Free;
end;
@ -1201,9 +1179,8 @@ var
begin
JSON := System.JSON.TJSONObject.Create;
JSON.AddPair('client', 'clientdata');
r := RESTClient
.Header(TMVCConstants.X_HTTP_Method_Override, 'PUT')
.doPOST('/echo', ['1', '2', '3'], TSystemJSON.JSONValueToString(JSON));
r := RESTClient.Header(TMVCConstants.X_HTTP_Method_Override, 'PUT').doPOST('/echo', ['1', '2', '3'],
TSystemJSON.JSONValueToString(JSON));
JSON := TSystemJSON.StringAsJSONObject(r.BodyAsString);
try
@ -1410,14 +1387,10 @@ procedure TServerTest.TestDirectoryRedirect;
var
lRes: IRESTResponse;
begin
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/static/', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/static/', []);
Assert.areEqual(200, lRes.ResponseCode, '/static/');
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/static', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/static', []);
Assert.areEqual(301, lRes.ResponseCode, '/static');
Assert.areEqual('/static/', lRes.HeaderValue('Location'), 'Wrong redirect');
end;
@ -1428,23 +1401,17 @@ var
I: Integer;
lUrl: string;
begin
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/index.html', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/index.html', []);
Assert.areEqual(200, lRes.ResponseCode);
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/..\donotdeleteme.txt', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/..\donotdeleteme.txt', []);
Assert.areEqual(404, lRes.ResponseCode);
lUrl := 'Windows\win.ini';
for I := 1 to 20 do
begin
lUrl := '..\' + lUrl;
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/' + lUrl, []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/' + lUrl, []);
Assert.areEqual(404, lRes.ResponseCode, 'Fail with: ' + '/' + lUrl);
end;
end;
@ -1455,33 +1422,23 @@ var
I: Integer;
lUrl: string;
begin
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/static/index.html', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/static/index.html', []);
Assert.areEqual(200, lRes.ResponseCode, '/static/index.html');
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/static.html', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/static.html', []);
Assert.areEqual(200, lRes.ResponseCode, '/static.html');
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/static/..\..\donotdeleteme.txt', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/static/..\..\donotdeleteme.txt', []);
Assert.areEqual(404, lRes.ResponseCode);
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/static/../../donotdeleteme.txt', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/static/../../donotdeleteme.txt', []);
Assert.areEqual(404, lRes.ResponseCode);
lUrl := 'Windows\win.ini';
for I := 1 to 30 do
begin
lUrl := '..\' + lUrl;
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/' + lUrl, []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/' + lUrl, []);
Assert.areEqual(404, lRes.ResponseCode, 'Fail with: ' + '/' + lUrl);
end;
end;
@ -1628,21 +1585,15 @@ var
I: Integer;
lUrl: string;
begin
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/spa/index.html', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/spa/index.html', []);
Assert.areEqual(200, lRes.ResponseCode);
Assert.Contains(lRes.BodyAsString, 'This is a TEXT file');
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/spa/', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/spa/', []);
Assert.areEqual(200, lRes.ResponseCode, '/static/');
Assert.Contains(lRes.BodyAsString, 'This is a TEXT file');
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/spa/pippo/pluto/paperino', []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/spa/pippo/pluto/paperino', []);
Assert.areEqual(200, lRes.ResponseCode, '/spa/pippo/pluto/paperino');
Assert.Contains(lRes.BodyAsString, 'This is a TEXT file');
@ -1650,9 +1601,7 @@ begin
for I := 1 to 30 do
begin
lUrl := '..\' + lUrl;
lRes := RESTClient
.Accept(TMVCMediaType.TEXT_HTML)
.doGET('/spa/' + lUrl, []);
lRes := RESTClient.Accept(TMVCMediaType.TEXT_HTML).doGET('/spa/' + lUrl, []);
Assert.areEqual(200, lRes.ResponseCode);
Assert.Contains(lRes.BodyAsString, 'This is a TEXT file');
end;
@ -1843,7 +1792,8 @@ begin
Assert.areEqual(HTTP_STATUS.OK, lRes.ResponseCode, lRes.BodyAsString);
var
lLines := lRes.BodyAsString.Split([sLineBreak]);
var lCount: Integer := 1001;
var
lCount: Integer := 1001;
for var lLine in lLines do
begin
var
@ -1922,11 +1872,10 @@ end;
{ TJSONRPCServerTest }
procedure TJSONRPCServerTest.SetUp;
procedure TJSONRPCServerTest.Setup;
begin
inherited;
FExecutor := TMVCJSONRPCExecutor.Create(GetServer + '/jsonrpc', false);
FExecutor2 := TMVCJSONRPCExecutor.Create(GetServer + '/jsonrpcclass', false);
FExecutor := TMVCJSONRPCExecutor.Create('http://' + TEST_SERVER_ADDRESS + ':9999/jsonrpc', false);
FExecutor2 := TMVCJSONRPCExecutor.Create('http://' + TEST_SERVER_ADDRESS + ':9999/jsonrpcclass', false);
end;
procedure TJSONRPCServerTest.TestRequestToNotFoundMethod;

View File

@ -116,7 +116,7 @@ type
implementation
uses System.SysUtils, System.Rtti, System.SyncObjs, LiveServerTestU;
uses System.SysUtils, System.Rtti, System.SyncObjs, LiveServerTestU, TestConstsU;
{ TTestRESTAdapter }

View File

@ -0,0 +1,11 @@
unit TestConstsU;
interface
const
//TEST_SERVER_ADDRESS = '192.168.56.1';
TEST_SERVER_ADDRESS = '127.0.0.1';
implementation
end.

View File

@ -7,6 +7,24 @@
<ItemGroup Condition="'$(Platform)'=='Win32'"/>
<ItemGroup Condition="'$(Platform)'=='Win64'"/>
<ItemGroup Condition="'$(Platform)'=='Linux64'">
<DeployFile Include="bin\sample.png" Condition="'$(Config)'=='CI'">
<RemoteDir>TestServer\</RemoteDir>
<RemoteName>sample.png</RemoteName>
<DeployClass>File</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="bin\www\static.html" Condition="'$(Config)'=='CI'">
<RemoteDir>TestServer\www\</RemoteDir>
<RemoteName>static.html</RemoteName>
<DeployClass>File</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="TestServer" Condition="'$(Config)'=='CI'">
<RemoteDir>TestServer\</RemoteDir>
<RemoteName>TestServer</RemoteName>
@ -17,5 +35,23 @@
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
<DeployFile Include="bin\www\index.html" Condition="'$(Config)'=='CI'">
<RemoteDir>TestServer\www\</RemoteDir>
<RemoteName>index.html</RemoteName>
<DeployClass>File</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
<DeployFile Include="bin\customers.json" Condition="'$(Config)'=='CI'">
<RemoteDir>TestServer\</RemoteDir>
<RemoteName>customers.json</RemoteName>
<DeployClass>File</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
</DeployFile>
</ItemGroup>
</Project>

View File

@ -8,7 +8,7 @@
<AppType>Console</AppType>
<FrameworkType>None</FrameworkType>
<ProjectVersion>19.0</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Linux64</Platform>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
@ -133,6 +133,38 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="bin\sample.png" Configuration="CI" Class="File">
<Platform Name="Linux64">
<RemoteName>sample.png</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="bin\www\static.html" Configuration="CI" Class="File">
<Platform Name="Linux64">
<RemoteDir>.\www</RemoteDir>
<RemoteName>static.html</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="TestServer" Configuration="CI" Class="ProjectOutput">
<Platform Name="Linux64">
<RemoteName>TestServer</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="bin\www\index.html" Configuration="CI" Class="File">
<Platform Name="Linux64">
<RemoteDir>.\www</RemoteDir>
<RemoteName>index.html</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="bin\customers.json" Configuration="CI" Class="File">
<Platform Name="Linux64">
<RemoteName>customers.json</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
@ -143,12 +175,6 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="TestServer" Configuration="CI" Class="ProjectOutput">
<Platform Name="Linux64">
<RemoteName>TestServer</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="OSX32">
<Operation>1</Operation>

View File

@ -99,9 +99,9 @@ begin
Result := TTestFault2Controller.Create; // this will raise an exception
end)
.AddMiddleware(TMVCSpeedMiddleware.Create)
.AddMiddleware(TMVCStaticFilesMiddleware.Create('/', '..\www', 'index.html', False))
.AddMiddleware(TMVCStaticFilesMiddleware.Create('/static', '..\www', 'index.html', False))
.AddMiddleware(TMVCStaticFilesMiddleware.Create('/spa', '..\www', 'index.html', True))
.AddMiddleware(TMVCStaticFilesMiddleware.Create('/', './www', 'index.html', False))
.AddMiddleware(TMVCStaticFilesMiddleware.Create('/static', './www', 'index.html', False))
.AddMiddleware(TMVCStaticFilesMiddleware.Create('/spa', './www', 'index.html', True))
.AddMiddleware(TMVCBasicAuthenticationMiddleware.Create(TBasicAuthHandler.Create))
.AddMiddleware(TMVCCustomAuthenticationMiddleware.Create(TCustomAuthHandler.Create, '/system/users/logged'))
.AddMiddleware(TMVCCompressionMiddleware.Create);